מדיה ויקי:Gadget-CustomSideBarLinks.js: הבדלים בין גרסאות בדף
מראה
תיקון קטן כדי לפתור בעיית עיצוב ב VECTOR |
תיקונים כדי שיעבוד טוב גם ב VECTOR + מוחק הערות לא רלוונטיות |
||
| שורה 1: | שורה 1: | ||
// הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה. | // הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה. | ||
// created by [[user:Yonidebest]] with some help from [[User:ערן]] | // created by [[user:Yonidebest]] with some help from [[User:ערן]] | ||
var CustomSideBarLinksShowDefualt = false; // he who wishes the side bar to be visibale by default, set this to true. | |||
function navCustonToggle() | |||
{ | |||
var divBody = document.getElementById('p-customBody1'); | |||
if ( divBody.style.display == 'none' ) divBody.style.display = 'block'; // show content | |||
else divBody.style.display = 'none'; // hide content | |||
} | } | ||
function createCustomNav(linkstext) | |||
function createCustomNav( | { | ||
var aLink1 = document.createElement('A'); | |||
aLink1.appendChild(document.createTextNode('הקישורים שלי')); | |||
aLink1.href = 'javascript:navCustonToggle();'; | |||
var h5CustonTitle = document.createElement('H5'); | |||
h5CustonTitle.appendChild(aLink1); | |||
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.innerHTML = linkstext; | |||
var navCustonMain = document.createElement('DIV'); | |||
navCustonMain.appendChild(h5CustonTitle); | |||
navCustonMain.appendChild(divCustonBody); | |||
var pCom = document.getElementById('p-community'); | |||
navCustonMain.className = pCom.className; | |||
divCustonBody.className = pCom.getElementsByTagName('DIV')[0].className; | |||
pCom.parentNode.insertBefore (navCustonMain, pCom); | |||
if ( !CustomSideBarLinksShowDefualt ) navCustonToggle(); | |||
} | } | ||
function initCustomNav() { | function initCustomNav() | ||
{ | |||
var a = sajax_init_object(); | |||
a.open ('GET', wgServer + wgScript + '?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); | addOnloadHook ( initCustomNav ); | ||
גרסה מ־22:19, 24 באפריל 2010
// הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה.
// created by [[user:Yonidebest]] with some help from [[User:ערן]]
var CustomSideBarLinksShowDefualt = false; // he who wishes the side bar to be visibale by default, set this to true.
function navCustonToggle()
{
var divBody = document.getElementById('p-customBody1');
if ( divBody.style.display == 'none' ) divBody.style.display = 'block'; // show content
else divBody.style.display = 'none'; // hide content
}
function createCustomNav(linkstext)
{
var aLink1 = document.createElement('A');
aLink1.appendChild(document.createTextNode('הקישורים שלי'));
aLink1.href = 'javascript:navCustonToggle();';
var h5CustonTitle = document.createElement('H5');
h5CustonTitle.appendChild(aLink1);
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.innerHTML = linkstext;
var navCustonMain = document.createElement('DIV');
navCustonMain.appendChild(h5CustonTitle);
navCustonMain.appendChild(divCustonBody);
var pCom = document.getElementById('p-community');
navCustonMain.className = pCom.className;
divCustonBody.className = pCom.getElementsByTagName('DIV')[0].className;
pCom.parentNode.insertBefore (navCustonMain, pCom);
if ( !CustomSideBarLinksShowDefualt ) navCustonToggle();
}
function initCustomNav()
{
var a = sajax_init_object();
a.open ('GET', wgServer + wgScript + '?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 );