ميدياويكي:Gadget-Popup.js
ملاحظة: بعد النشر، أنت قد تحتاج إلى إفراغ الكاش الخاص بمتصفحك لرؤية التغييرات.
- فايرفوكس / سافاري: أمسك Shift أثناء ضغط Reload، أو اضغط على إما Ctrl-F5 أو Ctrl-R (⌘-R على ماك)
- جوجل كروم: اضغط Ctrl-Shift-R (⌘-Shift-R على ماك)
- إنترنت إكسبلورر/إيدج: أمسك Ctrl أثناء ضغط Refresh، أو اضغط Ctrl-F5
- أوبرا: اضغط Ctrl-F5.
/**
* @source mediawiki.org/wiki/Snippets/Open_external_links_in_new_window
* @version 2
*/
jQuery(function ($) {
$('#content a.external').each(function () {
// Can't use wgServer because it can be protocol relative
// Use this.href property instead of this.getAttribute('href') because the propery
// is converted to a full URL (including protocol)
if (this.href.indexOf(location.protocol + '//' + location.hostname) !== 0) {
this.target = '_blank';
if ( this.rel.indexOf( 'noopener' ) < 0 ) {
this.rel += ' noopener'; // the leading space matters, rel attributes have space-separated tokens
}
if ( this.rel.indexOf( 'noreferrer' ) < 0 ) {
this.rel += ' noreferrer'; // the leading space matters, rel attributes have space-separated tokens
}
}
});
});