מדיה ויקי:Gadget-CustomSideBarLinks.js: הבדלים בין גרסאות בדף
מראה
מאין תקציר עריכה |
תיקון קטן כדי לפתור בעיית עיצוב ב VECTOR |
||
| שורה 18: | שורה 18: | ||
function createCustomNav(links) { | function createCustomNav(links) { | ||
var navCustonMain = document.createElement('DIV'); | var navCustonMain = document.createElement('DIV'); | ||
var h5CustonTitle = document.createElement('H5'); | var h5CustonTitle = document.createElement('H5'); | ||
var aLink1 = document.createElement('A'); | var aLink1 = document.createElement('A'); | ||
| שורה 40: | שורה 39: | ||
navCustonMain.appendChild(divCustonBody); | navCustonMain.appendChild(divCustonBody); | ||
var pCom = document.getElementById('p-community'); | var pCom = document.getElementById('p-community'); | ||
navCustonMain.className = pCom.className; | |||
pCom.parentNode.insertBefore(navCustonMain, pCom); | pCom.parentNode.insertBefore(navCustonMain, pCom); | ||
if (!CustomSideBarLinksShowDefualt) | if (!CustomSideBarLinksShowDefualt) | ||
גרסה מ־16:35, 24 באפריל 2010
//
// סקריפט 27: מתוך [[ויקיפדיה:סקריפטים/27]]
// הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה.
// 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');
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');
navCustonMain.className = pCom.className;
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);
// עד כאן סקריפט 27