K Seit MW1.17: jQuery anstatt addOnloadHook |
Ghost (Diskussion | Beiträge) K Fixes |
||
| (Eine dazwischenliegende Version von einem anderen Benutzer wird nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
$(function() | $(function() | ||
{ | { | ||
var wgAction = mw.config.get("wgAction"); | |||
if (wgAction != "edit" && wgAction != "submit") return; | if (wgAction != "edit" && wgAction != "submit") return; | ||
if ($ | if ($(".noSummary").length > 0) return; | ||
var label = document.createElement("label"); | var label = document.createElement("label"); | ||
label.htmlFor = "stdSummaries"; | label.htmlFor = "stdSummaries"; | ||
label.appendChild(document.createTextNode("Standard-Zusammenfassungen:")); | label.appendChild(document.createTextNode("Standard-Zusammenfassungen:")); | ||
var sel = document.createElement("select"); | var sel = document.createElement("select"); | ||
sel.id = "stdSummaries"; | sel.id = "stdSummaries"; | ||
| Zeile 25: | Zeile 26: | ||
document.getElementById("wpSummary").value += c+value; | document.getElementById("wpSummary").value += c+value; | ||
}; | }; | ||
var eo = document.getElementById("wpSummaryLabel").parentNode; | var eo = document.getElementById("wpSummaryLabel").parentNode; | ||
eo.insertBefore(document.createElement("br"), eo.firstChild); | eo.insertBefore(document.createElement("br"), eo.firstChild); | ||
| Zeile 31: | Zeile 32: | ||
eo.insertBefore(label, sel); | eo.insertBefore(label, sel); | ||
$ | var wgScript = mw.config.get("wgScript"); | ||
$.get(wgScript+"?title=Vorlage:Stdsummaries&action=raw&ctype=text/plain", function(text) | |||
{ | { | ||
var sel = document.getElementById("stdSummaries"); | var sel = document.getElementById("stdSummaries"); | ||
var lines = text.split("\n"); | var lines = text.split("\n"); | ||
for (var i=0; i<lines.length; i++) | for (var i=0; i<lines.length; i++) | ||
{ | { | ||