User:Will Pittenger/quartz.js

/* By manually purging this page, you will be able to see the divisions I have set up for easy navigation. Please purge manually as using the purge tab will have no effect.

Override of keyboard shortcut that interfered with my browser
I added this besause the default shortcut is Alt-D, which I need to reach the URL bar. */ //ta['ca-delete'] = new Array('','Delete this page');//

/*

Wikipedia:User:Lupin/popups.js
*/ document.write(' '); //  End of popup code //  end of popup code

/*

Options for Popups
*/ //popupFixDabs=true; //popupRevertSummaryPrompt=true;//

/*

Wikipedia:User:Cacycle/diff text diff code
 */ document.write(' '); //  end of text diff code

/*

Wikipedia:User:Pilaf/InstaView page preview tool
 */ document.write('');

//InstaView.conf.user.name = 'Will Pittenger'; wpUserName = "Will Pittenger";

//  end of InstaView code

/*

RegExTypoFix common typo fixer
*/ document.write('');//

/*

Options
 */ wikEdLoadRegExTypoFix = true; wikEdFollowHighlightedLinks = true;//

/*

Custom Buttons
See the instructions and sample at Wikipedia:User:Cacycle/wikEd  */ //define custom buttons (id, class, popup title, image src, width, height, alt text, onClick and parameters) var wikEdButton = [];//

/*

&lt;div> tags
 */ wikEdButton[100] = ['wikEdDiv', 'wikEdButton', 'Make the selection a html DIV element', 'http://upload.wikimedia.org/wikipedia/commons/e/eb/WikEd_button_DivTag.PNG', '16', '16', 'DIV', 'javascript:WikEdEditButton(this, this.id, null, CreateDivBtnHandler);' ];

// define the function which is called upon clicking the custom button function CreateDivBtnHandler(obj) {

// select the appropriate text change target (whole, selection, cursor, focusWord, focusLine, selectionWord, or selectionLine) WikEdGetText(obj, 'selection, cursor'); if (obj.selection.plain != '') { obj.changed = obj.selection; } else { obj.changed = obj.cursor; }

// make the changes to the plain target text if ( /&lt;div&gt;(.*?)&lt;\/div&gt;/i.test(obj.changed.plain) ) { obj.changed.plain = obj.changed.plain.replace(/&lt;div&gt;(.*?)&lt;\/div&gt;/gi, '$1'); } else { obj.changed.plain = '&lt;div&gt;' + obj.changed.plain + '&lt;/div&gt;'; obj.changed.plain = obj.changed.plain.replace(/(&lt;div&gt;)( *)(.*?)( *)(&lt;\/div&gt;)/, '$2$1$3$5$4'); }

// keep the changed text selected, needed to remove the formatting with a second click obj.changed.keepSel = true;

return; }//

/*

&lt;code> tags
 */ wikEdButton[101] = ['wikEdCode', 'wikEdButton', 'Make the selection a html CODE element', 'http://upload.wikimedia.org/wikipedia/commons/b/be/Wiked_button_CodeTag.PNG', '16', '16', 'CODE', 'javascript:WikEdEditButton(this, this.id, null, CreateCodeTagBtnHandler);' ];

// define the function which is called upon clicking the custom button function CreateCodeTagBtnHandler(obj) {

// select the appropriate text change target (whole, selection, cursor, focusWord, focusLine, selectionWord, or selectionLine) WikEdGetText(obj, 'selection, cursor'); if (obj.selection.plain != '') { obj.changed = obj.selection; } else { obj.changed = obj.cursor; }

// make the changes to the plain target text if ( /&lt;code&gt;(.*?)&lt;\/code&gt;/i.test(obj.changed.plain) ) { obj.changed.plain = obj.changed.plain.replace(/&lt;code&gt;(.*?)&lt;\/code&gt;/gi, '$1'); } else { obj.changed.plain = '&lt;code&gt;' + obj.changed.plain + '&lt;/code&gt;'; obj.changed.plain = obj.changed.plain.replace(/(&lt;code&gt;)( *)(.*?)( *)(&lt;\/code&gt;)/, '$2$1$3$5$4'); }

// keep the changed text selected, needed to remove the formatting with a second click obj.changed.keepSel = true;

return; }//

/*

&lt;pre> tags
 */ wikEdButton[102] = ['wikEdCode', 'wikEdButton', 'Make the selection a html PRE element', 'http://upload.wikimedia.org/wikipedia/commons/f/ff/WikEd_Button_PreTag.PNG', '16', '16', 'PRE', 'javascript:WikEdEditButton(this, this.id, null, CreatePreTagBtnHandler);' ];

// define the function which is called upon clicking the custom button function CreatePreTagBtnHandler(obj) {

// select the appropriate text change target (whole, selection, cursor, focusWord, focusLine, selectionWord, or selectionLine) WikEdGetText(obj, 'selection, cursor'); if (obj.selection.plain != '') { obj.changed = obj.selection; } else { obj.changed = obj.cursor; }

// make the changes to the plain target text if ( /&lt;pre&gt;(.*?)&lt;\/pre&gt;/i.test(obj.changed.plain) ) { obj.changed.plain = obj.changed.plain.replace(/&lt;pre&gt;(.*?)&lt;\/pre&gt;/gi, '$1'); } else { obj.changed.plain = '&lt;pre&gt;' + obj.changed.plain + '&lt;/pre&gt;'; obj.changed.plain = obj.changed.plain.replace(/(&lt;pre&gt;)( *)(.*?)( *)(&lt;\/pre&gt;)/, '$2$1$3$5$4'); }

// keep the changed text selected, needed to remove the formatting with a second click obj.changed.keepSel = true;

return; }//

/*

Actually display the custom buttons
*/ // define custom button bars (id, class, button numbers) var wikEdButtonBar = []; wikEdButtonBar['custom1'] = ['wikEdButtonBarCustom1', 'wikEdButtonBarCustom1', 'wikEdButtonsCustom1', 'wikEdButtonsCustom1', 44, 'My custom buttons', [100, 102, 'br', 101]];//

/*

wikEd core
Wikipedia:User:Cacycle/wikEd  */ document.write(' ');//

/*

Takes the wikipage "page" and includes its raw text as javascript.
 */ function import_module(page) { if(document.createElement && document.childNodes) {   var url = 'http://en.wikipedia.org/w/index.php?title=' + page.replace(/ /g, "_") + '&action=raw&ctype=text/javascript&dontcountme=s';

var scriptElem = document.createElement('script');

scriptElem.setAttribute('src',url); scriptElem.setAttribute('type','text/javascript'); document.getElementsByTagName('head')[0].appendChild(scriptElem); } } //  end of Import Module code

/*

WikiProject User scripts/Scripts/Edit Top
<pre style="overflow:auto"> */

import_module("User:Gerbrant/edit/top.js"); //  end of code to put edit links at the top of articles

/*

WikiProject User scripts/Scripts/Add purge to tabs
<pre style="overflow:auto"> */ //import_module("Wikipedia:WikiProject User scripts/Scripts/addLink"); //import_module("Wikipedia:WikiProject User scripts/Scripts/Add purge to tabs"); //

/*

WikiProject User scripts/Scripts/Watchlist since
<pre style="overflow:auto"> */ import_module('Wikipedia:WikiProject User scripts/Scripts/Watchlist since'); //

/*