MediaWiki:Common.js
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* Размещённый здесь код JavaScript будет загружаться пользователям при обращении к каждой странице */
document.onclick=function(ev){
var obj=ev?ev.target:event.srcElement;
while(obj.parentNode){
if(obj.className=="spoiler"){break;}
else{obj=obj.parentNode;}};
if(obj.className=="spoiler"){
clickSpoiler(obj);
return false;};
closet();
};
function clickSpoiler(el){
var s=el.getElementsByTagName("dd")[0].style.display;
closet();
if(s=="none"||s==""){
el.getElementsByTagName("dd")[0].style.display="block";};
};
function closet(){
var m, k;
m=document.getElementsByTagName("dl");
k=m.length;
while(k--){
if(m[k].className=="spoiler"){
m[k].getElementsByTagName("dd")[0].style.display="none";}};
};
(function($)
{
$(document).ready(function()
{
$('body').append('<div id="scrll"><div class="go-top help" id="ToTop"><span class="help_i">Вверх</span><span class="icon-arrow-up-2"></span></div><div class="go-content help" id="ToContent"><span class="help_i">К содержимому</span><span class="icon-list-view"></span></div><div class="go-bottom help" id="ToBottom"><span class="help_i">Вниз</span><span class="icon-arrow-down-2"></span></div></div>');
var allhlp = $('span.help_i');
var adh = $('div.help');
$(allhlp).hide();
$(adh).each(function(i) {
$(this).on("hover",function(){
$(allhlp[i]).show(200);
})
$(this).on("mouseleave",function(){
$(allhlp[i]).hide(200).stop(false, true);
})
})
var scrll = $("#scrll");
var t=$("#ToTop");
var b=$("#ToBottom");
var ht=$("html,body");
var content_position = $(window).scrollTop();
if ($(window).scrollTop() >= "250") {
$(t).fadeIn(500);
}
$(window).scroll(function(){
if ($(window).scrollTop() <= "250") {
$(t).fadeOut(500);
} else {
$(t).fadeIn(500);
}
if ($(window).scrollTop()>=$(document).height()-"999") $(b).fadeOut(500)
else $(b).fadeIn(500)
});
$(t).on("click",function(){
content_position = $(window).scrollTop();
$(ht).animate({scrollTop:0},500);
});
$(b).on("click",function(){
content_position = $(window).scrollTop();
$(ht).animate({scrollTop:jQuery(document).height()},500);
});
$("#ToContent").on("click",function(){
$(ht).animate({scrollTop:content_position},500);
});
//OFF ready
})
})(jQuery);