מדיה ויקי:Gadget-rollBackSummary.js: הבדלים בין גרסאות בדף
מראה
אין תקציר עריכה |
מ תיקון של משתמש:קיפודנחש |
||
| שורה 7: | שורה 7: | ||
function rollBackSummary() { | function rollBackSummary() { | ||
var bodyContent = document.getElementById('bodyContent') | var bodyContent = document.getElementById('bodyContent') || document.getElementById('mw_content') || document.getElementById('content') | ||
if (!bodyContent) return; | if (!bodyContent) return; | ||
var links = bodyContent.getElementsByTagName('A'); | var links = bodyContent.getElementsByTagName('A'); | ||
גרסה מ־17:52, 11 באוקטובר 2011
/*
* Adds option to add summary to rollback revets.
* Written by [[:he:User:Yonidebest]] based on [[:en:User:Ilmari Karonen]]'s script.
* Translated to Hebrew by [[User:ברק שושני]]
*
*/
function rollBackSummary() {
var bodyContent = document.getElementById('bodyContent') || document.getElementById('mw_content') || document.getElementById('content')
if (!bodyContent) return;
var links = bodyContent.getElementsByTagName('A');
if (!links) return;
var promptSummary = function () {
var summary = prompt("נא להכניס את סיבת השחזור, או להשאיר כ-\"ברירת מחדל\" לשימוש בתקציר העריכה הרגיל", "ברירת מחדל");
if (summary == null || summary == "") return false;
if (summary == "ברירת מחדל") return true;
this.href = this.href.replace("?", "?summary=" + encodeURIComponent(summary) + "&");
return true;
};
for (var i = 0; i < links.length; i++) {
if (links[i].href.indexOf('action=rollback') != -1) {
var newlink = document.createElement('A');
newlink.href = links[i].href;
newlink.title = "שחזור מהיר עם תקציר";
newlink.onclick = promptSummary;
newlink.appendChild(document.createTextNode('תקציר'));
if (wgAction == 'history') {
links[i].parentNode.appendChild(document.createTextNode(' | '));
links[i].parentNode.appendChild(newlink);
} else {
links[i].parentNode.appendChild(document.createTextNode(' ['));
links[i].parentNode.appendChild(newlink);
links[i].parentNode.appendChild(document.createTextNode(']'));
}
i++;
}
}
}
addOnloadHook(rollBackSummary);