K Seit MW1.17: jQuery anstatt addOnloadHook; $ (oder jQuery) statt $j |
Ghost (Diskussion | Beiträge) K Fixes |
||
| (3 dazwischenliegende Versionen von einem anderen Benutzer werden nicht angezeigt) | |||
| Zeile 2: | Zeile 2: | ||
$(function() | $(function() | ||
{ | { | ||
$("select[name=' | $("select[name^='DDSelect-']").each(function(i) | ||
{ | { | ||
this.onchange = function() | this.onchange = function() | ||
{ | { | ||
if (this.options[this.options.selectedIndex]. | if (this.options[this.options.selectedIndex].innerHTML == '(IP-)Signaturnachtrag') $.get(wgServer+wgScriptPath+'/api.php?action=query&format=json&titles='+encodeURIComponent(wgPageName)+'&prop=revisions&meta=siteinfo|allmessages&ammessages=jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec', | ||
function(data) | |||
{ | |||
if ("string" == typeof data) | |||
data = JSON.parse(data); | |||
var x = data.query.pages[wgArticleId].revisions[0].timestamp.split(/[- :TZ]/); | |||
var zeit = | |||
new Date(Date.UTC(x[0], x[1]-1, x[2], x[3], x[4], x[5])+data.query.general.timeoffset*60*1000); | |||
mw.toolbar.insertTags("{"+"{"+"subst:"+(data.query.pages[wgArticleId].revisions[0].anon===''?"IP-":"")+"Signaturnachtrag|"+data.query.pages[wgArticleId].revisions[0].user+"|"+(zeit.getUTCHours()<10?"0":"")+zeit.getUTCHours()+":"+(zeit.getUTCMinutes()<10?"0":"")+zeit.getUTCMinutes()+", "+zeit.getUTCDate()+". "+data.query.allmessages[zeit.getUTCMonth()]["*"]+" "+zeit.getUTCFullYear()+" (CE"+(data.query.general.timeoffset==120?"S":"")+"T)|"+wgUserName+"}"+"}", '', ''); | |||
var z = document.getElementById("wpSummary").value; | |||
if (z.substring((z.length - 16)) != "Signaturnachtrag") | |||
var c = (z.length && (z.substring((z.length - 3)) != "*/ ") ? ", " : ""); | |||
document.getElementById("wpSummary").value += c+"Signaturnachtrag"; | |||
}, 'json'); | |||
else mw.SGPack.insertSelect(this); | |||
else | |||
this.options.selectedIndex=0; | this.options.selectedIndex=0; | ||
}; | }; | ||
}); | }); | ||
}); | }); | ||