WhutBBCode?

By hateradio Last update Aug 7, 2013 — Installed 7,238 times.

There are 22 previous versions of this script.

the source is over 100KB, syntax highlighting in the browser is too slow

// ==UserScript==
// @id             WhutBBCode
// @name           WhutBBCode?
// @namespace      hateradio)))
// @author         hateradio
// @version        3.0.2
// @description    This is a cross-browser BBCode helper. It works with both What.CD and Waffles.fm and other sites . . . CDs and waffles, mmm.
// @homepage       https://www.userscripts.org/scripts/show/89544
// @updateURL      https://userscripts.org/scripts/source/89544.meta.js
// @icon           data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABx9JREFUeNrEV8uPHEcd/qr6MT2Pndm3vWt5TTbrmI1jY4IUBYEiISSEQg4IGfgDkhyJxIHHJYID4oCExIUDlpBAwgIhYTmOwiVKJKRwIuEQ7IBZr+N11muvva95d093V/FVd+9sz+zYXLDoVW33dFX93t/3qxZvvnkR/8/Lzu6So6hUXNFal/gsHqPOnpCyKYXs8DncN6DK8Vy1OvkVx3GPAvoxGiCCbrd9zfc7b/DHLWOAjONofn7+iVfPPPPcecuSUFqnSzn0/rah51GXHlY14p1t2bj18c3wb+//xStXCr8wBlgcM+O1yTNSCoS9AFrrITGpeGH+hHmikRxacyTv+UYo3tWgIVofkgE7pgzp3Lvz4Pz4RPEPdjbrxrESWikopUb6Jag5psIgUAj9LaD7CRDXOa2grSpE8Tgsbxqea8GScaJcj4iNkW9mAj+Y3dvpTdoDBj88b2gHjM7uh/Aab2GsdxWubMEWXc7FiJWLMK7Ct5fRrL0Ia+IcSp7FqOj/Ug+6j4JUvbFaD25SrMdWqwP7/kXMdC/DHSsD48cYyjnaxWjpgEXUgtNroNR+B+Hmu9jb+xrq86+gWh1PUjOgUutcapA3IAuBzh4Yck3ljUYbxY2fYwrvQcx9DnCI0ugewbRO55tcGqZZlCylShFOoYWZ3YvYvXUPjYUfYKw2zZSogfDmk2Pvh1gn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CnpW+6GXIqQsfxE+9k63Q70Ov2JnY1O5lAJO7cug0Fu4TOyNVawI+18ORsu90uvLv1HrTbbakNemKFCUCkmbr33vZNuHO3KWM6OTBBJpF1SMzY8h4XHYQY219g2t60Oh3LodqpvaZ5vLm9nuXl+5l+8XMppQ+CEHq9nlysHfkeySPQEUdhIJkpLbYnORht22z1e/1wt7+Hwts6kxKSS7N463TsHjJhRiT3mMKn+/+EySnNBCVOuZnJ1wwQIP49Qg5/EpABmeut8cZCjl4wlbUNnNAoCHngB75Pm5oNDYh/WbXrutYWD/npENM5EWG8lg9lmVlMBRDi4B2FzMjGxyBhLPM8S1Vuc6k3y0Q1kVSsMhua9PfG1ji5SZJJ4SkOdXu9oe95HkYlyjepqJ78sqqJ7Wa16n6902IXg9CqUw9LpCFRrrqYJaZ4JrMmEkuZ/JJDw8BFsrQfrz2aCzBM/j5LjIMQq5v5axierl3KJfmsVkCqprR8zkDtFO139kWv2x3yiLcwHI9iDYh/XEgacDP0gzd42H8pHAVPIEorlmVb6T6bTE4xbVvetHusA5br2SHPzAveB9wbb4iIAg6h70O/2xGDXt9D3d/Cm96xG3Y/9gGxEyREmqVy6U3f82vddtsNw+hRRr8mY+w4/nBSRwEuMAxGaPVe4Ifvokm/6rrOm/P1+YHpA4SOAnxxZdGrblW+2W62dhCI8+hA1qkIh/ZGmsCOieBxNZQcIEf5fXSCTXSI76BCX8VQuHXpymaU5QGxKUQPbz582/P8vVs3b73hDUdzUcQdOKY/oI7CEH05bTaEEZp0r9vpDj/+zFPioFxAhkWNkKed4//Zz38LMAAuaRY9Jc0fWAAAAABJRU5ErkJggg==
// @screenshot     http://i.min.us/iMfJGx70.png

// @include        http*://*what.cd/*
// @exclude        http*://*what.cd/*logchecker*
// @exclude        http*://*what.cd/user.php?action=notify*
// @exclude        http*://*what.cd/reportsv2.php*

// @include        http*://*waffles.fm/forum/*
// @include        http*://*waffles.fm/details.php*
// @include        http*://*waffles.fm/my.php*
// @include        http*://*waffles.fm/bbcode.php*
// @include        http*://*waffles.fm/forums.php*
// @include        http*://*waffles.fm/upload.php*

// @include        http*://*indietorrents.com/*

// @update         Aug 04 2013
// @since          Sep 30 2010
// 2010+, hateradio
// Please don't modify or edit my script and re-release it. D:
// Send me a message if you want something modified.
// ==/UserScript==

(function () {
	'use strict';

	// helpers
	var dom, ie, strg, update;
	
	// S T O R A G E HANDLE
	strg = {
		on: (function () { try { var a, b = localStorage, c = Math.random().toString(16).substr(2, 8); b.setItem(c, c); a = b.getItem(c); return a === c ? !b.removeItem(c) : false; } catch (e) { return false; } }()),
		read: function (key) { return this.on ? JSON.parse(localStorage.getItem(key)) : false; },
		save: function (key, dat) { return this.on ? !localStorage.setItem(key, JSON.stringify(dat)) : false; },
		wipe: function (key) { return this.on ? !localStorage.removeItem(key) : false; },
		zero: function (o) { var k; for (k in o) { if (o.hasOwnProperty(k)) { return false; } } return true; },
		grab: function (key, def) { var s = strg.read(key); return strg.zero(s) ? def : s; }
	};

	// U P D A T E HANDLE
	update = {
		name: 'WhutBBCode?',
		version: 3020,
		key: 'ujs_WBB_UPDT_HR',
		callback: 'wbbupdt',
		urij: 'https://dl.dropboxusercontent.com/u/14626536/userscripts/updt/wbb/wbb.json',
		uric: 'https://dl.dropboxusercontent.com/u/14626536/userscripts/updt/wbb/wbb.js',
		checkchrome: false,
		interval: 5,
		day: (new Date()).getTime(),
		time: function () { return new Date(this.day + (1000 * 60 * 60 * 24 * this.interval)).getTime(); },
		top: document.head || document.body,
		css: function (t) {
			if (!this.style) {
				this.style = document.createElement('style');
				this.style.type = 'text/css';
				this.top.appendChild(this.style);
			}
			if (ie) {
				this.style.cssText += t;
			} else {
				this.style.appendChild(document.createTextNode(t + '\n'));
			}
		},
		js: function (t) {
			var j = document.createElement('script');
			j.type = 'text/javascript';
			j[/^https?\:\/\//i.test(t) ? 'src' : 'textContent'] = t;
			this.top.appendChild(j);
		},
		notification: function (j) {
			if (j) {if (this.version < j.version) { window.localStorage.setItem(this.key, JSON.stringify({date: this.time(), version: j.version, page: j.page })); } else { return true; } }
			var a = document.createElement('a'), b = JSON.parse(window.localStorage.getItem(this.key));
			a.href = b.page || '#';
			a.id = 'userscriptupdater';
			a.title = 'Update now.';
			a.textContent = 'An update for ' + this.name + ' is available.';
			document.body.appendChild(a);
			return true;
		},
		check: function (opt) {
			if (typeof (GM_updatingEnabled) === 'boolean' || !strg.on) { return; }
			var stored = strg.read(this.key), J, page;
			this.csstxt();
			if (opt || !stored || stored.date < this.day) {
				page = stored && stored.page ? stored.page : '#';
				strg.save(this.key, {date: this.time(), version: this.version, page: page});
				if (!opt && typeof (GM_xmlhttpRequest) === 'function' && !this.chrome()) {
					GM_xmlhttpRequest({method: 'GET', url: update.urij, onload: function (r) { update.notification(JSON.parse(r.responseText)); }, onerror: function () { update.check(1); } });
				} else {
					J = this.notification.toString().replace('function', 'function ' + this.callback).replace('this.version', this.version).replace(/(?:this\.key)/g, "'" + this.key + "'").replace('this.time()', this.time()).replace('this.name', 'j.name');
					this.js(J);
					this.js(this.uric);
				}
			} else if (this.version < stored.version) { this.notification(); }
		},
		chrome: function () {
			if (this.checkchrome === true && typeof (chrome) === 'object') { return true; }
		},
		csstxt: function () {
			if (!this.pop) { this.pop = true; this.css('#userscriptupdater,#userscriptupdater:visited{-moz-box-shadow:0 0 6px #787878;-webkit-box-shadow:0 0 6px #787878;box-shadow:0 0 6px #787878;border:1px solid #777;-moz-border-radius:4px;border-radius:4px;cursor:pointer;color:#555;font-family:Arial, Verdana, sans-serif;font-size:11px;font-weight:700;text-align:justify;min-height:45px;position:fixed;z-index:999999;right:10px;top:10px;width:170px;background:#ebebeb url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACsAAACLCAYAAAD4QWAuAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2RpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cm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FkyMNWNHkSANWNDl0xqbJAZ+j1/nR5HBOv6zm/8JaPjQ5KKqiyRFVpORfk8PRf3NZq8lRrd3PhiaHc6pvcLk0ORDdfGlyAFg0OdKAPUlliG76mhyGUNaDLXOaHIjuJdXkoKVKXzU5wlJZZjU5AFyKKhErFkuVbjcoUo3Apcmhnu6Ebkcmc5oczd2dZlA3YNHkUAFwUtLkcJlWnm1a1ng94AvkbKnM1SxVTKwRMphYNDkAPNiFFU0OZuPV5NDMYiyaHOgKvJoc8CVftFk1ORRsi/FxvYR3yH9qZjYba+VGkwOTw5GCzZcmByzTmhyI6ra/kNkiz4wmByD/0+T4J8AAyDkZArebBxMAAAAASUVORK5CYII=) no-repeat 13px 15px;padding:12px 20px 10px 65px}#userscriptupdater:hover,#userscriptupdater:visited:hover{color:#55698c!important;background-position:13px -85px;border-color:#8f8d96}'); }
		}
	};
	update.check();

	ie = !document.body.addEventListener && document.selection;

	// M I S C HANDLE
	dom = {
		// a simple list iterator function for arrays, nodelists, etc
		aEach: function (list, cb, scope) { var i, j = list.length; for (i = 0; i < j; i++) { if (cb.call(scope, list[i], i, list) === false) { break; } } },
		// a simple object-type iterator | todo reverse cb order
		oEach: function (object, cb, scope) { var key; for (key in object) { if (object.hasOwnProperty(key)) { if (cb.call(scope, key, object[key], object) === false) { break; } } } },
		dom: function (name, attr, child, parent) {
			// dom element creator
			// attr is an object of attributes to apply
			// child to attach to this element
			// parent for this element
			var e = document.createElement(name);
			if (attr.txt) {
				e.appendChild(document.createTextNode(attr.txt));
				delete attr.txt;
			}
			dom.oEach(attr, function (key, data) {
				if (typeof data === 'object') {
					dom.oEach(data, function (name, value) {
						if (key === 'attr') {
							e.setAttribute(name, value);
						} else {
							e[key][name] = value;
						}
					});
				} else {
					e[key] = data;
				}
			});
			if (child) { e.appendChild(child); }
			if (parent) { parent.appendChild(e); }
			return e;
		},
		click: (function () {
			var e;

			if (ie) {
				e = document.createEventObject();
				return function (el) { return el && el.fireEvent('onclick', e); };
			}

			return function (el) {
				e = document.createEvent('MouseEvents');
				e.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
				return el && !el.dispatchEvent(e);
			};

		}()),
		evt: function (el, ev, cb, cap) {
			if (!ie) {
				return el.addEventListener(ev, cb, !!cap);
			}
			return el.attachEvent('on' + ev, function (e) {
				e.currentTarget = e.target = e.srcElement;
				e.preventDefault = function () { e.returnValue = false; };
				e.stopPropagation = function () { e.cancelBubble = true; };
				cb.call(el, e);
				e = null;
			});
		}
	};

	/**
	 * WhutBB Class
	 * The principal class should not be used directly,
	 * use WhutBB.create() instead
	 *
	 * Uses a textarea as a reference to attach elements and events
	 *
	 * @param textarea to use
	 * @param id to place on the textarea
	 */
	function WhutBB(textarea, id) {
		this.textarea = textarea;
		this.textarea.className += ' wbbarea';
		this.textarea.setAttribute('data-wbb', id);
		this.id = id;
		this.wrap = dom.dom('div', { className: 'wbbcode ' + WhutBB.$.data.getWrapClass() });

		WhutBB.Panel.copyTo(this);
		this.buttonList = this.makeButtonList();

		this.insert(WhutBB.config.beneath);
		this.events();
	}

	window.WhutBB = WhutBB;

	WhutBB.set = {};

	/**
	 * The factory gets all textareas on the page and creates new WhutBB instances
	 * for textareas that are not read-only or disabled
	 */
	WhutBB.factory = function () {
		dom.aEach(document.getElementsByTagName('textarea'), function (textarea) {
			if (!textarea.disabled && !textarea.readOnly) {
				WhutBB.create(textarea);
			}
		});
	};

	/**
	 * Creates a WhutBBCode? instance for a textarea
	 * Ignores textareas that contain the class noWhutBB
	 *
	 * Stores reference in WhutBB.set
	 *
	 * @param textarea to use
	 * @param force forces the creation of a new instance
	 */
	WhutBB.create = function (textarea, force) {
		if (!WhutBB.$.data.ignore.test(textarea.getAttribute('class'))) {
			var id = WhutBB.id(textarea);
			if (!WhutBB.set[id] || force === true) {
				WhutBB.set[id] = new WhutBB(textarea, id);
			}
			return WhutBB.set[id];
		}
	};

	/**
	 * Locates or returns a unique ID
	 * @param textarea to use
	 */
	WhutBB.id = function (textarea) {
		var dat = textarea.getAttribute('data-wbb');
		if (dat && dat.length > 0) {
			return dat;
		}
		return Math.random().toString(32);
	};

	/**
	 * Inserts the buttons beneath or below a textarea
	 */
	WhutBB.prototype.insert = function (beneath) {
		var node = beneath ? this.textarea.nextSibling : this.textarea;
		this.textarea.parentNode.insertBefore(this.wrap, node);
	};

	// WhutBB.prototype.update = function (textarea) {
		// // update the textarea
		// this.textarea = textarea;
		// // update the wrap
		// this.insert(WhutBB.config.beneath);
		// // update the events if the previous elements are different
		// this.events();
	// };

	/**
	 * Attaches event handlers
	 */
	WhutBB.prototype.events = function () {
		dom.evt(this.textarea, 'keydown', WhutBB.evt.key.register(this));
		dom.evt(this.wrap, 'click', WhutBB.evt.mouse.register(this));
	};

	/**
	 * Hides this instance's elements
	 */
	WhutBB.prototype.hide = function () {
		this.wrap.className += ' wbbhide';
	};

	/**
	 * Shows this instance's elements
	 */
	WhutBB.prototype.show = function () {
		this.wrap.className = this.wrap.className.replace(/(?: wbbhide)/g, '');
	};

	/**
	 * Returns a button (if any)
	 * @param name of the button to get
	 */
	WhutBB.prototype.getButton = function (name) {
		return this.buttonList[name];
	};

	/**
	 * Builds a list of DOM buttons for reference used
	 * by keyboard shortcuts
	 */
	WhutBB.prototype.makeButtonList = function () {
		var list = {};
		dom.aEach(this.panels.button.getElementsByTagName('button'), function (el) {
			list[el.name] = el;
		});
		return list;
	};

	// WhutBB.$ is a collection of misc functions and storage
	WhutBB.$ = {
		data: {
			ignore: /(?:\b(?:noWhutBB)\b)/i, // Ignore textareas with a CSS class of "noWhutBB"
			web: [
				[':test', /^$|^localhost$/],
				['what', /(?:what)\.cd/],
				['waffles', /(?:waffles\.fm)/],
				['indietorrents', /(?:indietorrents\.com)/],
				['passthepopcorn', /(?:passthepopcorn\.me)/]
				// /(?:(last)(?:fm)?\.fm)/,
			],
			wrapClasses: ['wbbimgless', 'wbbimg'], // Displays text or icons on buttons
			getWrapClass: function () {
				return this.wrapClasses[Number(WhutBB.user.settings.icon)];
			},
			glyph: {  // http://twitter.github.io/bootstrap/2.3.2/assets/img/glyphicons-halflings.png http://twitter.github.io/bootstrap/assets/img/glyphicons-halflings.png
				black: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdUAAACfCAQAAAAFBIvCAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAMaFJREFUeNrtfW1sXEW6pleytF7JurZEJHxuHHcn/qA7dn/Rjsc4jW0w+ZhrPGbZONmAsw4TPMtoMySIDCASCAxiLG1u5KDMDaMg0pMRF7jXEr6rMPHeH0wgWWA2cycdPgYUrFECAby/rh237p/9U/u+p7r6nG6fU/VWpzsxS71Hidv2c+rUqfM+VW+9x/VUVZUxY8aWnVl11rzF7GPe+WEm96PCI0MscNiaxBIUuD5r2roMF5+2+pZVg0xXCg8tc8ZuxzNWnXG8635Omv6j72/WGPxj6Mf4Sbt+TMUAGxWje//gLQnG+vFIOCVf6O+dTbLCo3f2Qr/isjZFV7LVLMSicIa8GYKsncVZAv4PMiutKFmz67AC8ECg77Em4fNBuy+atgKkBo61M2tY44Fo4BvfjdgtGWGN76ofs9dBwAfU6Dw+UPiVjCdcwaObSss7KPh9hiMAm1F6hJb/lICHOjTD/SVtP25mom50SyoYwK+y5mzLOUrJ2NoroUTe7kmn/Vl1MVmRqKxaXpygKB5dWVlFrb5mQOydwB7i0J6ubFjh7npdh1XXdKUdEAmoj3W5Db4m4QE1LVCapO1XgH2D/kB08JF83SNM9ZhZf5I9+7Rz8J/I3IIfrMb5LHcjByu+UvGUKxQ/kcaLYdZ40f8JWOkw+A4iEBtlYSmddP1HFw/dKtShd1YQrncW61ZeqsIAcmYleEIEKAhx1ry8ND6aFh/8V9VHtiPdBPGObFcRVTzQgcz40RO7WEpW0ba3k2z3i6zBvlL9xO4ka/1EVnLTSa+uo+mkNzrwWDyPcz4lWOAxAp2+TrKORXoPGvm6d5aKpzt50u4573rAOfhP1CUXfpbjl36l4XWpysmXBC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on-"]{display:inline-block;width:14px;height:14px;margin-right:.3em;line-height:14px;vertical-align:text-top;background-image:url(' + this.glyph.black + ');background-position:14px 14px;background-repeat:no-repeat;margin-top:1px}.icon-white{background-image:url("http://twitter.github.io/bootstrap/assets/img/glyphicons-halflings.png")}.icon-glass{background-position:0 0}.icon-music{background-position:-24px 0}.icon-search{background-position:-48px 0}.icon-envelope{background-position:-72px 0}.icon-heart{background-position:-96px 0}.icon-star{background-position:-120px 0}.icon-star-empty{background-position:-144px 0}.icon-user{background-position:-168px 0}.icon-film{background-position:-192px 0}.icon-th-large{background-position:-216px 0}.icon-th{background-position:-240px 0}.icon-th-list{background-position:-264px 0}.icon-ok{background-position:-288px 0}.icon-remove{background-position:-312px 0}.icon-zoom-in{background-position:-336px 0}.icon-zoom-out{background-position:-360px 0}.icon-off{background-position:-384px 0}.icon-signal{background-position:-408px 0}.icon-cog{background-position:-432px 0}.icon-trash{background-position:-456px 0}.icon-home{background-position:0 -24px}.icon-file{background-position:-24px -24px}.icon-time{background-position:-48px -24px}.icon-road{background-position:-72px -24px}.icon-download-alt{background-position:-96px -24px}.icon-download{background-position:-120px -24px}.icon-upload{background-position:-144px -24px}.icon-inbox{background-position:-168px -24px}.icon-play-circle{background-position:-192px -24px}.icon-repeat{background-position:-216px -24px}.icon-refresh{background-position:-240px -24px}.icon-list-alt{background-position:-264px -24px}.icon-lock{background-position:-287px -24px}.icon-flag{background-position:-312px -24px}.icon-headphones{background-position:-336px -24px}.icon-volume-off{background-position:-360px -24px}.icon-volume-down{background-position:-384px -24px}.icon-volume-up{background-position:-408px -24px}.icon-qrcode{background-position:-432px -24px}.icon-barcode{background-position:-456px -24px}.icon-tag{background-position:0 -48px}.icon-tags{background-position:-25px -48px}.icon-book{background-position:-48px -48px}.icon-bookmark{background-position:-72px -48px}.icon-print{background-position:-96px -48px}.icon-camera{background-position:-120px -48px}.icon-font{background-position:-144px -48px}.icon-bold{background-position:-167px -48px}.icon-italic{background-position:-192px -48px}.icon-text-height{background-position:-216px -48px}.icon-text-width{background-position:-240px -48px}.icon-align-left{background-position:-264px -48px}.icon-align-center{background-position:-288px -48px}.icon-align-right{background-position:-312px -48px}.icon-align-justify{background-position:-336px -48px}.icon-list{background-position:-360px -48px}.icon-indent-left{background-position:-384px -48px}.icon-indent-right{background-position:-408px -48px}.icon-facetime-video{background-position:-432px -48px}.icon-picture{background-position:-456px -48px}.icon-pencil{background-position:0 -72px}.icon-map-marker{background-position:-24px -72px}.icon-adjust{background-position:-48px -72px}.icon-tint{background-position:-72px -72px}.icon-edit{background-position:-96px -72px}.icon-share{background-position:-120px -72px}.icon-check{background-position:-144px -72px}.icon-move{background-position:-168px -72px}.icon-step-backward{background-position:-192px -72px}.icon-fast-backward{background-position:-216px -72px}.icon-backward{background-position:-240px -72px}.icon-play{background-position:-264px -72px}.icon-pause{background-position:-288px -72px}.icon-stop{background-position:-312px -72px}.icon-forward{background-position:-336px -72px}.icon-fast-forward{background-position:-360px -72px}.icon-step-forward{background-position:-384px -72px}.icon-eject{background-position:-408px -72px}.icon-chevron-left{background-position:-432px -72px}.icon-chevron-right{background-position:-456px -72px}.icon-plus-sign{background-position:0 -96px}.icon-minus-sign{background-position:-24px -96px}.icon-remove-sign{background-position:-48px -96px}.icon-ok-sign{background-position:-72px -96px}.icon-question-sign{background-position:-96px -96px}.icon-info-sign{background-position:-120px -96px}.icon-screenshot{background-position:-144px -96px}.icon-remove-circle{background-position:-168px -96px}.icon-ok-circle{background-position:-192px -96px}.icon-ban-circle{background-position:-216px -96px}.icon-arrow-left{background-position:-240px -96px}.icon-arrow-right{background-position:-264px -96px}.icon-arrow-up{background-position:-289px -96px}.icon-arrow-down{background-position:-312px -96px}.icon-share-alt{background-position:-336px -96px}.icon-resize-full{background-position:-360px -96px}.icon-resize-small{background-position:-384px -96px}.icon-plus{background-position:-408px -96px}.icon-minus{background-position:-433px -96px}.icon-asterisk{background-position:-456px -96px}.icon-exclamation-sign{background-position:0 -120px}.icon-gift{background-position:-24px -120px}.icon-leaf{background-position:-48px -120px}.icon-fire{background-position:-72px -120px}.icon-eye-open{background-position:-96px -120px}.icon-eye-close{background-position:-120px -120px}.icon-warning-sign{background-position:-144px -120px}.icon-plane{background-position:-168px -120px}.icon-calendar{background-position:-192px -120px}.icon-random{background-position:-216px -120px;width:16px}.icon-comment{background-position:-240px -120px}.icon-magnet{background-position:-264px -120px}.icon-chevron-up{background-position:-288px -120px}.icon-chevron-down{background-position:-313px -119px}.icon-retweet{background-position:-336px -120px}.icon-shopping-cart{background-position:-360px -120px}.icon-folder-close{background-position:-384px -120px}.icon-folder-open{background-position:-408px -120px;width:16px}.icon-resize-vertical{background-position:-432px -119px}.icon-resize-horizontal{background-position:-456px -118px}.icon-hdd{background-position:0 -144px}.icon-bullhorn{background-position:-24px -144px}.icon-bell{background-position:-48px -144px}.icon-certificate{background-position:-72px -144px}.icon-thumbs-up{background-position:-96px -144px}.icon-thumbs-down{background-position:-120px -144px}.icon-hand-right{background-position:-144px -144px}.icon-hand-left{background-position:-168px -144px}.icon-hand-up{background-position:-192px -144px}.icon-hand-down{background-position:-216px -144px}.icon-circle-arrow-right{background-position:-240px -144px}.icon-circle-arrow-left{background-position:-264px -144px}.icon-circle-arrow-up{background-position:-288px -144px}.icon-circle-arrow-down{background-position:-312px -144px}.icon-globe{background-position:-336px -144px}.icon-wrench{background-position:-360px -144px}.icon-tasks{background-position:-384px -144px}.icon-filter{background-position:-408px -144px}.icon-briefcase{background-position:-432px -144px}.icon-fullscreen{background-position:-456px -144px}';
				return o + ' .wbbcode button::-moz-focus-inner{border:0;padding:0}.wbbcode div,.wbbcode ul{margin:.2em;padding:.1em}.wbbset li{display:inline;margin:2px}.wbbset label input{vertical-align:text-bottom}.wbbset li label input{margin:0 3px 0 0}.wbbcode{width:' + WhutBB.config.width + 'px;text-align:center;font-size:11px;font-family:Tahoma, sans-serif;margin:auto;padding:3px}.wbbcode.wbb_noimg button{background-image:none}.wbbcode.wbbimg button span{text-indent:-100px;overflow:hidden;margin:0}.wbbcode.wbbimgless button span{margin:0;background:none}.wbbcode button.whutbbutton{float:none;overflow:hidden;background:#eee;color:#555;font-size:11px;font-family:Arial, sans-serif;font-weight:400;cursor:pointer;width:22px;height:21px;text-shadow:#fff 1px 1px 1px;border-top:1px solid #fff;border-left:1px solid #fff;border-right:1px solid #ccc;border-bottom:1px solid #ccc;-moz-border-radius:2px;border-radius:2px;-moz-transition-duration:.2s;-webkit-transition-duration:.2s;-o-transition:none;transition-duration:.2s;vertical-align:middle;margin:0 1px 3px;padding:1px}.wbbcode button:hover{background-color:#fff;color:#555;border-top:1px solid #eee;border-left:1px solid #eee;border-right:1px solid #bbb;border-bottom:1px solid #bbb}.wbbcode button:active span{margin:3px 0 0 1px}.wbblink{padding:2px 0}.wbbemot,.wbbset{overflow:auto;margin:auto}.wbbemot{max-height:150px;box-shadow:0 0 3px #777;padding:3px}.wbbemot img,.wbbemot div{cursor:pointer}div.wbbcode button.wbbpressed{background-color:#ddd;border-top:1px solid #aaa;border-left:1px solid #aaa;border-right:1px solid #eee;border-bottom:1px solid #eee}.wbbcon{color:#d06620;display:block;padding:3px 0}textarea[id^=editbox]{max-height:400px;overflow:auto!important}.wbbarea{outline-color:#ADD8E6;max-height:500px!important;overflow:auto!important;display:block;margin:3px auto 6px}.wbbshortcut{overflow:hidden;text-align:center;color:#2F2F2F;margin:0;padding:0}.wbbshortcut li{background:#eee;border-top:1px solid #fff;border-left:1px solid #fff;border-right:1px solid #ccc;border-bottom:1px solid #ccc;border-radius:2px;display:inline-block;zoom:1;height:50px;vertical-align:top;width:58px;margin:3px;padding:2px 3px}* html .wbbshortcut li{display:inline}.wbbhide,.hidden.wbbarea{display:none !important}';
			}
		},
		findSite: function () {
			var website = ':generic';
			dom.aEach(this.data.web, function (site) {
				if (site[1].test(document.domain)) {
					website = site[0];
					return false;
				}
			});
			return website;
		}
	};

	/**
	 * The WhutBBCode? initializer
	 *
	 * @param config, see WhutBB.Settings
	 *
	 * example:
	 *
	 *   WhutBB.init({
	 *     emoticonDir: 'https://ssl.what.cd/static/common/smileys/',
	 *     emoticons: WhutBB.db.emoticons.gz.slice(0, 4),
	 *     blueprint: [
	 *       ['b', 'i', 'u', 's'], ['code'],
	 *       ['color', 'size'], ['*'],
	 *       ['url', 'img'], ['quote'],
	 *       ['erase'], ['emoticon', 'shortcut', 'settings']
	 *     ]
	 *   });
	 *
	 */
	WhutBB.init = function (config) {
		WhutBB.config = new WhutBB.Settings(config || WhutBB.db.getSiteSettings(WhutBB.$.findSite()));
		// try {
			// console.info('WhutBBCode? mode ' + WhutBB.config.name);
			// console.log(WhutBB.config);
		// } catch (e) {}
		WhutBB.user.load();
		update.css(WhutBB.$.data.css());
		WhutBB.Panel.construct();
		if (document.getElementById('content')) {
			dom.evt(document.getElementById('content'), 'click', WhutBB.evt.delegate.edit);
			if (document.getElementById('messageform')) {
				dom.evt(document.getElementById('messageform'), 'click', WhutBB.evt.delegate.inbox);
			}
		}
	};

	/**
	 * Settings storage management
	 * Uses localStorage to store a user's settings
	 *
	 * Sends an appropriate message when settings are saved or not
	 *
	 * All settings are stored in the options object. These are
	 * also used in the Panel class, which generates check boxes per option.
	 */
	WhutBB.user = {
		message: [
			'Settings failed to save. D:',
			'Settings saved. :D'
		],
		options: {
			prompt: {
				txt: 'Prompts',
				title: 'Show browser prompts.',
				value: false
			},
			icon: {
				txt: 'Icons',
				title: 'Show icons.',
				value: false
			},
			link: {
				txt: 'WhutBBCode? Link',
				title: 'Show WhutBBCode? link',
				value: true
			}
		},
		load: function () {
			this.set(strg.grab('wbb3', this.defaults()));
			// console.log('load', this.settings);
		},
		set: function (settings) {
			this.settings = this.validate(settings);
		},
		save: function (settings) {
			WhutBB.Panel.message(this.message[Number(strg.save('wbb3', this.validate(settings)))]);
			return strg.on ? this.load() : this.set(settings);
		},
		validate: function (settings) { // returns only valid settings that exist in options
			var valid = {};
			dom.oEach(this.options, function (name) {
				valid[name] = !!settings[name];
			});
			return valid;
		},
		defaults: function () {
			var defaults = {};
			dom.oEach(this.options, function (name, options) {
				defaults[name] = options.value;
			});
			return defaults;
		},
		settings: {}
	};

	/**
	 * Psuedo-Database
	 * Contains all sites, buttons, emoticons, shortcuts
	 *
	 * Shortcuts are sorted by modifier key (ctrl/alt/ctrl+alt)
	 * Modifier properties (a single letter) should correspond to a keyboard key letter
	 * and the value (text) to a button name (WhutBB.db.button[text])
	 * Don't use CTRL with W, T, N, O (Chromium/IE Bugs)
	 *
	 */
	WhutBB.db = {
		sites: {
			':default': function () {
				return {
					name: '',
					link: 'https://userscripts.org/scripts/show/89544',
					beneath: true,
					blueprint: [],
					width: 430,
					emoticonDir: '',
					emoticonMax: 39,
					emoticons: [['', '']], // null emoticon
					shortcuts: WhutBB.db.shortcuts
				};
			},
			':generic': function () {
				return {
					emoticonDir: 'https://what.cd/static/common/smileys/',
					emoticons: WhutBB.db.emoticons.gz.slice(0, 4),
					blueprint: [
						['b', 'i', 'u', 's'], ['code'],
						['color', 'size'], ['*'],
						['url', 'img'], ['quote'],
						['erase'], ['emoticon', 'shortcut', 'settings']
					]
				};
			},
			':test': function () { // for tests
				return {
					emoticonDir: 'https://what.cd/static/common/smileys/',
					emoticons: WhutBB.db.emoticons.gz,
					blueprint: [
						['b', 'i', 'u', 's'], ['important', 'heading', 'code'],
						['color', 'size'], ['gz_left', 'gz_center', 'gz_right'],
						['#', '*'], ['url', 'img'], ['quote', 'pre', 'gz_src'], ['hide', 'mature'],
						['torrent', 'artist',  'user', 'wiki', 'gz_rule'], ['tex', 'plain'],
						['erase'], ['emoticon', 'shortcut', 'settings']
					]
				};
			},
			':markdown': function () {
				return {};
			},
			what: function () {
				return {
					link: '/wiki.php?action=article&name=BBCode',
					emoticonDir: 'https://what.cd/static/common/smileys/',
					emoticons: 'gazelle',
					width: 430,
					blueprint: [
						['b', 'i', 'u', 's'], ['important', 'heading', 'code'],
						['color', 'size'], ['gz_left', 'gz_center', 'gz_right'],
						['#', '*'], ['url', 'img'], ['quote', 'pre', 'gz_src'], ['hide', 'mature'],
						['artist', 'torrent', 'user', 'wiki', 'gz_rule'], ['tex', 'plain'],
						[ 'erase'], ['emoticon', 'settings', 'shortcut']
					]
				};
			},
			indietorrents: function () {
				return {
					link: '/wiki.php?action=article&id=3',
					emoticonDir: 'static/common/smileys/',
					emoticons: 'indie',
					width: 440,
					blueprint: [
						['b', 'i', 'u', 's'], ['color', 'size'],
						['gz_left', 'gz_center', 'gz_right'], ['*'], ['url', 'img', 'youtube'],
						['quote', 'pre', 'gz_src', 'hide'], ['table', 'tr', 'th', 'td'],
						['artist', 'user', 'wiki'], ['tex', 'plain'],
						['erase'], ['emoticon', 'settings', 'shortcut']
					]
				};
			},
			waffles: function () {
				WhutBB.db.buttons.raw = WhutBB.db.buttons.plain;

				return {
					link: '/bbcode.php',
					emoticonDir: 'https://www.waffles.fm/pic/smilies/',
					emoticons: 'waffles',
					beneath: false,
					width: 540,
					blueprint: [
						['b', 'i', 'u', 's'], ['size', 'color', 'font', 'spoiler'],
						['*'], ['url', 'img', 'youtube'],
						['center', 'quote', 'pre', 'raw'],
						['artist', 'user', 'torrent', 'search'],
						['erase'], ['emoticon', 'settings', 'shortcut']
					]
				};
			}
		},
		buttons: {
			b: {title: 'Bold', icon: 'bold'},
			i: {title: 'Italic', icon: 'italic'},
			u: {title: 'Underline', icon: 'text-width'}, //underline
			s: {title: 'Strike', icon: 'minus'},
			code: {display: 'c', title: 'Inline Code', icon: 'leaf'},
			important: {display: '!', title: 'Important Text', icon: 'exclamation-sign'},
			color: {type: 1, display: '\u25ee', prompt: 'Enter a #hexadecimal or color name.', title: 'Color', val: '#', icon: 'tint'},
			size: {type: 1, display: '\u00b1', prompt: 'Enter a number.', title: 'Size', val: 3, icon: 'text-height'},
			align: {type: 1, display: '-', title: 'Align Text', icon: 'align-left'},
			left: {display: '<', title: 'Align Left', icon: 'align-left'},
			center: {display: '\u2013', title: 'Align Center', icon: 'align-center'},
			right: {display: '>', title: 'Align Right', icon: 'align-right'},
			'#': {type: 3, title: 'Ordered List Item', icon: 'list-alt'},
			'*': {type: 3, title: 'List Item', icon: 'list'},
			url: {type: 1, prompt: 'Enter a Link', title: 'Web Link', val: 'http://', icon: 'globe'},
			img: {title: 'Image', icon: 'picture'},
			quote: {type: 1, display: 'q', prompt: 'Enter an author or name.', title: 'Quote', placeholder: 'author', icon: 'comment'},
			pre: {title: 'Preformated text/Code block', icon: 'asterisk'},
			hide: {display: 'h', title: 'Hide content/Spoilers', icon: 'warning-sign'},
			spoiler: {display: '_', title: 'Spoilers!', icon: 'exclamation-sign'},
			mature: {display: 'm', title: 'Hide mature content', icon: 'eye-open'},
			artist: {display: 'a', title: 'Link to an artist/band on the site', icon: 'music'},
			user: {display: 'p', title: 'Link to a person on the site', icon: 'user'},
			wiki: {type: 4, tag: ['[[', ']]'], display: 'w', title: 'Link to a Wiki article', icon: 'share'},
			tex: {display: 't', title: 'LaTeX', icon: 'pencil'},
			plain: {display: 'x', title: 'Disable BB tags.', icon: 'ban-circle'},
			youtube: {type: 2, display: 'yt', title: 'YouTube video', icon: 'film'},
			font: {type: 1, display: 'f', prompt: 'Enter a font\'s name', title: 'Font', val: 'Arial', icon: 'font'},
			torrent: {display: 'id', title: 'Link to a torrent ID.', icon: 'download'},
			search: {type: 1, display: '@', prompt: 'Enter a search term', title: 'Link to a search term.', val: 'keywords', icon: 'search'},
			table: {display: 'tbl', title: 'Insert a table.', icon: 'th-large'},
			tr: {display: 'tr', title: 'Insert a table row.', icon: 'th-list'},
			th: {display: 'th', title: 'Insert a table heading.', icon: 'th'},
			td: {display: 'td', title: 'Insert a table cell.', icon: 'pencil'},
			heading: {type: 4, tag: '=', display: '=', title: 'Insert a heading', icon: 'arrow-right'},
			// Gazelle
			gz_left: {tag: 'align', val: 'left', type: 1, noPrompt: true, display: '<', title: 'Align left', icon: 'align-left'},
			gz_center: {tag: 'align', val: 'center', type: 1, noPrompt: true, display: '\u2013', title: 'Align center', icon: 'align-center'},
			gz_right: {tag: 'align', val: 'right', type: 1, noPrompt: true, display: '>', title: 'Align right', icon: 'align-right'},
			gz_src: {macro: ['quote', 'pre'], type: -3, display: '<>', title: 'Source code', icon: 'tasks'},
			gz_rule: {tag: 'rule', title: 'Link to a rule', icon: 'info-sign', display: 'r' },
			// Panels
			emoticon: {display: ':]', toggle: ';]', title: 'Emoticons', type: -1, icon: 'fire'},
			settings: {display: '%', title: 'Settings', type: -1, icon: 'wrench'},
			shortcut: {display: '?', title: 'Shortcuts', type: -1, icon: 'question-sign'},
			erase: {display: '-', title: 'Delete message', type: -2, icon: 'remove-sign'}
		},
		emoticons: {
			gazelle: [[":angry:", "angry.gif"], [":D", "biggrin.gif"], [":|", "blank.gif"], [":blush:", "blush.gif"], [":cool:", "cool.gif"], [":'(", "crying.gif"], ["&gt;.&gt;", "eyesright.gif"], [":creepy:", "creepy.gif"], [":frown:", "frown.gif"], ["&lt;3", "heart.gif"], [":unsure:", "hmm.gif"], [":whatlove:", "ilu.gif"], [":lol:", "laughing.gif"], [":loveflac:", "loveflac.gif"], [":ninja:", "ninja.gif"], [":no:", "no.gif"], [":nod:", "nod.gif"], [":ohno:", "ohnoes.gif"], [":omg:", "omg.gif"], [":o", "ohshit.gif"], [":paddle:", "paddle.gif"], [":(", "sad.gif"], [":shifty:", "shifty.gif"], [":sick:", "sick.gif"], [":)", "smile.gif"], [":-)", "smile.gif"], [":sorry:", "sorry.gif"], [":thanks:", "thanks.gif"], [":P", "tongue.gif"], [":wave:", "wave.gif"], [":wink:", "wink.gif"], [":worried:", "worried.gif"], [":wtf:", "wtf.gif"], [":wub:", "wub.gif"], [":qmarklove:", "ilqmark-what.gif"], [":ajaxlove:", "ilajax-what.gif"], [":athenalove:", "ilathena-what.gif"], [":alderaanlove:", "ilalderaan-what.gif"], [":anankelove:", "ilananke-what.gif"], [":bashmorelove:", "ilbashmore-what.gif"], [":brancusilove:", "ilbrancusi-what.gif"], [":brdlove:", "ilbrd-what.gif"], [":carllove:", "ilcarl-what.gif"], [":dumontlove:", "ildumont-what.gif"], [":entrapmentlove:", "ilentrapment-what.gif"], [":espressolove:", "ilespresso-what.gif"], [":gamehendgelove:", "ilgamehendge-what.gif"], [":hyperionlove:", "ilhyperion-what.gif"], [":iapetuslove:", "iliapetus-what.gif"], [":irimiaslove:", "ilirimias-what.gif"], [":irredentialove:", "ilirredentia-what.gif"], [":kitchenstafflove:", "ilkitchenstaff-what.gif"], [":kopitiamlove:", "ilkopitiam-what.gif"], [":kryptoslove:", "ilkryptos-what.gif"], [":lenreklove:", "illenrek-what.gif"], [":lesadieuxlove:", "illesadieux-what.gif"], [":lisbethlove:", "illisbeth-what.gif"], [":nandolove:", "ilnando-what.gif"], [":porkpielove:", "ilporkpie-what.gif"], [":sinetaxlove:", "ilsinetax-what.gif"], [":theseuslove:", "iltheseus-what.gif"], [":toruslove:", "iltorus-what.gif"], [":wtelove:", "ilwte-what.gif"], [":zettellove:", "ilzettel-what.gif"], [":a9love:", "ila9-what.gif"], [":bionicsockslove:", "ilbionicsocks-what.gif"], [":chailove:", "ilchai-what.gif"], [":changleslove:", "ilchangles-what.gif"], [":claptonlove:", "ilclapton-what.gif"], [":emmlove:", "ilemm-what.gif"], [":fzeroxlove:", "ilfzerox-what.gif"], [":hothlove:", "ilhoth-what.gif"], [":interstellarlove:", "ilinterstellar-what.gif"], [":jowalove:", "iljowa-what.gif"], [":kharonlove:", "ilkharon-what.gif"], [":lylaclove:", "illylac-what.gif"], [":marienbadlove:", "ilmarienbad-what.gif"], [":marigoldslove:", "ilmarigolds-what.gif"], [":mavericklove:", "ilmaverick-what.gif"], [":mnlove:", "ilmn-what.gif"], [":mre2melove:", "ilmre2me-what.gif"], [":mugglelove:", "ilmugglehump-what.gif"], [":nightoathlove:", "ilnightoath-what.gif"], [":oinkmeuplove:", "iloinkmeup-what.gif"], [":padutchlove:", "ilpadutch-what.gif"], [":paintrainlove:", "ilpaintrain-what.gif"], [":sdfflove:", "ilsdff-what.gif"], [":seraphiellove:", "ilseraphiel-what.gif"], [":sisterraylove:", "ilsisterray-what.gif"], [":snowflakelove:", "ilsnowflake-what.gif"], [":soamlove:", "ilsoam-what.gif"], [":spacireleilove:", "ilspacirelei-what.gif"], [":stwlove:", "ilstw-what.gif"], [":whatmanlove:", "ilwhatman-what.gif"], [":whynotmicelove:", "ilwhynotmice-what.gif"], [":xorianlove:", "ilxorian-what.gif"]],
			waffles: [[':waffleslove:', 'wubwaffles.gif'], [':opplove:', 'opplove.gif'], [':-)', 'smile1.gif'], [':smile:', 'smile2.gif'], [':-D', 'grin.gif'], [':lol:', 'laugh.gif'], [':w00t:', 'w00t.gif'], [':think:', 'think.gif'], [':-P', 'tongue.gif'], [';-)', 'wink.gif'], [':-|', 'noexpression.gif'], [':-/', 'confused.gif'], [':-(', 'sad.gif'], [':cry:', 'cry.gif'], [':crybaby:', 'crybaby.gif'], [':weep:', 'weep.gif'], [':-O', 'ohmy.gif'], [':o)', 'clown.gif'], ['8-)', 'cool1.gif'], ['|-)', 'sleeping.gif'], [':bite:', 'bite.gif'], [':innocent:', 'innocent.gif'], [':whistle:', 'whistle.gif'], [':unsure:', 'unsure.gif'], [':closedeyes:', 'closedeyes.gif'], [':cool:', 'cool2.gif'], [':fun:', 'fun.gif'], [':thumbsup:', 'thumbsup.gif'], [':thumbsdown:', 'thumbsdown.gif'], [':blush:', 'blush.gif'], [':yes:', 'yes.gif'], [':no:', 'no.gif'], [':love:', 'love.gif'], [':?:', 'question.gif'], [':!:', 'excl.gif'], [':idea:', 'idea.gif'], [':arrow:', 'arrow.gif'], [':arrow2:', 'arrow2.gif'], [':hmm:', 'hmm.gif'], [':hmmm:', 'hmmm.gif'], [':huh:', 'huh.gif'], [':geek:', 'geek.gif'], [':look:', 'look.gif'], [':rolleyes:', 'rolleyes.gif'], [':kiss:', 'kiss.gif'], [':shifty:', 'shifty.gif'], [':blink:', 'blink.gif'], [':smartass:', 'smartass.gif'], [':sick:', 'sick.gif'], [':crazy:', 'crazy.gif'], [':orly:', 'orly.gif'], [':wacko:', 'wacko.gif'], [':alien:', 'alien.gif'], [':wizard:', 'wizard.gif'], [':wave:', 'wave.gif'], [':wavecry:', 'wavecry.gif'], [':baby:', 'baby.gif'], [':angry:', 'angry.gif'], [':ras:', 'ras.gif'], [':sly:', 'sly.gif'], [':devil:', 'devil.gif'], [':evil:', 'evil.gif'], [':evilmad:', 'evilmad.gif'], [':sneaky:', 'sneaky.gif'], [':axe:', 'axe.gif'], [':slap:', 'slap.gif'], [':wall:', 'wall.gif'], [':rant:', 'rant.gif'], [':jump:', 'jump.gif'], [':yucky:', 'yucky.gif'], [':nugget:', 'nugget.gif'], [':smart:', 'smart.gif'], [':shutup:', 'shutup.gif'], [':shutup2:', 'shutup2.gif'], [':crockett:', 'crockett.gif'], [':zorro:', 'zorro.gif'], [':snap:', 'snap.gif'], [':beer:', 'beer.gif'], [':beer2:', 'beer2.gif'], [':drunk:', 'drunk.gif'], [':strongbench:', 'strongbench.gif'], [':weakbench:', 'weakbench.gif'], [':dumbells:', 'dumbells.gif'], [':music:', 'music.gif'], [':stupid:', 'stupid.gif'], [':dots:', 'dots.gif'], [':offtopic:', 'offtopic.gif'], [':spam:', 'spam.gif'], [':oops:', 'oops.gif'], [':lttd:', 'lttd.gif'], [':please:', 'please.gif'], [':sorry:', 'sorry.gif'], [':hi:', 'hi.gif'], [':yay:', 'yay.gif'], [':cake:', 'cake.gif'], [':hbd:', 'hbd.gif'], [':band:', 'band.gif'], [':punk:', 'punk.gif'], [':rofl:', 'rofl.gif'], [':bounce:', 'bounce.gif'], [':mbounce:', 'mbounce.gif'], [':thankyou:', 'thankyou.gif'], [':gathering:', 'gathering.gif'], [':hang:', 'hang.gif'], [':chop:', 'chop.gif'], [':rip:', 'rip.gif'], [':whip:', 'whip.gif'], [':judge:', 'judge.gif'], [':chair:', 'chair.gif'], [':tease:', 'tease.gif'], [':boxing:', 'boxing.gif'], [':guns:', 'guns.gif'], [':shoot:', 'shoot.gif'], [':shoot2:', 'shoot2.gif'], [':flowers:', 'flowers.gif'], [':wub:', 'wub.gif'], [':lovers:', 'lovers.gif'], [':kissing:', 'kissing.gif'], [':kissing2:', 'kissing2.gif'], [':console:', 'console.gif'], [':group:', 'group.gif'], [':hump:', 'hump.gif'], [':hooray:', 'hooray.gif'], [':happy2:', 'happy2.gif'], [':clap:', 'clap.gif'], [':clap2:', 'clap2.gif'], [':weirdo:', 'weirdo.gif'], [':yawn:', 'yawn.gif'], [':bow:', 'bow.gif'], [':dawgie:', 'dawgie.gif'], [':cylon:', 'cylon.gif'], [':book:', 'book.gif'], [':fish:', 'fish.gif'], [':mama:', 'mama.gif'], [':pepsi:', 'pepsi.gif'], [':medieval:', 'medieval.gif'], [':rambo:', 'rambo.gif'], [':ninja:', 'ninja.gif'], [':hannibal:', 'hannibal.gif'], [':party:', 'party.gif'], [':snorkle:', 'snorkle.gif'], [':evo:', 'evo.gif'], [':king:', 'king.gif'], [':chef:', 'chef.gif'], [':mario:', 'mario.gif'], [':pope:', 'pope.gif'], [':fez:', 'fez.gif'], [':cap:', 'cap.gif'], [':cowboy:', 'cowboy.gif'], [':pirate:', 'pirate.gif'], [':pirate2:', 'pirate2.gif'], [':rock:', 'rock.gif'], [':cigar:', 'cigar.gif'], [':icecream:', 'icecream.gif'], [':oldtimer:', 'oldtimer.gif'], [':trampoline:', 'trampoline.gif'], [':banana:', 'bananadance.gif'], [':smurf:', 'smurf.gif'], [':yikes:', 'yikes.gif'], [':osama:', 'osama.gif'], [':saddam:', 'saddam.gif'], [':santa:', 'santa.gif'], [':indian:', 'indian.gif'], [':pimp:', 'pimp.gif'], [':nuke:', 'nuke.gif'], [':jacko:', 'jacko.gif'], [':ike:', 'ike.gif'], [':greedy:', 'greedy.gif'], [':super:', 'super.gif'], [':wolverine:', 'wolverine.gif'], [':spidey:', 'spidey.gif'], [':spider:', 'spider.gif'], [':bandana:', 'bandana.gif'], [':construction:', 'construction.gif'], [':sheep:', 'sheep.gif'], [':police:', 'police.gif'], [':detective:', 'detective.gif'], [':bike:', 'bike.gif'], [':fishing:', 'fishing.gif'], [':clover:', 'clover.gif'], [':horse:', 'horse.gif'], [':shit:', 'shit.gif'], [':soldiers:', 'soldiers.gif'], [':search:', 'search.gif'], [':tinfoilhat:', 'tinfoilhat.gif'], [':moon1:', 'moon1.gif'], [':moon2:', 'moon2.gif'], [':user:', 'user.gif'], [':staff:', 'staff.gif'], [':eggo:', 'eggo.png']], /*, [':box:', 'box.gif']*/
			indie: [[':-)', 'smile.gif'], [';-)', 'wink.gif'], [':-D', 'biggrin.gif'], [':-P', 'tongue.gif'], [':-(', 'sad.gif'], ['>:-|', 'blank.gif'], [':-/', 'confused.gif'], [':-O', 'ohmy.gif'], [':o)', 'clown.gif'], ['8-)', 'cool1.gif'], ['|-)', 'sleeping.gif'], [':cupcake:', 'cupcake1.gif'], [':innocent:', 'innocent.gif'], [':whistle:', 'whistle.gif'], [':unsure:', 'hmm.gif'], [':closedeyes:', 'closedeyes.gif'], [':angry:', 'angry.gif'], [':smile:', 'smile2.gif'], [':lol:', 'laughing.gif'], [':cool:', 'cool.gif'], [':fun:', 'fun.gif'], [':thumbsup:', 'thumbsup.gif'], [':thumbsdown:', 'thumbsdown.gif'], [':blush:', 'blush.gif'], [':weep:', 'weep.gif'], [':yes:', 'yes.gif'], [':no:', 'no.gif'], [':love:', 'love.gif'], [':?:', 'question.gif'], [':!:', 'excl.gif'], [':idea:', 'idea.gif'], [':arrow:', 'arrow.gif'], [':hmm:', 'hmm.gif'], [':hmmm:', 'hmmm.gif'], [':huh:', 'huh.gif'], [':w00t:', 'w00t.gif'], [':geek:', 'geek.gif'], [':look:', 'look.gif'], [':rolleyes:', 'rolleyes.gif'], [':kiss:', 'kiss.gif'], [':shifty:', 'shifty.gif'], [':blink:', 'blink.gif'], [':smartass:', 'smartass.gif'], [':sick:', 'sick.gif'], [':crazy:', 'crazy.gif'], [':wacko:', 'wacko.gif'], [':alien:', 'alien.gif'], [':wizard:', 'wizard.gif'], [':wave:', 'wave.gif'], [':wavecry:', 'wavecry.gif'], [':baby:', 'baby.gif'], [':ras:', 'ras.gif'], [':sly:', 'sly.gif'], [':devil:', 'devil.gif'], [':evil:', 'evil.gif'], [':godisevil:', 'evil.gif'], [':evilmad:', 'evilmad.gif'], [':yucky:', 'yucky.gif'], [':nugget:', 'nugget.gif'], [':sneaky:', 'sneaky.gif'], [':smart:', 'smart.gif'], [':shutup:', 'shutup.gif'], [':shutup2:', 'shutup2.gif'], [':yikes:', 'yikes.gif'], [':flowers:', 'flowers.gif'], [':wub:', 'wub.gif'], [':osama:', 'osama.gif'], [':saddam:', 'saddam.gif'], [':santa:', 'santa.gif'], [':indian:', 'indian.gif'], [':guns:', 'guns.gif'], [':crockett:', 'crockett.gif'], [':zorro:', 'zorro.gif'], [':snap:', 'snap.gif'], [':beer:', 'beer.gif'], [':beer2:', 'beer2.gif'], [':drunk:', 'drunk.gif'], [':mama:', 'mama.gif'], [':pepsi:', 'pepsi.gif'], [':medieval:', 'medieval.gif'], [':rambo:', 'rambo.gif'], [':ninja:', 'ninja.gif'], [':hannibal:', 'hannibal.gif'], [':party:', 'party.gif'], [':snorkle:', 'snorkle.gif'], [':evo:', 'evo.gif'], [':king:', 'king.gif'], [':chef:', 'chef.gif'], [':mario:', 'mario.gif'], [':pope:', 'pope.gif'], [':fez:', 'fez.gif'], [':cap:', 'cap.gif'], [':cowboy:', 'cowboy.gif'], [':pirate:', 'pirate2.gif'], [':rock:', 'rock.gif'], [':cigar:', 'cigar.gif'], [':icecream:', 'icecream.gif'], [':oldtimer:', 'oldtimer.gif'], [':wolverine:', 'wolverine.gif'], [':strongbench:', 'strongbench.gif'], [':weakbench:', 'weakbench.gif'], [':bike:', 'bike.gif'], [':music:', 'music.gif'], [':book:', 'book.gif'], [':fish:', 'fish.gif'], [':stupid:', 'stupid.gif'], [':dots:', 'dots.gif'], [':kelso:', 'kelso.gif'], [':red:', 'red.gif'], [':dobbs:', 'bobdobbs.gif'], [':axe:', 'axe.gif'], [':hooray:', 'hooray.gif'], [':yay:', 'yay.gif'], [':cake:', 'cake.gif'], [':hbd:', 'hbd.gif'], [':hi:', 'hi.gif'], [':offtopic:', 'offtopic.gif'], [':band:', 'band.gif'], [':hump:', 'hump.gif'], [':punk:', 'punk.gif'], [':bounce:', 'bounce.gif'], [':mbounce:', 'mbounce.gif'], [':group:', 'group.gif'], [':console:', 'console.gif'], [':smurf:', 'smurf.gif'], [':soldiers:', 'soldiers.gif'], [':spidey:', 'spidey.gif'], [':rant:', 'rant.gif'], [':pimp:', 'pimp.gif'], [':nuke:', 'nuke.gif'], [':judge:', 'judge.gif'], [':jacko:', 'jacko.gif'], [':ike:', 'ike.gif'], [':greedy:', 'greedy.gif'], [':dumbells:', 'dumbells.gif'], [':clover:', 'clover.gif'], [':shit:', 'shit.gif'], [':thankyou:', 'thankyou.gif'], [':horse:', 'horse.gif'], [':box:', 'boxing.gif'], [':fight:', 'fighting05.gif'], [':gathering:', 'gathering.gif'], [':hang:', 'hang.gif'], [':chair:', 'chair.gif'], [':spam:', 'spam.gif'], [':bandana:', 'bandana.gif'], [':construction:', 'construction.gif'], [':oops:', 'oops.gif'], [':rip:', 'rip.gif'], [':sheep:', 'sheep.gif'], [':tease:', 'tease.gif'], [':spider:', 'spider.gif'], [':shoot:', 'shoot.gif'], [':shoot2:', 'shoot2.gif'], [':police:', 'police.gif'], [':lovers:', 'lovers.gif'], [':kissing:', 'kissing.gif'], [':kissing2:', 'kissing2.gif'], [':jump:', 'jump.gif'], [':happy2:', 'happy2.gif'], [':clap:', 'clap.gif'], [':clap2:', 'clap2.gif'], [':chop:', 'chop.gif'], [':lttd:', 'lttd.gif'], [':whip:', 'whip.gif'], [':yawn:', 'yawn.gif'], [':bow:', 'bow.gif'], [':slap:', 'slap.gif'], [':wall:', 'wall.gif'], [':please:', 'please.gif'], [':sorry:', 'sorry.gif'], [':finger:', 'finger.gif'], [':brown:', 'brownnoser.gif'], [':cloud9:', 'cloud9.gif'], [':pity:', 'mrt.gif'], [':mug:', 'mug.gif'], [':banned:', 'banned.gif'], [':tkfu:', 'ninja_hide.gif'], [':baldfresh:', 'baldy.png'], [':camera:', 'camera.gif'], [':loggeek:', 'log.jpg'], [':coleman83:', 'random'], [':locked:', 'lockd.gif'], [':tomjones1:', 'tomjones01.png'], [':tomjones2:', 'tomjones02.png'], [':D', 'biggrin.gif'], [':|', 'blank.gif'], [':\'(', 'crying.gif'], ['>.>', 'eyesright.gif'], [':frown:', 'frown.gif'], ['<3', 'heart.gif'], [':nod:', 'nod.gif'], [':ohno:', 'ohnoes.gif'], [':ohnoes:', 'ohnoes.gif'], [':omg:', 'omg.gif'], [':o', 'ohshit.gif'], [':O', 'ohshit.gif'], [':paddle:', 'paddle.gif'], [':(', 'sad.gif'], [':)', 'smile.gif'], [':thanks:', 'thanks.gif'], [':P', 'tongue.gif'], [':-p', 'tongue.gif'], [':wink:', 'wink.gif'], [':creepy:', 'creepy.gif'], [':worried:', 'worried.gif'], [':wtf:', 'wtf.gif'], [':lmgtfy:', 'lmgtfy.gif'], [':fart:', 'fart.gif'], [':hifi:', 'hifi.gif'], [':cheers:', 'cheers.gif'], [':jambox:', 'jambox.gif'], [':rimshot:', 'rimshot.gif'], [':rockout:', 'rockout.gif'], [':yourmom:', 'yourmom.gif'], [':bong:', 'bong.gif'], [':peace:', 'hippie.gif'], [':vinyl:', 'vinyl.gif'], ['\\m/', 'horns.gif']]
		},
		shortcuts: {
			alt: {
				c: 'gz_src'
			},
			ctrl: {
				b: 'b',
				i: 'i',
				u: 'u',
				s: 's',
				g: 'code',
				k: '#',
				l: '*',
				h: 'url',
				m: 'img',
				d: 'erase'
			},
			'ctrl+alt': {
				i: 'important',
				e: 'emoticon',
				u: 'settings',
				x: 'shortcut'
			}
		},
		getShortcut: function (modifier, letter) {
			if (this.shortcuts[modifier] && this.shortcuts[modifier][letter]) {
				return this.shortcuts[modifier][letter];
			}
		},
		getSiteSettings: function (name) {
			if (WhutBB.db.sites[name]) {
				var settings = WhutBB.db.sites[name]();
				settings.name = name;
				return settings;
			}
			return {};
		},
		/**
		 * Inserts or replaces buttons
		 * Use this method before initializing the script (WhutBB.init)
		 * @param buttons - object of objects
		 */
		insertButtons: function (buttons) {
			dom.oEach(buttons, function (name, object) {
				WhutBB.db.buttons[name] = object;
			});
		},
		/**
		 *  Adds emoticons to (an exisiting) emoticons DB array
		 *  Use this method before initializing the script (WhutBB.init)
		 *
		 * @param name of array in the emoticons DB to use
		 *        if none exist, it will be created
		 * @param emoticons array
		 *        make sure to use an array of arrays
		 *
		 *  Example: add two emoticons to WhutBB.db.emoticons.gazelle
		 *    WhutBB.db.addEmoticons('gazelle', [[':new:', 'new.png'], [':pop:', 'pop.png']]);
		 */
		addEmoticons: function (name, emoticons) {
			WhutBB.db.emoticons[name] = (WhutBB.db.emoticons[name] || []).concat(emoticons);
		}
	};

	/**
	 * Event manager
	 * Aliases/references event data for easier use within various methods
	 */
	WhutBB.e = {
		current: null, // alias for the current event
		target: null, // alias for the current event target element
		whut: null, // alias for the current event's WhutBB instance
		macro: false, // flag for events called through a macro
		set: function (event, target, wbb) {
			WhutBB.e.current = event;
			WhutBB.e.target = target;
			WhutBB.e.whut = wbb;
		},
		clean: function () {
			this.current = this.target = this.whut = null;
		}
	};

	/**
	 * Event Object
	 *
	 * Contains all possible events, divided into:
	 *    1) mouse, 2) key, and 3) general button events
	 *
	 * Mouse and Key events trigger Button events, depending
	 * on the button type
	 *
	 * As mentioned earlier, buttons with custom events should find
	 * a method with that button's name within WhutBB.evt.button.custom
	 *
	 * WhutBB instances register themselves with the 
	 * register methods.
	 *
	 * The registers return an annonymous function that
	 * is used for any subsequent click or key events.
	 *
	 */
	WhutBB.evt = {
		button: { // button events
			custom: { // Custom button events
				erase: function () { // erase button event
					WhutBB.e.whut.textarea.value = '';
				},
				emoticonLoader: function () { // removes "View all emoticons." div and loads remaining emoticons
					WhutBB.e.target.parentNode.removeChild(WhutBB.e.target);
					WhutBB.Panel.attach.emoticons(WhutBB.config.emoticonMax - 1,
						WhutBB.config.emoticons.length);
				}
			},
			macro: function (name, wbb) { // macro button events
				if (!WhutBB.e.macro) {
					WhutBB.e.macro = true;
					dom.aEach(WhutBB.db.buttons[name].macro || [], function (name) {
						// console.log(name);
						dom.click(wbb.getButton(name));
					});
					WhutBB.e.macro = false;
				}
			},
			bbcode: function () { // bbcode buttons
				WhutBB.Tag.get(WhutBB.e.target.name).insertTo(WhutBB.e.whut.textarea);
			},
			emoticon: function () { // emoticon buttons
				WhutBB.box.select(WhutBB.e.whut.textarea).insert([' ' + WhutBB.e.target.title, '']);
			},
			panel: { // panel buttons
				toggle: function (panel, el) { // el = WhutBB.e.target
					var visible = /(?:wbbpressed)/i.test(el.className); // panel's current visibility
					WhutBB.evt.button.panel.store(el);
					if (visible) {
						el.className = el.className.replace(' wbbpressed', '');
						panel.className += ' wbbhide';
					} else {
						WhutBB.e.whut.wrap.appendChild(WhutBB.Panel.global[el.name].element);
						el.className += ' wbbpressed';
						panel.className = panel.className.replace(' wbbhide', '');
					}
					WhutBB.evt.button.panel.toggleText(visible, el.firstChild);
				},
				toggleText: function (visible, span) {
					if (span.getAttribute('data-toggle') !== '') {
						span.firstChild.nodeValue = span.getAttribute(visible ? 'data-txt' : 'data-toggle');
					}
				},
				store: function (button) {
					// remove pressed/toggled state of previous stored button
					if (WhutBB.evt.button.panel.store[button.name]) {
						WhutBB.evt.button.panel.store[button.name].className = 'whutbbutton';
						WhutBB.evt.button.panel.toggleText(true, WhutBB.evt.button.panel.store[button.name].firstChild);
					}
					WhutBB.evt.button.panel.store[button.name] = button;
				},
				stored: {}
			}
		},
		delegate: {
			button: function () { // TODO Polymorphism plz?
				var t = WhutBB.e.target;
				// console.log(t);
				WhutBB.e.current.stopPropagation();
				if (+t.getAttribute('data-type') === -3) {
					// console.log(-3);
					return WhutBB.evt.button.macro(t.name, WhutBB.e.whut);
				}
				if (+t.getAttribute('data-type') === -2) {
					// console.log(-2);
					return WhutBB.evt.button.custom[t.name]();
				}
				if (+t.getAttribute('data-type') === -1) {
					// console.log(-1);
					return WhutBB.evt.button.panel.toggle(WhutBB.Panel.global[t.name].element, t);
				}
				if (t.getAttribute('data-type') === 'emoticon') {
					// console.log(2);
					return WhutBB.evt.button.emoticon();
				}
				// console.log(1);
				return WhutBB.evt.button.bbcode();
			},
			edit: function (evt) { // RegExp.lastParen should contain an ID
				var el = evt.target,
					onclick = el.getAttribute('onclick') || '';
				if (onclick.match(/(?:Edit_Form\('(\d+))/)) {
					return window.setTimeout(function () {
						var txt = document.getElementById('editbox' + RegExp.lastParen);
						txt.setAttribute('data-wbb', RegExp.lastParen);
						WhutBB.create(txt, true);
					}, 500);
				}
				if (onclick.match(/(?:Preview_Edit\((\d+))/) || onclick.match(/(?:Save_Edit\((\d+))/)) {
					return WhutBB.set[RegExp.lastParen].hide();
				}
				if (onclick.match(/(?:Cancel_Preview\((\d+))/)) {
					return WhutBB.set[RegExp.lastParen].show();
				}
			},
			inbox: function (evt) { // todo inbox.php
				var el = evt.target;
				// console.log('inbox');
				if (/(?:preview)/i.test(el.value)) {
					document.getElementById('quickpost').className += ' wbbhide';
					document.getElementById('quickpost').nextSibling.className += ' wbbhide';
				}
				if (/(?:editor)/i.test(el.value)) {
					document.getElementById('quickpost').className = document.getElementById('quickpost').className.replace(/(?: wbbhide)/g, '');
					document.getElementById('quickpost').nextSibling.className = document.getElementById('quickpost').nextSibling.className.replace(/(?: wbbhide)/g, '');
				}
			},
			settings: { // settings events
				update:  function () { // translates checks into settings to store
					var settings = {}, saved;

					dom.aEach(WhutBB.Panel.global.settings.element.getElementsByTagName('input'), function (el) {
						settings[el.name] = el.checked;
					});

					saved = WhutBB.user.save(settings);

					// calls a sub function based on a setting's name
					// additional argument if the settings were saved
					if (this.fn[WhutBB.e.target.name]) {
						this.fn[WhutBB.e.target.name](saved);
					}
				},
				fn: {
					icon: function () { // toggles button icons
						var cls = 'wbbcode ' + WhutBB.$.data.getWrapClass();
						dom.oEach(WhutBB.set, function (id, wbb) {
							wbb.wrap.className = cls;
						});
					},
					link: function () { // toggles WhutBBCode? link
						var cls = 'wbblink ' + (WhutBB.user.settings.link ? '' : ' wbbhide');
						dom.oEach(WhutBB.set, function (id, wbb) {
							wbb.panels.link.className = cls;
						});
					}
				}
			}
		},
		mouse: {
			target: function (target) {
				// WebKit issue -- This returns an actual button, instead of the span.icon-* within it
				return (/(?:icon-)/).test(target.getAttribute('class')) ? target.parentNode : target;
			},
			down: function () {
				if (WhutBB.e.target.getAttribute('data-type')) {
					return WhutBB.evt.delegate.button();
				}
				if (WhutBB.e.target.getAttribute('data-setting')) {
					return WhutBB.evt.delegate.settings.update();
				}
			},
			register: function (wbb) {
				return function (evt) { // context for _this_ is the container div.wbbbuttons
					// console.log('mouse.register/anon');
					WhutBB.e.set(evt, WhutBB.evt.mouse.target(evt.target), wbb);
					WhutBB.evt.mouse.down();
					WhutBB.e.clean();
				};
			}
		},
		key: {
			down: function () {
				this.fire(this.button());
			},
			letter: function () {
				return String.fromCharCode(WhutBB.e.current.which || WhutBB.e.current.keyCode).toLowerCase();
			},
			modifier: function () {
				if (WhutBB.e.current.ctrlKey && WhutBB.e.current.altKey) { return 'ctrl+alt'; }
				if (WhutBB.e.current.ctrlKey) { return 'ctrl'; }
				if (WhutBB.e.current.altKey) { return 'alt'; }
				return '';
			},
			button: function () {
				return WhutBB.e.whut.getButton(WhutBB.db.getShortcut(this.modifier(), this.letter()));
			},
			fire: function (button) {
				if (button) {
					WhutBB.e.current.preventDefault();
					// dom.click(button);
					WhutBB.e.target = button;
					WhutBB.evt.mouse.down();
				}
			},
			register: function (wbb) {
				return function (evt) {
					// console.log('key.register/anon');
					WhutBB.e.set(evt, this, wbb); // _this_ is a textarea
					WhutBB.evt.key.down();
					WhutBB.e.clean();
				};
			}
		}
	};

	/**
	 * Box Object (aka textarea stuff)
	 * 
	 * How it works:
	 *  WhutBB.box.select(textarea).insert(['{start}', '{end}']);
	 *
	 * An array is used because Tags parse to that data type.
	 *
	 * Result:
	 * <textarea>{start}{end}</textarea>
	 * 
	 * It's (more) magical when used in an event.
	 */
	WhutBB.box = {
		select: function (textarea) {
			this.textarea = textarea;
			WhutBB.box.range.data = this.range.get();
			return this;
		},
		range: {
			get: function () {
				// Todo abstract ie and standard methods
				return ie ? this.ie() : this.standard();
			},
			rdata: function (start, end, selection) {
				return { start: start, end: end, selection: selection };
			},
			ie: function () {
				WhutBB.box.textarea.focus(); // important here
				var ieRange = document.selection.createRange(),
					dup = ieRange.duplicate(),
					start,
					end,
					selection;
				dup.moveToElementText(WhutBB.box.textarea);
				dup.setEndPoint('EndToEnd', ieRange);

				start = dup.text.length - ieRange.text.length;
				end = start + ieRange.text.length;
				selection = ieRange.text.replace(/\r\n/g, '\n');
				if (end === 0 && start === 0) { // Push inserts to the end
					start = end = WhutBB.box.textarea.value.length;
				}
				// console.log('tx1 ' + ieRange.text, 'txs ' + dup.text, 'txt ' + ieRange.text.replace(/\r\n/g, '\n'), 'SST ' + start, 'SSE ' + end);
				ieRange = dup = null;
				return this.rdata(start, end, selection);
			},
			standard: function () {
				if (WhutBB.box.textarea.selectionStart < 0) { return; }
				if (WhutBB.box.textarea.selectionEnd > WhutBB.box.textarea.value.length) {
					WhutBB.box.textarea.selectionEnd = WhutBB.box.textarea.value.length;
				}
				var s = WhutBB.box.textarea.selectionStart || 0,
					e = WhutBB.box.textarea.selectionEnd || 0;
				return this.rdata(s, e, WhutBB.box.textarea.value.substring(s, e) || '');
			}
		},
		insert: function (tag) {
			var pre = WhutBB.box.textarea.value.substring(0, WhutBB.box.range.data.start) + tag[0],
				post = tag[1] + WhutBB.box.textarea.value.substring(WhutBB.box.range.data.end);
			WhutBB.box.textarea.value = [pre, WhutBB.box.range.data.selection, post].join('');
			WhutBB.box.selection(pre.length);
		},
		selection: function (start) {
			var r;
			WhutBB.box.textarea.focus();
			if (ie) {
				r = WhutBB.box.textarea.createTextRange();
				r.collapse(true);
				r.moveStart('character', start);
				r.moveEnd('character', WhutBB.box.range.data.selection.length);
				r.select();
			} else {
				WhutBB.box.textarea.setSelectionRange(start, start + WhutBB.box.range.data.selection.length);
			}
		}
	};

	/**
	 * WhutBBCode Settings Class
	 * Intended to be a singleton used within WhutBB.init()
	 *
	 * This class is used to store site configurations for WhutBBCode?
	 * Using these options, the script can create buttons, emoticons, etc.
	 *
	 * Effectively, without any settings, nothing really happens.
	 *
	 * The most important option is blueprint, which tells the script which
	 * buttons to create.
	 *
	 * The Panel class uses this blueprint to construct buttons, put them in the button
	 * panel, and attach them to WhutBB instances.
	 *
	 * All buttons that exist in WhutBB.db.buttons are stored as validButtons. The script
	 * uses validButtons to list available shortcuts to the user.
	 *
	 * To reiterate, options are the most important aspect of this class
	 *
	 * param @options object with the following (mostly optional) attributes
	 *
	 * if none is given, the script will try to find an appropriate match
	 * for the site.
	 *
	 * if no setting is found, the "generic" default options will be used
	 *
	 *  name: (String) [ default: '' ]
	 *    the website's name
	 *
	 *  link:
	 *    link to information about the site's BBCode or WhutBBCode? itself (default)
	 *
	 *  beneath: (Boolean) [ default: true ]
	 *    location to insert buttons, beneath or above the textarea
	 *
	 *  blueprint: (Array) [ default: [] ]
	 *    an array of arrays containing buttons to create
	 *
	 *    group buttons together to create a set of similiar types
	 *
	 *    example:
	 *
	 *      blueprint: [
	 *         ['b', 'i', 'u'], // a set of three buttons
	 *         ['shortcut', 'settings'] // a set of two
	 *      ]
	 *
	 *    buttons are then placed in the DOM in the following order
	 *    [b][i][u] [?][+]
	 *
	 *    each set is separated by a space
	 *
	 *  width: (Number) [ default: 430 ]
	 *    a width (in pixels) to set for the WhutBB.wrap so that buttons fit well
	 *
	 *  emoticonDir: [ default: '' ]
	 *    absolute or relative (to the current location) location to where emoticons reside
	 *    it should end in a slash (/)
	 *
	 *  emoticonMax: (Number) [ default: 39 ]
	 *    a limit of emoticons to create
	 *
	 *  emoticons: (String|Array) [ default: [['', '']] ] (a null emoticon)
	 *    - name of the object from WhutBB.db.emoticons[options.emoticons]
	 *      three possible options: gazelle, waffles, indie
	 *
	 *    - an array of arrays containing emoticons to create
	 *    
	 *    the sub-arrays are formed by the emoticon text and the name (and location) of the 
	 *    image to produce
	 *
	 *    example:
	 *      emoticons: [ [":)", "happy.png"], [":D", "grin.png"], [":(", "sad.png"] ]
	 *
	 *    these create images based on the emoticon directory (emoticonDir)
	 *    if the directory varies, it should be included
	 *
	 *      example:
	 *
	 *        [':D', 'some-other-dir/grin.png']
	 *
	 *    absolute paths are not supported unless emoticonDir is an empty string
	 *
	 *    To add emoticons to an existing object from WhutBB.db.emoticons, see
	 *    WhutBB.db.addEmoticons().
	 *
	 *  shortcuts: (Object) [ default: WhutBB.db.shortcuts ]
	 *    an object of objects that account for shotcut mapping, see "Keyboard Shortcuts"
	 *    part of the documentation
	 *
	 *    example:
	 *      shortcuts: {
	 *        ctrl: {
	 *          i: 'i'
	 *        },
	 *        'alt+ctrl': {
	 *          x: 'shotcuts'
	 *        }
	 *      }
	 *
	 */
	WhutBB.Settings = function Settings(options) {
		var def = WhutBB.db.sites[':default']();

		try {
			this.name = options.name || def.name;
			this.link = options.link || def.link;

			this.beneath = !!options.beneath;
			this.blueprint = options.blueprint || def.blueprint;
			this.width = options.width || def.width;

			this.emoticonDir = options.emoticonDir || def.emoticonDir;
			this.emoticonMax = options.emoticonMax || def.emoticonMax;
			this.emoticons = (typeof options.emoticons === 'string') ? WhutBB.db.emoticons[options.emoticons] : (options.emoticons || def.emoticons); // null emoticon

			this.shortcuts = options.shortcuts || WhutBB.db.shortcuts;
		} catch (e) {
			dom.oEach(def, function (name, setting) {
				this[name] = setting;
			}, this);
		}
		this.validButtons = {};
	};

	/**
	 * Button
	 *
	 * Generic button class that encapsulates data from
	 * WhutBB.db.buttons objects and creates a button element
	 *
	 * Do not use the constructor directly, use Button.create instead!
	 */
	WhutBB.Button = (function () {

		function Button(name) {
			this.name = name;
			this.data = WhutBB.db.buttons[name];
		}

		/**
		 * Button.create returns a Button or a Null button
		 * All possible buttons located at WhutBB.db.buttons
		 */
		Button.create = function (button) {
			if (WhutBB.db.buttons[button]) {
				return new Button(button);
			}
			return Button.Null;
		};

		/**
		 * Creates a button element and also validates it
		 */
		Button.prototype.make = function () {
			this.validate();
			return dom.dom('button', {
				className: 'whutbbutton',
				name: this.name,
				title: this.data.title,
				attr: {
					type: 'button',
					'data-type': this.data.type || 'button'
				}
			},  dom.dom('span', {
				className: 'icon-' + this.data.icon,
				txt: this.data.display || this.name,
				attr: {
					'data-txt': this.data.display || this.name,
					'data-toggle': this.data.toggle || ''
				}
			}));
		};

		/**
		 * Validates a button by adding it to WhutBB.config.validButtons
		 */
		Button.prototype.validate = function () {
			WhutBB.config.validButtons[this.name] = true;
			return this;
		};

		/**
		 * Space creates a single-spaced text node.
		 *
		 * Both Space and Null objects are intended to mimic Buttons
		 * without using any real inheritance
		 */
		Button.Space = {
			make: function () {
				return document.createTextNode(' ');
			},
			validate: function () {
				return this;
			},
			data: {}
		};

		/**
		 * Null creates a simple text node.
		 * It's used when there is no real button in the db.
		 */
		Button.Null = {
			make: function () {
				return document.createTextNode('');
			},
			validate: function () {
				return this;
			},
			data: {}
		};

		Button.emoticon = function (emoticonData) {
			return dom.dom('img', {
				title: emoticonData[0],
				alt: emoticonData[0],
				src: WhutBB.config.emoticonDir + emoticonData[1],
				attr: {
					'data-type': 'emoticon'
				}
			});
		};

		Button.emoticonLoader = function () {
			return dom.dom('div', {
				className: 'emoticonLoader',
				name: 'emoticonLoader',
				txt: 'View all emoticons.',
				title: 'Loads all emoticons.',
				attr: {
					'data-type': -2
				}
			});
		};

		return Button;

	}());

	/**
	 * Panel Class
	 * Generates all the panels used in the script.
	 * 
	 * A panel is an element intended to be within a WhutBBInstance.wrap div.
	 *
	 * eg:
	 *	{ div (WhutBBInstance.wrap)
	 *   [ wbb link panel   ]
	 *   [ buttons panel    ]
	 *   [ settings panel*  ]
	 *   [ shortcuts panel* ]
	 *	}
	 *
	 * *Global panels
	 * 
	 * Use Panel.factory, instead of new Panel().
	 *
	 * Global/public panels are static and part of the Panel object,
	 * not a WhutBB instance. They are typically transient, meaning that
	 * they appear in different WhutBB.wraps depending on the toggle state
	 *
	 * For example, emoticons are appended to WBB instace 1 when its
	 * emoticon button is clicked, but once WBB instace 2's emoticon button
	 * is clicked, the emoticon panel will be appended to WBB 2's wrap.
	 *
	 * This aliviates the need to generate each panel separately for every instance.
	 * This means that if there are 100s of emoticons, they will only be created once
	 * and moved around as needed, instead of creating 100s of emoticons per instance.
	 * 
	 * Private panels are stored in the Panel.set object.
	 * Once panels are initially created within Panel.construct(),
	 * private panels can be copied to (copyTo) a WhutBB instance.
	 *
	 * The only two private panels are Button and Link, because they
	 * are not meant to be transient. Buttons are needed at every instance.
	 *
	 */
	WhutBB.Panel = (function () {

		/**
		 * An element is part of the instance
		 */
		function Panel(element) {
			this.element = element;
		}

		/**
		 * A set of private panels
		 */
		Panel.set = {};

		/**
		 * A set of global panels
		 */
		Panel.global = {};

		/**
		 * Panel.factory creates both global and private panels
		 *
		 * @param name for the panel
		 * @param element to encapsulate
		 * @param priv true for private panels, otherwise global
		 */
		Panel.factory = function (name, element, priv) {
			if (priv) {
				if (!Panel.set[name]) {
					Panel.set[name] = new Panel(element);
				}
				return Panel.set[name];
			}
			if (!Panel.global[name]) {
				Panel.global[name] = new Panel(element);
			}
			return Panel.global[name];
		};

		/**
		 * Creates and initializes every necessary panel
		 */
		Panel.construct = function () {
			Panel.factory('link', dom.dom('div', {className: 'wbblink' + (WhutBB.user.settings.link ? '' : ' wbbhide') },
				dom.dom('a', {href: WhutBB.config.link, title: 'Version 3.0', txt: 'WhutBBCode?'})), true);
			Panel.factory('button', dom.dom('div', {className: 'wbbbuttons'}), true);

			// Global Panels
			Panel.factory('shortcut', dom.dom('ul', {className: 'wbbshortcut wbbhide'}));
			Panel.factory('emoticon', dom.dom('div', {className: 'wbbemot wbbhide'}));
			Panel.factory('settings', dom.dom('ul', {className: 'wbbset wbbhide'}, null, document.body));
			Panel.factory('console', dom.dom('div', {className: 'wbbcon', txt: ''}));
			Panel.attach.fill();
		};

		/**
		 * Copies private panels to a WhutBB Instance
		 */
		Panel.copyTo = function (wbbInst) {
			wbbInst.panels = {};
			dom.oEach(Panel.set, function (name, panel) {
				wbbInst.panels[name] = panel.element.cloneNode(true);
				wbbInst.wrap.appendChild(wbbInst.panels[name]);
			});
		};

		/**
		 * Prints a message to the console
		 */
		Panel.message = function (text, time) {
			var el = WhutBB.Panel.global.console.element;
			el.innerHTML = text;
			window.setTimeout(function () {
				el.innerHTML = '';
			}, isNaN(+time) ? 2500 : time);
		};

		Panel.attach = {
			fill: function () {
				// fills the panels appropriertly
				this.buttons();
				this.emoticons(-1, Math.min(WhutBB.config.emoticons.length,
					WhutBB.config.emoticonMax));
				this.settings();
				this.shortcuts();
			},
			buttons: function () {
				var f = document.createDocumentFragment();
				dom.aEach(WhutBB.config.blueprint, function (set) {
					dom.aEach(set, function (name) {
						f.appendChild(WhutBB.Button.create(name).make());
					});
					f.appendChild(WhutBB.Button.Space.make());
				});
				Panel.set.button.element.appendChild(f);
				f = null;
			},
			emoticons: function (i, max) {
				var f = document.createDocumentFragment();
				while (++i < max) {
					f.appendChild(WhutBB.Button.emoticon(WhutBB.config.emoticons[i]));
				}
				// attach the div that loads all emoticons if required
				if (max !== WhutBB.config.emoticons.length
						&& WhutBB.config.emoticons.length > WhutBB.config.emoticonMax) {
					f.appendChild(WhutBB.Button.emoticonLoader());
				}
				Panel.global.emoticon.element.appendChild(f);
				f = null;
			},
			settings: function () {
				var list = [];
				dom.oEach(WhutBB.user.options, function (name, data) {
					list.push('<li><label title="' + data.title + '" ><input type="checkbox" data-setting="true" name="' + name + '" '
						+ (WhutBB.user.settings[name] ? 'checked="checked" ' : '') + '/>' + data.txt + '</label></li>');
				});
				Panel.global.settings.element.innerHTML = list.join('');
				Panel.global.settings.element.appendChild(Panel.global.console.element);
			},
			shortcuts: function () {
				dom.oEach(WhutBB.config.shortcuts, function (key, shortcuts) {
					dom.oEach(shortcuts, function (letter) {
						if (WhutBB.config.validButtons[shortcuts[letter]]) { // Checks if the site uses this button
							Panel.global.shortcut.element.appendChild(dom.dom('li', {
								innerHTML: [
									key.toUpperCase(),
									'+',
									letter.toUpperCase(),
									'<br>',
									WhutBB.db.buttons[shortcuts[letter]].title
								].join('')
							}));
						}
					});
				});
			}
		};

		return Panel;

	}());

	/**
	 * Tag Class
	 * Creates a tag of given name
	 * 
	 * Use Tag.get(), not new Tag()!
	 * Tag.get() uses lazy loading, and stores all new
	 * tags within Tags.tags[]
	 * 
	 * A tag's type generates the appropriate parsing
	 * All tags parse as a two-index array
	 *
	 * If a tag does not require an endpoint (matching tag),
	 * an empty string is required
	 * 
	 *   ['[tag]', '[/tag]']
	 *   ['open', '']
	 *   ['', 'close']
	 * 
	 * Example, insert a tag directly into a textarea
	 *   bTag = Tag.get('b');
	 *   bTag.insertTo(someTextarea);
	 * 
	 * PS: Note the use of WhutBB.box within insertTo().
	 */
	WhutBB.Tag = (function () {

		function Tag(text) {
			Tag.tags[text] = this;
			this.button = WhutBB.db.buttons[text];
			this.tag = this.button.tag || text;
		}

		// Stores new Tags 
		Tag.tags = {};

		/**
		 * Gets a tag by a name.
		 * Finds a tag in the tags object or creates a new tag.
		 * Returns an update()'d tag
		 */
		Tag.get = function (name) {
			if (WhutBB.db.buttons[name]) {
				return (Tag.tags[name] || new Tag(name)).update();
			}
		};

		/**
		 * Each button has a type which is used as the parsing method
		 */
		Tag.types = {
			0: function () { // Basic tag [tag][/tag]
				return ['[' + this.tag + ']', '[/' + this.tag + ']'];
			},
			1: function () { // [tag=option][/tag]
				return ['[' + this.tag + '=' + this.option + ']', '[/' + this.tag + ']'];
			},
			2: function () { // [tag=]
				return ['[' + this.tag + '=', ']'];
			},
			3: function () { // List [*] or [#]
				var j = [], li = WhutBB.box.range.data.selection.split('\n');

				if (li.length > 1) {
					dom.aEach(li, function (item) {
						j.push('[' + this.tag + ']' + item);
					}, this);
					WhutBB.box.range.data.selection = j.join('\n');
					return ['', ''];
				}

				return ['[' + this.tag + ']', ''];
			},
			4: function () { // used for custom tags
				if (typeof this.tag === 'string') {
					return [this.tag, this.tag];
				}
				return [this.tag[0], this.tag[1]];
			}
		};

		Tag.prototype.toString = function () {
			return [this.tag, this.option, this.type].join(' ');
		};

		Tag.prototype.insertTo = function (textarea) {
			WhutBB.box.select(textarea).insert(this.parse());
		};

		/**
		 * Parse uses some JavaScript magic to get the function
		 * based on the tag type, and call it with _this_ tag's
		 * instance
		 */
		Tag.prototype.parse = function () {
			return Tag.types[this.type].call(this);
		};

		Tag.prototype.findOption = function () {
			// console.log('find option');
			return this.button.type === 1 && this.optionText();
		};

		Tag.prototype.defaultText = function () {
			return this.button.placeholder || this.button.val || '';
		};

		Tag.prototype.placeholderText = function () {
			return this.button.placeholder ? ('\n(Default text [' + this.button.placeholder + '] will be removed automatically.)') : '';
		};

		Tag.prototype.optionText = function () {
			if (!WhutBB.e.macro && WhutBB.user.settings.prompt && this.button.noPrompt !== true) {
				this.option = window.prompt(this.button.prompt + this.placeholderText(), this.defaultText());
			} else {
				this.option = this.defaultText();
			}
			if (this.option === this.button.placeholder) {
				this.option = false;
			}
			return true;
		};

		Tag.prototype.findType = function () {
			return this.option === false ? 0 : this.button.type || 0;
		};

		Tag.prototype.update = function () {
			this.findOption();
			this.type = this.findType();
			return this;
		};

		return Tag;

	}());

	WhutBB.init();
	WhutBB.factory();
}());