מדיה ויקי:Gadget-CustomSideBarLinks.js

מתוך ויקיציטוט, מאגר הציטוטים החופשי.

קפיצה אל: ניווט, חיפוש

הערה: לאחר השמירה, עליכם לנקות את זכרון המטמון (Cache) של הדפדפן על־מנת להבחין בשינויים.

  • במוזילה, בפיירפוקס או בספארי, לחצו על מקש ה־Shift בעת לחיצתכם על העלה מחדש (Reload), או הקישו Ctrl+Shift+R (או Cmd+Shift+R במקינטוש של אפל).
  • באינטרנט אקספלורר, לחצו על מקש ה־Ctrl בעת לחיצתכם על רענן (Refresh), או הקישו על Ctrl+F5.
  • ב־Konqueror, לחצו על העלה מחדש (Reload), או הקישו על F5.
  • באופרה, ייתכן שתצטרכו להשתמש בכלים (Tools) > העדפות (Preferences) כדי לנקות לחלוטין את זכרון המטמון.
// מועתק מ[[w:ויקיפדיה:סקריפטים/27]]
// הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה. את הקישורים יש לקבוע ב[[מיוחד:Mypage/הקישורים שלי|דף משנה של דף המשתמש]]. ראו הוראות נוספות ב[[שיחת מדיה ויקי:Gadget-CustomSideBarLinks]].
// created by [[user:Yonidebest]] with some help from [[User:ערן]]
//
 
function navCustonToggle() {
 var divBody = document.getElementById('p-customBody1');
 
 if (divBody.style.display == 'none') // show content
   divBody.style.display = 'block';
 else { // hide content
   divBody.style.display = 'none';
 }
}
 
var CustomSideBarLinksShowDefualt = false; // he who wishes the side bar to be visibale by default, set this to true.
function createCustomNav(links) {
 var navCustonMain = document.createElement('DIV');
 navCustonMain.className = 'portlet';
 var h5CustonTitle = document.createElement('H5');
 var aLink1 = document.createElement('A');
 aLink1.appendChild(document.createTextNode('הקישורים שלי'));
 aLink1.href = 'javascript:navCustonToggle();';
 h5CustonTitle.appendChild(aLink1);
 navCustonMain.appendChild(h5CustonTitle);
 try { // for IE
    var divCustonBody = document.createElement('<DIV ID="p-customBody1"></DIV>');
 } catch (e) { // for FF
    var divCustonBody = document.createElement('DIV');
    divCustonBody.id = 'p-customBody1';
 };
 divCustonBody.className = 'pBody';
 divCustonBody.style.paddingRight = '11px';
 
 divCustonBody.innerHTML = '<ul>';
 divCustonBody.innerHTML += links.replace(/\*\s/g, '<li>');;
 divCustonBody.innerHTML += '</ul>';
 
 navCustonMain.appendChild(divCustonBody);
 var pCom = document.getElementById('p-community');
 pCom.parentNode.insertBefore(navCustonMain, pCom);
 if (!CustomSideBarLinksShowDefualt)
  navCustonToggle();
}
 
function initCustomNav() {
 var a = sajax_init_object();
 a.open('GET', wgServer + wgScriptPath + '/index.php?title=%D7%9E%D7%A9%D7%AA%D7%9E%D7%A9:' + encodeURIComponent(wgUserName) + '/%D7%94%D7%A7%D7%99%D7%A9%D7%95%D7%A8%D7%99%D7%9D_%D7%A9%D7%9C%D7%99&action=render', true);
 a.onreadystatechange = function() {
  if (a.readyState != 4) return;
  createCustomNav(a.responseText);
 };
 a.send(null);
}
 
addOnloadHook(initCustomNav);