מדיה ויקי:Gadget-CustomSideBarLinks.js: הבדלים בין גרסאות בדף
קפיצה לניווט
קפיצה לחיפוש
(יצירת דף עם התוכן "// הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה. // created by [[use...") |
חלוקת קונטרסים (שיחה | תרומות) (עדכון מויקיפדיה: https://he.wikipedia.org/wiki/%D7%9E%D7%93%D7%99%D7%94_%D7%95%D7%99%D7%A7%D7%99:Gadget-CustomSideBarLinks.js) |
||
שורה 1: | שורה 1: | ||
// הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה. | // הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה. | ||
// created by [[user:Yonidebest]] with some help from [[User:ערן]] | // created by [[user:Yonidebest]] with some help from [[User:ערן]] | ||
$(function(){ | $( 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; | return; | ||
} // else... | } // else... | ||
var | 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 } ) | |||
var | .addClass('portal') | ||
.append($('<h3>').addClass('vector-menu-heading').text('הקישורים שלי')) | |||
.append($('<div>', {'class': 'body'}).html(linkstext)); | |||
} | |||
} | |||
var $firstPortal = $('#p-navigation'); | |||
$firstPortal.after($div); | |||
// this kudge is needed in vector-2022 | |||
if (mw.config.get('skin') == 'vector-2022') { | |||
$('.vector-menu-content').find('li').addClass('mw-list-item'); | |||
} | |||
$( 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 | |||
}); | |||
}); | }); |
גרסה אחרונה מ־15:13, 4 ביולי 2024
// הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה.
// 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);
// this kudge is needed in vector-2022
if (mw.config.get('skin') == 'vector-2022') {
$('.vector-menu-content').find('li').addClass('mw-list-item');
}
$( 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
});
});