· 6 years ago · Jan 24, 2020, 02:48 PM
1// ==UserScript==
2// @id WhutBBCode
3// @name WhutBBCode?
4// @namespace hateradio)))
5// @author hateradio
6// @version 6.5
7// @description This is a cross-browser BBCode helper. It works with Gazelle and other sites . . . CDs and waffles, mmm.
8// @homepageURL https://greasyfork.org/en/scripts/1024-whutbbcode
9// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAEvNJREFUeNrkW+uPJcdVP9WP+56Ze+e1M7v22tnxZrO7juzMJt6sQfAFFCN/AQn+AnAeCkgWFtiO+YgUvgakIBHxgQTCI84HY2JQTKQEFJOXFcdsTLKOnPWOd2Z3dmfu+9GvKs6pqu6u27fvzB1WQhq4mlL33O7qrvOr8/idU3XZyy//Dfx//jiZ/xk2K3POdDuOH6Eb10fInI8BYOvmYitjK2Ar5oB03AAIsfm6DbEF2CLdEuFiwSvY6tgWsTWwVTUQ9jHUAqGFJMF72FrY9rC1sQ30PZFjqDjN+gq209gexLauwSgYZnHcPlwDQMJvY3sX2w1su1ozEg0gIeexncR24b5TZz52//1nPlIu1+rMshzDZI7hh0EY+IPt7a3tt3929Us46aE2BS/WAEvbOgFwqtFYuXLu3CNPKK0QIASX6iHAcB0stQeR40WF8SVj+n82eS3pEPeDyfPpYqXPTQaSHZR8pwDHcSvV6sJDPCw+PRjeuVMsFZqu65IpeI7hDOewrZ44cf+HU+HV00TyJqEk4vjd2MhTCUUGlfgZ6s9EThgDZ/od+ivG8pE1HipiZIUhtWAZhPRj5DkHy7Ibd3dbT1Yq7s9X11ffiwVn+kg+oMbAKiTCC67fJ3KkQnFo4FwJz5jQ55lx0z0JKFzdGz8zEUI/S3/HhBif3bRrOtO6XzIpsq8xPpG+n865/mo4GH5g0G2ftWz7reXVpaZj4EWevoAqrxweCS/E2MyMzVwCTKwlU1yxvsA5ly3i+rnGNRqkJB2WlTSWpwVi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O139kWv2x3yiLcwHI9iDYh/XEgacDP0gzd42H8pHAVPIEorlmVb6T6bTE4xbVvetHusA5br2SHPzAveB9wbb4iIAg6h70O/2xGDXt9D3d/Cm96xG3Y/9gGxEyREmqVy6U3f82vddtsNw+hRRr8mY+w4/nBSRwEuMAxGaPVe4Ifvokm/6rrOm/P1+YHpA4SOAnxxZdGrblW+2W62dhCI8+hA1qkIh/ZGmsCOieBxNZQcIEf5fXSCTXSI76BCX8VQuHXpymaU5QGxKUQPbz582/P8vVs3b73hDUdzUcQdOKY/oI7CEH05bTaEEZp0r9vpDj/+zFPioFxAhkWNkKed4//Zz38LMAAuaRY9Jc0fWAAAAABJRU5ErkJggg==
10// @screenshot https://raw.githubusercontent.com/hateradio/wbb/master/screenshot.png
11// @grant GM_Log
12
13// Not Gazelles
14
15// @include http*://*waffles.ch/forum/*
16// @include http*://*waffles.ch/details.php*
17// @include http*://*waffles.ch/my.php*
18// @include http*://*waffles.ch/bbcode.php*
19// @include http*://*waffles.ch/forums.php*
20// @include http*://*waffles.ch/upload.php*
21
22// @include http*://*cinemageddon.net/*
23
24// Beautiful Gazelles
25
26// @include http*://*redacted.ch/*
27// @include http*://*gazellegames.net/*
28// @include http*://*notwhat.cd/*
29// @include http*://*orpheus.network/*
30// @include http*://*indietorrents.com/*
31// @include http*://*brokenstones.club/*
32// @include http*://*bs.lunartype.com/*
33// @include http*://*hydra.zone/*
34// @include http*://*tehconnection.eu/*
35// @include http*://*oppaiti.me/*
36// @include http*://*morethan.tv/*
37// @include http*://*alpharatio.cc/*
38// @include http*://*efectodoppler.pw/*
39// @include http*://*secret-cinema.pw/*
40
41// RIP :(
42
43// @include http*://*what.cd/*
44
45// !update Dec 20 2018
46// !since Sep 30 2010
47// 2010+, hateradio
48// Please don't modify or edit my script and re-release it. D:
49// Send me a message if you want something modified.
50
51// ==/UserScript==
52
53/**
54### Updates
55
56#### 6
57
58 * removes apl, adds orph
59
60#### 5.3
61 * adds new BB code tags for RED (`[pad]`, `[php]`)
62 * adds a line break before list item tags
63 * makes sure to only add unique emoticons
64
65#### 5.2
66 * changes JSON version from string to int
67
68#### 5.1.1
69 * checks that site configuration exists
70 * adds grunt and node package files
71
72#### 5.1
73
74 * removes unnecessary site configurations
75
76#### 5
77
78 * simplifies Gazelle site inclusion, only requires to use @include
79
80// #Updates
81 */
82
83(function () {
84 'use strict';
85
86 // helpers
87 var dom, ie, strg, update;
88
89 // S T O R A G E HANDLE
90 strg = {
91 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; } }()),
92 read: function (key) { return this.on ? JSON.parse(localStorage.getItem(key)) : false; },
93 save: function (key, dat) { return this.on ? !localStorage.setItem(key, JSON.stringify(dat)) : false; },
94 wipe: function (key) { return this.on ? !localStorage.removeItem(key) : false; },
95 zero: function (o) { var k; for (k in o) { if (o.hasOwnProperty(k)) { return false; } } return true; },
96 grab: function (key, def) { var s = strg.read(key); return strg.zero(s) ? def : s; }
97 };
98
99 ie = !document.body.addEventListener && document.selection;
100
101 // M I S C HANDLE
102 dom = {
103 // a simple list iterator function for arrays, nodelists, etc
104 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; } } },
105 // a simple object-type iterator | todo reverse cb order
106 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; } } } },
107 dom: function (name, attr, child, parent) {
108 // dom element creator
109 // attr is an object of attributes to apply
110 // a child node to attach to this element
111 // a parent node for this element
112 var e = document.createElement(name);
113 if (attr.txt) {
114 e.appendChild(document.createTextNode(attr.txt));
115 delete attr.txt;
116 }
117 dom.oEach(attr, function (key, data) {
118 if (typeof data === 'object') {
119 dom.oEach(data, function (name, value) {
120 if (key === 'attr') {
121 e.setAttribute(name, value);
122 } else {
123 e[key][name] = value;
124 }
125 });
126 } else {
127 e[key] = data;
128 }
129 });
130 if (child) { e.appendChild(child); }
131 if (parent) { parent.appendChild(e); }
132 return e;
133 },
134 click: (function () {
135 var e;
136
137 if (ie) {
138 e = document.createEventObject();
139 return function (el) { return el && el.fireEvent('onclick', e); };
140 }
141
142 return function (el) {
143 e = document.createEvent('MouseEvents');
144 e.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
145 return el && !el.dispatchEvent(e);
146 };
147
148 }()),
149 evt: function (el, ev, cb, cap) {
150 if (!ie) {
151 return el.addEventListener(ev, cb, !!cap);
152 }
153 return el.attachEvent('on' + ev, function (e) {
154 e.currentTarget = e.target = e.srcElement;
155 e.preventDefault = function () { e.returnValue = false; };
156 e.stopPropagation = function () { e.cancelBubble = true; };
157 cb.call(el, e);
158 e = null;
159 });
160 },
161 top: document.head || document.body,
162 css: function (t) {
163 if (!this.style) {
164 this.style = document.createElement('style');
165 this.style.type = 'text/css';
166 this.top.appendChild(this.style);
167 }
168 if (ie) {
169 this.style.cssText += t;
170 } else {
171 this.style.appendChild(document.createTextNode(t + '\n'));
172 }
173 },
174 js: function (t) {
175 var j = document.createElement('script');
176 j.type = 'text/javascript';
177 j[/^https?\:\/\//i.test(t) ? 'src' : 'textContent'] = t;
178 this.top.appendChild(j);
179 },
180 observer: (function () {
181 var M = window.MutationObserver || window.WebKitMutationObserver;
182
183 return M ? function (element, callback) {
184 var obs = new M(function (mutations) {
185 console.log(mutations);
186 if (mutations[0].addedNodes.length > 0) {
187 callback();
188 }
189 });
190 obs.observe(element, {childList: true});
191 } : null;
192 }())
193 };
194
195 function obs (id) {
196 var content = document.getElementById('content' + id);
197 if (!content.hasAttribute('observed')) {
198 console.log('adding observer to', content);
199 dom.observer(content, function () {
200 console.log('observer!', id);
201 var txt = document.getElementById('editbox' + id);
202
203 if (!txt.hasAttribute('data-wbb')) {
204 txt.setAttribute('data-wbb', id);
205 WhutBB.create(txt, true);
206 }
207 });
208 content.setAttribute('observed', true);
209 }
210 }
211
212 // U P D A T E HANDLE
213 update = {
214 name: 'WhutBBCode?',
215 version: 6500,
216 key: 'ujs_WBB_UPDT_HR',
217 urij: 'https://hateradio.github.io/wbb/wbb.json',
218 page: 'https://greasyfork.org/en/scripts/1024-whutbbcode',
219 interval: 5,
220 day: (new Date()).getTime(),
221 time: function () { return new Date(this.day + (1000 * 60 * 60 * 24 * this.interval)).getTime(); },
222 notification: function (j) {
223 if (this.version < j.version) {
224 strg.save(this.key, { date: this.time(), version: j.version, page: j.page });
225 this.link();
226 }
227 },
228 link: function () {
229 this.csstxt();
230
231 var a = document.createElement('a'), b = strg.read(this.key);
232 a.href = b.page || this.page;
233 a.id = 'userscriptupdater2';
234 a.title = 'Update now.';
235 a.target = '_blank';
236 a.textContent = 'An update for ' + this.name + ' is available.';
237 a.addEventListener('click', function () { this.style.display = 'none'; }, false);
238 document.body.appendChild(a);
239 },
240 xhr: function () {
241 var x = new XMLHttpRequest();
242 x.addEventListener('load', function () { update.notification(JSON.parse(this.responseText)); }, false);
243 x.open('get', update.urij, true);
244 x.send();
245 },
246 check: function (opt) {
247 if (!strg.on) { return; }
248 if (window.chrome && window.chrome.extension) { return; }
249 var stored = strg.read(this.key), page;
250
251 if (opt || !stored || stored.date < this.day) {
252 page = (stored && stored.page) || this.page;
253 strg.save(this.key, {date: this.time(), version: this.version, page: page});
254 this.xhr();
255 } else if (this.version < stored.version) {
256 this.link();
257 }
258 },
259 csstxt: function () {
260 if (!this.pop) { this.pop = true; dom.css('#userscriptupdater2,#userscriptupdater2:visited{box-shadow:1px 1px 6px #7776;border-bottom:3px solid #d65e55;cursor:pointer;color:#555;font-family:sans-serif;font-size:12px;font-weight:700;text-align:justify;position:fixed;z-index:999999;right:10px;top:10px;background:#ebebeb url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOTguODQ4NTMgMTk5LjM4MzA3Ij48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNC4yNzYgLTE2LjM2NykiPjxjaXJjbGUgY3g9IjEwNC4zMjEiIGN5PSIxMTYuMzI3IiByPSI5OC4yNzQiIGZpbGw9IiNkNjVlNTUiLz48cGF0aCBmaWxsPSIjZTljZTAyIiBzdHJva2U9IiNlOWM4MDIiIHN0cm9rZS13aWR0aD0iMTYuNyIgZD0iTTE2Ni40NSAxNTcuMzEySDQxLjg5bDMxLjE0LTUzLjkzNSAzMS4xNC01My45MzUgMzEuMTM3IDUzLjkzNXoiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48dGV4dCB4PSI4NS42NDMiIHk9IjE1MS44NjYiIGZpbGw9IiNkNjVlNTUiIHN0cm9rZS13aWR0aD0iMS40NzciIHN0eWxlPSJsaW5lLWhlaWdodDoxLjI1Oy1pbmtzY2FwZS1mb250LXNwZWNpZmljYXRpb246J0Jvb2sgQW50aXF1YSciIGZvbnQtd2VpZ2h0PSI0MDAiIGZvbnQtc2l6ZT0iNTkuMDg4IiBmb250LWZhbWlseT0iQm9vayBBbnRpcXVhIiBsZXR0ZXItc3BhY2luZz0iMCIgd29yZC1zcGFjaW5nPSIwIj48dHNwYW4geD0iODUuNjQzIiB5PSIxNTEuODY2IiBzdHlsZT0iLWlua3NjYXBlLWZvbnQtc3BlY2lmaWNhdGlvbjonQm9vayBBbnRpcXVhJyIgZm9udC13ZWlnaHQ9IjcwMCIgZm9udC1zaXplPSIxMjYuMDU0Ij4hPC90c3Bhbj48L3RleHQ+PC9nPjwvc3ZnPg==) no-repeat 10px center;background-size:40px;padding:0 20px 0 60px;height:55px;line-height:55px}#userscriptupdater2:hover,#userscriptupdater2:visited:hover{color:#b33a3a !important;border-color:#ce4b30}'); }
261 }
262 };
263 update.check();
264
265 /**
266 * WhutBB Class
267 * The principal class should not be used directly,
268 * use WhutBB.create() instead
269 *
270 * Uses a textarea as a reference to attach elements and events
271 *
272 * @param textarea to use
273 * @param id to place on the textarea
274 */
275 function WhutBB(textarea, id) {
276 this.textarea = textarea;
277 this.textarea.className += ' wbbarea';
278 this.textarea.setAttribute('data-wbb', id);
279 this.id = id;
280 this.wrap = dom.dom('div', { className: 'wbbcode ' + WhutBB.$.data.getWrapClass() });
281
282 WhutBB.Panel.copyTo(this);
283 this.buttonList = this.makeButtonList();
284
285 this.insert(WhutBB.config.beneath);
286 this.events();
287 }
288
289 window.WhutBB = WhutBB;
290
291 WhutBB.mac = /(?:^mac)/i.test(navigator.platform);
292
293 // Array.from(document.querySelectorAll('script')).filter(function (e) { return e.src.includes('global.js?v='); }).length > 0
294 WhutBB.gazelle = document.querySelector('div#wrapper > div#content > div.thin');
295 WhutBB.gazelleBlacklist = /(?:\/logchecker)|(?:user.php\?action=notify)|(?:tools.php\?action=clear_cache)/i;
296
297 WhutBB.set = {};
298
299 /**
300 * The factory gets all textareas on the page and creates new WhutBB instances
301 * for textareas that are not read-only or disabled
302 */
303 WhutBB.factory = function () {
304 dom.aEach(document.getElementsByTagName('textarea'), function (textarea) {
305 if (!textarea.disabled && !textarea.readOnly) {
306 WhutBB.create(textarea);
307 }
308 });
309 };
310
311 /**
312 * Creates a WhutBBCode? instance for a textarea
313 * Ignores textareas that contain the class noWhutBB
314 *
315 * Stores reference in WhutBB.set
316 *
317 * @param textarea to use
318 * @param force forces the creation of a new instance
319 */
320 WhutBB.create = function (textarea, force) {
321 if (!WhutBB.$.data.ignore.test(textarea.getAttribute('class'))) {
322 var id = WhutBB.id(textarea);
323 if (!WhutBB.set[id] || force === true) {
324 WhutBB.set[id] = new WhutBB(textarea, id);
325 }
326 return WhutBB.set[id];
327 }
328 };
329
330 /**
331 * Locates or returns a unique ID
332 * @param textarea to use
333 */
334 WhutBB.id = function (textarea) {
335 var dat = textarea.getAttribute('data-wbb');
336 if (dat && dat.length > 0) {
337 return dat;
338 }
339 return Math.random().toString(32);
340 };
341
342 /**
343 * Inserts the buttons beneath or above a textarea
344 */
345 WhutBB.prototype.insert = function (beneath) {
346 var node = beneath ? this.textarea.nextSibling : this.textarea;
347 this.textarea.parentNode.insertBefore(this.wrap, node);
348 };
349
350 // WhutBB.prototype.update = function (textarea) {
351 // // update the textarea
352 // this.textarea = textarea;
353 // // update the wrap
354 // this.insert(WhutBB.config.beneath);
355 // // update the events if the previous elements are different
356 // this.events();
357 // };
358
359 /**
360 * Attaches event handlers
361 */
362 WhutBB.prototype.events = function () {
363 var type = (typeof document.documentElement.style.MozAppearance === 'string') ? 'keypress' : 'keydown';
364 dom.evt(this.textarea, type, WhutBB.evt.key.register(this));
365 dom.evt(this.wrap, 'click', WhutBB.evt.mouse.register(this));
366 };
367
368 /**
369 * Hides this instance's elements
370 */
371 WhutBB.prototype.hide = function () {
372 this.wrap.className += ' wbbhide';
373 };
374
375 /**
376 * Shows this instance's elements
377 */
378 WhutBB.prototype.show = function () {
379 this.wrap.className = this.wrap.className.replace(/(?: wbbhide)/g, '');
380 };
381
382 /**
383 * Returns a button (if any)
384 * @param name of the button to get
385 */
386 WhutBB.prototype.getButton = function (name) {
387 return this.buttonList[name];
388 };
389
390 /**
391 * Builds a list of DOM buttons for referencing
392 * Used for keyboard shortcuts
393 */
394 WhutBB.prototype.makeButtonList = function () {
395 var list = {};
396 dom.aEach(this.panels.button.getElementsByTagName('button'), function (el) {
397 list[el.name] = el;
398 });
399 return list;
400 };
401
402 // WhutBB.$ is a collection of misc functions and storage
403 // IMPORTANT: To add a new site, add a regular expression to the "web" array
404 WhutBB.$ = {
405 data: {
406 ignore: /(?:\b(?:noWhutBB)\b)/i, // Ignore textareas with a CSS class of "noWhutBB"
407 web: [
408 [':test', /^$|^localhost$/],
409 ['red', /(?:redacted)\.ch/],
410 ['notwhatcd', /(?:notwhat)\.cd/],
411 ['gazellegames', /(?:gazellegames)\.net/],
412 ['orpheus', /(?:orpheus)\.network/],
413 ['bs', /(?:bs\.lunartype)\.com/],
414 ['waffles', /(?:waffles\.ch)/],
415 ['indietorrents', /(?:indietorrents\.com)/],
416 ['oppaiti', /(?:oppaiti\.me)/]
417 // ['what', /(?:what)\.cd/]
418 // /(?:(last)(?:fm)?\.fm)/,
419 ],
420 wrapClasses: ['wbbimgless', 'wbbimg'], // Displays text or icons on buttons
421 getWrapClass: function () {
422 return this.wrapClasses[Number(WhutBB.user.settings.icon)];
423 },
424 glyph: { // http://twitter.github.io/bootstrap/2.3.2/assets/img/glyphicons-halflings.png http://twitter.github.io/bootstrap/assets/img/glyphicons-halflings.png
425 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/8V9VHt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RS+c6zxjRNHxH8R0QQxB0qvkEQcsrS/T/yqj6FntAqcrQxpYLsVsw+DXt8P2x/wdFm3wBeW40TQAAAABJRU5ErkJggg=='
426 },
427 css: function (o) { // bootstrap icons first
428 o = '[class^=icon-],[class*=" icon-"]{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}';
429 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 !important;font-size:11px;font-family:Tahoma, sans-serif;margin:auto;padding:3px}.wbbcode div{text-align:center !important}.sidebar .wbbcode {width: 100% !important;}.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;margin:3px;padding:2px 3px}* html .wbbshortcut li{display:inline}.wbbshortcut li.wbbnotes{width: 95%;height: auto;}.wbbshortcut li strong {font-weight:bold;border:1px solid #DEDEDE;padding:0 3px;background:#f3f3f3;border-radius:3px;}.wbbhide,.hidden.wbbarea{display:none !important}';
430 }
431 },
432 findSite: function () {
433 var website = WhutBB.gazelle ? ':gazelle' : ':generic';
434 dom.aEach(this.data.web, function (site) {
435 if (site[1].test(document.domain) && WhutBB.db.sites[site[0]]) {
436 website = site[0];
437 return false;
438 }
439 });
440 return website;
441 }
442 };
443
444 /**
445 * The WhutBBCode? initializer
446 *
447 * @param config, see WhutBB.Settings
448 *
449 * example:
450 *
451 * WhutBB.init({
452 * emoticonDir: 'https://ssl.what.cd/static/common/smileys/',
453 * emoticons: WhutBB.db.emoticons.gazelle.slice(0, 4),
454 * blueprint: [
455 * ['b', 'i', 'u', 's'], ['code'],
456 * ['color', 'size'], ['*'],
457 * ['url', 'img'], ['quote'],
458 * ['erase'], ['emoticon', 'shortcut', 'settings']
459 * ]
460 * });
461 *
462 */
463 WhutBB.init = function (config) {
464 if (WhutBB.gazelle && WhutBB.gazelleBlacklist.test(document.location.href)) {
465 console.log('WhutBBCode?: Will not run in ' + RegExp.lastMatch + '!');
466 return;
467 }
468
469 WhutBB.config = new WhutBB.Settings(config || WhutBB.db.getSiteSettings(WhutBB.$.findSite()));
470 try {
471 console.info('WhutBBCode? mode ' + WhutBB.config.name);
472 console.log(WhutBB.config);
473 } catch (e) {}
474
475 WhutBB.user.load();
476 dom.css(WhutBB.$.data.css());
477 WhutBB.db.setupShortcutMap();
478 WhutBB.Panel.construct();
479
480 if (WhutBB.gazelle) {
481 dom.evt(document.getElementById('content'), 'click', WhutBB.evt.delegate.edit);
482 if (document.getElementById('messageform')) {
483 dom.evt(document.getElementById('messageform'), 'click', WhutBB.evt.delegate.inbox);
484 }
485
486 if (document.getElementById('type')) {
487 dom.evt(document.getElementById('type'), 'change', WhutBB.evt.delegate.report);
488
489 window.setTimeout(function () {
490 WhutBB.factory();
491 return WhutBB.set[RegExp.lastParen].show();
492 }, 500);
493 }
494 }
495 };
496
497 /**
498 * Settings storage management
499 * Uses localStorage to store a user's settings
500 *
501 * Sends an appropriate message when settings are saved or not
502 *
503 * All settings are stored in the options object. These are
504 * also used in the Panel class, which generates check boxes per option.
505 */
506 WhutBB.user = {
507 message: [
508 'Settings failed to save. D:',
509 'Settings saved. :D'
510 ],
511 options: {
512 prompt: {
513 txt: 'Prompts',
514 title: 'Show browser prompts.',
515 value: false
516 },
517 icon: {
518 txt: 'Icons',
519 title: 'Show icons.',
520 value: false
521 },
522 link: {
523 txt: 'WhutBBCode? Link',
524 title: 'Show WhutBBCode? link',
525 value: true
526 }
527 },
528 load: function () {
529 this.set(strg.grab('wbb3', this.defaults()));
530 // console.log('load', this.settings);
531 },
532 set: function (settings) {
533 this.settings = this.validate(settings);
534 },
535 save: function (settings) {
536 WhutBB.Panel.message(this.message[Number(strg.save('wbb3', this.validate(settings)))]);
537 return strg.on ? this.load() : this.set(settings);
538 },
539 validate: function (settings) { // returns only valid settings that exist in options
540 var valid = {};
541 dom.oEach(this.options, function (name) {
542 valid[name] = !!settings[name];
543 });
544 return valid;
545 },
546 defaults: function () {
547 var defaults = {};
548 dom.oEach(this.options, function (name, options) {
549 defaults[name] = options.value;
550 });
551 return defaults;
552 },
553 settings: {}
554 };
555
556 /**
557 * Psuedo-Database
558 * Contains all sites, buttons, emoticons, shortcuts
559 *
560 * Shortcuts are sorted by modifier key (ctrl/alt/ctrl+alt)
561 * Modifier properties (a single letter) should correspond to a keyboard key letter
562 * and the value (text) to a button name (WhutBB.db.button[text])
563 * Don't use CTRL with W, T, N, O (Chromium/IE Bugs)
564 *
565 * Special Note: Meta key (such as that on a Mac) is aliased to CTRL,
566 * pressing either key returns the same result
567 *
568 */
569 WhutBB.db = {
570 sites: {
571 ':default': function () {
572 return {
573 name: '',
574 link: 'https://greasyfork.org/en/scripts/1024-whutbbcode',
575 beneath: true,
576 blueprint: [],
577 width: 430,
578 emoticonDir: '',
579 emoticonMax: 39,
580 emoticons: [['', '']], // null emoticon
581 shortcuts: WhutBB.db.shortcuts
582 };
583 },
584 ':generic': function () {
585 return {
586 emoticonDir: 'https://orpheus.network/static/common/smileys/',
587 emoticons: WhutBB.db.emoticons.gazelle.slice(0, 4),
588 blueprint: [
589 ['b', 'i', 'u', 's'], ['code'],
590 ['color', 'size'], ['*'],
591 ['url', 'img'], ['quote'],
592 ['erase'], ['emoticon', 'shortcut', 'settings']
593 ]
594 };
595 },
596 ':test': function () { // for tests
597 return {
598 emoticonDir: 'https://orpheus.network/static/common/smileys/',
599 emoticons: WhutBB.db.emoticons.gazelle,
600 blueprint: [
601 ['b', 'i', 'u', 's'], ['important', 'heading', 'code'],
602 ['color', 'size'], ['gz_left', 'gz_center', 'gz_right'],
603 ['#', '*'], ['url', 'img'], ['quote', 'pre', 'gz_src'], ['hide', 'mature'],
604 ['torrent', 'artist', 'user', 'wiki', 'gz_rule'], ['tex', 'plain'],
605 ['erase'], ['emoticon', 'shortcut', 'settings']
606 ]
607 };
608 },
609 ':gazelle': function () {
610 return {
611 emoticonDir: '/static/common/smileys/',
612 emoticons: 'gazelle',
613 blueprint: 'gazelle'
614 };
615 },
616 ':markdown': function () {
617 return {};
618 },
619 // Custom Site Rules
620 red: function () {
621 return {
622 link: '/wiki.php?action=article&name=BBCode',
623 emoticonDir: '/static/common/smileys/',
624 emoticons: WhutBB.db.uniqueEmoticons(WhutBB.db.emoticons.gazelle.concat(WhutBB.db.emoticons.red)),
625 blueprint: [
626 ['b', 'i', 'u', 's'], ['important', 'heading', 'code'],
627 ['color', 'size'], ['gz_left', 'gz_center', 'gz_right', 'pad'],
628 ['#', '*'], ['url', 'img'], ['quote', 'pre', 'php'], ['hide', 'mature'],
629 ['artist', 'torrent', 'user', 'wiki', 'gz_rule'], ['tex', 'plain'],
630 [ 'erase'], ['emoticon', 'settings', 'shortcut']
631 ]
632 };
633 },
634 what: function () {
635 // rip
636 return {
637 link: '/wiki.php?action=article&name=BBCode',
638 emoticonDir: 'https://what.cd/static/common/smileys/',
639 emoticons: WhutBB.db.uniqueEmoticons(WhutBB.db.emoticons.gazelle.concat(WhutBB.db.emoticons.what)),
640 blueprint: 'gazelle'
641 };
642 },
643 notwhatcd: function () {
644 return {
645 emoticonDir: 'https://notwhat.cd/static/common/smileys/',
646 emoticons: WhutBB.db.uniqueEmoticons(WhutBB.db.emoticons.gazelle.concat(WhutBB.db.emoticons.notwhatcd)),
647 blueprint: 'gazelle'
648 };
649 },
650 gazellegames: function () {
651 return {
652 emoticonDir: 'https://gazellegames.net/static/common/smileys/',
653 emoticons: WhutBB.db.uniqueEmoticons(WhutBB.db.emoticons.gazelle.concat(WhutBB.db.emoticons.gazellegames)),
654 width: 430,
655 blueprint: 'gazelle'
656 };
657 },
658 orpheus: function () {
659 return {
660 link: '/wiki.php?action=article&id=43',
661 emoticonDir: '/static/common/smileys/',
662 emoticons: WhutBB.db.uniqueEmoticons(WhutBB.db.emoticons.gazelle.concat(WhutBB.db.emoticons.orpheus)),
663 blueprint: 'gazelle'
664 };
665 },
666 bs: function () {
667 return {
668 emoticonDir: 'https://bs.lunartype.com/static/common/smileys/',
669 emoticons: WhutBB.db.uniqueEmoticons(WhutBB.db.emoticons.gazelle.concat(WhutBB.db.emoticons.bs)),
670 blueprint: 'gazelle'
671 };
672 },
673 indietorrents: function () {
674 return {
675 link: '/wiki.php?action=article&id=3',
676 emoticonDir: '/static/common/smileys/',
677 emoticons: 'indie',
678 width: 440,
679 blueprint: [
680 ['b', 'i', 'u', 's'], ['color', 'size'],
681 ['gz_left', 'gz_center', 'gz_right'], ['*'], ['url', 'img', 'youtube'],
682 ['quote', 'pre', 'gz_src', 'hide'], ['table', 'tr', 'th', 'td'],
683 ['artist', 'user', 'wiki'], ['tex', 'plain'],
684 ['erase'], ['emoticon', 'settings', 'shortcut']
685 ]
686 };
687 },
688 waffles: function () {
689 WhutBB.db.buttons.raw = WhutBB.db.buttons.plain;
690
691 return {
692 link: '/bbcode.php',
693 emoticonDir: 'https://d17wj6ajhy2qee.cloudfront.net/assets/images/smilies/',
694 emoticons: 'waffles',
695 beneath: false,
696 width: 540,
697 blueprint: [
698 ['b', 'i', 'u', 's'], ['size', 'color', 'font', 'spoiler'],
699 ['*'], ['url', 'img', 'youtube'],
700 ['center', 'quote', 'pre', 'raw'],
701 ['artist', 'user', 'torrent', 'search'],
702 ['erase'], ['emoticon', 'settings', 'shortcut']
703 ]
704 };
705 },
706 oppaiti: function () {
707 return {
708 emoticonDir: 'https://oppaiti.me/static/common/smileys/',
709 emoticons: 'gazelle',
710 blueprint: 'gazelle'
711 };
712 }
713 },
714 buttons: {
715 b: {title: 'Bold', icon: 'bold'},
716 i: {title: 'Italic', icon: 'italic'},
717 u: {title: 'Underline', icon: 'text-width'}, //underline
718 s: {title: 'Strike', icon: 'minus'},
719 code: {display: 'c', title: 'Inline Code', icon: 'leaf'},
720 important: {display: '!', title: 'Important Text', icon: 'exclamation-sign'},
721 color: {type: 1, display: '\u25ee', prompt: 'Enter a #hexadecimal or color name.', title: 'Color', val: '#', icon: 'tint'},
722 size: {type: 1, display: '\u00b1', prompt: 'Enter a number.', title: 'Size', val: 3, icon: 'text-height'},
723 align: {type: 1, display: '-', title: 'Align Text', icon: 'align-left'},
724 left: {display: '<', title: 'Align Left', icon: 'align-left'},
725 center: {display: '\u2013', title: 'Align Center', icon: 'align-center'},
726 right: {display: '>', title: 'Align Right', icon: 'align-right'},
727 '#': {type: 3, title: 'Ordered List Item', icon: 'list-alt'},
728 '*': {type: 3, title: 'List Item', icon: 'list'},
729 url: {type: 1, prompt: 'Enter a Link', title: 'Web Link', val: 'http://', icon: 'globe'},
730 img: {title: 'Image', icon: 'picture'},
731 quote: {type: 1, display: 'q', prompt: 'Enter an author or name', title: 'Quote', placeholder: 'author', icon: 'comment'},
732 pre: {title: 'Preformated text/Code block', icon: 'asterisk'},
733 hide: {type: 1, display: 'h', title: 'Hide content/Spoilers', val: 'Mediainfo', icon: 'warning-sign'},
734 spoiler: {display: '_', title: 'Spoilers!', icon: 'exclamation-sign'},
735 mature: {macro: ['hide', 'plain'], type: -3, display: 'MI', title: 'Hide Mediainfo', icon: 'eye-open'},
736 artist: {display: 'a', title: 'Link to an artist/band on the site', icon: 'music'},
737 user: {display: 'p', title: 'Link to a person on the site', icon: 'user'},
738 wiki: {type: 4, tag: ['[[', ']]'], display: 'w', title: 'Link to a Wiki article', icon: 'share'},
739 tex: {display: 't', title: 'LaTeX', icon: 'pencil'},
740 plain: {display: 'x', title: 'Disable BB tags', icon: 'ban-circle'},
741 youtube: {type: 2, display: 'yt', title: 'YouTube video', icon: 'film'},
742 font: {type: 1, display: 'f', prompt: 'Enter a font\'s name', title: 'Font', val: 'Arial', icon: 'font'},
743 torrent: {display: 'id', title: 'Link to a torrent ID', icon: 'download'},
744 search: {type: 1, display: '@', prompt: 'Enter a search term', title: 'Link to a search term', val: 'keywords', icon: 'search'},
745 table: {display: 'tbl', title: 'Insert a table', icon: 'th-large'},
746 tr: {display: 'tr', title: 'Insert a table row', icon: 'th-list'},
747 th: {display: 'th', title: 'Insert a table heading', icon: 'th'},
748 td: {display: 'td', title: 'Insert a table cell', icon: 'pencil'},
749 heading: {type: 4, tag: '=', display: '=', title: 'Insert a heading', icon: 'arrow-right'},
750 php: {display: '<?', title: 'Insert Source Code', icon: 'tasks'},
751 pad: {type: 1, display: '...', title: 'Add padding in pixels to the content (eg: top|right|bottom|left => 10|0|10|0)', val: '0|0|0|0', icon: 'icon-indent-right'},
752 // Gazelle
753 gz_left: {tag: 'align', val: 'left', type: 1, noPrompt: true, display: '<', title: 'Align left', icon: 'align-left'},
754 gz_center: {tag: 'align', val: 'center', type: 1, noPrompt: true, display: '\u2013', title: 'Align center', icon: 'align-center'},
755 gz_right: {tag: 'align', val: 'right', type: 1, noPrompt: true, display: '>', title: 'Align right', icon: 'align-right'},
756 gz_src: {macro: ['quote', 'pre'], type: -3, display: '<>', title: 'Source code', icon: 'tasks'},
757 gz_rule: {tag: 'rule', title: 'Link to a rule', icon: 'info-sign', display: 'r' },
758 // Panels
759 emoticon: {display: ':]', toggle: ';]', title: 'Emoticons', type: -1, icon: 'fire'},
760 settings: {display: '%', title: 'Settings', type: -1, icon: 'wrench'},
761 shortcut: {display: '?', title: 'Shortcuts', type: -1, icon: 'question-sign'},
762 erase: {display: '-', title: 'Delete message', type: -2, icon: 'remove-sign'}
763 },
764 emoticons: {
765 // for gazelle-based sites make sure to filter any overlapping emoticons
766 // use WhutBB.db.emoticons.gazelle.concat(WhutBB.db.emoticons.SOME_SITE) to cobine them
767 gazelle: [[":angry:", "angry.gif"], [":D", "biggrin.gif"], [":|", "blank.gif"], [":blush:", "blush.gif"], [":cool:", "cool.gif"], [":'(", "crying.gif"], [">.>", "eyesright.gif"], [":creepy:", "creepy.gif"], [":frown:", "frown.gif"], ["<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"]],
768 gazellegames: [],
769 orpheus: [],
770 notwhatcd: [],
771 red: [],
772 bs: [],
773 waffles: [[':waffleslove:', 'wubwaffles-2521f27a7566ee5cc069a3de14186bfd.gif'], [':opplove:', 'opplove-a8ccb8f7a9eac53ea93b79aefdcbbce2.gif'], [':-)', 'smile1-560658ee5e07e8ecaa3a08b2a1863c11.gif'], [':smile:', 'smile2-253a5659d9f881d0bebe9bc0b55651c6.gif'], [':-D', 'grin-4e432d4da3dacfc18d6b1efab45f109b.gif'], [':lol:', 'laugh-a1fab5d7a0444f1592f11b6300e8c735.gif'], [':w00t:', 'w00t-6d03c966b18c52fe27b8e71f4b5d0884.gif'], [':think:', 'think-ea7a2b4427bc8647d2482d56725feb55.gif'], [':-P', 'tongue-38d0b91dc1ff41a30c60cbfaf5c2a44d.gif'], [';-)', 'wink-89f2684eef38e562f10702689dac26de.gif'], [':-|', 'noexpression-4830284942db4804edd00add175bd878.gif'], [':-/', 'confused-b19136e38d02f3856fb8ada4c607c32d.gif'], [':-(', 'sad-99cbd04577892ef40541a94d426fb3da.gif'], [':cry:', 'cry-0c6e60c96c57cd04f537c064e0bcd2f9.gif'], [':crybaby:', 'crybaby-48ffb0fafe08c7e4113290a65741a92f.gif'], [':weep:', 'weep-cab525eab9fd0ca42f57534256d15b9f.gif'], [':-O', 'ohmy-219a8910835d309918b3fd38e136f5d0.gif'], [':o)', 'clown-69f44277bd832326ae116e3a8d0bdefa.gif'], ['8-)', 'cool1-40699903f40da78055f73c7a4dcf80d3.gif'], ['|-)', 'sleeping-5b9787c310fe92ca1179efa8773d13bb.gif'], [':bite:', 'bite-7d0251d8ca504cb6d9c963ba48527778.gif'], [':innocent:', 'innocent-ebfd211a73e277dcb8bb9aebe413186c.gif'], [':whistle:', 'whistle-df262302a1e22fb3b81e3c8091dd8ae8.gif'], [':unsure:', 'unsure-4f4483b4a49a4a48eea53f6a1fe2fbbe.gif'], [':closedeyes:', 'closedeyes-88fed55a5dba73d12b7d3a46ce61f1a5.gif'], [':cool:', 'cool2-585a4b126cdef75cff806373c11a6d4f.gif'], [':fun:', 'fun-bcdec9a81cf9af50b3c0db3671632a18.gif'], [':thumbsup:', 'thumbsup-9123163fe00ddf80036ee71b494b387c.gif'], [':thumbsdown:', 'thumbsdown-fd785afa98ea443ea00d88244849ecd4.gif'], [':blush:', 'blush-7e580b085806fe42a81d319821942eee.gif'], [':yes:', 'yes-458318d3341e1b7b8706e5103c2babd8.gif'], [':no:', 'no-fc2c2bcae3506ea2d3e3d3dc1b60f344.gif'], [':love:', 'love-d87adbbe12875920098a39974db15a58.gif'], [':?:', 'question-2da82c0b17b82f0f90859e2c2abe956b.gif'], [':!:', 'excl-ffa5e74329d67f804c3e75cdce4d2ae2.gif'], [':idea:', 'idea-7414639bdb7eddf4caea80ed3ba5d4d4.gif'], [':arrow:', 'arrow-ecca9442544396e7bf5258b76d837234.gif'], [':arrow2:', 'arrow2-060bb04e31b7f2ca25e24d7ccd223403.gif'], [':hmm:', 'hmm-9bcee658025a5bdf25e3e5327f3480ea.gif'], [':hmmm:', 'hmmm-e7d0bfb876d6dfc665d0d26c313b105b.gif'], [':huh:', 'huh-40027207c6263888d7cb60b1a11da8d8.gif'], [':geek:', 'geek-391ef98eb0e54003c0cfaaefe5942439.gif'], [':look:', 'look-78d96bcf1f6fe9744ecbf4d5244536c5.gif'], [':rolleyes:', 'rolleyes-41a1a18f3b18b0772240d89c45df5269.gif'], [':kiss:', 'kiss-146a79fb9405272d4f42e99c8e5ffe63.gif'], [':shifty:', 'shifty-89e6633d5f65e865b740f0d86dfcfb5b.gif'], [':blink:', 'blink-b1ceeb6a6c7c795dd141a1f5abc407cc.gif'], [':smartass:', 'smartass-df4ddd1ce630a8b2b1b1d4a07bb51802.gif'], [':sick:', 'sick-c2118245556bc2d3bd41222e5d978831.gif'], [':crazy:', 'crazy-c01c4dc3ff4ee33b23084a1d2d908023.gif'], [':orly:', 'orly-10e48d1489ca1370b37cf004e0107922.gif'], [':wacko:', 'wacko-32608221a12351b6085b2a76cbbaf1b6.gif'], [':alien:', 'alien-4242ce616db4008baeb965751ffdbd6d.gif'], [':wizard:', 'wizard-9cdf13a144a6f27ca01f9a84c50920d8.gif'], [':wave:', 'wave-356ec60e5f19bac9eff3b498ebfc1302.gif'], [':wavecry:', 'wavecry-4d265e41f67e026ebc4ab217bead7d6d.gif'], [':baby:', 'baby-97427920507ee34dfcb3647732205334.gif'], [':angry:', 'angry-0b177f61464277696e0ea047300be941.gif'], [':ras:', 'ras-5e59f83e717b19e5e26157b806437483.gif'], [':sly:', 'sly-738f409e4047197bb6375b25c7ee7f5c.gif'], [':devil:', 'devil-e3f6d8c109d34b0a6c02df621d37eb6f.gif'], [':evil:', 'evil-1dcf0991650e337d0eddb0375c6673de.gif'], [':evilmad:', 'evilmad-8094521229f4019c25b73591ae4dc0c1.gif'], [':sneaky:', 'sneaky-f1b79d0f7204bbd63f9cf47537c64f14.gif'], [':axe:', 'axe-057fb27c78a80d9bb9f002b4a5b7bb5e.gif'], [':slap:', 'slap-927bb31ea2f24e9c62e934e3944cdb23.gif'], [':wall:', 'wall-2cb395672976b927b720c6d4870c4ab8.gif'], [':rant:', 'rant-592949953cea288aa52319fa6b4c8b94.gif'], [':jump:', 'jump-29047acc082f064e6ce0c298c0d86995.gif'], [':yucky:', 'yucky-cefb1203e739c431569304382f96e524.gif'], [':nugget:', 'nugget-6753bf5221ee7569de7a689851c941c3.gif'], [':smart:', 'smart-aeeac59afce3e6b3a29c15dab8a1d2db.gif'], [':shutup:', 'shutup-955bf0025595c5ee1e7e8b7ed3c8b451.gif'], [':shutup2:', 'shutup2-12b77059128e69ea02f2c83cd674c2d8.gif'], [':crockett:', 'crockett-f6f21951664e037350178ddc48e43cc7.gif'], [':zorro:', 'zorro-6ed3d91db57faf8f1c679a0104df3287.gif'], [':snap:', 'snap-abe3f319906de4ad2c911db2f8be0457.gif'], [':beer:', 'beer-8624578c14d53eb15fcb53ce1d92b624.gif'], [':beer2:', 'beer2-3ac8a709706edc3ec23640ae261a7d7b.gif'], [':drunk:', 'drunk-9f7e144e04f9b645a0664c19d971d187.gif'], [':strongbench:', 'strongbench-a31c4395e1497b99a65ef03d9001f0f5.gif'], [':weakbench:', 'weakbench-ae49b68c1a3aeb0338067600b027630e.gif'], [':dumbells:', 'dumbells-66c83d31692d9f891f7c4abd528ce34a.gif'], [':music:', 'music-8fdf83519a7784655553167651f5b906.gif'], [':stupid:', 'stupid-64c93342b79365e6253668c56061ae30.gif'], [':dots:', 'dots-76bd535228d09950e0469c1035085733.gif'], [':offtopic:', 'offtopic-dde3c44e1eab9e64e0a0342830ece5d8.gif'], [':spam:', 'spam-89dc0d0860bf67faaf638ae5d4af5522.gif'], [':oops:', 'oops-7b7c406acac8cb9556647124b47f65bf.gif'], [':lttd:', 'lttd-419bf447899d4bd0d12421508d6b182e.gif'], [':please:', 'please-b493794982b341bd165dc78e8da392ca.gif'], [':sorry:', 'sorry-296b4590f343aae1fbcdcaec26aa9d6b.gif'], [':hi:', 'hi-d43d6f4647b842c186e4751d5f8593fa.gif'], [':yay:', 'yay-f0142dc8b6b7480c2d3c2d63cb97fbe6.gif'], [':cake:', 'cake-09bb27b361ddc8f36af89cf5c416ded1.gif'], [':hbd:', 'hbd-c88a75dffd37270ca561f3e8fa2d4792.gif'], [':band:', 'band-05785c3ffa59700b2d4d392c6d055ac1.gif'], [':punk:', 'punk-9a668ff6c0d9aa86a5f224394dd69388.gif'], [':rofl:', 'rofl-f8b19634186288c71d057d5f573b0c08.gif'], [':bounce:', 'bounce-01e0269597d0977117516e453785165e.gif'], [':mbounce:', 'mbounce-5d299f4fb8e63d88f447616fe9c6a228.gif'], [':thankyou:', 'thankyou-756e056b129ff51bbb32f25a34cee551.gif'], [':gathering:', 'gathering-086469368ada9d89216831908d16b71a.gif'], [':hang:', 'hang-7eb55fd687c7da7963c65df6738d078f.gif'], [':chop:', 'chop-01d980e59de44860127351fb8c4378d5.gif'], [':rip:', 'rip-9f76c7e7f6406a88eb51f8f7e11bf8b5.gif'], [':whip:', 'whip-449fae3c143197dbe50d1e23aa06ba1b.gif'], [':judge:', 'judge-3b457cc503c6333eb9c617bb0aaf939b.gif'], [':chair:', 'chair-06dbccd541c32f5b8b78a00be533ea48.gif'], [':tease:', 'tease-14fac8acbb4aa7941e0a0a19c24468fd.gif'], [':box:', 'box-3f8587850b9ee5e73baa303dd7be817a.gif'], [':boxing:', 'boxing-863999b9867552a5c0b9a899bfeb8b2a.gif'], [':guns:', 'guns-ed7df8a2db38d6c5ffa99175ab4c28c1.gif'], [':shoot:', 'shoot-0615a7c3de81fec986a3e9c4517a16e9.gif'], [':shoot2:', 'shoot2-f6920a2710da65de365d3c22cd2ae542.gif'], [':flowers:', 'flowers-27332577023d64cfb727141fe5e4d14b.gif'], [':wub:', 'wub-0ad5e6feb5270036b984bceef2f003d8.gif'], [':lovers:', 'lovers-f5e6c32a84e8493a4158e5e433f93361.gif'], [':kissing:', 'kissing-0fe382763a16cf6c3c60d5b08db0f9b2.gif'], [':kissing2:', 'kissing2-ee32fc798de7cb2acd5559ce73178f61.gif'], [':console:', 'console-68b189b1dab66bf547027e563ecf0c15.gif'], [':group:', 'group-c9a1ec760a777981072d1ef32aa15c18.gif'], [':hump:', 'hump-272f1f79650b59ea69f923d9130ef69e.gif'], [':hooray:', 'hooray-6c652ce73716362393686b7c6ef0b440.gif'], [':happy2:', 'happy2-c62e525a319bb1f890915a7b9aab66b0.gif'], [':clap:', 'clap-04df3e4f3c7503db3eece534e0cfc222.gif'], [':clap2:', 'clap2-948072586f68c56b095cd882883a92b2.gif'], [':weirdo:', 'weirdo-272bef79cbd6b67841ee58a11a231748.gif'], [':yawn:', 'yawn-887032484c9d38e473984004bcfb065d.gif'], [':bow:', 'bow-e7bb9c96931ac0df88d1641e0e5f3851.gif'], [':dawgie:', 'dawgie-c67131b834f9bb2a9b30cee42b67987d.gif'], [':cylon:', 'cylon-5ea27fc2b0719f40d289f4c7b93f7ada.gif'], [':book:', 'book-be7f16f0671c0c559a4e2bd74c393b8c.gif'], [':fish:', 'fish-00be24fac4a017112d7804c3e897097f.gif'], [':mama:', 'mama-4dfb65772fb41f145a3f89ad37790a81.gif'], [':pepsi:', 'pepsi-7b4b1badd4396b3f4e22d6118e323f02.gif'], [':medieval:', 'medieval-50260f623bc633f0ecf74d7c17393ff1.gif'], [':rambo:', 'rambo-09d6efc427fb1e7e6340fbb147d43a11.gif'], [':ninja:', 'ninja-1df82da69d50dbd46d2cb359f8527419.gif'], [':hannibal:', 'hannibal-426ef9b9bcc9a3333c4ab26715492580.gif'], [':party:', 'party-66ad63e75a1828550d3486931a49f857.gif'], [':snorkle:', 'snorkle-3e5f5fd9bf0db02f1f33517717683970.gif'], [':evo:', 'evo-312ef9ba37feaf9f3467d4e8d46a663e.gif'], [':king:', 'king-81506071dd6ee2049ad6fa5a21a46157.gif'], [':chef:', 'chef-e5089f65672d3467fb6840fae5976929.gif'], [':mario:', 'mario-36b76b39c0c58e36b65a055a3ce54941.gif'], [':pope:', 'pope-fb424bc064d80fe7bc29341eddbab4c6.gif'], [':fez:', 'fez-7a0ebd6c8eea5c7e6020ceff77fca632.gif'], [':cap:', 'cap-4cbad47f6570262439eeba3137b6beb7.gif'], [':cowboy:', 'cowboy-2e6c4ed4565b3cdb7af6c52367f83fe5.gif'], [':pirate:', 'pirate-0c35d70ab51a83113a8f111476da6f5e.gif'], [':pirate2:', 'pirate2-a0a401392f51e48eb66831ebbe67df53.gif'], [':rock:', 'rock-40548e8d132ae530802a14d89c2d760b.gif'], [':cigar:', 'cigar-676427cb7a3bbbea4303015d3d2acfdc.gif'], [':icecream:', 'icecream-032618e68cfae2cc8ae02b0fa3704e05.gif'], [':oldtimer:', 'oldtimer-757ffdf57d44a55ca1f72c96f09fd1b0.gif'], [':trampoline:', 'trampoline-2ba70f11043de1ef9010fc75cd29afb8.gif'], [':banana:', 'bananadance-3f9ed835b302b721ff8c82ade10459a0.gif'], [':smurf:', 'smurf-fdbbd6f4b8d709620293c49bd844febb.gif'], [':yikes:', 'yikes-0200f0559a21414f04632172f77fa99d.gif'], [':osama:', 'osama-d01f5ee7a14b25177bfd60b30d438a3f.gif'], [':saddam:', 'saddam-27b72ffd9b4d13aaa00e03567b40eea4.gif'], [':santa:', 'santa-7c385ec9c2718f9f01633dfd9a56b0b6.gif'], [':indian:', 'indian-fb42d05ff92de4d57b123e945e951244.gif'], [':pimp:', 'pimp-d0a709339d63c555d57ed7bca0c00ddb.gif'], [':nuke:', 'nuke-2f73939082f53cb445bf9e166108143d.gif'], [':jacko:', 'jacko-cfc99a11372c2eba9367932d7df360f0.gif'], [':ike:', 'ike-1992ee857800281bac157d4866d8385b.gif'], [':greedy:', 'greedy-4a04cd5db2356e54c750fe6f9f2ab93b.gif'], [':super:', 'super-19790574533d71b475ac60bc88be05fa.gif'], [':wolverine:', 'wolverine-054e82e4a90dd2874ac1dcbf773d8bdf.gif'], [':spidey:', 'spidey-7ef425b6d02a12067936229c04b821f0.gif'], [':spider:', 'spider-fac295e77895de28902d26ebc14344ca.gif'], [':bandana:', 'bandana-764003ef9751eca0f70b3f6b6668c533.gif'], [':construction:', 'construction-ec7857a9ee8ba8e7ef236cf749401194.gif'], [':sheep:', 'sheep-c8e7ce684732354235f91284927ae812.gif'], [':police:', 'police-e02b59b0fb153ad7d7314edf7b985c39.gif'], [':detective:', 'detective-4c526178c97055d4851c212e6e5d8c7c.gif'], [':bike:', 'bike-773e389449eedf0719cf6352ac9d0a85.gif'], [':fishing:', 'fishing-0d961d64c39a324a62bd6ff276200f61.gif'], [':clover:', 'clover-67a8ff1eddedfe1a2cd3c8e8cd9b9ef2.gif'], [':horse:', 'horse-ff20edcdc92f16cfc1565d38aa8ad7da.gif'], [':shit:', 'shit-90a3b56537435867cb120a4d85984704.gif'], [':soldiers:', 'soldiers-012a263073b602c268ecfae69672e1f5.gif'], [':search:', 'search-7d7bd7365acc3edb2e050b85cc4180fd.gif'], [':tinfoilhat:', 'tinfoilhat-4bf3badd9c9afbb1b0a9f2e0a92097f2.gif'], [':moon1:', 'moon1-7f51ab8d5699c8398083985aa34ff1b8.gif'], [':moon2:', 'moon2-967c0e89b8e8ab2393c23cf9dd763a22.gif'], [':user:', 'user-cadad12a1f12dae826bf1dcfbfa29db1.gif'], [':staff:', 'staff-f6921aa4cb3d0960eac347ba772f5ce2.gif']], /*, [':box:', 'box.gif']*/
774 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']],
775 what: [[":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"]]
776 },
777 blueprints: {
778 gazelle: [ // pretty standard gazelle blueprint as of ... 2012 or 2013?
779 ['b', 'i', 'u', 's'], ['important', 'heading', 'code'],
780 ['color', 'size'], ['gz_left', 'gz_center', 'gz_right'],
781 ['#', '*'], ['url', 'img'], ['quote', 'pre', 'gz_src'], ['hide', 'mature'],
782 ['artist', 'torrent', 'user', 'wiki', 'gz_rule'], ['tex', 'plain'],
783 [ 'erase'], ['emoticon', 'settings', 'shortcut']
784 ]
785 },
786 shortcuts: {
787 alt: {
788 c: 'gz_src',
789 i: 'torrent'
790 },
791 ctrl: {
792 b: 'b',
793 i: 'i',
794 u: 'u',
795 s: 's',
796 g: 'code',
797 k: '#',
798 l: '*',
799 h: 'url',
800 m: 'img',
801 d: 'erase'
802 },
803 'ctrl+alt': {
804 i: 'important',
805 e: 'emoticon',
806 u: 'settings',
807 x: 'shortcut'
808 }
809 },
810 setupShortcutMap: function () {
811 dom.oEach(WhutBB.config.shortcuts, function (meta, letters) {
812 // WhutBB.config.shortcuts
813 dom.oEach(letters, function (letter, button) {
814 // console.log(letter, button);
815 if (!WhutBB.config.shortcutMap[button]) {
816 WhutBB.config.shortcutMap[button] = [];
817 }
818 WhutBB.config.shortcutMap[button].push(meta + '+' + letter);
819 });
820 });
821
822 // console.log('created', WhutBB.config.shortcutMap);
823 },
824 getShortcut: function (modifier, letter) {
825 if (this.shortcuts[modifier] && this.shortcuts[modifier][letter]) {
826 return this.shortcuts[modifier][letter];
827 }
828 },
829 getShortcutText: function (modifier) { // changes CTRL and ALT to Mac-centric keys if required // .replace(/(?:CTRL\+ALT)/g, 'ALT+CTRL')
830 return WhutBB.mac ? modifier.toUpperCase().replace(/(?:CTRL)/g, '\u2318').replace(/(?:ALT)/g, '\u2325') : modifier.toUpperCase();
831 },
832 getSiteSettings: function (name) {
833 if (WhutBB.db.sites[name]) {
834 var settings = WhutBB.db.sites[name]();
835 settings.name = name;
836 return settings;
837 }
838 return {};
839 },
840 /**
841 * Inserts or replaces buttons
842 * Use this method before initializing the script (WhutBB.init)
843 * @param buttons - object of objects
844 */
845 insertButtons: function (buttons) {
846 dom.oEach(buttons, function (name, object) {
847 WhutBB.db.buttons[name] = object;
848 });
849 },
850 /**
851 * Adds emoticons to (an exisiting) emoticons DB array
852 * Use this method before initializing the script (WhutBB.init)
853 *
854 * @param {string} name of the array in the emoticons DB to use
855 * if none exist, it will be created
856 * @param {array} emoticons
857 * make sure to use an array of arrays
858 *
859 * Example: add two emoticons to WhutBB.db.emoticons.gazelle
860 * WhutBB.db.addEmoticons('gazelle', [[':new:', 'new.png'], [':pop:', 'pop.png']]);
861 */
862 addEmoticons: function (name, emoticons) {
863 WhutBB.db.emoticons[name] = (WhutBB.db.emoticons[name] || []).concat(emoticons);
864 },
865 /**
866 * @param {array} emoticons
867 */
868 uniqueEmoticons: function (emoticons) {
869 var unique = {}, arr = [], i;
870
871 dom.aEach(emoticons, function (e) {
872 unique[e[0]] = e;
873 })
874
875 dom.oEach(unique, function (key, obj) {
876 arr.push(obj);
877 });
878
879 return arr;
880 }
881 };
882
883 /**
884 * Event manager
885 * Aliases/references event data for easier use within various methods
886 */
887 WhutBB.e = {
888 current: null, // alias for the current event
889 target: null, // alias for the current event target element
890 whut: null, // alias for the current event's WhutBB instance
891 macro: false, // flag for events called through a macro
892 set: function (event, target, wbb) {
893 WhutBB.e.current = event;
894 WhutBB.e.target = target;
895 WhutBB.e.whut = wbb;
896 },
897 clean: function () {
898 this.current = this.target = this.whut = null;
899 }
900 };
901
902 /**
903 * Event Object
904 *
905 * Contains all possible events, divided into:
906 * 1) mouse, 2) key, and 3) general button events
907 *
908 * Mouse and Key events trigger Button events, depending
909 * on the button type
910 *
911 * As mentioned earlier, buttons with custom events should find
912 * a method with that button's name within WhutBB.evt.button.custom
913 *
914 * WhutBB instances register themselves with the
915 * register methods.
916 *
917 * The registers return an annonymous function that
918 * is used for any subsequent click or key events.
919 *
920 */
921 WhutBB.evt = {
922 button: { // button events
923 custom: { // Custom button events
924 erase: function () { // erase button event
925 WhutBB.e.whut.textarea.value = '';
926 },
927 emoticonLoader: function () { // removes "View all emoticons." div and loads remaining emoticons
928 WhutBB.e.target.parentNode.removeChild(WhutBB.e.target);
929 WhutBB.Panel.attach.emoticons(WhutBB.config.emoticonMax - 1,
930 WhutBB.config.emoticons.length);
931 }
932 },
933 macro: function (name, wbb) { // macro button events
934 if (!WhutBB.e.macro) {
935 WhutBB.e.macro = true;
936 dom.aEach(WhutBB.db.buttons[name].macro || [], function (name) {
937 // console.log(name);
938 dom.click(wbb.getButton(name));
939 });
940 WhutBB.e.macro = false;
941 }
942 },
943 bbcode: function () { // bbcode buttons
944 WhutBB.Tag.get(WhutBB.e.target.name).insertTo(WhutBB.e.whut.textarea);
945 },
946 emoticon: function () { // emoticon buttons
947 WhutBB.box.select(WhutBB.e.whut.textarea).insert([' ' + WhutBB.e.target.title, '']);
948 },
949 panel: { // panel buttons
950 toggle: function (panel, el) { // el = WhutBB.e.target
951 var visible = /(?:wbbpressed)/i.test(el.className); // panel's current visibility
952 WhutBB.evt.button.panel.store(el);
953 if (visible) {
954 el.className = el.className.replace(' wbbpressed', '');
955 panel.className += ' wbbhide';
956 } else {
957 WhutBB.e.whut.wrap.appendChild(WhutBB.Panel.global[el.name].element);
958 el.className += ' wbbpressed';
959 panel.className = panel.className.replace(' wbbhide', '');
960 }
961 WhutBB.evt.button.panel.toggleText(visible, el.firstChild);
962 },
963 toggleText: function (visible, span) {
964 if (span.getAttribute('data-toggle') !== '') {
965 span.firstChild.nodeValue = span.getAttribute(visible ? 'data-txt' : 'data-toggle');
966 }
967 },
968 store: function (button) {
969 // remove pressed (toggled) state of previous stored button
970 if (WhutBB.evt.button.panel.store[button.name]) {
971 WhutBB.evt.button.panel.store[button.name].className = 'whutbbutton';
972 WhutBB.evt.button.panel.toggleText(true, WhutBB.evt.button.panel.store[button.name].firstChild);
973 }
974 WhutBB.evt.button.panel.store[button.name] = button;
975 },
976 stored: {}
977 }
978 },
979 delegate: {
980 button: function () { // TODO Polymorphism plz?
981 var t = WhutBB.e.target;
982 // console.log(t);
983 WhutBB.e.current.stopPropagation();
984 if (+t.getAttribute('data-type') === -3) {
985 // console.log(-3);
986 return WhutBB.evt.button.macro(t.name, WhutBB.e.whut);
987 }
988 if (+t.getAttribute('data-type') === -2) {
989 // console.log(-2);
990 return WhutBB.evt.button.custom[t.name]();
991 }
992 if (+t.getAttribute('data-type') === -1) {
993 // console.log(-1);
994 return WhutBB.evt.button.panel.toggle(WhutBB.Panel.global[t.name].element, t);
995 }
996 if (t.getAttribute('data-type') === 'emoticon') {
997 // console.log(2);
998 return WhutBB.evt.button.emoticon();
999 }
1000 // console.log(1);
1001 return WhutBB.evt.button.bbcode();
1002 },
1003 edit: function (evt) { // RegExp.lastParen should contain an ID
1004 var el = evt.target,
1005 attr = el.getAttribute('onclick') || '',
1006 id,
1007 interv;
1008
1009 if (attr.match(/(?:Edit_Form\('(\d+))/)) {
1010 id = RegExp.lastParen;
1011 // obs(id);
1012 // evt.preventDefault();
1013 interv = window.setInterval(function () {
1014 var txt = document.getElementById('editbox' + id);
1015
1016 if (txt) {
1017 window.clearInterval(interv);
1018 console.log('clearing', interv);
1019 txt.setAttribute('data-wbb', id);
1020 WhutBB.create(txt, true);
1021 }
1022 }, 500);
1023 }
1024 if (attr.match(/(?:Preview_Edit\((\d+))/) || attr.match(/(?:Save_Edit\((\d+))/)) {
1025 return WhutBB.set[RegExp.lastParen].hide();
1026 }
1027 if (attr.match(/(?:Cancel_Preview\((\d+))/)) {
1028 return WhutBB.set[RegExp.lastParen].show();
1029 }
1030 },
1031 report: function (evt) {
1032 var el = evt.target,
1033 attr = el.getAttribute('onchange') || '';
1034
1035 if (attr.match(/(?:ChangeReportType\()/)) {
1036 window.setTimeout(function () {
1037 var txt = document.getElementById('dynamic_form');
1038
1039 if (txt) {
1040 WhutBB.factory();
1041 return WhutBB.set[RegExp.lastParen].show();
1042 }
1043 }, 500);
1044 }
1045 },
1046 inbox: function (evt) { // todo inbox.php
1047 var el = evt.target;
1048 // console.log('inbox');
1049
1050 var qp = document.getElementById('quickpost');
1051 var ps = qp.previousElementSibling;
1052 if (/(?:preview)/i.test(el.value)) {
1053 qp.className += ' wbbhide';
1054 ps.className += ' wbbhide';
1055 }
1056 if (/(?:editor)/i.test(el.value)) {
1057 qp.className = qp.className.replace(/(?: wbbhide)/g, '');
1058 ps.className = ps.className.replace(/(?: wbbhide)/g, '');
1059 }
1060 },
1061 settings: { // settings events
1062 update: function () { // translates checks into settings to store
1063 var settings = {}, saved;
1064
1065 dom.aEach(WhutBB.Panel.global.settings.element.getElementsByTagName('input'), function (el) {
1066 settings[el.name] = el.checked;
1067 });
1068
1069 saved = WhutBB.user.save(settings);
1070
1071 // calls a sub function based on a setting's name
1072 // additional argument if the settings were saved
1073 if (this.fn[WhutBB.e.target.name]) {
1074 this.fn[WhutBB.e.target.name](saved);
1075 }
1076 },
1077 fn: {
1078 icon: function () { // toggles button icons
1079 var cls = 'wbbcode ' + WhutBB.$.data.getWrapClass();
1080 dom.oEach(WhutBB.set, function (id, wbb) {
1081 wbb.wrap.className = cls;
1082 });
1083 },
1084 link: function () { // toggles WhutBBCode? link
1085 var cls = 'wbblink ' + (WhutBB.user.settings.link ? '' : ' wbbhide');
1086 dom.oEach(WhutBB.set, function (id, wbb) {
1087 wbb.panels.link.className = cls;
1088 });
1089 }
1090 }
1091 }
1092 },
1093 mouse: {
1094 target: function (target) {
1095 // WebKit issue -- This returns an actual button, instead of the span.icon-* within it
1096 return (/(?:icon-)/).test(target.getAttribute('class')) ? target.parentNode : target;
1097 },
1098 down: function () {
1099 if (WhutBB.e.target.getAttribute('data-type')) {
1100 return WhutBB.evt.delegate.button();
1101 }
1102 if (WhutBB.e.target.getAttribute('data-setting')) {
1103 return WhutBB.evt.delegate.settings.update();
1104 }
1105 },
1106 register: function (wbb) {
1107 return function (evt) { // context for _this_ is the container div.wbbbuttons
1108 // console.log('mouse.register/anon');
1109 WhutBB.e.set(evt, WhutBB.evt.mouse.target(evt.target), wbb);
1110 WhutBB.evt.mouse.down();
1111 WhutBB.e.clean();
1112 };
1113 }
1114 },
1115 key: {
1116 down: function () {
1117 this.fire(this.button());
1118 },
1119 letter: function () {
1120 return String.fromCharCode(WhutBB.e.current.which || WhutBB.e.current.keyCode).toLowerCase();
1121 },
1122 modifier: function () {
1123 // meta key aliases to ctrl
1124 var cm = WhutBB.e.current.ctrlKey || WhutBB.e.current.metaKey;
1125 if (cm && WhutBB.e.current.altKey) { return 'ctrl+alt'; }
1126 if (cm) { return 'ctrl'; }
1127 if (WhutBB.e.current.altKey) { return 'alt'; }
1128 return '';
1129 },
1130 button: function () {
1131 return WhutBB.e.whut.getButton(WhutBB.db.getShortcut(this.modifier(), this.letter()));
1132 },
1133 fire: function (button) {
1134 if (button) {
1135 WhutBB.e.current.preventDefault();
1136 // dom.click(button);
1137 WhutBB.e.target = button;
1138 WhutBB.evt.mouse.down();
1139 }
1140 },
1141 register: function (wbb) {
1142 return function (evt) {
1143 // console.log('key.register/anon');
1144 WhutBB.e.set(evt, this, wbb); // _this_ is a textarea
1145 WhutBB.evt.key.down();
1146 WhutBB.e.clean();
1147 };
1148 },
1149 completeStop: function (e) {
1150 // prevents certain browsers (eg Firefox) from using their default actions
1151 e.preventDefault();
1152 e.stopPropagation();
1153 return false;
1154 }
1155 }
1156 };
1157
1158 /**
1159 * Box Object (aka textarea stuff)
1160 *
1161 * How it works:
1162 * WhutBB.box.select(textarea).insert(['{start}', '{end}']);
1163 *
1164 * An array is used because Tags parse to that data type.
1165 *
1166 * Result:
1167 * <textarea>{start}{end}</textarea>
1168 *
1169 * It's (more) magical when used in an event.
1170 */
1171 WhutBB.box = {
1172 select: function (textarea) {
1173 this.textarea = textarea;
1174 WhutBB.box.range.data = this.range.get();
1175 return this;
1176 },
1177 range: {
1178 get: function () {
1179 // Todo abstract ie and standard methods
1180 return ie ? this.ie() : this.standard();
1181 },
1182 rdata: function (start, end, selection) {
1183 return { start: start, end: end, selection: selection };
1184 },
1185 ie: function () {
1186 WhutBB.box.textarea.focus(); // important here
1187 var ieRange = document.selection.createRange(),
1188 dup = ieRange.duplicate(),
1189 start,
1190 end,
1191 selection;
1192 dup.moveToElementText(WhutBB.box.textarea);
1193 dup.setEndPoint('EndToEnd', ieRange);
1194
1195 start = dup.text.length - ieRange.text.length;
1196 end = start + ieRange.text.length;
1197 selection = ieRange.text.replace(/\r\n/g, '\n');
1198 if (end === 0 && start === 0) { // Push inserts to the end
1199 start = end = WhutBB.box.textarea.value.length;
1200 }
1201 // console.log('tx1 ' + ieRange.text, 'txs ' + dup.text, 'txt ' + ieRange.text.replace(/\r\n/g, '\n'), 'SST ' + start, 'SSE ' + end);
1202 ieRange = dup = null;
1203 return this.rdata(start, end, selection);
1204 },
1205 standard: function () {
1206 if (WhutBB.box.textarea.selectionStart < 0) { return; }
1207 if (WhutBB.box.textarea.selectionEnd > WhutBB.box.textarea.value.length) {
1208 WhutBB.box.textarea.selectionEnd = WhutBB.box.textarea.value.length;
1209 }
1210 var s = WhutBB.box.textarea.selectionStart || 0,
1211 e = WhutBB.box.textarea.selectionEnd || 0;
1212 return this.rdata(s, e, WhutBB.box.textarea.value.substring(s, e) || '');
1213 }
1214 },
1215 insert: function (tag) {
1216 var pre = WhutBB.box.textarea.value.substring(0, WhutBB.box.range.data.start) + tag[0],
1217 post = tag[1] + WhutBB.box.textarea.value.substring(WhutBB.box.range.data.end);
1218 WhutBB.box.textarea.value = [pre, WhutBB.box.range.data.selection, post].join('');
1219 WhutBB.box.selection(pre.length);
1220 },
1221 selection: function (start) {
1222 var r;
1223 WhutBB.box.textarea.focus();
1224 if (ie) {
1225 r = WhutBB.box.textarea.createTextRange();
1226 r.collapse(true);
1227 r.moveStart('character', start);
1228 r.moveEnd('character', WhutBB.box.range.data.selection.length);
1229 r.select();
1230 } else {
1231 WhutBB.box.textarea.setSelectionRange(start, start + WhutBB.box.range.data.selection.length);
1232 }
1233 }
1234 };
1235
1236 /**
1237 * WhutBBCode Settings Class
1238 * Intended to be a singleton used within WhutBB.init()
1239 *
1240 * This class is used to store site configurations for WhutBBCode?
1241 * Using these options, the script can create buttons, emoticons, etc.
1242 *
1243 * Effectively, without any settings, nothing really happens.
1244 *
1245 * The most important option is blueprint, which tells the script which
1246 * buttons to create.
1247 *
1248 * The Panel class uses this blueprint to construct buttons, put them in the button
1249 * panel, and attach them to WhutBB instances.
1250 *
1251 * All buttons that exist in WhutBB.db.buttons are stored as validButtons. The script
1252 * uses validButtons to list available shortcuts to the user.
1253 *
1254 * To reiterate, options are the most important aspect of this class
1255 *
1256 * param @options object with the following (mostly optional) attributes
1257 *
1258 * if none is given, the script will try to find an appropriate match
1259 * for the site.
1260 *
1261 * if no setting is found, the "generic" default options will be used
1262 *
1263 * name: (String) [ default: '' (empty string) ]
1264 * the website's name
1265 *
1266 * link:
1267 * link to information about the site's BBCode or WhutBBCode? itself (default)
1268 *
1269 * beneath: (Boolean) [ default: true ]
1270 * location to insert buttons, beneath or above the textarea
1271 *
1272 * blueprint: (String|Array) [ default: [] (empty array) ]
1273 * - string: name of the array from WhutBB.db.blueprints
1274 * currently only 'gazelle' exists (WhutBB.db.blueprints.gazelle)
1275 * use arrays for custom configurations!
1276 *
1277 * tip: use 'gazelle' for sites that use the default gazelle BBCode
1278 *
1279 * - array: an array of arrays containing buttons to create
1280 *
1281 * group buttons together to create a set of similiar types
1282 *
1283 * example:
1284 *
1285 * blueprint: [
1286 * ['b', 'i', 'u'], // a set of three buttons
1287 * ['shortcut', 'settings'] // a set of two
1288 * ]
1289 *
1290 * buttons are then placed in the DOM in the following order
1291 * [b][i][u] [?][+]
1292 *
1293 * each set is separated by a space
1294 *
1295 * width: (Number) [ default: 430 ]
1296 * a width (in pixels) to set for the WhutBB.wrap so that buttons fit well
1297 *
1298 * emoticonDir: [ default: '' ]
1299 * absolute or relative (to the current site) location to where emoticons reside
1300 * it should end in a slash (/)
1301 *
1302 * emoticonMax: (Number) [ default: 39 ]
1303 * a limit of emoticons to display to the user
1304 * eg: If 100 emoticons exist, the script will display the first 39
1305 * a link to show the rest of the emoticons will be generated
1306 * the intent of this is to reduce loading times of emoticon images
1307 *
1308 * emoticons: (String|Array) [ default: [['', '']] (a null emoticon) ]
1309 * - string: name of the array from WhutBB.db.emoticons
1310 * for example, possible options: 'gazelle', 'waffles', 'indie'
1311 *
1312 * - array: an array of arrays containing emoticons to create
1313 *
1314 * the sub-arrays are formed by the emoticon text to insert and the location of the
1315 * image to show in the emoticon list
1316 *
1317 * [ ["text to append to textarea", "url or path to an image"] ]
1318 *
1319 * any arbitrary string can be appended to the textarea
1320 *
1321 * example:
1322 * emoticons: [ [":)", "happy.png"], [":D", "grin.png"], [":(", "sad.png"] ]
1323 *
1324 * these create images with the emoticon directory (emoticonDir)
1325 * if the directory varies, it should be included
1326 *
1327 * example:
1328 * [':D', 'some-other-dir/grin.png']
1329 *
1330 * absolute paths are supported
1331 *
1332 * example:
1333 * [':]', 'https://emto/ticon.png']
1334 *
1335 * clicking on the image "https://emto/ticon.png" will append ":]" to the textarea
1336 *
1337 * ['[img]https://emto/ticon.gif[/img]', 'https://emto/ticon.gif']
1338 *
1339 * in the second example, the string "[img]https://emto/ticon.gif[/img]" will be appended
1340 *
1341 * To add emoticons to an existing object from WhutBB.db.emoticons, see
1342 * WhutBB.db.addEmoticons().
1343 *
1344 * shortcuts: (Object) [ default: WhutBB.db.shortcuts ]
1345 * an object of objects that account for shotcut mapping, see "Keyboard Shortcuts"
1346 * part of the documentation
1347 *
1348 * example:
1349 * shortcuts: {
1350 * ctrl: {
1351 * i: 'i'
1352 * },
1353 * 'alt+ctrl': {
1354 * x: 'shotcuts'
1355 * }
1356 * }
1357 *
1358 */
1359 WhutBB.Settings = function Settings(options) {
1360 var def = WhutBB.db.sites[':default']();
1361
1362 try {
1363 this.name = options.name || def.name;
1364 this.link = options.link || def.link;
1365
1366 this.beneath = !!options.beneath;
1367 this.blueprint = (typeof options.blueprint === 'string') ? WhutBB.db.blueprints[options.blueprint] : (options.blueprint || def.blueprint); // options.blueprint || def.blueprint;
1368 this.width = options.width || def.width;
1369
1370 this.emoticonDir = options.emoticonDir || def.emoticonDir;
1371 this.emoticonMax = options.emoticonMax || def.emoticonMax;
1372 this.emoticons = (typeof options.emoticons === 'string') ? WhutBB.db.emoticons[options.emoticons] : (options.emoticons || def.emoticons); // null emoticon
1373
1374 this.shortcuts = options.shortcuts || WhutBB.db.shortcuts;
1375 } catch (e) {
1376 dom.oEach(def, function (name, setting) {
1377 this[name] = setting;
1378 }, this);
1379 }
1380 this.validButtons = {};
1381 this.shortcutMap = {};
1382 };
1383
1384 /**
1385 * Button
1386 *
1387 * Generic button class that encapsulates data from
1388 * WhutBB.db.buttons objects and creates a button element
1389 *
1390 * Do not use the constructor directly, use Button.create instead!
1391 */
1392 WhutBB.Button = (function () {
1393
1394 function Button(name) {
1395 this.name = name;
1396 this.data = WhutBB.db.buttons[name];
1397 }
1398
1399 /**
1400 * Button.create returns a Button or a Null button
1401 * All possible buttons located at WhutBB.db.buttons
1402 */
1403 Button.create = function (button) {
1404 if (WhutBB.db.buttons[button]) {
1405 return new Button(button);
1406 }
1407 return Button.Null;
1408 };
1409
1410 /**
1411 * Creates a button element and also validates it
1412 */
1413 Button.prototype.make = function () {
1414 var el = dom.dom('button', {
1415 className: 'whutbbutton',
1416 name: this.name,
1417 title: this.data.title + this.getShortcut(this.name),
1418 attr: {
1419 type: 'button',
1420 'data-type': this.data.type || 'button'
1421 }
1422 }, dom.dom('span', {
1423 className: 'icon-' + this.data.icon,
1424 txt: this.data.display || this.name,
1425 attr: {
1426 'data-txt': this.data.display || this.name,
1427 'data-toggle': this.data.toggle || ''
1428 }
1429 }));
1430
1431 this.validate();
1432 return el;
1433 };
1434
1435 /**
1436 * Validates a button by adding it to WhutBB.config.validButtons
1437 */
1438 Button.prototype.validate = function () {
1439 WhutBB.config.validButtons[this.name] = true;
1440 return this;
1441 };
1442
1443 Button.prototype.getShortcut = function (name) {
1444 var title = '';
1445
1446 if (WhutBB.config.shortcutMap[name]) {
1447 title = ' (' + WhutBB.config.shortcutMap[name].join(', ') + ')';
1448 }
1449
1450 return WhutBB.db.getShortcutText(title);
1451 };
1452
1453 /**
1454 * Space creates a single-spaced text node.
1455 *
1456 * Both Space and Null objects are intended to mimic Buttons
1457 * without using any real inheritance
1458 */
1459 Button.Space = {
1460 make: function () {
1461 return document.createTextNode(' ');
1462 },
1463 validate: function () {
1464 return this;
1465 },
1466 data: {}
1467 };
1468
1469 /**
1470 * Null creates a simple text node.
1471 * It's used when there is no real button in the db.
1472 */
1473 Button.Null = {
1474 make: function () {
1475 return document.createTextNode('');
1476 },
1477 validate: function () {
1478 return this;
1479 },
1480 data: {}
1481 };
1482
1483 Button.emoticon = function (emoticonData) {
1484 return dom.dom('img', {
1485 title: emoticonData[0],
1486 alt: emoticonData[0],
1487 src: /^(?:http)/g.test(emoticonData[1]) ? emoticonData[1] : WhutBB.config.emoticonDir + emoticonData[1],
1488 attr: {
1489 'data-type': 'emoticon'
1490 }
1491 });
1492 };
1493
1494 Button.emoticonLoader = function () {
1495 return dom.dom('div', {
1496 className: 'emoticonLoader',
1497 name: 'emoticonLoader',
1498 txt: 'View all emoticons.',
1499 title: 'Loads all emoticons.',
1500 attr: {
1501 'data-type': -2
1502 }
1503 });
1504 };
1505
1506 return Button;
1507
1508 }());
1509
1510 /**
1511 * Panel Class
1512 * Generates all the panels used in the script.
1513 *
1514 * A panel is an element intended to be within a WhutBBInstance.wrap div.
1515 *
1516 * eg:
1517 * { div (WhutBBInstance.wrap)
1518 * [ wbb link panel ]
1519 * [ buttons panel ]
1520 * [ settings panel* ]
1521 * [ shortcuts panel* ]
1522 * }
1523 *
1524 * *Global panels
1525 *
1526 * Use Panel.factory, instead of new Panel().
1527 *
1528 * Global (or public) panels are static and part of the Panel.global object,
1529 * not a WhutBB instance. They are typically transient, meaning that
1530 * they appear in different WhutBB.wraps depending on the toggle state
1531 *
1532 * For example, emoticons are appended to WBB instace for textarea 1 when its
1533 * emoticon button is clicked, but once WBB instace for textarea 2's emoticon button
1534 * is clicked, the emoticon panel will be moved to WBB 2's wrap.
1535 *
1536 * This aliviates the need to generate each panel separately for every instance.
1537 * This means that if there are 100s of emoticons, they will only be created once
1538 * and moved around as needed, instead of creating 100s of emoticons per instance/textarea.
1539 *
1540 * Private (non-global) panels are stored in the Panel.set object.
1541 * Once panels are initially created within Panel.construct(),
1542 * private panels can be copied to (copyTo) a WhutBB instance.
1543 *
1544 * The only two private panels are Button and Link, because they
1545 * are not meant to be transient. Buttons are needed at every instance.
1546 *
1547 */
1548 WhutBB.Panel = (function () {
1549
1550 /**
1551 * An element is part of the instance
1552 */
1553 function Panel(element) {
1554 this.element = element;
1555 }
1556
1557 /**
1558 * A set of private panels
1559 */
1560 Panel.set = {};
1561
1562 /**
1563 * A set of global panels
1564 */
1565 Panel.global = {};
1566
1567 /**
1568 * Panel.factory creates both global and private panels
1569 *
1570 * @param name for the panel
1571 * @param element to encapsulate
1572 * @param priv true for private panels, otherwise global
1573 */
1574 Panel.factory = function (name, element, priv) {
1575 if (priv) {
1576 if (!Panel.set[name]) {
1577 Panel.set[name] = new Panel(element);
1578 }
1579 return Panel.set[name];
1580 }
1581 if (!Panel.global[name]) {
1582 Panel.global[name] = new Panel(element);
1583 }
1584 return Panel.global[name];
1585 };
1586
1587 /**
1588 * Creates and initializes every necessary panel
1589 */
1590 Panel.construct = function () {
1591 Panel.factory('link', dom.dom('div', {className: 'wbblink' + (WhutBB.user.settings.link ? '' : ' wbbhide') },
1592 dom.dom('a', {href: WhutBB.config.link, title: 'Version r.' + update.version, txt: 'WhutBBCode?', target: '_blank'})), true);
1593 Panel.factory('button', dom.dom('div', {className: 'wbbbuttons'}), true);
1594
1595 // Global Panels
1596 Panel.factory('shortcut', dom.dom('ul', {className: 'wbbshortcut wbbhide'}));
1597 Panel.factory('emoticon', dom.dom('div', {className: 'wbbemot wbbhide'}));
1598 Panel.factory('settings', dom.dom('ul', {className: 'wbbset wbbhide'}, null, document.body));
1599 Panel.factory('console', dom.dom('div', {className: 'wbbcon', txt: ''}));
1600 Panel.attach.fill();
1601 };
1602
1603 /**
1604 * Copies private panels to a WhutBB Instance
1605 */
1606 Panel.copyTo = function (wbbInst) {
1607 wbbInst.panels = {};
1608 dom.oEach(Panel.set, function (name, panel) {
1609 wbbInst.panels[name] = panel.element.cloneNode(true);
1610 wbbInst.wrap.appendChild(wbbInst.panels[name]);
1611 });
1612 };
1613
1614 /**
1615 * Prints a message to the console
1616 */
1617 Panel.message = function (text, time) {
1618 var el = WhutBB.Panel.global.console.element;
1619 el.innerHTML = text;
1620 window.setTimeout(function () {
1621 el.innerHTML = '';
1622 }, isNaN(+time) ? 2500 : time);
1623 };
1624
1625 Panel.attach = {
1626 fill: function () {
1627 // fills the panels appropriately
1628 this.buttons();
1629 this.emoticons(-1, Math.min(WhutBB.config.emoticons.length,
1630 WhutBB.config.emoticonMax));
1631 this.settings();
1632 this.shortcuts();
1633 },
1634 buttons: function () {
1635 var f = document.createDocumentFragment();
1636 dom.aEach(WhutBB.config.blueprint, function (set) {
1637 dom.aEach(set, function (name) {
1638 f.appendChild(WhutBB.Button.create(name).make());
1639 });
1640 f.appendChild(WhutBB.Button.Space.make());
1641 });
1642 Panel.set.button.element.appendChild(f);
1643 f = null;
1644 },
1645 emoticons: function (i, max) {
1646 var f = document.createDocumentFragment();
1647 while (++i < max) {
1648 f.appendChild(WhutBB.Button.emoticon(WhutBB.config.emoticons[i]));
1649 }
1650 // attach the div that loads all emoticons if required
1651 if (max !== WhutBB.config.emoticons.length
1652 && WhutBB.config.emoticons.length > WhutBB.config.emoticonMax) {
1653 f.appendChild(WhutBB.Button.emoticonLoader());
1654 }
1655 Panel.global.emoticon.element.appendChild(f);
1656 f = null;
1657 },
1658 settings: function () {
1659 var list = [];
1660 dom.oEach(WhutBB.user.options, function (name, data) {
1661 list.push('<li><label title="' + data.title + '" ><input type="checkbox" data-setting="true" name="' + name + '" '
1662 + (WhutBB.user.settings[name] ? 'checked="checked" ' : '') + '/>' + data.txt + '</label></li>');
1663 });
1664 Panel.global.settings.element.innerHTML = list.join('');
1665 Panel.global.settings.element.appendChild(Panel.global.console.element);
1666 },
1667 shortcuts: function () {
1668 var ul = Panel.global.shortcut.element;
1669
1670 // todo change?
1671 dom.oEach(WhutBB.config.shortcuts, function (key, shortcuts) {
1672 dom.oEach(shortcuts, function (letter, button) {
1673 if (WhutBB.config.validButtons[button]) { // Checks if the site uses this button
1674 ul.appendChild(dom.dom('li', {
1675 innerHTML: [
1676 '<strong>',
1677 WhutBB.db.getShortcutText(key),
1678 '+',
1679 letter.toUpperCase(),
1680 '</strong><br>',
1681 WhutBB.db.buttons[button].title
1682 ].join('')
1683 }));
1684 }
1685 });
1686 });
1687
1688 if (ul.hasChildNodes()) {
1689 ul.appendChild(dom.dom('li', {className: 'wbbnotes', innerHTML: '<strong>CTRL</strong> and <strong>Command</strong> (<strong>⌘</strong>) are interchangable'}));
1690 }
1691 }
1692 };
1693
1694 return Panel;
1695
1696 }());
1697
1698 /**
1699 * Tag Class
1700 * Creates a tag of given name
1701 *
1702 * Use Tag.get(), not new Tag()!
1703 * Tag.get() uses lazy loading, and stores all new
1704 * tags within Tags.tags[]
1705 *
1706 * A tag's type generates the appropriate parsing
1707 * All tags parse as a two-index array
1708 *
1709 * If a tag does not require an endpoint (matching tag),
1710 * an empty string is required
1711 *
1712 * ['[tag]', '[/tag]']
1713 * ['open', '']
1714 * ['', 'close']
1715 *
1716 * Example, insert a tag directly into a textarea
1717 * bTag = Tag.get('b');
1718 * bTag.insertTo(someTextarea);
1719 *
1720 * PS: Note the use of WhutBB.box within insertTo().
1721 */
1722 WhutBB.Tag = (function () {
1723
1724 function Tag(text) {
1725 Tag.tags[text] = this;
1726 this.button = WhutBB.db.buttons[text];
1727 this.tag = this.button.tag || text;
1728 }
1729
1730 // Stores new Tags
1731 Tag.tags = {};
1732
1733 // Types
1734 Tag.BASIC = 0;
1735 Tag.OPTION = 1;
1736 Tag.OPTION_NOCLOSE = 2;
1737 Tag.LIST = 3;
1738 Tag.CUSTOM = 4;
1739
1740 /**
1741 * Gets a tag by a name.
1742 * Finds a tag in the tags object or creates a new tag.
1743 * Returns an update()'d tag
1744 */
1745 Tag.get = function (name) {
1746 if (WhutBB.db.buttons[name]) {
1747 return (Tag.tags[name] || new Tag(name)).update();
1748 }
1749 };
1750
1751 /**
1752 * Each button has a type which is used as the parsing method
1753 */
1754 Tag.types = {
1755 0: function () { // Basic tag [tag][/tag]
1756 return ['[' + this.tag + ']', '[/' + this.tag + ']'];
1757 },
1758 1: function () { // [tag=option][/tag]
1759 return ['[' + this.tag + '=' + this.option + ']', '[/' + this.tag + ']'];
1760 },
1761 2: function () { // [tag=]
1762 return ['[' + this.tag + '=', ']'];
1763 },
1764 3: function () { // List [*] or [#]
1765 var j = [], li = WhutBB.box.range.data.selection.split('\n');
1766
1767 if (li.length > 1) {
1768 dom.aEach(li, function (item) {
1769 j.push('[' + this.tag + ']' + item);
1770 }, this);
1771 WhutBB.box.range.data.selection = j.join('\n');
1772 return ['', ''];
1773 }
1774
1775 return ['\n[' + this.tag + ']', ''];
1776 },
1777 4: function () { // used for custom tags
1778 if (typeof this.tag === 'string') {
1779 return [this.tag, this.tag];
1780 }
1781 return [this.tag[0], this.tag[1]];
1782 }
1783 };
1784
1785 Tag.prototype.toString = function () {
1786 return [this.tag, this.option, this.type].join(' ');
1787 };
1788
1789 Tag.prototype.insertTo = function (textarea) {
1790 WhutBB.box.select(textarea).insert(this.parse());
1791 };
1792
1793 /**
1794 * Parse uses some JavaScript magic to get the function
1795 * based on the tag type, and call it with _this_ tag's
1796 * instance
1797 */
1798 Tag.prototype.parse = function () {
1799 return Tag.types[this.type].call(this);
1800 };
1801
1802 Tag.prototype.findOption = function () {
1803 // console.log('find option');
1804 return this.button.type === 1 && this.optionText();
1805 };
1806
1807 Tag.prototype.defaultText = function () {
1808 return this.button.placeholder || this.button.val || '';
1809 };
1810
1811 Tag.prototype.placeholderText = function () {
1812 return this.button.placeholder ? ('\n(Default text [' + this.button.placeholder + '] will be removed automatically.)') : '';
1813 };
1814
1815 Tag.prototype.optionText = function () {
1816 if (!WhutBB.e.macro && WhutBB.user.settings.prompt && this.button.noPrompt !== true) {
1817 this.option = window.prompt(this.button.prompt + this.placeholderText(), this.defaultText());
1818 } else {
1819 this.option = this.defaultText();
1820 }
1821 if (this.option === this.button.placeholder || this.option === '') {
1822 this.option = false;
1823 }
1824 return true;
1825 };
1826
1827 Tag.prototype.findType = function () {
1828 return this.option === false ? 0 : this.button.type || 0;
1829 };
1830
1831 Tag.prototype.update = function () {
1832 this.findOption();
1833 this.type = this.findType();
1834 return this;
1835 };
1836
1837 return Tag;
1838
1839 }());
1840
1841 WhutBB.init();
1842 WhutBB.factory();
1843}());