מדיה ויקי:Gadget-IsBlock.js: הבדלים בין גרסאות בדף

אין תקציר עריכה
לא עובד
שורה 1: שורה 1:
(function() {
$(document).ready( () => {
// when query returns, see if there are any blocks, and if there are, add the block marker.
if ($( '.blockRequestUserName ').length > 0)
// note that list[user] is an array of all the spans in the page requesting to block this user.
mw.loader.using(['mediawiki.util', 'mediawiki.api']).done( () => {
// typically this array will be of length 1, but it can be more.
function reportBlocks( data ) {
if (data && data.query && data.query.blocks )
data.query.blocks.forEach( block => {
var user = decodeURIComponent( block.user ); // the api returns the user name encoded.
addBlockedMarker( list[user], block.by );
});
}
 
function addBlockedMarker( spans, by ) {
spans.forEach( span =>
span
.text(' | חסומ/ה ')
.attr('title', 'נחסמ/ה על ידי ' + by)
);
}
 
$( () => {
if ($( '.blockRequestUserName ').length > 0) {
var list = {};
var list = {};


שורה 58: שורה 39:
.done( reportBlocks );
.done( reportBlocks );
}
}
}
// when query returns, see if there are any blocks, and if there are, add the block marker.
// note that list[user] is an array of all the spans in the page requesting to block this user.
// typically this array will be of length 1, but it can be more.
function reportBlocks( data ) {
if (data && data.query && data.query.blocks )
data.query.blocks.forEach( block => {
var user = decodeURIComponent( block.user ); // the api returns the user name encoded.
addBlockedMarker( list[user], block.by );
});
}
function addBlockedMarker( spans, by ) {
spans.forEach( span =>
span
.text(' | חסומ/ה ')
.attr('title', 'נחסמ/ה על ידי '  + by)
);
}
});
});
});
})();