ميډياويکي:Gadget-autolink.js

د ويکيپېډيا، وړیا پوهنغونډ له خوا

د نور تفصيل لپاره د غځول په تنۍ کلېک وکړئيادښت: د غوره توبونو د خوندي کولو وروسته، خپل د کتنمل (بروزر) ساتل شوې حافظه تازه کړی.د نور تفصيل لپاره د غځول په تنۍ کلېک وکړئ.

  • فايرفاکس/ سفري: په دې کتنمل کې د Reload د ټکوهلو په وخت د Shift تڼۍ نيولې وساتی، او يا هم Ctrl-F5 يا Ctrl-Rتڼۍ کېښکاږۍ (په Apple Mac کمپيوټر باندې ⌘-R کېښکاږۍ)
  • گووگل کروم: په دې کتنمل کې د Ctrl-Shift-R تڼۍ کېښکاږۍ (د مک لپاره ⌘-Shift-R)
  • انټرنټ اېکسپلورر: په دې کتنمل کې د Refresh د ټکوهلو په وخت کې د Ctrl تڼۍ کېښکاږلې ونيسۍ، او يا هم د Ctrl-F5 تڼۍ کېښکاږۍ
  • اوپرا: په دې کتنمل کې د خپل براوزر ساتل شوې حافظه پدې توگه سپينولی شی Tools→Preferences
لاسوند[جوړول]
//[[en:User:Minesweeper.007/autolink.js]]
//<pre>
// Autolink [[wikilinks]] and {{templates}} (especially useful for monobook.js and similar pages)

$(function () {
    // Get the HTML of just the main body of the page, not including textareas hopefully
    if (location.href.indexOf('&action=history') != -1) {
       return;                    //The history page crashes when this script is used
    } else
    if (document.title.indexOf("جوړول ") != 0) {
        targetdiv = document.getElementById('bodyContent');  // bodyContent div for most pages
    } else 
    if (document.getElementById('wikiPreview')) {
        targetdiv = document.getElementById('wikiPreview');  // wikiPreview if it's there
    } else
    if (document.getElementById('wikiDiff')) {
        targetdiv = document.getElementById('wikiDiff');   // wikiDiff if it's there
    } else {
        return;
    }
    content = targetdiv.innerHTML;
    content = content.replace(/([^\[])\[{2}([^\[\]\|\<\>\n]*)([^\[\]\<\>\n]*?)?\]{2}([^\]])/g, '$1<a class="autolink" href="/wiki/$2">[[$2$3]]</a>$4'); // Make wikilink code into links
    content = content.replace(/([^\{])\{{2}(subst\:|msg\:)?([^\{\}\|\<\>\n]*)([^\{\}\<\>\n]*?)?\}{2}([^\}])/g, '$1<a class="autolink" href="/wiki/Template:$3">{{$2$3$4}}</a>$5'); // Make template code into links
    targetdiv.innerHTML = content; // Write it back
});
//</pre>