MediaWiki:Common.js: Porovnání verzí
Z Wiki JU
Bez shrnutí editace |
Bez shrnutí editace |
||
| Řádek 32: | Řádek 32: | ||
'</div>'; | '</div>'; | ||
function injectNote(root) { | |||
var $ | var $title = (root ? $(root) : $(document)) | ||
.find('.articleFeedbackv5- | .find('.articleFeedbackv5-title-wrap') | ||
.first(); | .first(); | ||
if (!$ | if (!$title.length) return false; // nadpis není | ||
if (document.getElementById(NOTE_ID)) return true; // už vloženo | if (document.getElementById(NOTE_ID)) return true; // už vloženo | ||
$ | $title.after(NOTE_HTML); // vložit pod nadpis | ||
return true; | return true; | ||
} | } | ||
if (injectNote()) return; | if (injectNote()) return; | ||
var obs = new MutationObserver(function (mutations) { | var obs = new MutationObserver(function (mutations) { | ||
for (var m of mutations) { | for (var m of mutations) { | ||
| Řádek 58: | Řádek 56: | ||
obs.observe(document.body, { childList: true, subtree: true }); | obs.observe(document.body, { childList: true, subtree: true }); | ||
setTimeout(function () { injectNote(); obs.disconnect(); }, 5000); | setTimeout(function () { injectNote(); obs.disconnect(); }, 5000); | ||
})(); | })(); | ||
Verze z 22. 9. 2025, 09:12
/* Zde uvedený JavaScript bude použit pro všechny uživatele při načtení každé stránky */
$(function () {
// Zruš jQuery UI vzhled tlačítka
$('.articleFeedbackv5-submit').button('destroy');
});
document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('.extern-download').forEach(el => {
el.style.cursor = 'pointer';
el.style.color = '#0645AD';
el.style.textDecoration = 'underline';
el.addEventListener('click', () => {
const a = document.createElement('a');
a.href = el.getAttribute('data-url');
a.setAttribute('download', '');
a.style.display = 'none';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
});
});
});
(function () {
var NOTE_ID = 'af5-note';
var NOTE_HTML =
'<div id="' + NOTE_ID + '" class="articleFeedbackv5-note">' +
'Tento formulář slouží pouze jako zpětná vazba pro tuto stránku. ' +
'Řešíte-li nějaký problém, podívejte se na ' +
'<a href="/Servicedesk/Seznam_e-mailových_adres_pro_zadávání_požadavků">seznam e-mailových adres</a> pro zadávání požadavků.' +
'</div>';
function injectNote(root) {
var $title = (root ? $(root) : $(document))
.find('.articleFeedbackv5-title-wrap')
.first();
if (!$title.length) return false; // nadpis není
if (document.getElementById(NOTE_ID)) return true; // už vloženo
$title.after(NOTE_HTML); // vložit pod nadpis
return true;
}
if (injectNote()) return;
var obs = new MutationObserver(function (mutations) {
for (var m of mutations) {
if (injectNote(m.target)) {
obs.disconnect();
break;
}
}
});
obs.observe(document.body, { childList: true, subtree: true });
setTimeout(function () { injectNote(); obs.disconnect(); }, 5000);
})();