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

מ לבקשת דניאל
מ 39 גרסאות של הדף wikipedia:he:מדיה_ויקי:AlertProtected.js יובאו
 
(17 גרסאות ביניים של 7 משתמשים אינן מוצגות)
שורה 1: שורה 1:
/*
/*This is old script for adding {{protected}} automaticlly. */
* Adds an automatic "{{תב|מוגן}}" or "{{תב|מוגן חלקית}}" template when the page is protected.
* You can use the {{תב|ללא הודעת הגנה אוטומטית}} to prevent the protection notice from being inserted.
*
* written by [[User:Yonidebest]]
*
*/
 
function alertProtected() {
/* only run if:
  * the page is protected (not including "move" protection) AND
  * the page is in edit or submit view AND
  * the page doesn't contain the {{תב|ללא הודעת הגנה אוטומטית}} template AND
  * the page in not in a MediaWiki namespace
  */
if ((wgRestrictionEdit[0] == 'sysop' || wgRestrictionEdit[0] == 'autoconfirmed') && (wgAction == 'view' || wgAction == 'submit') && !document.getElementById('pl-noprotectionnotice') && wgNamespaceNumber != 8) {
 
  var alertLink = '<a href="/wiki/';
  alertLink += encodeURIComponent((wgNamespaceNumber == 0) ? 'שיחה:' : 'שיחת ');
  alertLink += encodeURIComponent(wgPageName);
  alertLink += '" title="';
  alertLink += (wgNamespaceNumber == 0) ? 'שיחה:' : 'שיחת ';
  alertLink += wgPageName;
  alertLink += '">דף השיחה</a>';
 
  // create alert
  var plTD1 = document.createElement('TD');
  plTD1.className = 'plprotected';
  plTD1.innerHTML = '<a href="/wiki/%D7%AA%D7%9E%D7%95%D7%A0%D7%94:Lock-icon.png" class="image" title="Lock-icon.png"><img alt="" src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b0/Lock-icon.png/50px-Lock-icon.png" width="50" height="48" border="0" /></a>';
  var plTD2 = document.createElement('TD');
  plTD2.style.textAlign = 'right';
 
  var plProtected = 0; // 0 = sysop; 1 = autoconfirmed
  var alertTxt;
 
  // deal with sysop protection
  if (wgRestrictionEdit[0] == 'sysop') {
  // avoid articles which have the protection template
  if (document.getElementById('pl-protected')) return;
 
  // attach the text
  plTD2.innerHTML = '<b><a href="/wiki/%D7%95%D7%99%D7%A7%D7%99%D7%A4%D7%93%D7%99%D7%94:%D7%93%D7%A3_%D7%9E%D7%95%D7%92%D7%9F" title="ויקיפדיה:דף מוגן">דף זה מוגן מפני עריכות</a></b><br /><a href="/wiki/%D7%95%D7%99%D7%A7%D7%99%D7%A4%D7%93%D7%99%D7%94:%D7%9E%D7%A4%D7%A2%D7%99%D7%9C_%D7%9E%D7%A2%D7%A8%D7%9B%D7%AA" title="ויקיפדיה:מפעיל מערכת">מפעילי המערכת</a> נאלצו להפוך דף זה ל<a href="/wiki/%D7%95%D7%99%D7%A7%D7%99%D7%A4%D7%93%D7%99%D7%94:%D7%93%D7%A3_%D7%9E%D7%95%D7%92%D7%9F" title="ויקיפדיה:דף מוגן">דף מוגן</a> מפני עריכות. לפרטים וסיבות עיינו בדף הגרסאות הקודמות וב' + alertLink + '.<br />אם אתם סבורים שיש לשנות את תוכן הערך (להוסיף מידע, להסיר מידע, או כל שינוי אחר), אנא ציינו זאת ב' + alertLink + ', ושם גם המקום לטעון שהדף אינו צריך להיות מוגן.';
 
  } else { // deal with autoconfirmed protection
  plProtected = 1;
 
  // avoid articles which have the protection template
  if (document.getElementById('pl-autoconfirmed')) return;
 
  // attach the text
  plTD2.innerHTML = '<b><a href="/wiki/%D7%95%D7%99%D7%A7%D7%99%D7%A4%D7%93%D7%99%D7%94:%D7%93%D7%A3_%D7%9E%D7%95%D7%92%D7%9F" title="ויקיפדיה:דף מוגן">דף זה מוגן</a></b> ויכולים לערוך אותו רק <a href="/wiki/%D7%95%D7%99%D7%A7%D7%99%D7%A4%D7%93%D7%99%D7%94:%D7%95%D7%99%D7%A7%D7%99%D7%A4%D7%93%D7%99%D7%9D" title="ויקיפדיה:ויקיפדים">ויקיפדים</a> בעלי ותק של ארבעה ימים לפחות.<br />לפרטים וסיבות עיינו בדף הגרסאות הקודמות וב' + alertLink + '.<br />אם אתם סבורים שיש לשנות את תוכן הערך, אנא ציינו זאת ב' + alertLink + '.';
 
  }
 
  var plTR = document.createElement('TR');
  plTR.appendChild(plTD1);
  plTR.appendChild(plTD2);
  var plTBody = document.createElement('TBODY');
  plTBody.appendChild(plTR);
  var plTable = document.createElement('TABLE');
  plTable.className = 'ambox plprotected';
  plTable.align = 'center';
  plTable.appendChild(plTBody);
 
  var attachHere = document.getElementById('catlinks');
  if (!attachHere) attachHere = getElementsByClassName(document, 'DIV', 'printfooter')[0];
  attachHere.parentNode.insertBefore(plTable, attachHere);
 
  // attach the icon
  var iconTxt = '<div class="toplink" style="left: 35px;"><div style="position: relative;"><a href="/wiki/%D7%95%D7%99%D7%A7%D7%99%D7%A4%D7%93%D7%99%D7%94:%D7%93%D7%A3_%D7%9E%D7%95%D7%92%D7%9F" title="דף זה מוגן' + (plProtected ? ' חלקית' : ' מפני עריכה') + '"><img alt="" src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b0/Lock-icon.png/25px-Lock-icon.png" width="25" height="24" border="0" /></a></div></div>';
 
  attachHere.parentNode.innerHTML += iconTxt;
}
}
 
addOnloadHook(alertProtected);