User:Dudemanfellabra/vector.js
From Wikipedia, the free encyclopedia
< User:Dudemanfellabra (Redirected from User:Dudemanfellabra/monobook.js)
| Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. The code will be executed when previewing this page under some skins, including Monobook. |
|
|
The accompanying .css page for this skin is at User:Dudemanfellabra/vector.css. |
importScript('User:Dr pda/prosesizebytes.js'); // Adds "Page size" to Toolbox section importScript('User:Ais523/watchlistnotifier.js'); // Notifies me when my watchlist updates importScript('User:Anomie/util.js'); // Highlights link types importScript('User:Anomie/linkclassifier.js'); // Colors redirects, dabs, etc. differently than regular links importScript('User:Sander Säde/quickpreview.js'); // Reduces time when previewing edits importScript('User:Ais523/adminrights.js'); // Highlights users if they are admins importScript('User:Ale_jrb/Scripts/userhist.js'); // Allows searching page histories for edits by a certain user importScript('User:Dudemanfellabra/diffs.js'); // Adds time between diffs var loadTime = new Date(); function PageViews() { var month = loadTime.getMonth() + 1; if (month<10) { month = "0" + month; } var year = loadTime.getFullYear(); url = "http://stats.grok.se/en/" + year + month + "/" + wgPageName; addPortletLink("p-tb", url, "Page views", "pt-logs", "Daily breakdown of page views this month"); } function CustomMain() { if (wgPageName == "Main_Page") { window.location.replace('http://en.wikipedia.org/wiki/Wikipedia:Main_Page_alternative_(CSS_Update)'); //My custom main page } } function Unwatch() { if (!wgCanonicalSpecialPageName || wgCanonicalSpecialPageName != "Watchlist") return; if (!document.forms[0] || !document.forms[0].namespace) return; var query_prefix = "action=unwatch&title="; var links = document.getElementById('content').getElementsByTagName('a'); var linksCopy = new Array (); for (var i = 0; i < links.length; i++) { if (/[?&]action=history([&#]|$)/.test(links[i].href)) linksCopy.push(links[i]); } links = linksCopy; for (var i = 0; i < links.length; i++) { // create unwatch link and append it after history link var unwatch = document.createElement('a'); unwatch.href = wgServer + wgScriptPath + "/index.php?" + query_prefix + encodeURIComponent(links[i].title); unwatch.title = "Unwatch "+links[i].title; unwatch.appendChild(document.createTextNode("unwatch")); links[i].parentNode.insertBefore(unwatch, links[i].nextSibling); // insert a delimiter between the two links var delim = links[i].previousSibling; delimText = (delim.nodeType == 3 ? delim.nodeValue : ""); // kluge to handle case where "diff" is unlinked delim = document.createTextNode(delimText.replace(/^.*diff/, "")); links[i].parentNode.insertBefore(delim, unwatch); } } function LoadTime() { var mySpan = document.createElement( 'div' ); mySpan.setAttribute('style', 'float:right; font-size:11px; color:#555; margin-top:3px;') mySpan.setAttribute('id', 'loadtime') var ul = document.getElementById( 'pt-logout' ).parentNode.parentNode; var date = '0' + loadTime.getUTCDate(); date = date.substr(date.length-2, date.length); var month = loadTime.getUTCMonth() + 1; month = '0' + month month = month.substr(month.length-2, month.length); var year = loadTime.getUTCFullYear(); var hours = '0' + loadTime.getUTCHours(); hours = hours.substr(hours.length-2, hours.length); var minutes = '0' + loadTime.getUTCMinutes(); minutes = minutes.substr(minutes.length-2, minutes.length); var timestring = "Page loaded at " + year + "-" + month + "-" + date + ", " + hours + ":" + minutes + " (UTC)"; datePlace = ul.appendChild(mySpan); datePlace.innerHTML = timestring; } function TimeSinceLoad() { var currentTime = new Date(); var diff = DateSub(loadTime,currentTime); document.getElementById('loadtime').title=diff + ' ago'; var t = setTimeout("TimeSinceLoad()",60000); } addOnloadHook(Unwatch); // Adds "unwatch" links to my watchlist addOnloadHook(PageViews); // Adds "Page views" to Toolbox section addOnloadHook(LoadTime); // Adds UTC clock to top right of page addOnloadHook(TimeSinceLoad); // Adds time since load as tooltip addOnloadHook(CustomMain); // My custom Main Page