Screamer gallery is currently down due to vulnerabilities in the software.

User:LuaGunsX/vector.js: Difference between revisions

From Screamer Wiki
Jump to navigation Jump to search
Created page with "→<span id="blockreason" data-username="Username"></span>: mw.loader.using('mediawiki.api').then(() => { $(function () { const blockspan = document.querySelector('#blockreason'); if (!blockspan) return; const username = blockspan.dataset.username; if (!username) return; const api = new mw.Api(); api.get({ action: 'query', list: 'logevents', letype: 'block', letitle: 'User:' + username, lelimit: 1 }).then(data => {..."
 
ok this works well
Tags: Blanking Reverted
Line 1: Line 1:
/* <span id="blockreason" data-username="Username"></span> */


mw.loader.using('mediawiki.api').then(() => {
$(function () {
    const blockspan = document.querySelector('#blockreason');
    if (!blockspan) return;
    const username = blockspan.dataset.username;
    if (!username) return;
    const api = new mw.Api();
api.get({
    action: 'query',
    list: 'logevents',
    letype: 'block',
    letitle: 'User:' + username,
    lelimit: 1
}).then(data => {
    let log = null;
    if (
        data &&
        data.query &&
        data.query.logevents &&
        data.query.logevents.length
    ) {
        log = data.query.logevents[0];
    }
    if (!log) {
        blockspan.textContent = 'User isn\'t blocked.';
        return;
    }
    blockspan.textContent = log.comment || 'No reason.';
}).catch(err => {
    console.error(err);
    blockspan.textContent = 'Error';
});
});
});

Revision as of 19:08, 5 November 2026