לדלג לתוכן

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

מתוך צפונות ויקי
תיקון קטן כדי לפתור בעיית עיצוב ב VECTOR
תיקונים כדי שיעבוד טוב גם ב VECTOR + מוחק הערות לא רלוונטיות
שורה 1: שורה 1:
//
// סקריפט 27: מתוך [[ויקיפדיה:סקריפטים/27]]
// הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה.
// הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה.
// created by [[user:Yonidebest]] with some help from [[User:ערן]]
// created by [[user:Yonidebest]] with some help from [[User:ערן]]
//


function navCustonToggle() {
var CustomSideBarLinksShowDefualt = false; // he who wishes the side bar to be visibale by default, set this to true.
var divBody = document.getElementById('p-customBody1');


if (divBody.style.display == 'none') // show content
function navCustonToggle()
  divBody.style.display = 'block';
{
  else { // hide content
    var divBody = document.getElementById('p-customBody1');
  divBody.style.display = 'none';
    if ( divBody.style.display == 'none' ) divBody.style.display = 'block';  // show content
}
                                      else divBody.style.display = 'none';   // hide content
}
}


var CustomSideBarLinksShowDefualt = false; // he who wishes the side bar to be visibale by default, set this to true.
function createCustomNav(linkstext)
function createCustomNav(links) {
{
var navCustonMain = document.createElement('DIV');
    var aLink1 = document.createElement('A');
var h5CustonTitle = document.createElement('H5');
    aLink1.appendChild(document.createTextNode('הקישורים שלי'));
var aLink1 = document.createElement('A');
    aLink1.href = 'javascript:navCustonToggle();';
aLink1.appendChild(document.createTextNode('הקישורים שלי'));
 
aLink1.href = 'javascript:navCustonToggle();';
    var h5CustonTitle = document.createElement('H5');
h5CustonTitle.appendChild(aLink1);
    h5CustonTitle.appendChild(aLink1);
navCustonMain.appendChild(h5CustonTitle);
 
try { // for IE
    try { // for IE
    var divCustonBody = document.createElement('<DIV ID="p-customBody1"></DIV>');
      var divCustonBody = document.createElement('<DIV ID="p-customBody1"></DIV>');
} catch (e) { // for FF
    } catch (e) { // for FF
    var divCustonBody = document.createElement('DIV');
      var divCustonBody = document.createElement('DIV');
    divCustonBody.id = 'p-customBody1';
      divCustonBody.id = 'p-customBody1';
};
    };
divCustonBody.className = 'pBody';
    divCustonBody.innerHTML = linkstext;
divCustonBody.style.paddingRight = '11px';
 
    var navCustonMain = document.createElement('DIV');
    navCustonMain.appendChild(h5CustonTitle);
    navCustonMain.appendChild(divCustonBody);


divCustonBody.innerHTML = '<ul>';
    var pCom = document.getElementById('p-community');
divCustonBody.innerHTML += links.replace(/\*\s/g, '<li>');;
    navCustonMain.className = pCom.className;
divCustonBody.innerHTML += '</ul>';
    divCustonBody.className = pCom.getElementsByTagName('DIV')[0].className;
    pCom.parentNode.insertBefore (navCustonMain, pCom);


navCustonMain.appendChild(divCustonBody);
    if ( !CustomSideBarLinksShowDefualt ) navCustonToggle();
var pCom = document.getElementById('p-community');
navCustonMain.className = pCom.className;
pCom.parentNode.insertBefore(navCustonMain, pCom);
if (!CustomSideBarLinksShowDefualt)
  navCustonToggle();
}
}


function initCustomNav() {
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);
    var a = sajax_init_object();
a.onreadystatechange = function() {
    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);
  if (a.readyState != 4) return;
    a.onreadystatechange = function()
  createCustomNav(a.responseText);
      {
};
        if ( a.readyState != 4 ) return;
a.send(null);
        createCustomNav ( a.responseText );
      };
    a.send (null);
}
}


addOnloadHook(initCustomNav);
addOnloadHook ( initCustomNav );
// עד כאן סקריפט 27

גרסה מ־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 );