מדיה ויקי:Gadget-IsBlock.js: הבדלים בין גרסאות בדף
לא עובד |
ועכשיו? |
||
| שורה 1: | שורה 1: | ||
$( | $(() => { | ||
// 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) | |||
); | |||
} | |||
if ($( '.blockRequestUserName ').length > 0) { | |||
var list = {}; | var list = {}; | ||
| שורה 39: | שורה 56: | ||
.done( reportBlocks ); | .done( reportBlocks ); | ||
} | } | ||
} | |||
}); | }); | ||