أهلاً بكم، في الموسوعة القبطية الأرثوذكسية
ميدياويكي:Gadget-autolink.js
ملاحظة: بعد النشر، أنت قد تحتاج إلى إفراغ الكاش الخاص بمتصفحك لرؤية التغييرات.
- فايرفوكس / سافاري: أمسك Shift أثناء ضغط Reload، أو اضغط على إما Ctrl-F5 أو Ctrl-R (⌘-R على ماك)
- جوجل كروم: اضغط Ctrl-Shift-R (⌘-Shift-R على ماك)
- إنترنت إكسبلورر/إيدج: أمسك Ctrl أثناء ضغط Refresh، أو اضغط Ctrl-F5
- أوبرا: اضغط Ctrl-F5.
//[[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>