MediaWiki:Common.js
(відмінності між версіями)
Elena (Обговорення • внесок) |
Elena (Обговорення • внесок) |
||
| Рядок 63: | Рядок 63: | ||
} | } | ||
| − | |||
| − | |||
| − | |||
| − | |||
| + | #translate_widget { | ||
| + | |||
| + | position: fixed; | ||
| + | top: 15px; | ||
| + | right: 20px; | ||
| + | |||
| + | background: white; | ||
| + | padding: 6px 10px; | ||
| + | |||
| + | border-radius: 6px; | ||
| + | box-shadow: 0 2px 6px rgba(0,0,0,0.2); | ||
| + | |||
| + | font-size: 18px; | ||
| + | z-index: 9999; | ||
| + | |||
| + | } | ||
| + | |||
| + | |||
| + | |||
| + | $(document).ready(function(){ | ||
| + | |||
| + | var translate = ` | ||
| + | <div id="translate_widget"> | ||
<a href="#" onclick="doGTranslate('uk|en');return false;">🇬🇧</a> | <a href="#" onclick="doGTranslate('uk|en');return false;">🇬🇧</a> | ||
<a href="#" onclick="doGTranslate('uk|de');return false;">🇩🇪</a> | <a href="#" onclick="doGTranslate('uk|de');return false;">🇩🇪</a> | ||
| Рядок 75: | Рядок 94: | ||
<a href="#" onclick="doGTranslate('uk|pl');return false;">🇵🇱</a> | <a href="#" onclick="doGTranslate('uk|pl');return false;">🇵🇱</a> | ||
<a href="#" onclick="doGTranslate('uk|ja');return false;">🇯🇵</a> | <a href="#" onclick="doGTranslate('uk|ja');return false;">🇯🇵</a> | ||
| − | + | </div> | |
| − | </ | + | |
`; | `; | ||
| − | $(" | + | $("body").append(translate); |
}); | }); | ||
| − | function doGTranslate(lang_pair) { | + | function doGTranslate(lang_pair){ |
| − | var lang=lang_pair.split('|')[1]; | + | var lang = lang_pair.split('|')[1]; |
location.href = | location.href = | ||
| − | + | "https://translate.google.com/translate?sl=uk&tl=" | |
| − | +lang+ | + | + lang + |
| − | + | "&u=" + encodeURIComponent(location.href); | |
} | } | ||
Версія за 13:50, 13 березня 2026
/* Any JavaScript here will be loaded for all users on every page load. */
if(mw.config.get('wgArticleId') == 1736) {
$( document ).ready( function() {
var sli = $("#photoGroups .holder ul")[0];
sli.parentNode.style.height = "200px";
$("#photoGroups p").each(function(i) {
$(this).mouseenter(function() {
$(sli).stop();
$(sli).animate({marginTop:"-"+(200+i*200)+"px"});
});
});
})};
$('.xpand a').click(function() {
var c = this.firstChild.nodeValue,
d = c.substring(0,c.length-1);
this.innerHTML = c.charCodeAt(c.length-1) === 9658 ? d+'\u25BC' : d+'\u25BA';
$('.'+$(this).attr('href').substring(1)).slideToggle();
return false;
});
var ph = $('.photogal ul .thumbimage');
if (ph[0]) {
ph[0].style.opacity = 0.66;
var img = $('.photogal img')[0],
caption = $('.photogal .thumbcaption')[0];
img.removeAttribute('width');
$('.photogal .thumbinner')[0].style.width = '';
ph.each(function(i) {
$(this).click(function() {
var cpt = $('.thumbcaption',$('.photogal li')[i])[0];
caption.innerHTML = cpt.innerText || cpt.textContent;
img.src = this.src.replace('200px','800px');
img.parentNode.href = this.parentNode.href;
ph.each(function(j) { this.style.opacity = i === j ? 0.66 : 1 });
return false;
});
});
}
var team = $('.team img');
if(team.length){
var hl = $('<div class="photo_hl"></div>');
hl.append(team.clone());
team.before(hl);
hl = hl.children();
$('.team ul li').each(function(){
$(this).mouseover(function() {
var pos = $(this).attr('data-pos');
if(pos) {
pos = pos.split(':');
hl.css('clip','rect('+
hl.height()/(100/pos[1])+'px '+
hl.width()/(100/(pos[0]*1+pos[2]*1))+'px '+
hl.height()/(100/(pos[1]*1+pos[3]*1))+'px '+
hl.width()/(100/pos[0])+'px)'
);
}
});
$(this).mouseout(function() {
hl.css('clip','rect(0 '+hl.width()+'px '+hl.height()+'px 0)');
});
if(!hl.attr('style')) $(this).mouseout();
});
}
#translate_widget {
position: fixed;
top: 15px;
right: 20px;
background: white;
padding: 6px 10px;
border-radius: 6px;
box-shadow: 0 2px 6px rgba(0,0,0,0.2);
font-size: 18px;
z-index: 9999;
}
$(document).ready(function(){
var translate = `
<div id="translate_widget">
<a href="#" onclick="doGTranslate('uk|en');return false;">🇬🇧</a>
<a href="#" onclick="doGTranslate('uk|de');return false;">🇩🇪</a>
<a href="#" onclick="doGTranslate('uk|fr');return false;">🇫🇷</a>
<a href="#" onclick="doGTranslate('uk|es');return false;">🇪🇸</a>
<a href="#" onclick="doGTranslate('uk|pl');return false;">🇵🇱</a>
<a href="#" onclick="doGTranslate('uk|ja');return false;">🇯🇵</a>
</div>
`;
$("body").append(translate);
});
function doGTranslate(lang_pair){
var lang = lang_pair.split('|')[1];
location.href =
"https://translate.google.com/translate?sl=uk&tl="
+ lang +
"&u=" + encodeURIComponent(location.href);
}
