לדלג לתוכן

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

מתוך צפונות ויקי
מ תקלדה
כותב מחדש את כל הסקריפט. עובד במונובוק ווקטור, FF, IE8, כרום
שורה 1: שורה 1:
/* הסקריפט מוסיף לשוניות "מחיקה", "הגנה" ו"חסימה" על מנת שאפשר יהיה לבקש מחיקת דפים, הגנת דפים וחסימת משתמשים באמצעות דף בקשות ממפעילים.
/* הסקריפט מוסיף לשוניות "מחיקה", "הגנה" ו"חסימה" על מנת שאפשר יהיה לבקש מחיקת דפים, הגנת דפים וחסימת משתמשים באמצעות דף בקשות ממפעילים. */
* נכתב על ידי [[משתמש:ערן]]
* נבדק בFF3.5 ובIE8
*/


// delete option
function addExtraJS_Tabs()
function addDeleteOption()
{
{
     var historyTab = document.getElementById('ca-history');
     function addTab ( modelTab, type, text, title, req, section )
     if (!historyTab ) return;
     {
    var deleteTab = document.createElement('li');
        var newtab = modelTab.cloneNode ( true );
    deleteTab.id = 'ca-js-delete';
        newtab.id = "ca-js-" + type;
    var deleteLink = document.createElement('a');
        newtab.className = "";
    deleteLink.href = '#';
 
    deleteLink.title = 'מחיקת דף זה';
        var link = newtab.firstChild;
deleteLink.onclick = function(){
        if ( link.nodeName != "A" ) return;
var reqDel = wgPageName;
 
if(wgNamespaceNumber==14 || wgNamespaceNumber==6){//for categories and files
        link.href = "#";
reqDel =':'+reqDel;
        link.title = title;
}
        link.onclick = function() {
var reqRes=prompt("סיבה לבקשת המחיקה");
            var reason = prompt ( "סיבה לבקשת ה" + text );
if(reqRes) reqRes=' - '+reqRes;
            if ( !reason ) return;           // cancel the operation
else reqRes='';
//            window.location.href = encodeURIComponent("http://he.wikipedia.org/w/index.php?title=ויקיפדיה:בקשות_ממפעילים&action=edit&section=") +
window.location.href='http://he.wikipedia.org/w/index.php?title=ויקיפדיה:בקשות_ממפעילים&action=edit&section=1&pleasedelete=yes&pagefordel=' + reqDel+'&delRes='+reqRes;
            window.location.href = "http://he.wikipedia.org/w/index.php?title=משתמש:Mikimik/ארגז חול3&action=edit&section=" +
}
                                  section + "&ExtraJSTabreq=" + type + "&target=" + encodeURIComponent(req) + "&reason=" + encodeURIComponent(reason);
  if (historyTab.children) {
        }
    deleteLink.appendChild(document.createTextNode('מחיקה'));
 
    deleteTab.appendChild(deleteLink);
        if ( link.firstChild.nodeName == "SPAN" ) link.firstChild.firstChild.nodeValue = text;
    historyTab.parentNode.insertBefore(deleteTab,historyTab);
        else link.firstChild.nodeValue = text;
  } else {
    deleteLink.appendChild(document.createTextNode('מחיקה'));
    deleteTab.appendChild(deleteLink);
    document.getElementById('p-cactions').childNodes[3].insertBefore(deleteTab,null);
  }
}
addOnloadHook(function (){
if(location.href.match(/pleasedelete=yes/)) {
    var txtLoc=location.href;
    var decLoc=decodeURI(txtLoc);
    var delrgx = new RegExp("pagefordel=(.*?)&delRes=(.*)");
    var m = delrgx.exec(decLoc);
    if(m){
var reqDel=m[1].replace(/_/g," ");
var reqRes=m[2];
    document.getElementById('wpSummary').value = '/* בקשות מחיקה */ [' + '[' + reqDel + ']]';
    document.getElementById('wpTextbox1').value = document.getElementById('wpTextbox1').value + '\n*[' + '['+reqDel+']]'+reqRes+' ~~'+'~~';
    document.getElementById('editform').submit();
}
}
});
addOnloadHook(addDeleteOption);


        modelTab.parentNode.insertBefore ( newtab, skin == "vector" ? modelTab : modelTab.nextSibling );
        return newtab;
    }


// protect option
    var x = null;
function addProtectOption()
     var historyTab = document.getElementById("ca-history");
{
     if ( historyTab )
     var historyTab = document.getElementById('ca-history');
     {
     if (!historyTab ) return;
        var x = addTab ( historyTab , "delete", "מחיקה", "מחיקת דף זה",
     var protectTab = document.createElement('li');
                        ( wgNamespaceNumber == 14 || wgNamespaceNumber == 6 ? ":" : "" ) + wgPageName, 1 );
    protectTab.id = 'ca-js-protect';
    var protectLink = document.createElement('a');
    protectLink.href = '#';
    protectLink.title = 'הגנה על דף זה';
protectLink.onclick = function(){
var reqProt = wgPageName;
if(wgNamespaceNumber==14 || wgNamespaceNumber==6){//for categories and files
reqProt =':'+reqProt;
}
var reqRes=prompt("סיבה לבקשת ההגנה");
if(reqRes) reqRes=' - '+reqRes;
else reqRes='';
window.location.href='http://he.wikipedia.org/w/index.php?title=ויקיפדיה:בקשות_ממפעילים&action=edit&section=3&pleaseprotect=yes&pageforprot=' + reqProt+'&protRes='+reqRes;
}
  if (historyTab.children) {
    protectLink.appendChild(document.createTextNode('הגנה'));
    protectTab.appendChild(protectLink);
    historyTab.parentNode.insertBefore(protectTab,historyTab);
  } else {
    protectLink.appendChild(document.createTextNode('הגנה'));
    protectTab.appendChild(protectLink);
    document.getElementById('p-cactions').childNodes[3].insertBefore(protectTab,null);
  }
}
addOnloadHook(function (){
if(location.href.match(/pleaseprotect=yes/)) {
    var txtLoc=location.href;
    var decLoc=decodeURI(txtLoc);
    var protrgx = new RegExp("pageforprot=(.*?)&protRes=(.*)"); 
    var m = protrgx.exec(decLoc);
    if(m){
var reqProt=m[1].replace(/_/g," ");
var reqRes=m[2];
    document.getElementById('wpSummary').value = '/* בקשות הגנה / הסרת הגנה */ [' + '[' + reqProt + ']]';
    document.getElementById('wpTextbox1').value = document.getElementById('wpTextbox1').value + '\n*[' + '['+reqProt+']]'+reqRes+' ~~'+'~~';
    document.getElementById('editform').submit();
}
}
});
addOnloadHook(addProtectOption);


        x = addTab ( x, "protect", "הגנה", "הגנה על דף זה",
                    ( wgNamespaceNumber == 14 || wgNamespaceNumber == 6 ? ":" : "" ) + wgPageName, 3 );
    }


// block option
     if ( document.getElementById("t-contributions") )
function addBlockOption()
        addTab ( x || document.getElementById("ca-addsection") || document.getElementById("ca-edit") || document.getElementById("ca-nstab-user"),
{
                "block", "חסימה", "חסימת משתמש זה", wgTitle, 2 );
     if (!document.getElementById('ca-nstab-user')) return;
    var userTab = document.getElementById('ca-js-delete');
    if (!userTab) userTab = document.getElementById('ca-move');
    if (!userTab) userTab = document.getElementById('ca-history');
    if (!userTab) userTab = document.getElementById('ca-addsection');
    if (!userTab) userTab = document.getElementById('ca-edit');
    if (!userTab) userTab = document.getElementById('ca-nstab-user');
    var blockTab = document.createElement('li');
    blockTab.id = 'ca-js-block';
    var blockLink = document.createElement('a');
    blockLink.href='#';
    blockLink.title = 'חסימת משתמש זה';
blockLink.onclick=function(){
var reqBlock = wgTitle;
var reqRes=prompt("סיבה לבקשת החסימה");
if(reqRes) reqRes=' - '+reqRes;
else reqRes='';
window.location.href='http://he.wikipedia.org/w/index.php?title=ויקיפדיה:בקשות_ממפעילים&action=edit&section=2&pleaseblock=yes&userforblock=' + reqBlock+'&blockRes='+reqRes;
}
  if (userTab.children) {
    blockLink.appendChild(document.createTextNode('חסימה'));
    blockTab.appendChild(blockLink);
    userTab.parentNode.insertBefore(blockTab,userTab.nextSibling);
  } else {
    blockLink.appendChild(document.createTextNode('חסימה'));
    blockTab.appendChild(blockLink);
    document.getElementById('p-cactions').childNodes[3].insertBefore(blockTab,null);
  }
}
addOnloadHook(function (){
if(location.href.match(/pleaseblock=yes/)) {
    var txtLoc=location.href;
    var decLoc=decodeURI(txtLoc);
    var delrgx = new RegExp("userforblock=(.*?)&blockRes=(.*)"); 
    var m = delrgx.exec(decLoc);
    if(m){
var reqBlock=m[1];
var reqRes=m[2];
    document.getElementById('wpSummary').value = '/* בקשות חסימה / הסרת חסימה */ [' + '[משתמש:'+reqBlock+']] ([' + '[שיחת משתמש:'+reqBlock+'|שיחה]])';
    document.getElementById('wpTextbox1').value = document.getElementById('wpTextbox1').value + '\n* {' + '{לחסום|'+reqBlock+'}}'+reqRes+' ~~'+'~~';
    document.getElementById('editform').submit();
}
}
}
if ( /&ExtraJSTabreq=/.test(location.href) ) addOnloadHook ( function () {
        if ( getParamValue("ExtraJSTabreq") == "block" )
        {
            document.getElementById("wpSummary").value += " [" + "[משתמש:" + getParamValue("target") + "]]" +
                                                          " ([" + "[שיחת משתמש:" + getParamValue("target") + "]])";
            document.getElementById("wpTextbox1").value += "\n* {" + "{לחסום|" + getParamValue("target") + "}} - " + getParamValue("reason") + " ~~" + "~~";
        }
        else
        {
            document.getElementById("wpSummary").value += " [" + "[" + getParamValue("target") + "]]";
            document.getElementById("wpTextbox1").value += "\n* [" + "[" + getParamValue("target") + "]] - " + getParamValue("reason") + " ~~" + "~~";
        }
        document.getElementById("wpSave").click();
});
});


if ( wgNamespaceNumber == 2 || wgNamespaceNumber == 3 ) addOnloadHook(addBlockOption);
if ( wgTitle != "בקשות ממפעילים" && wgNamespaceNumber >= 0 ) addOnloadHook ( addExtraJS_Tabs );

גרסה מ־15:10, 1 ביולי 2010

/* הסקריפט מוסיף לשוניות "מחיקה", "הגנה" ו"חסימה" על מנת שאפשר יהיה לבקש מחיקת דפים, הגנת דפים וחסימת משתמשים באמצעות דף בקשות ממפעילים. */

function addExtraJS_Tabs()
{
    function addTab ( modelTab, type, text, title, req, section )
    {
        var newtab = modelTab.cloneNode ( true );
        newtab.id = "ca-js-" + type;
        newtab.className = "";

        var link = newtab.firstChild;
        if ( link.nodeName != "A" ) return;

        link.href = "#";
        link.title = title;
        link.onclick = function() {
            var reason = prompt ( "סיבה לבקשת ה" + text );
            if ( !reason ) return;            // cancel the operation
//            window.location.href = encodeURIComponent("http://he.wikipedia.org/w/index.php?title=ויקיפדיה:בקשות_ממפעילים&action=edit&section=") +
            window.location.href = "http://he.wikipedia.org/w/index.php?title=משתמש:Mikimik/ארגז חול3&action=edit&section=" +
                                   section + "&ExtraJSTabreq=" + type + "&target=" + encodeURIComponent(req) + "&reason=" + encodeURIComponent(reason);
        }

        if ( link.firstChild.nodeName == "SPAN" ) link.firstChild.firstChild.nodeValue = text;
         else link.firstChild.nodeValue = text;

        modelTab.parentNode.insertBefore ( newtab, skin == "vector" ? modelTab : modelTab.nextSibling );
        return newtab;
    }

    var x = null;
    var historyTab = document.getElementById("ca-history");
    if ( historyTab )
    {
        var x = addTab ( historyTab , "delete", "מחיקה", "מחיקת דף זה",
                         ( wgNamespaceNumber == 14 || wgNamespaceNumber == 6 ? ":" : "" ) + wgPageName, 1 );

        x = addTab ( x, "protect", "הגנה", "הגנה על דף זה",
                     ( wgNamespaceNumber == 14 || wgNamespaceNumber == 6 ? ":" : "" ) + wgPageName, 3 );
    }

    if ( document.getElementById("t-contributions") )
        addTab ( x || document.getElementById("ca-addsection") || document.getElementById("ca-edit") || document.getElementById("ca-nstab-user"),
                 "block", "חסימה", "חסימת משתמש זה", wgTitle, 2 );
}

if ( /&ExtraJSTabreq=/.test(location.href) ) addOnloadHook ( function () {
        if ( getParamValue("ExtraJSTabreq") == "block" )
        {
            document.getElementById("wpSummary").value += " [" + "[משתמש:" + getParamValue("target") + "]]" +
                                                          " ([" + "[שיחת משתמש:" + getParamValue("target") + "]])";
            document.getElementById("wpTextbox1").value += "\n* {" + "{לחסום|" + getParamValue("target") + "}} - " + getParamValue("reason") + " ~~" + "~~";
        }
         else
        {
            document.getElementById("wpSummary").value += " [" + "[" + getParamValue("target") + "]]";
            document.getElementById("wpTextbox1").value += "\n* [" + "[" + getParamValue("target") + "]] - " + getParamValue("reason") + " ~~" + "~~";
        }
        document.getElementById("wpSave").click();
});

if ( wgTitle != "בקשות ממפעילים" && wgNamespaceNumber >= 0 ) addOnloadHook ( addExtraJS_Tabs );