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

מתוך אוצר הספרים היהודי השיתופי
קפיצה לניווט קפיצה לחיפוש
(תודה חזרתי)
מ (בקשות הגנה)
שורה 3: שורה 3:
  * נבדק בFF3.5 ובIE8
  * נבדק בFF3.5 ובIE8
  */
  */
 
//delete option
function addDeleteOption()
function addDeleteOption()
{
{
שורה 51: שורה 51:
   
   
addOnloadHook(addDeleteOption);
addOnloadHook(addDeleteOption);
//protect option
function addProtectOption()
{
    var historyTab = document.getElementById('ca-history');
    if (!historyTab ) return;
    var protectTab = document.createElement('li');
    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 = delrgx.exec(decLoc);
    if(m){
var reqProt=m[1];
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);




//block option
function addBlockOption()
function addBlockOption()
{
{

גרסה מ־23:03, 4 במאי 2010

/* הסקריפט מוסיף לשוניות "מחיקה" ו"חסימה" על מנת שאפשר יהיה לבקש מחיקת דפים וחסימת משתמשים באמצעות דף בקשות ממפעילים.
 * נכתב על ידי [[משתמש:ערן]]
 * נבדק בFF3.5 ובIE8
 */
//delete option
function addDeleteOption()
{
    var historyTab = document.getElementById('ca-history');
    if (!historyTab ) return;
    var deleteTab = document.createElement('li');
    deleteTab.id = 'ca-js-delete';
    var deleteLink = document.createElement('a');
    deleteLink.href = '#';
    deleteLink.title = 'מחיקת דף זה';
deleteLink.onclick = function(){
var reqDel = wgPageName;
if(wgNamespaceNumber==14 || wgNamespaceNumber==6){//for categories and files
reqDel =':'+reqDel;
}
var reqRes=prompt("סיבה לבקשת המחיקה");
if(reqRes) reqRes=' - '+reqRes;
else reqRes='';
window.location.href='http://he.wikipedia.org/w/index.php?title=ויקיפדיה:בקשות_ממפעילים&action=edit&section=1&pleasedelete=yes&pagefordel=' + reqDel+'&delRes='+reqRes;
}
  if (historyTab.children) {
    deleteLink.appendChild(document.createTextNode('מחיקה'));
    deleteTab.appendChild(deleteLink);
    historyTab.parentNode.insertBefore(deleteTab,historyTab);
  } 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];
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);

//protect option
function addProtectOption()
{
    var historyTab = document.getElementById('ca-history');
    if (!historyTab ) return;
    var protectTab = document.createElement('li');
    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 = delrgx.exec(decLoc);
    if(m){
var reqProt=m[1];
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);


//block option
function addBlockOption()
{
    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(wgNamespaceNumber==2 || wgNamespaceNumber==3){
addOnloadHook(addBlockOption);
}