MediaWiki:Common.js: Porovnání verzí
Vzhled
Bez shrnutí editace |
Bez shrnutí editace |
||
| Řádek 1: | Řádek 1: | ||
// Google Translate | // Force Google Translate widget to load on every page | ||
function | (function () { | ||
function addGoogleTranslate() { | |||
if (document.getElementById('google_translate_element')) return; | |||
var div = document.createElement('div'); | var div = document.createElement('div'); | ||
div.id = 'google_translate_element'; | div.id = 'google_translate_element'; | ||
| Řádek 18: | Řádek 11: | ||
div.style.zIndex = '9999'; | div.style.zIndex = '9999'; | ||
document.body.appendChild(div); | document.body.appendChild(div); | ||
var script = document.createElement('script'); | |||
script.src = "https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"; | |||
document.body.appendChild(script); | |||
} | } | ||
window.googleTranslateElementInit = function () { | |||
new google.translate.TranslateElement({ | |||
document. | pageLanguage: 'cs', | ||
}); | includedLanguages: 'cs,en', | ||
autoDisplay: false | |||
}, 'google_translate_element'); | |||
}; | |||
document.addEventListener("DOMContentLoaded", addGoogleTranslate); | |||
})(); | |||
Verze z 21. 2. 2026, 21:59
// Force Google Translate widget to load on every page
(function () {
function addGoogleTranslate() {
if (document.getElementById('google_translate_element')) return;
var div = document.createElement('div');
div.id = 'google_translate_element';
div.style.position = 'fixed';
div.style.top = '10px';
div.style.right = '10px';
div.style.zIndex = '9999';
document.body.appendChild(div);
var script = document.createElement('script');
script.src = "https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit";
document.body.appendChild(script);
}
window.googleTranslateElementInit = function () {
new google.translate.TranslateElement({
pageLanguage: 'cs',
includedLanguages: 'cs,en',
autoDisplay: false
}, 'google_translate_element');
};
document.addEventListener("DOMContentLoaded", addGoogleTranslate);
})();