מדיה ויקי:Gadget-CustomSideBarLinks.js: הבדלים בין גרסאות בדף
מראה
מאין תקציר עריכה |
ככה? |
||
| שורה 29: | שורה 29: | ||
divCustonBody.addClass(pCom.find('div').attr('class')); | divCustonBody.addClass(pCom.find('div').attr('class')); | ||
navCustonMain.insertBefore(pCom); | navCustonMain.insertBefore(pCom); | ||
$( document ).trigger('custome-sidebar-loaded'); | |||
} | } | ||
| שורה 39: | שורה 40: | ||
success: createCustomNav | success: createCustomNav | ||
}); | }); | ||
}); | |||
}) | |||
גרסה מ־17:05, 24 במאי 2014
// הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה.
// created by [[user:Yonidebest]] with some help from [[User:ערן]]
$(function(){
function createCustomNav(linkstext)
{
if (mw.config.get('skin') == 'vector') {
var linksPortalName = 'myLinksPortal';
var state = $.cookie('vector-nav-' + linksPortalName) == 'true';
var div = $('<div>', {'class': 'portal ' + (state ? 'expanded' : 'collapsed'), id: linksPortalName});
$('#mw-panel > div.portal:eq(0)').after(
div
.append($('<h3>').text('הקישורים שלי'))
.append($('<div>', {'class': 'body'}).css({display: state ? 'block' : 'hidden'}).html(linkstext))
);
return;
} // else...
var aLink1 = $('<a href="#">הקישורים שלי</a>');
aLink1.click(function(){
$('#p-customBody1').toggle();
return false;
});
var h3CustonTitle = $('<h3>').append(aLink1);
var divCustonBody = $('<div id="p-customBody1" style="display:none;"></div>');
divCustonBody.html(linkstext);
var navCustonMain = $('<div></div>').append(h3CustonTitle).append(divCustonBody);
var pCom = $('#p-community');
navCustonMain.addClass(pCom.attr('class'));
divCustonBody.addClass(pCom.find('div').attr('class'));
navCustonMain.insertBefore(pCom);
$( document ).trigger('custome-sidebar-loaded');
}
$.ajax({
url: mw.util.wikiScript('index'),
data: {
title: 'משתמש:'+mw.config.get('wgUserName')+'/הקישורים שלי',
action: 'render'
},
success: createCustomNav
});
});