מדיה ויקי:Gadget-CustomSideBarLinks.js: הבדלים בין גרסאות בדף
קפיצה לניווט
קפיצה לחיפוש
ויקיציטוט>Ladsgroup מ (Maintenance: Replacing legacy global variable (phab:T72470)) |
מ (גרסה אחת יובאה) |
(אין הבדלים)
| |
גרסה אחרונה מ־09:47, 21 בספטמבר 2025
// מועתק מ[[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', mw.config.get('wgServer') + wgScriptPath + '/index.php?title=%D7%9E%D7%A9%D7%AA%D7%9E%D7%A9:' + encodeURIComponent(mw.config.get('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);
}
$(initCustomNav);