User:T3h 1337 b0y/vector.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | The accompanying .css page for this skin is at User:T3h 1337 b0y/vector.css. |
importScript('User:Pyrospirit/metadata/assesslinks.js'); //[[User:Pyrospirit/metadata/assesslinks.js]]
importScript('User:Ale_jrb/Scripts/igloo.js'); // [[User:Ale_jrb/Scripts/igloo]]
/************* *** Regex menu framework *** by [[m:user:Pathoschild]] <http://meta.wikimedia.org/wiki/User:Pathoschild/Scripts/Regex_menu_framework> *** - adds a sidebar menu of user-defined scripts. *************/ importScriptURI('http://meta.wikimedia.org/w/index.php?title=User:Pathoschild/Scripts/Regex_menu_framework.js&action=raw&ctype=text/javascript'); /* menu links */ // In the function below, add more lines like "regexTool('link text','function_name()')" to add // links to the sidebar menu. The function name is the function defined in rfmscripts() below. function rmflinks() { regexTool('Custom regex','custom()'); // a default tool which performs regex input in a dynamic form } /* scripts */ // Below, define the functions linked to from rmflinks() above. These functions can use any JavaScript, // but there is a set of simplified tools documented at // http://meta.wikimedia.org/wiki/User:Pathoschild/Script:Regex_menu_framework .
// ==UserScript== // @name WP:Deredirectification // @description Changes the text of the title of hyperlinks that are redirects to the title of the target of the redirect : // @include http://*.wikipedia.org/wiki/* // @include http://*.wikimedia.org/wiki/* // ==/UserScript== // extracted from json.js (http://www.json.org/json.js ) // which is Copyright © 2002 JSON.org (go read http://www.json.org/license.html ) String.prototype.parseJSON = function () { try { return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test( this.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + this + ')'); } catch (e) { return false; } }; var logging = 0; //increment for GM_log diarrhoea! var titles = []; var A = document.getElementsByTagName("A"); for (var i = 0; i < A.length; i++) if ((/^[A-Z][A-Za-z]?:/.test(A[i].title)) && (titles.indexOf(A[i].title) < 0)) titles.push(A[i].title); titles.sort(); //not necessary, but pretty! : if (logging > 0) {GM_log(titles.length + "| " + titles);} // this is the onload callback function for the GM_xmlhttpRequest function BANZAI(response) { if (logging > 0) {GM_log("status: " + response.status);} if (logging > 1) {GM_log("status text: " + response.statusText);} if (logging > 1) {GM_log("response headers:\n" + response.responseHeaders);} if (logging > 1) {GM_log("response text:\n" + response.responseText);} if (response.status != 200) throw ("You Have Angered The Cabal!\n" + "Try Again In " + response.status + " Years."); var yurik = response.responseText.parseJSON(); if (yurik == false) throw ("I Smell A Wumpus!\n" + "Response Isn't JSON."); if (yurik.error) throw ("Beware Of Developers Wielding Cluebats!\n" + "Your Error Was \"" + yurik.error.* + "\"."); var redirects = {}; for (var id in yurik.pages) { var title = yurik.pages[id].title; if (yurik.pages[id].redirect != undefined && yurik.pages[id].redirect.to != undefined) { var redirect = yurik.pages[id].redirect.to.*; redirects[title] = redirect; if (logging > 2) {GM_log(title + " " + redirect);} } } var A = document.getElementsByTagName("A"); for (var i = 0; i < A.length; i++) if (redirects[A[i].title] != undefined) A[i].title = redirects[A[i].title]; } var URL = "http://" + document.domain + "/w/query.php" //query the right server! URL += "?noprofile"; //Don't care URL += "&format=json"; //JSON FTW URL += "&what=redirects"; //important URL += "&titles="; //This gets tacked on later ´ if (titles.length > 0) //avoid an empty query { //OK, so WP:WP has like 432 redirect links on it, // which makes shit fly when you stuff all that into one query //Soooo& now we split large queries into chunks and make multiple requests var chunk = 100; for (var k = 0; k < titles.length; k += chunk) { var request = {method: "GET", onload: BANZAI}; request.headers = { "Accept": "application/json", }; request.url = encodeURI(URL + titles.slice(k, k + chunk).join('|')) if (logging > 1) {GM_log(request.url );} GM_xmlhttpRequest(request); } }
importScript('User:AzaToth/morebits.js');