מדיה ויקי:Gadget-CustomSideBarLinks.js: הבדלים בין גרסאות בדף
מראה
סידור רווחים |
Vector is default, so reverse the condition |
||
| שורה 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) { | |||
if (mw.config.get('skin') !== 'vector') { | |||
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 linksPortalName = 'myLinksPortal'; | |||
var div = $('<div>', { id: linksPortalName } ).addClass('portal'); | |||
$('#mw-panel > div.portal:eq(0)').after(div | |||
.append($('<h3>').text('הקישורים שלי')) | |||
var | .append($('<div>', {'class': 'body'}).html(linkstext)) | ||
var | ); | ||
$( document ).trigger( 'new-portlet-link', [linksPortalName] ); | |||
} | } | ||
גרסה מ־09:45, 5 בדצמבר 2017
// הסקריפט מוסיף קישורים (שנבחרו על ידי המשתמש) לתיבה שממוקמת מעל לתיבת הקהילה.
// created by [[user:Yonidebest]] with some help from [[User:ערן]]
$( function() {
function createCustomNav(linkstext) {
if (mw.config.get('skin') !== 'vector') {
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');
$('#mw-panel > div.portal:eq(0)').after(div
.append($('<h3>').text('הקישורים שלי'))
.append($('<div>', {'class': 'body'}).html(linkstext))
);
$( document ).trigger( 'new-portlet-link', [linksPortalName] );
}
$.ajax({
url: mw.util.wikiScript('index'),
data: {
title: 'משתמש:' + mw.config.get('wgUserName') + '/הקישורים שלי',
action: 'render'
},
success: createCustomNav
});
});