מדיה ויקי:Gadget-CustomSideBarLinks.js: הבדלים בין גרסאות בדף
מראה
כמקובל |
יותר מדויק |
||
| שורה 13: | שורה 13: | ||
}); | }); | ||
var h3CustomTitle = $('<h3> | var h3CustomTitle = $('<h3>').append(aLink1); | ||
var divCustomBody = $('<div>', { id: "p-customBody1"} ).toggle(!! window.customLinksOpen); | var divCustomBody = $('<div>', { id: "p-customBody1"} ).toggle(!! window.customLinksOpen); | ||
divCustomBody.html(linkstext); | divCustomBody.html(linkstext); | ||
| שורה 29: | שורה 29: | ||
$div = $('<nav>', { id: linksPortalName } ) | $div = $('<nav>', { id: linksPortalName } ) | ||
.addClass('mw-portlet vector-menu vector-menu-portal portal') | .addClass('mw-portlet vector-menu vector-menu-portal portal') | ||
.append($('<h3>').text('הקישורים שלי')) | .append($('<h3>').addClass('vector-menu-heading').text('הקישורים שלי')) | ||
.append($('<div>', {'class': 'vector-menu-content'}).html(linkstext)); | .append($('<div>', {'class': 'vector-menu-content'}).html(linkstext)); | ||
} else { | } else { | ||
$div = $('<nav>', { id: linksPortalName } ) | $div = $('<nav>', { id: linksPortalName } ) | ||
.addClass('portal') | .addClass('portal') | ||
.append($('<h3>').text('הקישורים שלי')) | .append($('<h3>').addClass('vector-menu-heading').text('הקישורים שלי')) | ||
.append($('<div>', {'class': 'body'}).html(linkstext)); | .append($('<div>', {'class': 'body'}).html(linkstext)); | ||
} | } | ||
גרסה מ־23:34, 30 בנובמבר 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
});
});