MediaWiki:Common.js: Porovnání verzí
Z TEST Wiki
Bez shrnutí editace značka: revertováno |
Bez shrnutí editace značka: revertováno |
||
| Řádek 48: | Řádek 48: | ||
restoreButtons(); | restoreButtons(); | ||
}); | |||
}); | |||
mw.loader.using(['jquery', 'jquery.ui'], function () { | |||
$(function () { | |||
function forceEnableButtons() { | |||
$('.articleFeedbackv5-button-placeholder.ui-button').each(function () { | |||
const $btn = $(this); | |||
$btn.removeClass('ui-state-disabled'); | |||
$btn.attr('aria-disabled', 'false'); | |||
this.removeAttribute('aria-disabled'); | |||
this.removeAttribute('style'); | |||
// přepiš vnitřní <span> | |||
$btn.find('.ui-button-text').css({ | |||
'opacity': '1', | |||
'color': '#ffffff' | |||
}); | |||
// nastav znovu button jQuery UI, ale bez disabled | |||
if ($btn.button) { | |||
$btn.button('enable'); | |||
} | |||
$btn.css({ | |||
'opacity': '1', | |||
'pointer-events': 'auto', | |||
'filter': 'none', | |||
'background-color': '#0052cc', | |||
'color': '#ffffff', | |||
'border': 'none', | |||
'cursor': 'pointer' | |||
}); | |||
}); | |||
} | |||
// Spusť s prodlevou, aby AFTv5 měl čas tlačítka připravit | |||
setTimeout(forceEnableButtons, 1000); | |||
}); | }); | ||
}); | }); | ||
Verze z 9. 6. 2025, 10:53
/* Zde uvedený JavaScript bude použit pro všechny uživatele při načtení každé stránky */
$(document).ready(function() {
var searchForm = $("#searchform");
if (searchForm.length > 0) {
var searchInput = searchForm.find("input[name='search']");
if (searchInput.length > 0) {
var currentAction = searchForm.attr("action");
// Přepíšeme `profile=default` na `profile=all`
var newAction = currentAction.replace("profile=default", "profile=all");
searchForm.attr("action", newAction);
}
}
});
mw.loader.using(['jquery'], function () {
$(function () {
function restoreButtons(retries = 10) {
const $buttons = $('.articleFeedbackv5-button-placeholder.ui-button');
if ($buttons.length === 0 && retries > 0) {
setTimeout(() => restoreButtons(retries - 1), 300);
return;
}
$buttons.each(function () {
const $btn = $(this);
$btn.removeClass('ui-state-disabled');
$btn.attr('aria-disabled', 'false');
$btn.css({
'opacity': '1',
'pointer-events': 'auto',
'filter': 'none',
'background-color': '#0052cc',
'color': '#ffffff',
'border': 'none',
'cursor': 'pointer'
});
// Změna textového <span>
$btn.find('.ui-button-text').css({
'color': '#ffffff',
'opacity': '1'
});
});
}
restoreButtons();
});
});
mw.loader.using(['jquery', 'jquery.ui'], function () {
$(function () {
function forceEnableButtons() {
$('.articleFeedbackv5-button-placeholder.ui-button').each(function () {
const $btn = $(this);
$btn.removeClass('ui-state-disabled');
$btn.attr('aria-disabled', 'false');
this.removeAttribute('aria-disabled');
this.removeAttribute('style');
// přepiš vnitřní <span>
$btn.find('.ui-button-text').css({
'opacity': '1',
'color': '#ffffff'
});
// nastav znovu button jQuery UI, ale bez disabled
if ($btn.button) {
$btn.button('enable');
}
$btn.css({
'opacity': '1',
'pointer-events': 'auto',
'filter': 'none',
'background-color': '#0052cc',
'color': '#ffffff',
'border': 'none',
'cursor': 'pointer'
});
});
}
// Spusť s prodlevou, aby AFTv5 měl čas tlačítka připravit
setTimeout(forceEnableButtons, 1000);
});
});