לדלג לתוכן

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

מתוך צפונות ויקי
מאין תקציר עריכה
מ 37 גרסאות של הדף wikipedia:he:מדיה_ויקי:Gadget-CustomSideBarLinks.js יובאו
 
(30 גרסאות ביניים של 5 משתמשים אינן מוצגות)
שורה 1: שורה 1:
// הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה.
// הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה.
// created by [[user:Yonidebest]] with some help from [[User:ערן]]
// created by [[user:Yonidebest]] with some help from [[User:ערן]]
$( function() {
function createCustomNav(linkstext) {
var skin = mw.config.get('skin');


var CustomSideBarLinksShowDefualt = false; // he who wishes the side bar to be visibale by default, set this to true.
        if (skin === 'monobook') {
        var aLink1 = $('<a href="#">הקישורים שלי</a>');


function navCustonToggle()
        aLink1.click(function(){
{
            $('#p-customBody1').toggle();
    var divBody = document.getElementById('p-customBody1');
            return false;
    if ( divBody.style.display == 'none' ) divBody.style.display = 'block'; // show content
        });
                                      else divBody.style.display = 'none';   // hide content
}


$(document).ready(function(){
        var h3CustomTitle = $('<h3>').append(aLink1);
function createCustomNav(linkstext)
        var divCustomBody = $('<div>', { id: "p-customBody1"} ).toggle(!! window.customLinksOpen);
{
        divCustomBody.html(linkstext);
    var aLink1 = document.createElement('A');
        var navCustomMain = $('<div>').append(h3CustomTitle).append(divCustomBody);
    aLink1.appendChild(document.createTextNode('הקישורים שלי'));
        var pCom = $('#p-community');
    aLink1.href = 'javascript:navCustonToggle();';
        navCustomMain.addClass(pCom.attr('class'));
        divCustomBody.addClass(pCom.find('div').attr('class'));
        navCustomMain.insertBefore(pCom);


    var h5CustonTitle = document.createElement('H5');
            return;
    h5CustonTitle.appendChild(aLink1);
        } // else...
        var linksPortalName = 'myLinksPortal';
        var $div;
if (skin === 'vector' || skin === 'vector-2022'){
        $div = $('<nav>', { id: linksPortalName } )
        .addClass('mw-portlet vector-menu vector-menu-portal portal')
            .append($('<h3>').addClass('vector-menu-heading').text('הקישורים שלי'))
            .append($('<div>', {'class': 'vector-menu-content'}).html(linkstext));
} else {
        $div = $('<nav>', { id: linksPortalName } )
        .addClass('portal')
            .append($('<h3>').addClass('vector-menu-heading').text('הקישורים שלי'))
            .append($('<div>', {'class': 'body'}).html(linkstext));
}


    try { // for IE
        var $firstPortal = $('#p-navigation');
      var divCustonBody = document.createElement('<DIV ID="p-customBody1"></DIV>');
       
    } catch (e) { // for FF
        $firstPortal.after($div);
      var divCustonBody = document.createElement('DIV');
      divCustonBody.id = 'p-customBody1';
    };
    divCustonBody.innerHTML = linkstext;


    var navCustonMain = document.createElement('DIV');
        $( document ).trigger( 'new-portlet-link', [linksPortalName] );
    navCustonMain.appendChild(h5CustonTitle);
}
    navCustonMain.appendChild(divCustonBody);
 
    $.ajax({
    var pCom = document.getElementById('p-community');
            url: mw.util.wikiScript('index'),
    navCustonMain.className = pCom.className;
            data: {
    divCustonBody.className = pCom.getElementsByTagName('DIV')[0].className;
                title: new mw.Title(mw.config.get('wgUserName')+'/הקישורים שלי', mw.config.get('wgNamespaceIds').user).getPrefixedText(),
    pCom.parentNode.insertBefore (navCustonMain, pCom);
                action: 'render'
 
            },
    if ( !CustomSideBarLinksShowDefualt ) navCustonToggle();
            success: createCustomNav
}
    });
 
$.ajax({ url: mw.util.wikiScript('index'), data: {
title: 'משתמש:'+mw.user.name()+'/הקישורים שלי',
action: 'render'
}, success: createCustomNav
});
});
});

גרסה אחרונה מ־07:26, 5 בדצמבר 2022

// הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה.
// created by [[user:Yonidebest]] with some help from [[User:ערן]]
$( function() {
	function createCustomNav(linkstext) {
		var skin = mw.config.get('skin');

        if (skin === 'monobook') {
	        var aLink1 = $('<a href="#">הקישורים שלי</a>');

	        aLink1.click(function(){
	            $('#p-customBody1').toggle();
	            return false;
	        });

	        var h3CustomTitle = $('<h3>').append(aLink1);
	        var divCustomBody = $('<div>', { id: "p-customBody1"} ).toggle(!! window.customLinksOpen);
	        divCustomBody.html(linkstext);
	        var navCustomMain = $('<div>').append(h3CustomTitle).append(divCustomBody);
	        var pCom = $('#p-community');
	        navCustomMain.addClass(pCom.attr('class'));
	        divCustomBody.addClass(pCom.find('div').attr('class'));
	        navCustomMain.insertBefore(pCom);

            return;
        } // else...
        var linksPortalName = 'myLinksPortal';
        var $div;
		if (skin === 'vector' || skin === 'vector-2022'){
	        $div = $('<nav>', { id: linksPortalName } )
	        	.addClass('mw-portlet vector-menu vector-menu-portal portal')
	            .append($('<h3>').addClass('vector-menu-heading').text('הקישורים שלי'))
	            .append($('<div>', {'class': 'vector-menu-content'}).html(linkstext));
		} else {
	        $div = $('<nav>', { id: linksPortalName } )
        	.addClass('portal')
            .append($('<h3>').addClass('vector-menu-heading').text('הקישורים שלי'))
            .append($('<div>', {'class': 'body'}).html(linkstext));
		}

        var $firstPortal = $('#p-navigation');
        
        $firstPortal.after($div);

        $( document ).trigger( 'new-portlet-link', [linksPortalName] );
	}
 
    $.ajax({
            url: mw.util.wikiScript('index'),
            data: {
                title: new mw.Title(mw.config.get('wgUserName')+'/הקישורים שלי', mw.config.get('wgNamespaceIds').user).getPrefixedText(),
                action: 'render'
            },
            success: createCustomNav
    });
});