No edit summary |
No edit summary |
||
(14 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | function isUserLoggedIn() { |
||
− | // Use MediaWiki's user interface elements to check the login status |
||
⚫ | |||
− | } |
||
− | |||
− | function insertLoginMessage($element) { |
||
− | // Check if aria-disabled is set to "true" |
||
− | if ($element.attr('aria-disabled') === 'true') { |
||
− | // Create a new HTML snippet with MediaWiki links |
||
⚫ | |||
− | |||
− | // Insert the message after the disabled button |
||
⚫ | |||
− | } |
||
− | } |
||
− | |||
$(document).ready(function() { |
$(document).ready(function() { |
||
⚫ | |||
− | // Check the initial state |
||
⚫ | |||
− | checkElements(); |
||
⚫ | |||
− | |||
− | + | elements.each(function() { |
|
⚫ | |||
− | $(document).on('DOMNodeInserted', function(event) { |
||
⚫ | |||
− | var target = $(event.target); |
||
⚫ | |||
− | if (target.hasClass('oo-ui-buttonElement-button')) { |
||
− | + | }); |
|
} |
} |
||
− | }); |
+ | }, 250); |
− | |||
− | function checkElements() { |
||
− | // Select all elements with the specified class |
||
⚫ | |||
⚫ | |||
⚫ | |||
− | insertLoginMessage($element); |
||
− | }); |
||
− | } |
||
}); |
}); |
Latest revision as of 01:31, 15 October 2023
$(document).ready(function() {
setTimeout(function() {
if (mw.user.isAnon()) {
var elements = $('.cs-header > .oo-ui-widget-disabled');
elements.each(function() {
var $element = $(this);
var loginMessage = '<p style="cs-custom-login-prompt">Please <a href="/wiki/Special:UserLogin">login</a> or <a href="/wiki/Special:CreateAccount">sign up</a> to continue.</p>';
$element.after(loginMessage);
});
}
}, 250);
});