מדיה ויקי:Gadget-CustomSideBarLinks.js: הבדלים בין גרסאות בדף
מראה
trying a simpler and more portable selector |
מאין תקציר עריכה |
||
| שורה 41: | שורה 41: | ||
url: mw.util.wikiScript('index'), | url: mw.util.wikiScript('index'), | ||
data: { | data: { | ||
title: | title: new mw.Title(mw.config.get('wgUserName')+'/הקישורים שלי', mw.config.get('wgNamespaceIds').user).getPrefixedText(), | ||
action: 'render' | action: 'render' | ||
}, | }, | ||
גרסה מ־07:07, 28 באפריל 2018
// הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה.
// 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 = $('<div>', { id: linksPortalName } )
.addClass('portal')
.append($('<h3>').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
});
});