לדלג לתוכן

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

מתוך צפונות ויקי
מ תיקון של משתמש:קיפודנחש
מ עדכון של משתמש:קיפודנחש
שורה 3: שורה 3:
  * Written by [[:he:User:Yonidebest]] based on [[:en:User:Ilmari Karonen]]'s script.
  * Written by [[:he:User:Yonidebest]] based on [[:en:User:Ilmari Karonen]]'s script.
  * Translated to Hebrew by [[User:ברק שושני]]
  * Translated to Hebrew by [[User:ברק שושני]]
* Rewritten by [[User:קיפודנחש]]
  *
  *
  */  
  */  
   
  $(document).ready(function() {
function rollBackSummary() {
        var hist = mw.util.getParamValue('action') == 'history';
var bodyContent = document.getElementById('bodyContent') || document.getElementById('mw_content') || document.getElementById('content')
        $('span.mw-rollback-link').append(
if (!bodyContent) return;
                $('<a>', {href: '#', title: 'שחזור מהיר עם תקציר'})
var links = bodyContent.getElementsByTagName('A');
                .text(hist ? ' | תקציר' : '[תקציר]')
if (!links) return;
                .click(function() {
var promptSummary = function () {
                        var summary = $.trim(prompt('אנא הזינו תקציר לשחזור') || '');
  var summary = prompt("נא להכניס את סיבת השחזור, או להשאיר כ-\"ברירת מחדל\" לשימוש בתקציר העריכה הרגיל", "ברירת מחדל");
                        if (summary)  
  if (summary == null || summary == "") return false;
                                window.location = $(this).parent().find('a:eq(0)').attr('href') + '&summary=' + encodeURIComponent(summary);
  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);

גרסה מ־17:12, 30 בנובמבר 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:ברק שושני]]
 * Rewritten by [[User:קיפודנחש]]
 *
 */ 
 $(document).ready(function() {
        var hist = mw.util.getParamValue('action') == 'history'; 
        $('span.mw-rollback-link').append(
                $('<a>', {href: '#', title: 'שחזור מהיר עם תקציר'})
                .text(hist ? ' | תקציר' : '[תקציר]')
                .click(function() {
                        var summary = $.trim(prompt('אנא הזינו תקציר לשחזור') || '');
                        if (summary) 
                                window.location = $(this).parent().find('a:eq(0)').attr('href') + '&summary=' + encodeURIComponent(summary);
                }));
});