Изменения

Перейти к: навигация, поиск

MediaWiki:Common.js

2228 байтов убрано, 20:02, 2 июня 2016
Отмена правки 44383, сделанной участником [[Special:Contribs/Dream|Dream]] ([[User talk:Dream|обс.]])
mw.loader.load('http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML&delayStartupUntil=configured');
mw.loader.load('http://allll.net/w/index.php?title=MediaWiki:MathJax.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
 
jQuery.fn.addtocopy = function(usercopytxt) {
var options = {htmlcopytxt: '<br>More: <a href="'+window.location.href+'">'+window.location.href+'</a><br>', minlen: 25, addcopyfirst: false}
$.extend(options, usercopytxt);
var copy_sp = document.createElement('span');
copy_sp.id = 'ctrlcopy';
copy_sp.innerHTML = options.htmlcopytxt;
return this.each(function(){
$(this).mousedown(function(){$('#ctrlcopy').remove();});
$(this).mouseup(function(){
if(window.getSelection){ //good times
var slcted=window.getSelection();
var seltxt=slcted.toString();
if(!seltxt||seltxt.length<options.minlen) return;
var nslct = slcted.getRangeAt(0);
seltxt = nslct.cloneRange();
seltxt.collapse(options.addcopyfirst);
seltxt.insertNode(copy_sp);
if (!options.addcopyfirst) nslct.setEndAfter(copy_sp);
slcted.removeAllRanges();
slcted.addRange(nslct);
} else if(document.selection){ //bad times
var slcted = document.selection;
var nslct=slcted.createRange();
var seltxt=nslct.text;
if (!seltxt||seltxt.length<options.minlen) return;
seltxt=nslct.duplicate();
seltxt.collapse(options.addcopyfirst);
seltxt.pasteHTML(copy_sp.outerHTML);
if (!options.addcopyfirst) {nslct.setEndPoint("EndToEnd",seltxt); nslct.select();}
}
});
});
}
if (wgUserName == null) {
$(document).addtocopy({htmlcopytxt: '<br>Подробнее: <a href="'+window.location.href+'">'+window.location.href+'</a>'});
}
$(function() {
$('.dynnav-button').each(function(i,e) {
$(this).data('i', i+1).click(function() {
var $this = $(this),
$template = $('#dynnav-template-' + $this.data('i'));
if( $this.hasClass('dynnav-button-inactive') ) {
$('.dynnav-button-active').removeClass('dynnav-button-active').addClass('dynnav-button-inactive');
$('.dynnav-template').slideUp(250);
$this.removeClass('dynnav-button-inactive').addClass('dynnav-button-active');
$template.slideDown(300);
} else {
$this.removeClass('dynnav-button-active').addClass('dynnav-button-inactive');
$template.slideUp(300);
}
return false;
});
});
});
Куратор, наблюдатель
19 821
правка