User:Salix alba/vector.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
The accompanying .css page for this skin is at User:Salix alba/vector.css. |
$.when( mw.loader.using( [ 'mediawiki.util' ] ), $.ready ).then( function() {
console.log("AAAA");
//.mwe-math-mathml-inline
mw.util.addPortletLink ('p-tb', '/wiki/Help:Formula', 'Help:Formula');
mw.util.addPortletLink ('p-tb', '/wiki/Wikipedia:Template messages','List of available templates');
mw.util.addPortletLink ('p-tb', '/wiki/Wikipedia talk:WikiProject Mathematics','WT:WPM');
mw.util.addPortletLink ('p-tb', '/wiki/Category:Articles with math errors','Cat:MathErr');
mw.util.addPortletLink ('p-tb', 'http://commons.wikimedia.org/','commons');
mw.util.addPortletLink ('p-tb', 'http://en.wiktionary.org/','wiktionary');
console.log("BBBB");
/*** Null Edit ***/
// Adds a link to perform a [[WP:NULLEDIT]] on the current page
// Documentation at [[en:w:User:BrandonXLF/NullEdit]]
// By [[en:w:User:BrandonXLF]]
$(mw.util.addPortletLink('p-cactions', '#', 'Null edit')).click(function(e) {
e.preventDefault();
new mw.Api().edit(mw.config.get('wgPageName'), function(rev) {
return rev.content;
}).then(function() {
window.location.reload();
});
});
console.log("CCCC");
var pgname = mw.config.get( 'wgPageName' );
console.log(pgname);
var mpurge = $("<li></li>").addClass("mw-list-item");
var linstr= '<a href="/w/index.php?title='+pgname+'&action=purge&mathpurge=true">mathpurge</a>';
console.log(linstr);
var plink = $(linstr);
mpurge.append(plink);
//console.log(mpurge);
$('#ca-purge').after(mpurge);
console.log("DDDD");
// Makes double clicking on a mathematical equation copy the source latex to the clipboard
$(".mwe-math-mathml-a11y").each(function(ind,ele) {
var parent = ele.parentElement;
$(parent).dblclick(function(ev) {
console.log(ev.delegateTarget);
var root = ev.delegateTarget;
var latex = $(root).find("annotation").text();
var $temp = $("<input>")
$("body").append($temp);
$temp.val(latex).select();
document.execCommand("copy");
$temp.remove();
});
});
console.log("EEEE");
var searchform = $('form#searchform');
searchform.attr("target","_blank");
//console.log(searchform.target);
//if (searchform) searchform.setAttribute('target','_blank');
// Paste jQuery snippet heres
//console.log('foo');
//console.log($('.ve-ce-protectedNode').css('position'));
//console.log($('.ve-ce-protectedNode *').css());
//console.log('bar');
$('li#ca-edit a').html('Edit'); // change label for wikitext edit tab
$('li#ca-ve-edit a').html('VE edit'); // change label for visualEditor edit tab
$('.mw-editsection a:nth-child(2)' ).html('Edit'); // change label for wikitext section edits links
$('.mw-editsection-visualeditor').html('VE edit'); // change label for visualEditor section edit links
$('.mw-editsection-bracket').css('display','none'); // Don't display [ ] square brackets for section edits
// $('.mw-editsection-divider').css('display','none'); // Don't display the | divider for section edits (commented out)
$('#firstHeading .mw-editsection-visualeditor').css('display','none'); // Don't display the section 0 VE edit link which is broken
$('#firstHeading .mw-editsection-divider').css('display','none'); // Don't display the divider for section zero
//console.log($('.ve-ce-protectedNode, .ve-ce-protectedNode *').css());
//$('.ve-ce-protectedNode, .ve-ce-protectedNode *').css('-webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;');
//alert($('.ve-ce-protectedNode, .ve-ce-protectedNode *').css());
var $cats_ul = $('#mw-normal-catlinks ul');
var $cats_li = $cats_ul.children('li'); //$('#mw-normal-catlinks ul li');
//console.log($cats_li);
$cats_li.sort(function(a,b) {
//console.log(a.innerText + " : "+ b.innerText);
if(a.children[0].innerHTML > b.children[0].innerHTML) return 1;
return -1;
});
//console.log($cats_li);
$cats_li.detach().appendTo($cats_ul);
} );
console.log("FFFF");
mw.loader.load( '/w/index.php?title=User:Salix_alba/TDList.js&action=raw&ctype=text/javascript' );
mw.loader.load( '/w/index.php?title=User:Salix_alba/Citoid.js&action=raw&ctype=text/javascript' );
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Joeytje50/JWB.js/load.js&action=raw&ctype=text/javascript');
console.log("GGGG");