MediaWiki:Gadget-Zusammenfassung.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
K $ (oder jQuery) statt $j |
Ghost (Diskussion | Beiträge) K Fixes |
||
| 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 ($(".noSummary").length > 0) return; | if ($(".noSummary").length > 0) return; | ||
| Zeile 6: | Zeile 7: | ||
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) | $.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++) | ||
{ | { | ||
Aktuelle Version vom 30. November 2025, 15:20 Uhr
$(function()
{
var wgAction = mw.config.get("wgAction");
if (wgAction != "edit" && wgAction != "submit") return;
if ($(".noSummary").length > 0) return;
var label = document.createElement("label");
label.htmlFor = "stdSummaries";
label.appendChild(document.createTextNode("Standard-Zusammenfassungen:"));
var sel = document.createElement("select");
sel.id = "stdSummaries";
sel.name = "stdSummaries";
sel.onchange = function()
{
var sel = document.getElementById("stdSummaries");
var value = sel.options[sel.selectedIndex].value;
if (value != "")
var z = document.getElementById("wpSummary").value;
if (z != "")
if (z.substring((z.length - 3)) == "*/ ")
var c = "";
else
var c = ", ";
else
var c = "";
document.getElementById("wpSummary").value += c+value;
};
var eo = document.getElementById("wpSummaryLabel").parentNode;
eo.insertBefore(document.createElement("br"), eo.firstChild);
eo.insertBefore(sel, eo.firstChild);
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 lines = text.split("\n");
for (var i=0; i<lines.length; i++)
{
if (lines[i].indexOf("<!--") == 0) continue;
var value = lines[i].indexOf("-- ") == 0 ? lines[i].substring(3) : "";
var opt = document.createElement("option");
opt.value = value;
if (value == "" && i)
opt.disabled = "disabled";
opt.appendChild(document.createTextNode(lines[i]));
sel.appendChild(opt);
}
sel.selectedIndex = 0;
}, "text");
});