מדיה ויקי:Gadget-CustomSideBarLinks.js: הבדלים בין גרסאות בדף
מראה
מ תקלדה |
מ תקלדה |
||
| שורה 21: | שורה 21: | ||
return false; | return false; | ||
}); | }); | ||
var | 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); | ||
var navCustomMain = $('<div>').append( | var navCustomMain = $('<div>').append(h3CustomTitle).append(divCustomBody); | ||
var pCom = $('#p-community'); | var pCom = $('#p-community'); | ||
navCustomMain.addClass(pCom.attr('class')); | |||
divCustomBody.addClass(pCom.find('div').attr('class')); | |||
navCustomMain.insertBefore(pCom); | |||
} | } | ||
גרסה מ־19:05, 30 בספטמבר 2015
// הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה.
// created by [[user:Yonidebest]] with some help from [[User:ערן]]
$(function(){
function createCustomNav(linkstext)
{
if (mw.config.get('skin') == 'vector') {
var linksPortalName = 'myLinksPortal';
var div = $('<div>', { id: linksPortalName } ).addClass('portal');
$('#mw-panel > div.portal:eq(0)').after(
div
.append($('<h3>').text('הקישורים שלי'))
.append($('<div>', {'class': 'body'}).html(linkstext))
);
$( document ).trigger( 'new-portlet-link', [linksPortalName] );
return;
} // else...
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);
}
$.ajax({
url: mw.util.wikiScript('index'),
data: {
title: 'משתמש:'+mw.config.get('wgUserName')+'/הקישורים שלי',
action: 'render'
},
success: createCustomNav
});
});