User:Themeparkgc/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:Themeparkgc/vector.css. |
importScript('User:Ohconfucius/script/MOSNUM dates.js'); //Dates
importScript("User:GregU/dashes.js"); //Dashes
importScript('MediaWiki:LinkFixr.js'); //Link fixr
importScript('User:Ohconfucius/script/EngvarB.js'); //ENGVAR
importScript('User:AWeenieMan/furme.js'); //FUR Me
importScript('User:AzaToth/morebits.js');
importScript('User:Shubinator/DYKcheck.js'); //DYKcheck tool
importScript('User:Porchcorpter/rollback.js'); //Rollback extension
importScript('User:Splarka/ajaxfilemove.js');//File mover script
//RefToolbar - custom dialogs
$j('head').one('reftoolbarbase', function() {
CiteTB.UserOptions['autodate fields'] = ['date', 'accessdate', 'archivedate'];
CiteTB.UserOptions['months'] = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
new citeTemplate('RCDB', 'RCDB',
[ // Basic fields
{"field": "coaster_name", "label":"Coaster name"},
{"field": "location"},
{"field": "metric"},
{"field": "rcdb_number", "label":"RCDB number"},
{"field": "accessdate", "label":"Access date"},
{"field": "url", "label":"URL"}
],
[ // Expanded fields
]);
new citeTemplate('Parkz', 'Parkz',
[ // Basic fields
{"field": "ride_name", "label":"Ride name"},
{"field": "location"},
{"field": "parkz_number", "label":"Parkz Number"},
{"field": "accessdate", "label":"Access date"}
],
[ // Expanded fields
]);
new citeTemplate('TV Tonight', 'TV Tonight',
[ // Basic fields
{"field": "title", "label":"Title"},
{"field": "url", "label":"URL"},
{"field": "date", "label":"Date"},
{"field": "accessdate", "label":"Access date"}
],
[ // Expanded fields
{"field": "archivedate", "label":"Archive date"},
{"field": "archiveurl", "label":"Archive URL"}
]);
new citeTemplate('Cite press release', 'press release',
[ // Basic fields
{"field": "title"},
{"field": "url"},
{"field": "accessdate"},
{"field": "date"},
{"field": "publisher"}
],
[ // Expanded fields
{"field": "archivedate"},
{"field": "archiveurl"}
]);
});
//Article traffic
function getTrafficURL() {
var now = new Date();
var month = now.getMonth() + 1;
var monthLong;
if (month < 10) {
monthLong = "0" + month;
} else {
monthLong = month;
}
var year = now.getFullYear();
return 'http://stats.grok.se/en/' + year + monthLong + '/' + encodeURIComponent(wgTitle);
}
//AUTOTAG SCRIPT
addOnloadHook(function() {
if (wgNamespaceNumber == 1) {//Talk
addPortletLink("p-tb", "javascript:projectsTag()", 'Project tagging');
} else if (wgNamespaceNumber == 14) {//Category
addPortletLink("p-tb", "javascript:catmainTag()", '{' + '{Catmain}}');
} else if (wgNamespaceNumber == 0) {//Article
addPortletLink("p-tb", "javascript:hatnoteTag()", 'Add hatnote');
addPortletLink("p-tb", "javascript:toolbox()", 'Article toolbox');
} else if (wgNamespaceNumber == 6) {//File
addPortletLink("p-tb", "javascript:thumbnailImage()", 'Load thumbnail');
addPortletLink('p-tb','http://toolserver.org/~magnus/commonshelper.php?interface=en&image=' + encodeURIComponent(wgTitle) + '&reallydirectupload=1&remove_categories=1&commonsense=0&lang=en&username=' + encodeURIComponent(wgUserName) + '&tusc_user=' + encodeURIComponent(wgUserName),'Move to Commons','','Move to Commons');
} else if (wgNamespaceNumber == 10) {//Template
addPortletLink("p-tb", "javascript:hlistConvert()", 'Convert to hlist');
} else if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {
addPortletLink("p-tb", "javascript:toolbox_user()", 'User toolbox');
}
if (location.href.indexOf("§ion=new")!=-1&&document.getElementById('wpTextbox1')!=null&&wgNamespaceNumber==6) {
document.getElementById('wpSave').click();
} else if(location.href.indexOf("&autotag=")!=-1&&document.getElementById('wpTextbox1')!=null) {
var x=decodeURIComponent(location.href.split("&autotag=")[1]);
document.getElementById('wpTextbox1').value = x + "\n" + document.getElementById('wpTextbox1').value;
document.getElementById('wpSummary').value = "Adding " + x + " using [[User:Themeparkgc/vector.js|script]]";
document.getElementById('wpSave').click();
} else if(location.href.indexOf("&hlist=")!=-1&&document.getElementById('wpTextbox1')!=null) {
var content = document.getElementById('wpTextbox1').value;
content = replaceAll(content, " ", " ");
content = replaceAll(content, " ", " ");
content = replaceAll(content, "•", "\n*");
content = replaceAll(content, "{{·}}", "\n*");
content = replaceAll(content, "{{•}}", "\n*");
content = replaceAll(content, "{{·w}}", "\n*");
content = replaceAll(content, "{{!}}", "\n*");
content = replaceAll(content, "{" + "{Navbox","{" + "{Navbox\n|listclass=hlist\n|belowclass=hlist");
content = replaceAll(content, "{" + "{navbox","{" + "{Navbox\n|listclass=hlist\n|belowclass=hlist");
for(i=0;i<20;i++) {
content = content.replace("list" + i + " =", "list" + i + " =\n*");
content = content.replace("list" + i + "=", "list" + i + "=\n*");
}
content = content.replace("below =", "below =\n*");
content = content.replace("below=", "below=\n*");
document.getElementById('wpTextbox1').value = content;
document.getElementById('wpSummary').value = "convert to [[WP:HLIST|hlist]] using [[User:Themeparkgc/vector.js|script]]";
document.getElementById('wpPreview').click();
//document.getElementById('wpSave').click();
}
});
function replaceAll(txt, replace, with_this) {
return txt.replace(new RegExp(replace, 'g'),with_this);
}
function catmainTag() {
var x=prompt("Tagging for {" + "{Catmain}}. Main article: ", wgTitle);
if (x==null) return;
x = "{" + "{Catmain|" + x + "}}";
location.href=wgServer+wgScript+"?title=" + encodeURIComponent(wgPageName) + "&action=edit&autotag=" + encodeURIComponent(x);
}
function hatnoteTag() {
var str;
var x=prompt("Add hatnote. Template name (without braces): ", "");
if (x==""|x==null) return;
var y=prompt("{" + "{" + x + "}} parameter (leave blank for no parameter): ", "");
if (y==""|y==null) str = "{" + "{" + x + "}}";
else str = "{" + "{" + x + "|" + y + "}}";
location.href=wgServer+wgScript+"?title=" + encodeURIComponent(wgPageName) + "&action=edit&autotag=" + encodeURIComponent(str);
}
function hlistConvert() {
location.href=wgServer+wgScript+"?title=" + encodeURIComponent(wgPageName) + "&action=edit&hlist=true";
}
function projectsTag() {
/*
var projects = 0;
var str = "";
var classRating = prompt("Please enter a class rating for the article:", "");
if (classRating) {
var response = prompt("Please enter an importance rating for WikiProject Amusement Parks:," "");
if (response) {
str += "{" + "{WikiProject Amusement Parks|class=" + classRating + "|importance=" + response + "}}\n";
projects++;
}
response = prompt("Please enter an importance rating for WikiProject Australia:," "");
if (response) {
str += "{" + "{WikiProject Australia|class=" + classRating + "|importance=" + response + "}}\n";
projects++;
}
var response = prompt("Please enter an importance rating for WikiProject Roller Coasters:," "");
if (response) {
str += "{" + "{WikiProject Roller Coasters|class=" + classRating + "|importance=" + response + "}}\n";
projects++;
}
if (str != "") {
if (projects > 1) {
str = "{" + "{WikiProjectBannerShell|1=\n" + str + "}}\n"
}
location.href=wgServer+wgScript+"?title=" + encodeURIComponent(wgPageName) + "&action=edit&autotag=" + encodeURIComponent(str);
}
}
*/
}
function toolbox() {
document.getElementById('bodyContent').innerHTML = '<div style="background-color:#F9F9F9;border:1px solid #AAAAAA;padding:5px;width:220px;border-radius:10px;"><ul><li><a target="_blank" href="http://toolserver.org/%7Edispenser/cgi-bin/altviewer.py/' + encodeURIComponent(wgPageName) + '">Alt Text</a></li><li><a target="_blank" href="http://toolserver.org/%7Edispenser/cgi-bin/webreflinks.py/' + encodeURIComponent(wgPageName) + '?client=script&citeweb=on&overwrite=&limit=20&lang=en">Reflinks</a></li><li><a target="_blank" href="http://toolserver.org/~daniel/WikiSense/Contributors.php?wikilang=en&wikifam=.wikipedia.org&page=' + encodeURIComponent(wgPageName) + '&since=&until=&grouped=on&order=-edit_count&max=100&format=html">Article Contributors</a></li><li><a target="_blank" href="' + getTrafficURL() + '">Article Traffic Stats</a></li><li><a target="_blank" href="http://toolserver.org/%7Edispenser/cgi-bin/webchecklinks.py/' + encodeURIComponent(wgPageName) + '">Check Links</a></li><li><a target="_blank" href="http://toolserver.org/%7Edispenser/cgi-bin/dablinks.py/' + encodeURIComponent(wgPageName) + '">DAB links</a></li><li><a target="_blank" href="http://toolserver.org/%7Edispenser/view/Peer_reviewer#page:' + encodeURIComponent(wgPageName) + '">Peer Reviewer</a></li><li><a target="_blank" href="http://toolserver.org/%7Edispenser/cgi-bin/rdcheck.py/' + encodeURIComponent(wgPageName) + '">Redirects</a></li></ul></div>' + document.getElementById('bodyContent').innerHTML;
}
function toolbox_user() {
document.getElementById('bodyContent').innerHTML = '<div style="background-color:#F9F9F9;border:1px solid #AAAAAA;padding:5px;width:220px;border-radius:10px;"><ul><li><a target="_blank" href="http://toolserver.org/~tparis/pages/index.php?name=' + encodeURIComponent(wgUserName) + '&namespace=0&redirects=noredirects">Article list</a></li><li><a target="_blank" href="http://toolserver.org/~tparis/pcount/index.php?name=' + encodeURIComponent(wgUserName) + '&lang=en&wiki=wikipedia">Edit count</a></li><li><a target="_blank" href="/wiki/Special:Contributions/' + encodeURIComponent(wgUserName) + '">User contributions</a></li><li><a target="_blank" href="http://en.wikichecker.com/user/?t=' + encodeURIComponent(wgUserName) + '">WikiChecker</a></li></ul></div>' + document.getElementById('bodyContent').innerHTML;
}
function thumbnailImage() {
var size = prompt("Please enter a size for the thumbnail: ", "250px");
if (size==null) return;
var title = wgTitle;
title.replace(" ", "+");
location.href="/media/wikipedia/en/thumb/5/50/" + title + "/" + size + "-" + title;
}
addOnloadHook(function () {
// Check if we're on the watchlist
if (!wgCanonicalSpecialPageName || wgCanonicalSpecialPageName != "Watchlist") return;
if (!document.forms[0] || !document.forms[0].namespace) return;
// Unwatch links go back to watchlist with "Removing requested items from watchlist..." message
//var query_prefix = "title="+encodeURIComponent(wgPageName)+"&action=submit&remove=1&id[]=";
// ...or...
// Unwatch links go to "Removed from watchlist" page
var query_prefix = "action=unwatch&title=";
// get list of all links in content:
var links = document.getElementById('content').getElementsByTagName('a');
// make a static copy of the nodelist and lose the original for speed
// while we're at it, prune the uninteresting links from the list
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);
}
});