User:Darkwind/common.js: Difference between revisions

Content deleted Content added
m more commenting out
 
(45 intermediate revisions by 2 users not shown)
Line 1:
importScript('User:Darkwind/sandbox.js'); //testing script
/*
////////////////////////////////////////////////////////////////
// =-=-=- HELPER FUNCTIONS -=-=-=-
function addlilink(tabs, url, name, id, title, key)
{
//check for duplicates
if (document.getElementById(id)){return;}
//cologne blue bypass
if (document.getElementById('quickbar'))
{
if (document.getElementById('quickbar') && document.getElementById('quickbar').getElementsByTagName('h6')[0])
{
addquickbarlink(url, name, id, title, 'Edit');
}
if (document.getElementById('footer') && !document.getElementById('bodyContent'))
{
addfooterlink(url, name, id, title);
}
return;
}
//monobook
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
tabs.appendChild(li);
if(id)
{
if(key && title)
{
ta[id] = [key, title];
}
else if(key)
{
ta[id] = [key, ''];
}
else if(title)
{
ta[id] = ['', title];
}
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}
 
function insertAfter(parent, node, referenceNode) {
parent.insertBefore(node, referenceNode.nextSibling);
}
 
function prependChild(parent, node) {
parent.insertBefore(node, parent.firstChild);
}
 
function addToolboxLink(url, name, id, key)
{
if (document.getElementById('p-tb'))
{var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];}
addlilink(tb, url, name, id, key);
}
 
function addTab(url, name, id, title, key)
{
//monobook
if (document.getElementById('p-cactions'))
{var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];}
//cologneblue
else {
if (document.getElementById('quickbar'))
{var tabs = document.getElementById('quickbar').getElementsByTagName('h6')[2];}
if (document.getElementById('footer'))
{var tabs = document.getElementById('footer').getElementsByTagName('td')[0];}
return addquickbarlink(url, name, id, 'Edit');
}
return addlilink(tabs, url, name, id, title, key);
}
 
///////////////
//cologneblue tab/link adder
function addquickbarlink(url, name, id, title, header)
{
var header = '<h6>' + header + '</h6>';
var tabs = document.getElementById('quickbar');
if (tabs.innerHTML.indexOf(header) ==-1)
{return;}
var add_html = '<strong><a id="' + id + '" title="' + title + '" href="' + url + '">' + name + '</a></strong><br />';
var section_html = tabs.innerHTML.split(header)[1].split('<h6>')[0];
var next_section = '<h6>' + tabs.innerHTML.split(header)[1].split('<h6>')[1].split('</h6>')[0] + '</h6>';
tabs.innerHTML = tabs.innerHTML.split(header)[0] + header + section_html + add_html + next_section + tabs.innerHTML.split(next_section)[1];
}
 
function addfooterlink(url, name, id, title)
{
var tabs = document.getElementById('footer').getElementsByTagName('td')[1];
var add_html = '<strong><a href="' + url + '" title="' + title + '" id="' + id + '">' + name + '</a></strong>';
tabs.innerHTML = add_html + ' | ' + tabs.innerHTML;
}
///////////////
 
function addLink(where, url, name, id, title, key, after){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
if(after) {
tabs.insertBefore(li,document.getElementById(after));
} else {
tabs.appendChild(li);
}
if(id) {
if(key && title) { ta[id] = [key, title]; }
else if(key) { ta[id] = [key, '']; }
else if(title) { ta[id] = ['', title];}
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}
/////////////////////////////////////////////*/
 
/**** Add generic tab ****/
/*
function addlilink_simple(tabs, url, name, id){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.id = id;
li.appendChild(na);
tabs.appendChild(li);
return li;
}
 
function addlimenu(tabs, name, id)
{
var na = document.createElement('a');
na.href = '#';
var mn = document.createElement('ul');
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.id = id;
li.className = 'tabmenu';
li.appendChild(na);
li.appendChild(mn);
tabs.appendChild(li);
return li;
}
 
/////////
//These are simplier versions of the above, except they add the links on top, not on botton
function addnavbox_link(URL,Name,ID)
{
//cologne blue bypass
if (document.getElementById('quickbar') && document.getElementById('quickbar').getElementsByTagName('h6')[0])
{
var tabs = document.getElementById('quickbar');
addquickbarlink(URL, Name, ID, Name, 'Browse');
return;
}
//monobook
var portlet = document.getElementById('p-navigation');
var links = portlet.getElementsByTagName('ul')[0];
links.innerHTML += '<li id="' + ID + '"><a href="' + URL + '">' + Name + '</a></li>';
}
//////////
 
function URLEncoding(input)
{
var encodedInputString=escape(input);
encodedInputString=encodedInputString.replace(/\+/g, "%2B");
encodedInputString=encodedInputString.replace(/\//g,"%2F");
encodedInputString=encodedInputString.replace(/&/g,"%26");
var outputurl=encodedInputString;
return outputurl;
}
 
function toRegExp(what)
{
what = what.replace(/\\/g,"\\\\");
what = what.replace(/\(/g,"\\(").replace(/\)/g,"\\)");
what = what.replace(/\{/g,"\\{").replace(/\}/g,"\\}");
what = what.replace(/\[/g,"\\[").replace(/\]/g,"\\]");
what = what.replace(/\|/g,"\\|");
what = what.replace(/\./g,"\\.");
what = what.replace(/\$/g,"\\$");
what = what.replace(/\+/g,"\\+");
what = what.replace(/\^/g,"\\^");
what = what.replace(/\?/g,"\\?");
what = what.replace(/\*/g,"\\*");
what = what.replace(/\//g,"\\/");
return what;
}
 
if (document.implementation.createDocument)
{var gml_xmlparser = new DOMParser();}
 
function standard_XMLParse(string)
{
if (document.implementation.createDocument)
{
return gml_xmlparser.parseFromString(string, "text/xml");
}
else if (window.ActiveXObject)
{
string = string.replace(/<body .*\"ns-(.*)\">/, '<body class="ns-$1">');
rer = string.match(/<h1 .*<\/h1>/)[0].replace(/&/g, '&');
if (rer) {string = string.replace(/<h1 .*<\/h1>/, rer);}
var gml_xmldoc = new ActiveXObject("Microsoft.XMLDOM");
gml_xmldoc.async = false;
ret = gml_xmldoc.loadXML(string);
myErr = gml_xmldoc.parseError;
if (myErr.errorCode || !ret)
{
showError("Error: " + ERROR_XML + myErr.reason);
return null;
}
return gml_xmldoc.documentElement
}
return null;
}
 
function HTTPClient()
{
var xml_http = false;
if(window.XMLHttpRequest)
xml_http = new XMLHttpRequest();
else if (IE){
try{
xml_http = new ActiveXObject("Msxml2.XMLHTTP")
} catch (e){
try{
xml_http = new ActiveXObject("Microsoft.XMLHTTP")
} catch (e){}
}
}
if (!xml_http) showError(ERROR_XML);
return xml_http
};
*/
 
//Adds 'Check Refs' to the toolbox, links to http://toolserver.org/~dispenser/cgi-bin/reflinks.py -- Dispenser's reference title fixer.
function refcheck()
{
addPortletLink("p-tb", "http://toolserver.org/~dispenser/cgi-bin/webreflinks.py?page=" + wgPageName + "&citeweb=on", "Check Refs");
};
function linkcheck()
{
addPortletLink("p-tb", "http://toolserver.org/~dispenser/cgi-bin/webchecklinks.py?page=" + wgPageName, "Check Links");
};
 
function dabsolver()
{
addPortletLink("p-tb", "http://toolserver.org/~dispenser/cgi-bin/dab_solver.py?page=" + wgPageName, "Dab Solver");
};
 
function samspade()
{
addPortletLink("p-tb", "http://whois.domaintools.com/" + wgTitle, "Whois Lookup");
};
 
function hurricane()
{
addPortletLink("p-tb", "http://rwhois.he.net/whois.php?query=" + wgTitle, "RWhois Lookup")
}
if ( wgNamespaceNumber == 0 ) {
addOnloadHook(refcheck);
addOnloadHook(linkcheck);
addOnloadHook(dabsolver);
};
 
if ( wgNamespaceNumber == 3 ) {
addOnloadHook(samspade);
addOnloadHook(hurricane);
};
 
importScript('User:Darkwind/stubtagtab2.js');
 
/**** afd helper ****/
//importScript('User:Jnothman/afd_helper/script.js');
 
/* This is to keep track of who is using this extension: [[User:Jnothman/afd_helper/script.js]] */
 
importScript('User:Mr.Z-man/closeAFD.js');
 
importScript('User:Writ Keeper/Scripts/deletionFinder.js');
 
importScriptURImw.loader.load('//ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-markblocked.js&action=raw&ctype=text/javascript');
 
importScript('User:Darkwind/DAVT/Beta-test.js'); //for testing!
 
importScript('User:Ale_jrb/Scripts/csdhelper.js'); //[[User:Ale_jrb/Scripts]]
Line 304 ⟶ 21:
 
importScript("User:Timotheus Canens/spihelper.js");
 
// Provides several useful functions for rollback (custom edit summary, mark as bot edits and mass revert)
// by [[m:user:Hoo man]] <http://meta.wikimedia.org/wiki/User:Hoo_man/Scripts/Smart_rollback>
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Hoo_man/smart_rollback.js&action=raw&ctype=text/javascript');
 
/* User:MusikAnimal/responseHelper.js */
importScript( 'User:MusikAnimal/responseHelper.js' );// Backlink: [[User:MusikAnimal/responseHelper.js]]
 
ebPrefs = {
markWarnAsMinor: false,
displayStatus: true
};
 
mw.loader.load( "https://meta.wikimedia.org/w/index.php?title=User:Zhaofeng_Li/Reflinks.js&action=raw&ctype=text/javascript" );
window.kephirUnclutter = {
enableOnPageLoad : false,
wrapDiscussions : false,
collapseDiscussionsByDefault: false,
signaturesProcess : true,
signaturesMinimise : true,
signaturesColourise : false,
signaturesExceptions : [],
userAnnotations : { /* "username": "annotation" pairs, separated by commas */ },
processSig : function (context) { return false; },
postProcessSig : function (context) { return false; }
};
importScript('User:Kephir/gadgets/unclutter.js'); // [[User:Kephir/gadgets/unclutter]]
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Hedonil/XTools/XTools.js&action=raw&ctype=text/javascript');
importScript( 'User:Enterprisey/script-installer.js' ); // Backlink: [[User:Enterprisey/script-installer.js]]
importScript('User:Enterprisey/url-select-revdel.js'); // Backlink: [[User:Enterprisey/url-select-revdel.js]]
importScript('User:Suffusion of Yellow/effp-helper.js'); // Backlink: [[User:Suffusion of Yellow/effp-helper.js]]
importScript('User:RedWarn/.js'); // Backlink: [[User:RedWarn/.js]]
importScript('User:Evad37/MoveToDraft.js'); // Backlink: [[User:Evad37/MoveToDraft.js]]
importScript('User:Evad37/rater.js'); // Backlink: [[User:Evad37/rater.js]]
importScript('User:Enterprisey/reply-link.js'); // Backlink: [[User:Enterprisey/reply-link.js]]
 
window.replyLinkPreloadPing="button";
window.replyLinkPreloadPingTpl="{{re|##}} ";
window.replyLinkCustomSummary="true";
importScript('User:Alex Smotrov/histcomb.js'); // Backlink: [[User:Alex Smotrov/histcomb.js]]
importScript('User:Ingenuity/AntiVandal.js'); // Backlink: [[User:Ingenuity/AntiVandal.js]]