ผลต่างระหว่างรุ่นของ "มีเดียวิกิ:Gadget-edittop.js"

เนื้อหาที่ลบ เนื้อหาที่เพิ่ม
Ladsgroup (คุย | ส่วนร่วม)
Maintenance: Replacing legacy global variable (phab:T72470)
แทนที่เนื้อหาด้วย "mw.loader.load("//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-edittop.js&action=raw&ctype=text/javascript");"
ป้ายระบุ: ถูกแทน
 
บรรทัดที่ 1:
mw.loader.load("//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-edittop.js&action=raw&ctype=text/javascript");
// **********************************************************************
// ** ***WARNING GLOBAL GADGET FILE*** **
// ** changes to this file affect many users. **
// ** please discuss on the talk page before editing **
// ** **
// **********************************************************************
// Imported from [[User:Alex Smotrov/edittop.js]], version as of: 2007-06-19T04:28:52
if (mw.config.get('wgAction') == 'view' && mw.config.get('wgNamespaceNumber') >=0)
$(function edittop_hook(){
var localtitles = {
en: 'Edit lead section',
fr: 'Modifier le résumé introductif',
it: 'Modifica della sezione iniziale',
ja: '導入部を編集'
};
var h2s = document.getElementsByTagName('H2');
var h2 = h2s[0];
if (!h2) return;
if (h2.parentNode.id == 'toctitle') h2 = h2s[1];
if (!h2) return;
var span = h2.firstChild;
if (!span || span.className != 'editsection') return;
var zero = span.cloneNode(true);
if (document.getElementById('featured-star')) zero.style.marginRight = '25px';
if (document.getElementById('spoken-icon')) zero.style.marginRight = '45px';
if (document.getElementById('administrator') && zero.style.marginRight) zero.style.marginRight = '70px';
var parent = document.getElementsByTagName('H1')[0];
parent.insertBefore(zero, parent.firstChild);
var a = zero.getElementsByTagName('A')[0];
if(localtitles[wgUserLanguage]) a.title = localtitles[wgUserLanguage];
// TODO check for content of header, to get a more precise replacement
else a.title = a.title.replace(/:.*$/,': 0');
a.setAttribute('href', a.href.replace(/&section=1/,'&section=0'));
})