Difference between revisions of "MediaWiki:Common.js"
| Line 71: | Line 71: | ||
$('a').each(function() { | $('a').each(function() { | ||
var a = new RegExp('/' + window.location.host + '/'); | var a = new RegExp('/' + window.location.host + '/'); | ||
| − | if(!a.test(this. | + | if(!a.test(this.[])) { |
$(this).click(function(event) { | $(this).click(function(event) { | ||
event.preventDefault(); | event.preventDefault(); | ||
event.stopPropagation(); | event.stopPropagation(); | ||
| − | window.open(this. | + | window.open(this.[], '_blank'); |
}); | }); | ||
} | } | ||
}); | }); | ||
Revision as of 12:37, 7 April 2017
/* Размещённый здесь код 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";}};
};
jQuery(document).ready(function(){
jQuery('.spoiler-head').click(function(){
$(this).parents('.spoiler-wrap').toggleClass("active").find('.spoiler-body').slideToggle();
})
})
$(function() {
$(window).scroll(function() {
if($(this).scrollTop() != 0) {
$('#topNubex').fadeIn();
} else {
$('#topNubex').fadeOut();
}
});
$('#topNubex').click(function() {
$('body,html').animate({scrollTop:0},700);
});
});
$('a').each(function() {
var a = new RegExp('/' + window.location.host + '/');
if(!a.test(this.[])) {
$(this).click(function(event) {
event.preventDefault();
event.stopPropagation();
window.open(this.[], '_blank');
});
}
});