Jump to content

User:Salix alba/vector.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
$.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+'&amp;action=purge&amp;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");