User:Justin Folvarcik/common.js

importScript('MediaWiki:admin.js'); // // Rights // Sets a variable "rights" which will return "false" if the // currently logged in user is a bureaucrat, administrator, or autoconfirmed user. It will return true otherwise. // var rights_isAdmin = (wgUserGroups.toString.indexOf('sysop') != -1); var rights_isAuto = (wgUserGroups.toString.indexOf('autoconfirmed') != -1); var rights_isCrat = (wgUserGroups.toString.indexOf('bureaucrat') != -1); var rights = true; if (rights_isCrat || rights_isAdmin || rights_isAuto) {rights=false}

if (navigator.userAgent.match(/Chrome/i)) {

// // Patrol tab // adds a "marked as patrolled" tab to pages that have that link already on it. // Once patrolled, the button turns into a button to go to the recent changes // with patrolled edits hidden. Further speeding up patrolling. // The second function of the button has the same access key. // function patroltab { if (document.URL.indexOf('&rcid=') > 0 && wgAction != 'markpatrolled') { addPortletLink ('p-cactions', "/index.php?title=" + encodeURIComponent(wgPageName) + "&action=markpatrolled&rcid=" + document.location.toString.split('&rcid=')[1].split('&'), 'patrol', 'ca-patrol', 'Mark as patrolled', '1'); } else if (document.URL.indexOf('&rcid=') > 0 && wgAction == 'markpatrolled') { addPortletLink ('p-cactions', "/index.php?title=Special:RecentChanges&hidepatrolled=1", 'return', 'ca-return', 'Return to unpatrolled recent changes', '1'); } } addOnloadHook(patroltab); } // // Perma-link to disambiguation links page // addOnloadHook(function {    {addPortletLink('p-Community', '/Special:Disambiguations', "Disambiguation Links", 't-test', 'This page shows links to disambiguation pages. These need to be tackled.');} }); // // UTC Clock // Adds a live UTC clock to the personal links. //

function liveClock{ liveClock.node = addPortletLink( 'p-personal', wgServer + '/index.php?title=' + encodeURIComponent(wgPageName) + '&action=view', '', 'utcdate' ); liveClock.node.style.fontSize = 'larger'; liveClock.node.style.fontWeight = 'bolder';

showTime; } addOnloadHook(liveClock);

function showTime{ var dateNode = liveClock.node; if( !dateNode ) { return; }

var now = new Date; var hh = now.getUTCHours; var mm = now.getUTCMinutes; var ss = now.getUTCSeconds; var time = ( hh < 10 ? '0' + hh : hh ) + ':' + ( mm < 10 ? '0' + mm : mm ) + ':' + ( ss < 10 ? '0' + ss : ss ); dateNode.firstChild.replaceChild( document.createTextNode( time ), dateNode.firstChild.firstChild );

window.setTimeout(showTime, 1000); }

//

// // load css // Loads the user's personal css page despite any // errors preventing it normally or user CSS being disabled // if (skin=='monobook') { importStylesheetURI(wgServer +"/User:" + encodeURIComponent(wgUserName) + "/monobook.css&ctype=text/css&action=raw"); } // // Check tab. Allows me to cross reference the Zeldapedia // version of an article to detect copypasta. // addOnloadHook(function { {addPortletLink('p-cactions', "http://zelda.wikia.com/wiki/" + wgPageName, "Check", 'ca-cr', "Check the Zeldapedia version of this article to detect copy-paste jobs.", '2');} }); // // // Recent Changes w/ unpatrolled edits only // Takes me straight to the patrol backlog. Weee! // addOnloadHook(function {    {addPortletLink('p-Navigation', '/index.php?title=Special:RecentChanges&hidepatrolled=1', "Patrol Backlog", 't-backlog', 'Jump straight into the patrol backlog and start patrolling edits.');} });

// // Contains citation templates to be added to the toolbar. Source: wikipedia:User:Zman/refbuttons.js // All of these need images made. //

function refbuttons { if (mwCustomEditButtons) { var time = new Date; var curday = time.getDate; var curmonth = time.getMonth+1; var nowyear = time.getYear+1900; var nowday = curday.toString; if (curday <10) { nowday = "0"+nowday;} var nowmonth = curmonth.toString; if (curmonth <10) { nowmonth = "0"+nowmonth;}

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://zeldawiki.org/images/9/91/Button_cite_web.png", "speedTip": "Web citation", "tagOpen": " ", "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://zeldawiki.org/images/e/ef/Button_cite_book.png", "speedTip": "Book citation", "tagOpen": " ", "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://zeldawiki.org/images/5/53/Button_cite_person.png", "speedTip": "Person citation", "tagOpen": " ", "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://zeldawiki.org/images/1/1c/Button_cite_episode.png", "speedTip": "Episode citation", "tagOpen": " ", "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://zeldawiki.org/images/5/5d/Button_cite_manual.png", "speedTip": "Manual citation", "tagOpen": " ", "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://zeldawiki.org/images/2/20/Button_cite_template.png", "speedTip": "Regular citation", "tagOpen": " ", "sampleText": ""};

} } addOnloadHook(refbuttons);