User:Laurinavicius/vector.js

importScript('User:TheDJ/Gadget-HotCat.js'); importScript('User:TheFearow/qstring.js'); importScript('User:Drilnoth/codefixer.js'); importScript('MediaWiki:LinkFixr.js'); importScript('User:Cameltrader/Advisor.js'); importScript('User:Mr.Z-man/refbuttons.js'); importScript('User:MarkS/extraeditbuttons.js'); //User:MarkS/extraeditbuttons.js importScript('User:Odie5533/SnipManager.user.js'); importScript('User:TheJosh/Scripts/RecentChangesPatrol.js'); importScript('User:TheJosh/Scripts/NewPagePatrol.js'); /* Watchlist notifier (User:Ais523/watchlistnotifier.js); displays a message every time a watched page changes. */ // // User:Lupin/popups.js importScript('User:Lupin/popups.js'); // install User:Cacycle/wikEdDiff enhanced diff view using ajax importScript('User:Cacycle/wikEdDiff.js'); importScript('User:Misza13/statusChanger.js'); //FastButtons 1.0 importScript('User:Macy/FastButtons.js'); importScript('User:Ioeth/friendly.js'); importScript('User:Drilnoth/assessortags.js'); //See User:Drilnoth/assessortags.js/doc for details importScript('User:AzaToth/twinkle.js'); // Code originally by raylu // Modified by User:Moeron // This script adds a "subst:welcome2" tab to the top of User pages // when in edit mode. function dowelcome2 { document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '\n{' + '{' + 'subst' + ':' + 'welcome2' + '}' + '}' + ' ' + '~' + '~' + '~' + '~'; document.editform.wpSummary.value = 'Welcome to Wikipedia!'; document.editform.wpMinoredit.checked = false; document.editform.submit; } function addwelcome2 { addTab("javascript:dowelcome2", "subst:welcome2", "ca-welcome2", "subst:welcome2", ""); akeytt; } $(function { if (document.title.indexOf("User:") != -1 || document.title.indexOf("User talk:") != -1) {  addOnloadHook(addwelcome2);  } }); importScript('Wikipedia:AutoEd/complete.js'); if( typeof( FriendlyConfig ) == 'undefined' ) FriendlyConfig = {}; // DO NOT REMOVE THIS LINE - ALL FRIENDLY SETTINGS AFTER THIS FriendlyConfig.clockStyle			=	"dynamic"; FriendlyConfig.enableClock			=	true; FriendlyConfig.groupByDefault			=	true; FriendlyConfig.idsToRename			=	[ { id: 'ca-nstab-main', name: 'Main', mainPageOnly: true }, { id: 'ca-nstab-help', name: 'Help' }, { id: 'ca-nstab-special', name: 'Special' }, { id: 'ca-nstab-project', name: 'Project' }, { id: 'ca-nstab-user', name: 'User' }, { id: 'ca-edit', name: 'Edit' }, { id: 'ca-viewsource', name: 'Source' }, { id: 'ca-talk', name: 'Talk' }, { id: 'ca-undelete', name: 'Undelete' }, { id: 'ca-addsection', name: '+' } ]; FriendlyConfig.insertHeadings			=	true; FriendlyConfig.insertSignature			=	true; FriendlyConfig.insertUsername			=	true; FriendlyConfig.markSharedIPAsMinor		=	true; FriendlyConfig.markTaggedPagesAsMinor		=	true; FriendlyConfig.markTaggedPagesAsPatrolled	=	true; FriendlyConfig.markTalkbackAsMinor		=	true; FriendlyConfig.markWelcomesAsMinor		=	true; FriendlyConfig.maskTemplateInSummary		=	true; FriendlyConfig.quickWelcomeMode		=	"auto"; FriendlyConfig.quickWelcomeTemplate		=	"Welcome"; FriendlyConfig.summaryAd			=	" using Friendly"; FriendlyConfig.talkbackHeading			=	"== Talkback =="; FriendlyConfig.topWelcomes			=	false; FriendlyConfig.watchTaggedPages		=	true; FriendlyConfig.watchWelcomes			=	true; FriendlyConfig.welcomeHeading			=	"== Welcome =="; importScript('User:AWeenieMan/furme.js'); // //This function adds a link to the toolbox which, when clicked, displays the size of the page //and the size of the prose. See the talk page for more details. // //To use this function add User:Dr pda/prosesize.js to your monobook.js // function loadXMLDocPassingTemplate(url,handler, page) {   // branch for native XMLHttpRequest object if (window.XMLHttpRequest) { var req = new XMLHttpRequest; }   // branch for IE/Windows ActiveX version else if (window.ActiveXObject) { var req = new ActiveXObject("Microsoft.XMLHTTP"); }  if (req) { req.onreadystatechange = function {handler(req, page)}; req.open("GET", url, true); req.send(""); } } function getWikiText(req, page) { // only if req shows "loaded" if (req.readyState == 4) { // only if "OK" if (req.status == 200) { // ...processing statements go here... response = req.responseXML.documentElement; var rev = response.getElementsByTagName('rev'); if(rev.length > 0){ result = rev[0].getAttribute('size'); if(result > 10240){ result = (result/1024).toFixed(0)+' kB'; }          else{ result = result+' B'; }          wiki_value = document.createElement("li"); wiki_value.id = "wiki-size"; wiki_value.innerHTML = 'Wiki text: '+result; var output = document.getElementById("document-size-stats"); prose_value = document.getElementById("prose-size"); output.insertBefore(wiki_value,prose_value); }	 else{ //alert("There was a problem using the Wikipedia Search to find the wiki text size\nEither the search is not working or the correct article did not appear on the first page of results"); wiki_value = document.createElement("li"); wiki_value.id = "wiki-size"; wiki_value.innerHTML = 'Wiki text: Problem getting wiki text size'; var output = document.getElementById("document-size-stats"); prose_value = document.getElementById("prose-size"); output.insertBefore(wiki_value,prose_value); }       } else { alert("There was a problem retrieving the XML data:\n" +               req.statusText); }   } } function getFileSize(req, page) { // only if req shows "loaded" if (req.readyState == 4) { // only if "OK" if (req.status == 200) { // ...processing statements go here... var fsize = req.responseText.length; window.status = fsize; var total_value = document.createElement("li"); total_value.id = "total-size"; total_value.innerHTML='File size: '+(fsize/1024).toFixed(0)+' kB'; var output = document.getElementById("document-size-stats"); var prose_html_value = document.getElementById("prose-size-html"); output.insertBefore(total_value,prose_html_value); } else { alert("There was a problem retrieving the XML data:\n" +               req.statusText + "\n(" + url + ")"); }   } } function getLength(id){ var textLength = 0; for(var i=0;i<id.childNodes.length; i++){ if(id.childNodes[i].nodeName == '#text'){ textLength += id.childNodes[i].nodeValue.length; } else if(id.childNodes[i].id == 'coordinates'){ //special case for °N, °W template } else{ textLength += getLength(id.childNodes[i]); } } return textLength; } function getRefMarkLength(id,html){ var textLength = 0; for(var i=0;i<id.childNodes.length; i++){ if(id.childNodes[i].className == 'reference'){ textLength += (html)? id.childNodes[i].innerHTML.length : getLength(id.childNodes[i]); } } return textLength; } function getDocumentSize{ contentDivName = ''; if(skin == 'monobook' || skin == 'chick' || skin == 'myskin' || skin == 'simple'){ contentDivName = 'bodyContent'; } else if (skin == 'modern'){ contentDivName = 'mw_contentholder'; } else if (skin == 'standard' || skin == 'cologneblue' || skin == 'nostalgia'){ contentDivName = 'article'; } else{ //fallback case; the above covers all currently existing skins contentDivName = 'bodyContent'; } //Same for all skins if previewing page if(wgAction == 'submit') contentDivName = 'wikiPreview'; var bodyContent = document.getElementById(contentDivName); if(document.getElementById("document-size-stats")){ //if statistics already exist, turn them off and remove highlighting var output = document.getElementById("document-size-stats"); var oldStyle = output.className; var pList = bodyContent.getElementsByTagName("p"); for(var i=0;i<pList.length; i++){ if(pList[i].parentNode.id == contentDivName) pList[i].style.cssText = oldStyle; }  output.parentNode.removeChild(output); var header = document.getElementById("document-size-header"); header.parentNode.removeChild(header); } else{ var output = document.createElement("ul"); output.id = "document-size-stats"; var prose_html_value = document.createElement("li"); prose_html_value.id = "prose-size-html"; output.appendChild(prose_html_value); var ref_html_value = document.createElement("li"); ref_html_value.id = "ref-size-html"; output.appendChild(ref_html_value); var prose_value = document.createElement("li"); prose_value.id = "prose-size"; output.appendChild(prose_value); output.className = bodyContent.getElementsByTagName("p").item(0).style.cssText; var ref_value = document.createElement("li"); ref_value.id = "ref-size"; output.appendChild(ref_value); var dummy = document.getElementById("siteSub"); dummy.parentNode.insertBefore(output, dummy.nextSibling); var header = document.createElement("span"); header.id = "document-size-header"; header.innerHTML = ' Document statistics: (See here for details.) '; dummy.parentNode.insertBefore(header,output); //File size not well defined for preview mode or section edit if(wgAction != 'submit'){ //If browser supports document.fileSize property (IE) if(document.fileSize){ var total_value = document.createElement("li"); total_value.id = "total-size"; total_value.innerHTML='File size: '+(document.fileSize/1024).toFixed(0)+' kB'; output.insertBefore(total_value,prose_html_value); }  else{ loadXMLDocPassingTemplate(location.pathname,getFileSize,'') } } //Get size of images only if browser supports filesize property (IE) var iList = bodyContent.getElementsByTagName("img"); if(iList.length >0 && iList[0].fileSize){ //Get size of images included in document var image_size = 0; var first_magnify = true; for (var i=0;i<iList.length; i++){ var im = iList[i]; if(im.getAttribute("src").indexOf("magnify-clip.png") != -1){ if(first_magnify){ image_size += im.fileSize*1; first_magnify = false; }   }    else{ image_size += im.fileSize*1; }  }   var image_value = document.createElement("li"); image_value.id = "image-size"; image_value.innerHTML='Images: '+(image_size/1024).toFixed(0)+' kB'; output.appendChild(image_value); } //Calculate prose size and size of reference markers ([1] etc) var pList = bodyContent.getElementsByTagName("p"); prose_size = 0; prose_size_html = 0; refmark_size = 0; refmark_size_html = 0; word_count = 0; for(var i=0;i]+)>)/ig,"").split(' ').length para.style.cssText = "background-color:yellow"; } } if((prose_size-refmark_size)>10240){ prose_value.innerHTML='Prose size (text only): '+((prose_size-refmark_size)/1024).toFixed(0)+' kB ('+word_count+' words) "readable prose size"'; } else{ prose_value.innerHTML='Prose size (text only): '+(prose_size-refmark_size)+' B ('+word_count+' words) "readable prose size"'; } if((prose_size_html-refmark_size_html)>10240){ prose_html_value.innerHTML='Prose size (including all HTML code): '+((prose_size_html-refmark_size_html)/1024).toFixed(0)+' kB'; } else{ prose_html_value.innerHTML='Prose size (including all HTML code): '+(prose_size_html-refmark_size_html)+' B'; } //Calculate size of references (i.e. output of ) var rList = bodyContent.getElementsByTagName("ol"); var ref_size = 0; var ref_size_html = 0; for (var i=0; i10240){ ref_value.innerHTML='References (text only): '+((ref_size+refmark_size)/1024).toFixed(0)+' kB'; } else{ ref_value.innerHTML='References (text only): '+(ref_size+refmark_size)+' B'; } if((ref_size_html+refmark_size_html)>10240){ ref_html_value.innerHTML='References (including all HTML code): '+((ref_size_html+refmark_size_html)/1024).toFixed(0)+' kB'; } else{ ref_html_value.innerHTML='References (including all HTML code): '+(ref_size_html+refmark_size_html)+' B'; } //get correct name of article from wikipedia-defined global variables var pageNameUnderscores = wgPageName; var pageNameSpaces = pageNameUnderscores.replace(/_/g,' ') //if page is a permalink, diff, etc don't try to search if(!location.pathname.match('/w/index.php')){ //Get revision size from API var searchURL = wgScriptPath + '/api.php?action=query&prop=revisions&rvprop=size&format=xml&revids=' + wgCurRevisionId; loadXMLDocPassingTemplate(searchURL,getWikiText,pageNameSpaces); } else if(wgAction == 'submit'){ //Get size of text in edit box result = document.getElementById('wpTextbox1').value.length; if(result > 10240){ result = (result/1024).toFixed(0)+' kB'; }  else{ result = result+' B'; }  wiki_value = document.createElement("li"); wiki_value.id = "wiki-size"; wiki_value.innerHTML = 'Wiki text: '+result; var output = document.getElementById("document-size-stats"); prose_value = document.getElementById("prose-size"); output.insertBefore(wiki_value,prose_value); } } } $(function {  if(wgAction == 'edit' || (wgAction == 'submit' && document.getElementById('wikiDiff')) ){    mw.util.addPortletLink('p-tb', 'javascript:alert("You need to preview the text for the prose size script to work in edit mode.")', 'Page size', 't-page-size', 'Calculate page and prose size', , );    document.getElementById("t-page-size").firstChild.style.cssText = "color:black;"  }  else if(wgAction == 'view' || wgAction == 'submit' || wgAction == 'purge'){    mw.util.addPortletLink('p-tb', 'javascript:getDocumentSize', 'Page size', 't-page-size', 'Calculate page and prose size', , );  } }); // // install Wikipedia:User:Cacycle/wikEd in-browser text editor document.write(''); // Fix hyphens, dashes, and minus signs per MOS:DASH. // // To install, add the following line to your monobook.js user subpage: //     importScript("User:GregU/dashes.js"); // This will add a "–" tab to the tabs at the top. // // The user can disable these conversions by putting "nodashes" somewhere // in the text — either temporarily or permanently. You can similarly add // "scores" if the score-detection heuristic doesn't trigger automatically. // // This tool can be used standalone until it is added to AutoEd and wikEd. // This module should follow unicodify.js if it is used. // Testing page is at User:GregU/dashes.js/tests. // Please report false positives on the talk page. function autoEdDashes (str) { if (str.search(/nodashes/i) >= 0) return str; var scpat = /\bscores?\b|\[\[Category:.*\b(sport|athlet|players|teams|games|league|champion|tournament|competit|cup\b|\w+ball\b|hockey|lacrosse|cricket|rugby|tennis|golf|polo|boxing|boxers|martial.art|chess)/i; var scoresAreLikely = (str.search(scpat) >= 0); // Ensure the replacement isn't a link such as FOO - BAR before // replacing it, so that we don't break the link. But we do want to // replace dashes used in the right-side label part of links. Also, // don't break templates, URLs, DOIs,, equations, // source code, or . // function ifNotLink (str,pos,string) {   var pat = /\[\^|\*$|\{\{[^|}]*$|[:\/%][^\s|>]+$|<[^>]*$|#\w*expr:.*$/i; if (string.substring(pos-260,pos+1).search(pat) >= 0) return str;            // it's a link, so don't change it    var pat2 = /\{\{(main|see|detail|about|for\b|other|redir|conv|coor)[^}]*$/i; if (string.substring(pos-260,pos+1).search(pat2) >= 0) return str;            // likely templates with page-name or neg params var m = string.slice(pos).search(/<\/?(math|source|syntaxhighlight|pre|code)\b/i); if (m >= 0 && string.charAt(pos+m+1) == '/') return str;            // don't break a  equation, or source code if (string.slice(pos).search(/^[^|{}[\]<>\n]*\.[a-z]{3,4}\s*[|}]|^.*hyphen/i) >= 0) return str;            // it's a file name parameter, or     if (str.search(/[ |(>][-–]\b/) >= 0)        return str.replace(/[-–]/, "−");       // minus sign    else        return str.replace(/--+\b/g, "—") . replace(/[-–−]+/g, "–");     // dash  }  str = str.replace(/\s--?\s/g, ifNotLink);                  // en dash looks better  str = str.replace(/[a-z\d]---?[a-z\d]/ig, ifNotLink);      // em dash  str = str.replace(/\d\d\d]*}*[-−](?:present|current)\b/ig, ifNotLink);     // 1973-present  str = str.replace(/[^\w−-](?:18|19|20)\d\d]*}*[-−][^\w−-]/g, ifNotLink);   // (1973-)  str = str.replace(/\d(?:s|%|\?|)[-−]\d/g, ifNotLink);   // 1950s-1960s, 40%-50%  str = str.replace(/\d[-−](?:\$|'+)\d/g, ifNotLink);        // $40-$50, 7-4''', '49-'53  str = str.replace(/[½⅓⅔¼¾⅛⅜⅝⅞]%?[-−][\d½⅓⅔¼¾⅛⅜⅝⅞]/g, ifNotLink);               // 3½-6  str = str.replace(/\d(?:st|nd|rd|th)?[-−]\d+(?:st|nd|rd|th)\b/g, ifNotLink);   // 2nd-3rd str = str.replace(/(?:[a-z,'"”\]>] +|\(|^\| *|\|\| *)[-–]\d/mig, ifNotLink);  // minus -35  str = str.replace(/<((sup|sub|td)>\s*)[-–](\d)/ig, "<$1−$3");        // 10-3  str = str.replace(/(?=.? ) *[-–—−] *(\d*:\d\d[\s*<])/g, " – $1");    // album track listings  // November 15, 2005-March 7, 2006; March 18-April 4  str = str.replace(/(\d\]*)[-–—−](\[*(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]* +\d)/g, "$1 – $2");  // July-August 2007  str = str.replace(/\b(?:(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*[-−]?\b){2,}/g, ifNotLink);  // 266-283  str = str.replace(/(\d(?: BC)?\]\])[-−]((ca?\.|AD ?)?\[\[\d+[^\d-])/g, "$1–$2");  // (1984 – 1992)  str = str.replace(/([(|=] *\[*\d+\]*) +[–—−] +(\[*\d+\]*\s*[)|}])/g, "$1–$2");  // iv-xii  str = str.replace(/[ ;(=](?=\w+-)(?:m*(?:cm|cd|d?c*)(?:xc|xl|l?x*)(?:ix|iv|v?i*)-?\b){2}[^\w-]/g, ifNotLink);  if (scoresAreLikely)      // W-L-D or 73–70–67–70=280, but not castling str = str.replace(/[^\w−–-](?!0-0-0)(?:\d\d?\d?[-–−]){2,}\d\d?[^\w\/−–-]/g, ifNotLink); str = str.replace(/\b(\d+)[–−](year|month|day|hour|minute|mile|yard|foot|inch|bit|door|speed|gun|page|seat|way|point|ton|man)\b/g, "$1-$2");    // hyphen // Number ranges and scores should use en dashes, per MOS:DASH. // This has been well-tested and false positives (e.g., ID nos.) are rare. // function range (str, from,to, pos,string) {   var dash   = true; var except = /\b(fig(ure)?|table|example|exhibit|circular|section|part|number|no|nr|id|model|pub|std|report|rpt|law|P?L|p|page|date|IS\wN\b[ a-z]*)[^\w(,;]*$/i;   var rpat   = /^([^A-Za-z]|nbsp)*(AD|BC|B?CE|BP|[kMG]a|km|mi|kg|lb|\w?Hz|vote|decision|record|odds|scor\w*|win|loss|tie|draw|lead|victory|defeat|upset|run|deficit|start|finish|season|game)\b/;    var lpat   = /\b(pages|pp|rp|nos|\d+\)?'*[:,]|(w[io]n|lost?|tie|dr.w|lea?d|f.ll|vot|rul|decid|pass|fail|defeat|scor|gam|match|trail|finish|end)e?[ds]?|\w\w+ing|ahead|behind|up|down|from|to|is|are|was|were|of|out|by|an?|at|it|went|go|gone|beaten|between)([^a-z]|nbsp)*$/i; var inorder  = (to-0 > from.slice(-to.length));     // pp 362-5 var precision = Math.max( from.search(/0*$/), to.search(/0*$/) ); if (string.substring(pos-20,pos+1).search(except) >= 0) { return str;     // based on preceding word, looks like a ref number }   if (from == 9 && to == 11) { dash = false;   // 9-11 is a common special case }   if (from-0 >= to) { dash = false;   // values don't look like a range }   if (to-from > 120 && from * (precision > 2 ? 5 : 50) < to && from > 1) { dash = false;   // values don't look like a range }   if (scoresAreLikely && from <= 900 && to <= 900) { dash = true;    // likely a score or wins-losses }   if (from < 2-to && string.search(/Category:.*\bChess\b/i) >= 0) { dash = false;   // chess notations 0-0, 0-1, 1-0 }   if (str.charAt(0) == '(' && string.charAt(pos + str.length) == ')') { dash = true;    // scores often seen as (8-4) }   if (from.search(/^0./) >= 0 || to.search(/^0./) >= 0) { dash = false;   // 3-07 and 0123-4567 look like ref numbers }   if (string.substr(pos-1,15).search(/^\d([:,.])\d+.\d+\1\d/) >= 0) { dash = true;    // 10:30-11:30, 35,000-40,000, 2.5-4.0 }   if (string.substr(pos,30).search(rpat) >= 0) { dash = true;    // 12-5 BC, 5-5000 km, 6-4 win, 73-50 vote }   if (string.substring(pos-80,pos).search(lpat) >= 0) { dash = true;    // pp. 8, 25, 270-74, 313-7; won 6-4, 6-2 }   if (from > 1000 && from < 2100 && to.length == 2 && inorder) { dash = true;    // 1994-95 year range }   return dash ? ifNotLink(str,pos,string) : str; } str = str.replace(/[^\w\/+−–-](\d{1,4})[-−](\d{1,4})(?!'*[\w\/+−–-])/g, range); return str; } // Hook to allow using this tool "standalone" if (importScript("Wikipedia:AutoEd/core.js"))  // if not otherwise using AutoEd {   function autoEdFunctions { var txt = document.editform.wpTextbox1; var str = txt.value; str = str.replace(/&mdash;/g, '—'); str = str.replace(/–/g, '–'); str = str.replace(/&minus;/g, '−'); txt.value = autoEdDashes( str ); }   autoEdLinkName  = "–"; autoEdLinkHover = "Fix dashes, hyphens, and minus signs"; autoEdTag      = "fixed – using dashes.js"; } importScript('User:AWeenieMan/furme.js'); mw.loader.load('//en.wikipedia.org/w/index.php?title=Dr_pda%2Fprosesize.js&action=raw&ctype=text/javascript'); // Dr_pda/prosesize.js

importScript('User:Anomie/linkclassifier.js'); // Linkback: User:Anomie/linkclassifier.js importStylesheet('User:Anomie/linkclassifier.css'); // Linkback: User:Anomie/linkclassifier.css

mw.loader.load('//en.wikipedia.org/w/index.php?title=User%3APyrospirit%2Fmetadata.js&action=raw&ctype=text/javascript'); // User:Pyrospirit/metadata.js