מדיה ויקי:Gadget-rollBackSummary.js: הבדלים בין גרסאות בדף
מראה
מאין תקציר עריכה |
מאין תקציר עריכה |
||
| שורה 20: | שורה 20: | ||
for each (var link in links) { | for each (var link in links) { | ||
if ( | if (link.href.indexOf('action=rollback') != -1) { | ||
var newlink = document.createElement('A'); | var newlink = document.createElement('A'); | ||
newlink.href = | newlink.href = link.href; | ||
newlink.title = "שחזור מהיר עם תקציר"; | newlink.title = "שחזור מהיר עם תקציר"; | ||
newlink.onclick = promptSummary; | newlink.onclick = promptSummary; | ||
newlink.appendChild(document.createTextNode('תקציר')); | newlink.appendChild(document.createTextNode('תקציר')); | ||
if (wgAction == 'history') { | if (wgAction == 'history') { | ||
link.parentNode.appendChild(document.createTextNode(' |')); | |||
link.parentNode.appendChild(newlink); | |||
link.parentNode.appendChild(document.createTextNode(' ')); | |||
} else { | } else { | ||
link.parentNode.appendChild(document.createTextNode(' [')); | |||
link.parentNode.appendChild(newlink); | |||
link.parentNode.appendChild(document.createTextNode('] ')); | |||
} | } | ||
} | } | ||
גרסה מ־10:14, 17 בפברואר 2009
/*
* Prompt for an edit summary when clicking a rollback link
* 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');
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 each (var link in links) {
if (link.href.indexOf('action=rollback') != -1) {
var newlink = document.createElement('A');
newlink.href = link.href;
newlink.title = "שחזור מהיר עם תקציר";
newlink.onclick = promptSummary;
newlink.appendChild(document.createTextNode('תקציר'));
if (wgAction == 'history') {
link.parentNode.appendChild(document.createTextNode(' |'));
link.parentNode.appendChild(newlink);
link.parentNode.appendChild(document.createTextNode(' '));
} else {
link.parentNode.appendChild(document.createTextNode(' ['));
link.parentNode.appendChild(newlink);
link.parentNode.appendChild(document.createTextNode('] '));
}
}
}
/*
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);
links[i].parentNode.appendChild(document.createTextNode(' '));
} else {
links[i].parentNode.appendChild(document.createTextNode(' ['));
links[i].parentNode.appendChild(newlink);
links[i].parentNode.appendChild(document.createTextNode('] '));
}
links.splice(i, 1);
}
}
*/
}
addOnloadHook(rollBackSummary);