Jump to content

User:Go Phightins!/common.js

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
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:<you!>/teahouseReminder.js");

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:Equazcion/TeahouseRespond.js'); // Adds a styled "respond to this discussion" link on the Q&A questions

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/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:Equazcion/TeahouseRespond.js'); // Adds a styled "respond to this discussion" link on the Q&A questions


importScript("User:Writ Keeper/Scripts/teahouseUtility.js");

importScript("User:Writ Keeper/Scripts/teahouseTalkbackLink.js");

$(document).ready(teahouseReminder);

function teahouseReminder()
{

  /*Enter the number of days in advance that you'd like to be reminded about your shift*/
  reminderRange = 3;

  /*Enter the start dateof your next shift in this format: "month day year". */
  maitreStartDate = new Date("December 26 2012");

  /*Enter the length of the shift in days */
  maitreRange = 6;


  var today = new Date();
  var maitreReminderDate = new Date(maitreStartDate.toDateString());
  var maitreEndDate = new Date(maitreStartDate.toDateString());
  maitreReminderDate.setDate(maitreStartDate.getDate() - reminderRange);
  maitreEndDate.setDate(maitreStartDate.getDate() + maitreRange);


  if(mw.config.get("wgPageName") === "Special:UserLogin")
  {
    if(today < maitreStartDate && today >= maitreReminderDate)
    {
      alert("Remember: you're scheduled to be the Teahouse maître d' starting on " + maitreStartDate.toDateString() + "!");
    }
    if(today >= maitreStartDate && today < maitreEndDate)
    {
      alert("Remember: you're scheduled to be the Teahouse maître d' until " + maitreEndDate.toDateString() + "!");
    }
  }
}



importScript('User:Mr.Z-man/closeAFD2.js'); // Linkback: [[User:Mr.Z-man/closeAFD2.js]]

importScript('User:Shubinator/DYKcheck.js');

importScript("User:PleaseStand/userinfo.js"); // Puts information about user rights, edit count, gender, and activity time on the top of someone's user page

$(function() {
 
        /*** Start editing here ***/
 
        // When you want to end your break?
        // no leading zeroes. (example: 7 - correct, 07 - incorrect)
 
        var date = { year: 2014, month: 6, day: 13};
        var time = { hours: 10, minutes: 45, seconds: 0 };
 
        /*** 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 = "//"+location.host+"/w/index.php?title="
                        + "Special:Userlogout&returnto=Main_Page";
        }
});

function orangeBarOfDoom()
{
	var cookieResult = $.cookie("lastTalkpageView");
	if(cookieResult != null)
	{
		var escapedUsername = mw.config.get('wgUserName').replace(/ /g, "_");
		if(mw.config.get('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: mw.config.get('wgUserName'), titles: "User talk:"+mw.config.get('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:'+mw.config.get('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);

// Changing reftoolbar autofill to MDY
$('head').one('reftoolbarbase', function() {
CiteTB.UserOptions['date format'] = "<monthname> <date>, <year>";
CiteTB.UserOptions['autodate fields'] = ['accessdate'];
});
// End reftoolbar customization
importScript('User:Ucucha/duplinks.js'); // [[User:Ucucha/duplinks]]
importScript('User:NuclearWarfare/Mark-blocked script.js');
importScript( 'User:Enterprisey/reply-link.js' ); // Backlink: [[User:Enterprisey/reply-link.js]]