לדלג לתוכן

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

מתוך צפונות ויקי
מ שכתובון
מאין תקציר עריכה
שורה 11: שורה 11:
}
}


$(document).ready(function(){
function createCustomNav(linkstext)
function createCustomNav(linkstext)
{
{
שורה 40: שורה 41:
}
}


$(document).ready(function(){
$.ajax({ url: mw.util.wikiScript('index'), data: {
$.ajax({ url: mw.util.wikiScript('index'), data: {
title: mw.util.wikiUrlencode('משתמש:'+mw.user.name()+'/הקישורים שלי'),
title: mw.util.wikiUrlencode('משתמש:'+mw.user.name()+'/הקישורים שלי'),
action: 'render'
action: 'render'
}, success:  
}, success: createCustomNav
function(data){createCustomNav(data);}
});
}
});
});

גרסה מ־20:08, 4 באוקטובר 2011

// הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה.
// 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
}

$(document).ready(function(){
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();
}

	$.ajax({ url: mw.util.wikiScript('index'), data: {
		title: mw.util.wikiUrlencode('משתמש:'+mw.user.name()+'/הקישורים שלי'),
		action: 'render'
	}, success: createCustomNav
	});
});