Jump to content

User:Gilderien/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.
importScript('User:AzaToth/twinkle.js');
importScript('User:Ucucha/HarvErrors.js');
importScript('User:Xenocidic/satusChanger2.js');
importScript('User:Shubinator/DYKcheck.js'); //DYKcheck tool
importScript('User:Cameltrader/Advisor.js');
mw.loader.load('https://ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-markblocked.js&action=raw&ctype=text/javascript');
importScript('User:Js/ajaxPreview.js'); // [[user:js/ajaxPreview]]
importScript('User:Anomie/linkclassifier.js'); // Linkback: User:Anomie/linkclassifier.js
importStylesheet('User:Anomie/linkclassifier.css'); // Linkback: User:Anomie/linkclassifier.css

/*** BEGIN WIKIBREAK ENFORCER ***/
$(function() {
 
        /*** Start editing here ***/
 
        // When you want to end your break?
        // no leading zeroes. (example: 7 - correct, 07 - incorrect)
 
        var date = { year: 2012, month: 4, day: 16};
        var time = { hours: 23, minutes: 52, seconds: 13 };
 
        /*** Stop editing here ***/
 
        var currentDate = new Date();
        var enforcedBreakEnd = new Date(
                date.year,date.month-1,date.day,time.hours,time.minutes,time.seconds);
        if (currentDate <= enforcedBreakEnd) {
                alert("Enforced wikibreak until "+enforcedBreakEnd.toLocaleString()
                        + "\n(now is "+currentDate.toLocaleString()+")\n\nBye!");
                location = "http://"+location.host+"/w/index.php?title="
                        + "Special:Userlogout&returnto=Main_Page";
        }
});
/*** END WIKIBREAK ENFORCER ***/

// Add [[WP:Reflinks]] launcher in the toolbox on left addOnloadHook(function () { mw.util.addPortletLink(  "p-tb",     // toolbox portlet  "http://toolserver.org/~dispenser/cgi-bin/webreflinks.py/" + wgPageName   + "?client=script&citeweb=on&overwrite=&limit=20&lang=" + wgContentLanguage,  "Reflinks"  // link label )});


importScript("User:Writ Keeper/Scripts/teahouseUtility.js"); // Gives one-click option to add Teahouse invitation or talkback to a user

importScript("User:Writ Keeper/Scripts/teahouseTalkback.js"); // Adds Talkback reminder when you save an edit at the Teahouse

importScript("User:Writ Keeper/Scripts/teahouseTalkbackLink.js"); // Adds a talkback link to signatures on the Teahouse 

importScript("User:Ocaasi/WikiLoveinstallscript.js");// Adds Teahouse Badges to WikiLove

/*
FOR FUTURE REFERENCE, SHOULD THE WMF EVER DECIDE TO REMOVE THE ORANGE BAR FOR REAL:
.usermessage {
background-color: #ffce7b;
border: 1px solid #ffa500;
color: black;
font-weight: bold;
margin: 2em 0 1em;
padding: .5em 1em;
vertical-align: middle;
}
 
These are the CSS styles applied to the OBoD to make it look the way it is.
 
*/
 
 
function orangeBarOfDoom()
{
	var cookieResult = $.cookie("lastTalkpageView");
	if(cookieResult != null)
	{
		var escapedUsername = wgUserName.replace(/ /g, "_");
		if(wgPageName == "User_talk:"+ escapedUsername)
		{
			var d = new Date();
			$.cookie("lastTalkpageView", d.getTime(), {expires:365, path: '/'});
		}
		else
		{
			var data = {action: "query", prop:"revisions", format:"json", rvprop:"timestamp|user", rvlimit:"1", rvdir:"older", rvexcludeuser: wgUserName, titles: "User talk:"+wgUserName};
			$.post("/w/api.php", data, function(results)
			{
				var index = Object.keys(results.query.pages)[0];
				var lastUser = results.query.pages[index].revisions[0].user
				var lastTimestamp = Date.parse(results.query.pages[index].revisions[0].timestamp);
				if( cookieResult < lastTimestamp )
				{
					var orangeBarDiv = document.createElement("div");
					orangeBarDiv.innerHTML = 'You have <a href="/w/index.php?title=User_talk:'+escapedUsername+'&amp;redirect=no" title="User talk:'+wgUserName+'">new messages.</a> Last edit by '+lastUser+'.';
					orangeBarDiv.className = "usermessage";
					$("#contentSub").after(orangeBarDiv);
				}
			})
		}
	}
	else
	{
		var d = new Date();
		$.cookie("lastTalkpageView", d.getTime(), {expires:365, path: '/'});
	}
}
$(document).ready(orangeBarOfDoom);