אונטערשייד צווישן ווערסיעס פון "מעדיעוויקי:Common.js"

183 בייטן צוגעלייגט ,  פֿאַר 2 חדשים
קיין רעדאגירונג באמערקונג
אין תקציר עריכה
אין תקציר עריכה
 
שורה 3: שורה 3:
// adds backlink to copied text
// adds backlink to copied text
document.addEventListener('copy', function(event) {
document.addEventListener('copy', function(event) {
    if (mw.config.get('wgUserName') !== null) {
        return;
    }
    if (mw.config.get('wgAction') !== 'view') {
        return;
    }
     const selection = window.getSelection();
     const selection = window.getSelection();
     if (!selection || selection.rangeCount === 0) return;
     if (!selection || selection.rangeCount === 0) return;
שורה 8: שורה 14:
     if (selectedText.length > 150) {
     if (selectedText.length > 150) {
         if (event.clipboardData) {
         if (event.clipboardData) {
             const attribution = "\n\nפון המכלול: " + decodeURI(document.location.href);
            const decodedUrl = decodeURI(document.location.href);
             const attribution = "\n\nפון המכלול: " + decodedUrl;
             const combinedText = selectedText + attribution;
             const combinedText = selectedText + attribution;
             event.clipboardData.setData('text/plain', combinedText);
             event.clipboardData.setData('text/plain', combinedText);