מדיה ויקי:Gadget-rollBackSummary.js: הבדלים בין גרסאות בדף

מאין תקציר עריכה
מ 84 גרסאות של הדף wikipedia:he:מדיה_ויקי:Gadget-rollBackSummary.js יובאו
 
(70 גרסאות ביניים של 5 משתמשים אינן מוצגות)
שורה 1: שורה 1:
var slideShowLinks = [];
/*
var currentImage;
* Adds option to add summary to rollback revets.
 
* Written by [[:he:User:Yonidebest]] based on [[:en:User:Ilmari Karonen]]'s script.
function changeSlideShowImage(text) {
* Translated to Hebrew by [[User:ברק שושני]]
var slideshowimage = document.getElementById('slideshowimage');
* Rewritten by [[User:קיפודנחש]] and [[User:Guycn2]]
var slideshowimagelink = document.getElementById('slideshowimagelink');
*
 
*/
var rx = new RegExp('<div class="fullImageLink" id="file"><a href="(.*)"><img alt=".*" src="\1" width="120" height="107" border="0" \/><\/a>', 'g');
(function() {
var m = rx.exec(text);
if (!m) return;
"use strict";
 
slideshowimage.src = m[0];
function i18n(key) {
slideshowimage.alt = slideShowLinks[currentImage].title;
switch (mw.config.get("wgUserLanguage")) {
slideshowimagelink.href = wgServer + wgScript + slideShowLinks[currentImage].title;
case "he":
 
switch (key) {
var slideshowlinkleft = document.getElementById('slideshowlinkleft');
case "summaryLinkTooltip":
var slideshowlinkright = document.getElementById('slideshowlinkright');
return "שחזור מהיר עם תקציר";
if (currentImage == 0)
case "summaryLinkText":
  slideshowlinkleft.href = "";
return "תקציר";
else
case "dialogText":
  slideshowlinkleft.href = 'javascript:toggleSlideShowImage(1)';
return "נא להזין תקציר לשחזור:";
if (currentImage == slideShowLinks.length - 1)
case "notPerformed":
  slideshowlinkright.href = "";
return "השחזור לא בוצע";
else
case "noRollbackUrl":
  slideshowlinkright.href = 'javascript:toggleSlideShowImage(0)';
return "כתוצאה משגיאה בלתי צפויה, לא ניתן היה לאתר את כתובת השחזור.";
}
case "noSummary":
 
return "לא הוזן תקציר.";
function toggleSlideShowImage(direction) {
case "actionCancelled":
// figure out which image to load
return "הפעולה בוטלה.";
if (direction) // = 1 = up
}
  currentImage++;
break;
else // = 0 = down
default:
  currentImage--;
switch (key) {
case "summaryLinkTooltip":
// load image page
return "Rollback with summary";
var a = sajax_init_object();
case "summaryLinkText":
a.open('GET', wgServer + wgScriptPath + '/index.php?title=' + encodeURIComponent(slideShowLinks[currentImage]) + 'action=render', true);
return "summary";
a.onreadystatechange = function() {
case "dialogText":
  if (a.readyState != 4) return;
return "Please enter rollback summary:";
  changeSlideShowImage(a.responseText);
case "notPerformed":
  // alert("[" + a.status + ":" + a.statusText + "]\n" + a.responseText);
return "Rollback was not performed";
};
case "noRollbackUrl":
a.send(null);
return "Due to an unexpected error, the rollback URL could not be detected.";
}
case "noSummary":
 
return "No summary was entered.";
function initSlideShow() {
case "actionCancelled":
if (!(wgPageName == 'מיוחד:כל_הדפים' && getParamValue('namespace') == 6)) return;
return "Action was cancelled.";
 
}
// get all link in page and remove non-images
}
slideShowLinksTemp = document.getElementsByTagName('A');
return key;
for (var i = 0; i < slideShowLinksTemp.length; i++)
}
  if (slideShowLinksTemp[i].title.indexOf('תמונה:') != 0)
  slideShowLinks.push(slideShowLinksTemp[i]);
function addSummaryLinks(content) {
 
$(".mw-rollback-link", content).append(
// create the frame, hide almost everything else
" | ",
var tables = document.getElementById('bodyContent').getElementsByTagName('TABLE');
$("<a>", {
tables[2].style.display = 'none';
"class": "rollback-summary-link",
 
role: "button",
var td1SS = document.createElement('TD');
href: "#",
td1SS.className = 'slideShowTD';
title: i18n("summaryLinkTooltip"),
 
text: i18n("summaryLinkText"),
var img1SS = document.createElement('IMG');
click: rollbackWithSummary
img1SS.id = 'slideshowimage';
})
var aSS = document.createElement('A');
);
aSS.id = 'slideshowimagelink';
}
aSS.appendChild(img1SS);
td1SS.appendChild(aSS);
function rollbackWithSummary(event) {
 
event.preventDefault();
var tr1SS = document.createElement('TR');
var $summaryLink = $(event.target);
tr1SS.appendChild(td1SS);
var rollbackUrl = $summaryLink
 
.siblings("a:first[href*='&action=rollback']")
var td2SS = document.createElement('TD');
.attr("href");
td2SS.className = 'slideShowTD';
if (typeof rollbackUrl === "undefined") {
 
rollbackUrl = $summaryLink
var a1SS = document.createElement('A');
.siblings(".jquery-confirmable-wrapper")
a1SS.id = 'slideshowlinkleft';
.find("a:first[href*='&action=rollback']")
a1SS.href = 'javascript:toggleSlideShowImage(1)'; // 1 = left/up
.attr("href");
a1SS.innerHTML = '>';
if (typeof rollbackUrl === "undefined") {
 
mw.notify(i18n("noRollbackUrl"), {
var a2SS = document.createElement('A');
title: i18n("notPerformed"),
a2SS.id = 'slideshowlinkright';
type: "error"
a2SS.href = 'javascript:toggleSlideShowImage(0)'; // 0 = right/down
});
a2SS.innerHTML = '<';
return;
 
}
td2SS.appendChild(a2SS);
}
td2SS.appendChild(document.createTextNode(' | '));
OO.ui.prompt(i18n("dialogText")).done(function(summary) {
td2SS.appendChild(a1SS);
if (summary) {
 
window.location.assign(
var tr2SS = document.createElement('TR');
rollbackUrl + "&summary=" + encodeURIComponent(summary) +
tr2SS.appendChild(td2SS);
"&usingRollbackSummaryGadget=1"
var tbodySS = document.createElement('TBODY');
);
tbodySS.appendChild(tr1SS);
} else if (summary === "") {
tbodySS.appendChild(tr2SS);
mw.notify(i18n("noSummary"), {
var tableSS = document.createElement('TABLE');
title: i18n("notPerformed")
tableSS.className = 'slideshowTable';
});
tableSS.appendChild(tbodySS);
} else {
tables[2].parentNode.insertBefore(tableSS, tables[2]);
mw.notify(i18n("actionCancelled"), {
 
title: i18n("notPerformed")
// start the show
});
currentImage = 1;
}
toggleSlideShowImage(0);
});
}
}
 
addOnloadHook(initSlideShow);
function bypassRollbackConfirmation() {
// This function bypasses the confirmation message that shows up when performing
// rollbacks, if the user has the "showrollbackconfirmation" option enabled
if (mw.util.getParamValue("usingRollbackSummaryGadget") === "1") {
if (mw.user.options.get("showrollbackconfirmation") === "1") {
$("button[type='submit']", mw.util.$content).eq(0).click();
}
}
}
mw.hook("wikipage.content").add(addSummaryLinks);
if (mw.config.get("wgAction") === "rollback") {
bypassRollbackConfirmation();
}
})();