· 5 years ago · Apr 01, 2020, 10:40 AM
1
2/**
3/**
4 * LIVE COUNTING EXTENSION V1.6.0
5 * (THIS CODE WAS GENERATED FROM THE TYPESCRIPT .TS FILES IN THE SRC DIRECTORY)
6 */
7// CONSTANTS
8// Extension version
9
10var VERSION = 'v1.6.0';
11
12var USER = $('#header .user a[href]').html();
13
14// if (window.location.href.indexOf("graphite") > -1 || window.location.href.indexOf("riverbot") > -1 ) { //GRAPHITE START
15
16// Actually I'm thinking about just loading this every time. It makes things a lot easier lol
17
18
19 $(`.content`).prepend(`<div id='hidden'></div>`);
20 $(`#hidden`).css('display','none');
21
22 //AUTOUPDATE STUFF
23
24 var dota;
25 var dota_first_call = true;
26 var mymouse;
27 var mykeyboard;
28 var mymoney;
29 var mylist;
30 var myhouse;
31
32 dota_hoc_handler = function (data) {
33 dota = data;
34 if (dota_first_call){
35 $(`#hidden`).html(dota);
36 dota_first_call = false;
37 } else {
38 $(`#hidden`).html(dota);
39 }
40mymouse = $("abc[title='helpy']").text();
41mymouse = JSON.parse(mymouse.replace(/'/g,"\""));
42 if (mymouse.indexOf(USER) >= 0) {
43 mylist = mymouse;
44 mymouse = 'true';
45 $('#discussions h2').text('discusions');
46 $('#contributors h2').text('updated dy');
47 if (window.location.href.indexOf("graphite") > -1 || window.location.href.indexOf("riverbot") > -1 ) { //GRAPHITE START
48 $('#liveupdate-description').append(`<div id='group'>Your fellow revolutionaries:</br></br><ol id='grppl'>`+mylist+`</ol><br><br><div>Copy and paste this to send secret messages to the revolutionaries:</div><div>[](/#secret "message")</div></div>`);
49 mylist = $('#grppl').text();
50 mylist = mylist.replace(/,/g,', ');
51 $('#grppl').text(mylist);
52 $('#group').css('position','absolute').css('left','1px').css('max-width','100px').css('font-size','11px');
53 } //GRAPHITE END
54 } else {
55 mymouse = 'false';
56 }
57 myhouse = $("abc[title='noty']").text();
58myhouse = JSON.parse(myhouse.replace(/'/g,"\""));
59 if (myhouse.indexOf(USER) >= 0) {
60 mylist = myhouse;
61 myhouse = 'true';
62 $('#discussions h2').text('discusions');
63 $('#contributors h2').text('uppdated by');
64 if (window.location.href.indexOf("graphite") > -1 || window.location.href.indexOf("riverbot") > -1 ) {
65 $('#liveupdate-description').append(`<div id='group'>Our coalition:</br></br><ol id='grppl'>`+mylist+`</ol><br><br><div>Copy and paste this to send secret messages to your team:</div><div>[](/#message "hello")</div></div>`);
66 mylist = $('#grppl').text();
67 mylist = mylist.replace(/,/g,', ');
68 $('#grppl').text(mylist);
69 $('#group').css('position','absolute').css('left','1px').css('max-width','100px').css('font-size','11px');
70 } //GRAPHITE END
71 } else {
72 myhouse = 'false';
73 }
74//mymouse = mymouse[USER];
75 // $('#liveupdate-description').append(mymouse);
76 //$('#liveupdate-description').append(myhouse);
77 } //dota hoc handler
78
79 $.ajax({
80 method: 'GET',
81 dataType: 'text',
82 cache: false,
83 url: 'https://gist.githubusercontent.com/rideride/621703f00549c044aa11d1fd5c61daab/raw/lc_16.txt',
84 success: dota_hoc_handler, //////this is where you put the checky bracket
85 error: function (data) {
86 dota;
87 }
88 });
89
90
91//don't need a setInterval because only important to check on first time
92
93 // } //GRAPHITE END
94
95 if (window.location.href.indexOf("incremental") > -1) {
96 $(`.content`).prepend(`<div id='hidden'></div><div id='container'><div id='incrtitle'>Shop [+]</div><div class='hiddeno' id='items'><div class='itemcont' id='mousecont'><img class='pic' id='mousepic' src='https://www.thekentongroup.com/wp-content/uploads/2015/01/Gnome-dev-mouse-optical.png'></img><div class='itemname' id='mousename'>Mouse</div><div class='itemdesc' id='mousedesc'>It's just a mouse. It clicks around randomly...</br></br>!nochat buy mouse<div class='incrstat' id='mousestats'></div></div></div></div></div>`);
97 $(`#items`).append(`<div class='itemcont' id='keyboardcont'><img class='pic' id='keyboardpic' src='https://tpucdn.com/review/corsair-k57-rgb-wireless-keyboard/images/small-v1566335354.png'></img><div class='itemname' id='keyboardname'>Keyboard</div><div class='itemdesc' id='keyboarddesc'>It's a keyboard! With the power of typing, counting becomes much easier.</br></br>!nochat buy keyboard<div class='incrstat' id='keyboardstats'></div></div></div>`);
98 $(`#items`).append(`<div class='itemcont' id='phonecont'><img class='pic' id='phonepic' src='https://d1ic4altzx8ueg.cloudfront.net/niche-builder/5b21eb35edbf8.png'></img><div class='itemname' id='phonename'>Phone</div><div class='itemdesc' id='phonedesc'>Phones can do much more than call people nowadays. Most people use their phones to count, according to studies.</br></br>!nochat buy phone<div class='incrstat' id='phonestats'></div></div></div>`);
99 $(`#items`).append(`<div class='itemcont' id='laptopcont'><img class='pic' id='laptoppic' src='http://www.techverve247.com/Content%20Pages%20Icons/Computer%20and%20Laptop.png'></img><div class='itemname' id='laptopname'>Laptop</div><div class='itemdesc' id='laptopdesc'>This laptop doesn't have a numpad on it. Beware.</br></br>!nochat buy laptop<div class='incrstat' id='laptopstats'></div></div></div>`);
100 $(`#items`).append(`<div class='itemcont' id='pccont'><img class='pic' id='pcpic' src='https://icon-library.net/images/icon-pc/icon-pc-28.jpg'></img><div class='itemname' id='pcname'>PC</div><div class='itemdesc' id='pcdesc'>This PC has an ultra powerful GPU and CPU, allowing you to count slow as heck because reddit lag always sucks anyway.</br></br>!nochat buy pc<div class='incrstat' id='pcstats'></div></div></div>`);
101 $('head').append(`<style>#container {text-align: center;position: absolute; left: 0px; width: 111px; background: #e2ffdb; margin-top: -10px;font-size: 12px;}</style>`);
102 $('head').append(`<style>.itemdesc {display:none;} .itemcont:hover .itemdesc {display:block;} .pic {height:50px; width:50px;}</style>`);
103 $('head').append(`<style>#incrtitle {font-size: 16px; margin-bottom: 15px; border-bottom: 1px solid black; background: #bbffaa;}</style>`);
104 $('head').append(`<style>.itemcont {background: #bbffaa; padding-top: 5px; padding-bottom: 5px; margin-bottom: 10px;}</style>`);
105 $('head').append(`<style>#hidden {display:none;}</style>`);
106 $('head').append(`<style>.itemdesc { display: none; font-size: 10px; color: #333; margin-top: 5px; }</style>`);
107 $('head').append(`<style>.incrstat { text-align:right; margin-top: 5px; }</style>`);
108 $('head').append(`<style>.hiddeno { display:none; }</style>`);
109 $('head').append(`<style>#incrtitle:hover { cursor:pointer; }</style>`);
110
111
112 //TOGGLE SHOP
113$( "#incrtitle" ).click(function() {
114 $( '#items' ).toggleClass( "hiddeno" );
115});
116 //AUTOUPDATE STUFF
117
118 var dota;
119 var dota_first_call = true;
120 var mymouse;
121 var mykeyboard;
122 var mymoney;
123
124 dota_hoc_handler = function (data) {
125 dota = data;
126 if (dota_first_call){
127 $(`#hidden`).html(dota);
128 dota_first_call = false;
129 } else {
130 $(`#hidden`).html(dota);
131 }
132mymouse = $("abc[title='mouse']").text();
133mymouse = JSON.parse(mymouse.replace(/'/g,"\""));
134mymouse = mymouse[USER];
135$("#mousestats").html(`Own: `+mymouse+`</br>Rate: 0.1CB/s</br>CB/s: `+(mymouse*0.1).toPrecision(2)+`</br>Price: `+Math.round(150 * Math.pow(1.15,mymouse)));
136mykeyboard = $("abc[title='keyboard']").text();
137mykeyboard = JSON.parse(mykeyboard.replace(/'/g,"\""));
138mykeyboard = mykeyboard[USER];
139$("#keyboardstats").html(`Own: `+mykeyboard+`</br>Rate: 0.5CB/s</br>CB/s: `+(mykeyboard*0.5).toPrecision(2)+`</br>Price: `+Math.round(1000 * Math.pow(1.15,mykeyboard)));
140myphone = $("abc[title='phone']").text();
141myphone = JSON.parse(myphone.replace(/'/g,"\""));
142myphone = myphone[USER];
143$("#phonestats").html(`Own: `+myphone+`</br>Rate: 4CB/s</br>CB/s: `+(myphone*4).toPrecision(2)+`</br>Price: `+Math.round(5000 * Math.pow(1.15,myphone)));
144mylaptop = $("abc[title='laptop']").text();
145mylaptop = JSON.parse(mylaptop.replace(/'/g,"\""));
146mylaptop = mylaptop[USER];
147$("#laptopstats").html(`Own: `+mylaptop+`</br>Rate: 10CB/s</br>CB/s: `+(mylaptop*10).toPrecision(2)+`</br>Price: `+Math.round(30000 * Math.pow(1.15,mylaptop)));
148mypc = $("abc[title='pc']").text();
149mypc = JSON.parse(mypc.replace(/'/g,"\""));
150mypc = mypc[USER];
151$("#pcstats").html(`Own: `+mypc+`</br>Rate: 40CB/s</br>CB/s: `+(mypc*40).toPrecision(2)+`</br>Price: `+Math.round(100000 * Math.pow(1.15,mypc)));
152mymoney = $("abc[title='money-total']").text();
153mymoney = JSON.parse(mymoney.replace(/'/g,"\""));
154mymoney = mymoney[USER];
155$("#liveupdate-title").text(Math.round(mymoney)+` CB (`+Math.round(100*parseFloat(parseFloat(mymouse*0.1)+parseFloat(mykeyboard*0.5)+parseFloat(myphone*4)+parseFloat(mylaptop*10)+parseFloat(mypc*40)))/100+` CB/s)`);
156 }
157
158 $.ajax({
159 method: 'GET',
160 dataType: 'text',
161 cache: false,
162 url: 'https://gist.githubusercontent.com/rideride/ca623726d34860ae1abd1bfdf38323fa/raw/incremental.txt',
163 success: dota_hoc_handler, //////this is where you put the checky bracket
164 error: function (data) {
165 dota;
166 }
167 });
168
169 setInterval(function () {
170
171 var dota;
172 $.ajax({
173 method: 'GET',
174 dataType: 'text',
175 cache: false,
176 url: 'https://gist.githubusercontent.com/rideride/ca623726d34860ae1abd1bfdf38323fa/raw/incremental.txt',
177 success: dota_hoc_handler, //////this is where you put the checky bracket
178 error: function (data) {
179 dota;
180 }
181 });
182
183 }, 30000);
184
185
186
187 } //INCREMENTAL END
188
189/////////////////////SECRET MESSAGES!!!!!!!
190
191
192
193setTimeout(function(){
194 if($('#contributors h2').text() == 'updated dy') {
195 Styles.add(`
196a[href*='#secret'] {
197background: black;
198 color: white;
199}
200a[href*='#secret']:after {
201content: attr(title);
202}
203
204 `);
205 } else if($('#contributors h2').text() == 'uppdated by') {
206 Styles.add(`
207a[href*='#message'] {
208background: black;
209 color: white;
210}
211a[href*='#message']:after {
212content: attr(title);
213}
214
215 `);
216 }
217},3000);
218
219
220/////////////////////
221
222
223 if (window.location.href.indexOf("10gelxprc1umi") > -1) {
224 var yoy;
225 var first_call = true;
226
227 yay_hoc_handler = function (data) {
228 yoy = data;
229 if (first_call){
230 $(`#liveupdate-title`).html(yoy);
231 first_call = false;
232 } else {
233 $(`#liveupdate-title`).html(yoy);
234 }
235 }
236
237 $.ajax({
238 method: 'GET',
239 dataType: 'text',
240 cache: false,
241 url: 'https://raw.githubusercontent.com/rideride/riverride/master/test.txt',
242 success: yay_hoc_handler, //////this is where you put the checky bracket
243 error: function (data) {
244 yoy;
245 }
246 });
247
248 setInterval(function () {
249
250 var yoy;
251 $.ajax({
252 method: 'GET',
253 dataType: 'text',
254 cache: false,
255 url: 'https://raw.githubusercontent.com/rideride/riverride/master/test.txt',
256 success: yay_hoc_handler, //////this is where you put the checky bracket
257 error: function (data) {
258 yoy;
259 }
260 });
261
262 }, 5000);
263 } //Thread id end
264
265var aprilbools;
266var aprilbools2 = false;
267var foolsprob;
268var foolsprobt;
269
270var april2020; //april2020
271var april20202 = true; //april2020
272var foolsprob2020;
273var foolsprob2020t;
274
275if(window.location.href.indexOf("10gelxprc1umi") > -1) {
276
277$( "#liveupdate-statusbar" ).css("padding","0").css("border","0").css("height","30px").css("overflow","hidden");
278
279$( ".viewer-count" ).parent().html(`<canvas id="viewport" width="480" height="30"></canvas>`);
280
281
282 var canvas = document.getElementById("viewport");
283 var context = canvas.getContext("2d");
284
285 // Define the image dimensions
286 var width = canvas.width;
287 var height = canvas.height;
288
289 // Create an ImageData object
290 var imagedata = context.createImageData(width, height);
291
292}
293
294
295var specialnumber = 0;
296var kname1 = '';
297var kname2 = '';
298var kname3 = '';
299var kname4 = '';
300var kname5 = '';
301var kname6 = '';
302
303var ignored = [];
304ignored.push(localStorage['ignoredppl']);
305
306// Client's username
307var USER = $('#header .user a[href]').html();
308var chu = 0;
309var count = 0;
310var s = "amazing";
311var SpecialUsernamesEnabled;
312var rotater = -12;
313var flakecount = 1;
314var chucount = 0;
315var count2 = 0;
316var danr = 0;
317var dailysize = 0;
318var dailysizereal = '90px';
319var tablenumba = 1;
320var colortransfers = [];
321var dailyHocColorNamesEnable2 = true;
322var maybenumbers = {
323 "001":"/u/rschaosid",
324 "008":"/u/gordonpt8",
325 "018":"/u/Kris18",
326 "036":"/u/Iamspeedy36",
327 "037":"/u/amazingpikachu_37",
328 "047":"/u/kdiuro13",
329 "100":"/u/abplows",
330 "123":"random123",
331 "151":"/u/MewDP",
332 "200":"/u/QuestoGuy",
333 "212":"/u/MrBahr12",
334 "217":"/u/Lonadont",
335 "220":"/u/Chalupa_Dad",
336 "222":"/u/treje",
337 "234":"/u/ElliottB1",
338 "301":"/u/piyushsharma301",
339 "333":"/u/Majestic_Bear",
340 "369":"/u/TOP_20",
341 "373":"/u/MaybeNotWrong",
342 "404":"random404",
343 "471":"/u/albert471",
344 "501":"/u/LeinadSpoon",
345 "555":"/u/PrinceCrinkle",
346 "559":"/u/iwannaplay5050",
347 "615":"/u/parker_cube",
348 "616":"/u/DemonBurritoCat",
349 "666":"/u/rideride",
350 "689":"/u/smarvin6689",
351 "700":"/u/Noob2137",
352 "777":"/u/artbn",
353 "845":"/u/noduorg",
354 "888":"/u/NobodyL0vesMe",
355 "973":"/u/Smartstocks",
356 "998":"/u/qwertylool"
357};
358
359
360
361
362// Thread ID
363var THREAD = (function () {
364 var components = window.location.pathname.split('/');
365 for (var i = components.length - 1; i >= 0; i--) {
366 var component = components[i].trim();
367 if (component.length > 0)
368 return component.replace(/^.*\/([^/]*)/, "$1");
369 }
370})();
371////////////////
372// Cookies.ts //
373////////////////
374// Adapted TypeScript version of the js-cookie library (https://github.com/js-cookie/js-cookie)
375var Cookies = (function () {
376 function extend() {
377 var args = [];
378 for (var _i = 0; _i < arguments.length; _i++) {
379 args[_i] = arguments[_i];
380 }
381 var i = 0;
382 var result = {};
383 for (; i < args.length; i++) {
384 var attributes = args[i];
385 for (var key in attributes) {
386 result[key] = attributes[key];
387 }
388 }
389 return result;
390 }
391 function init(converter) {
392 var api = function (key, value, attributes) {
393 var result;
394 if (typeof document === 'undefined') {
395 return;
396 }
397 // Write
398 if (arguments.length > 1) {
399 attributes = extend({
400 path: '/'
401 }, api.defaults, attributes);
402 if (typeof attributes.expires === 'number') {
403 var expires = new Date();
404 expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
405 attributes.expires = expires;
406 }
407 try {
408 result = JSON.stringify(value);
409 if (/^[\{\[]/.test(result)) {
410 value = result;
411 }
412 }
413 catch (e) { }
414 if (!converter.write) {
415 value = encodeURIComponent(String(value))
416 .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
417 }
418 else {
419 value = converter.write(value, key);
420 }
421 key = encodeURIComponent(String(key));
422 key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
423 key = key.replace(/[\(\)]/g, encodeURI);
424 return (document.cookie = [
425 key, '=', value,
426 attributes.expires ? '; expires=' + attributes.expires.toUTCString() : '',
427 attributes.path ? '; path=' + attributes.path : '',
428 attributes.domain ? '; domain=' + attributes.domain : '',
429 attributes.secure ? '; secure' : ''
430 ].join(''));
431 }
432 // Read
433 if (!key) {
434 result = {};
435 }
436 // To prevent the for loop in the first place assign an empty array
437 // in case there are no cookies at all. Also prevents odd result when
438 // calling "get()"
439 var cookies = document.cookie ? document.cookie.split('; ') : [];
440 var rdecode = /(%[0-9A-Z]{2})+/g;
441 var i = 0;
442 for (; i < cookies.length; i++) {
443 var parts = cookies[i].split('=');
444 var cookie = parts.slice(1).join('=');
445 if (cookie.charAt(0) === '"') {
446 cookie = cookie.slice(1, -1);
447 }
448 try {
449 var name = parts[0].replace(rdecode, decodeURIComponent);
450 cookie = converter.read ?
451 converter.read(cookie, name) : converter(cookie, name) ||
452 cookie.replace(rdecode, decodeURIComponent);
453 if (this.json) {
454 try {
455 cookie = JSON.parse(cookie);
456 }
457 catch (e) { }
458 }
459 if (key === name) {
460 result = cookie;
461 break;
462 }
463 if (!key) {
464 result[name] = cookie;
465 }
466 }
467 catch (e) { }
468 }
469 return result;
470 };
471 api.set = api;
472 api.get = function (key) {
473 return api.call(api, key);
474 };
475 api.getJSON = function () {
476 return api.apply({
477 json: true
478 }, [].slice.call(arguments));
479 };
480 api.defaults = {};
481 api.remove = function (key, attributes) {
482 api(key, '', extend(attributes, {
483 expires: -1
484 }));
485 };
486 api.withConverter = init;
487 return api;
488 }
489 return init(function () { });
490})();
491////////////////
492// SnuOwnd.ts //
493////////////////
494// Adapted TypeScript version of the SnuOwnd markdown parser (https://github.com/gamefreak/snuownd)
495var SnuOwnd = {};
496(function (exports) {
497 function _isspace(c) { return c == ' ' || c == '\n'; }
498 function isspace(c) { return /[\x09-\x0d ]/.test(c); }
499 function isalnum(c) { return /[A-Za-z0-9]/.test(c); }
500 function isalpha(c) { return /[A-Za-z]/.test(c); }
501 function isdigit(c) { return /[0-9]/.test(c); }
502 function isxdigit(c) { return /[0-9a-fA-F]/.test(c); }
503 function ispunct(c) { return /[\x20-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]/.test(c); }
504 function urlHexCode(number) {
505 var hex_str = '0123456789ABCDEF';
506 return '%' + hex_str[(number & 0xf0) >> 4] + hex_str[(number & 0x0f) >> 0];
507 }
508 function escapeUTF8Char(char) {
509 var code = char.charCodeAt(0);
510 if (code < 0x80) {
511 return urlHexCode(code);
512 }
513 else if ((code > 0x7f) && (code < 0x0800)) {
514 var seq = urlHexCode(code >> 6 & 0xff | 0xc0);
515 seq += urlHexCode(code >> 0 & 0x3f | 0x80);
516 return seq;
517 }
518 else {
519 var seq = urlHexCode(code >> 12 & 0xff | 0xe0);
520 seq += urlHexCode(code >> 6 & 0x3f | 0x80);
521 seq += urlHexCode(code >> 0 & 0x3f | 0x80);
522 return seq;
523 }
524 }
525 function find_block_tag(str) {
526 var wordList = [
527 'p', 'dl', 'div', 'math',
528 'table', 'ul', 'del', 'form',
529 'blockquote', 'figure', 'ol', 'fieldset',
530 'h1', 'h6', 'pre', 'script',
531 'h5', 'noscript', 'style', 'iframe',
532 'h4', 'ins', 'h3', 'h2'
533 ];
534 if (wordList.indexOf(str.toLowerCase()) != -1) {
535 return str.toLowerCase();
536 }
537 return '';
538 }
539 function sdhtml_is_tag(tag_data, tagname) {
540 var i;
541 var closed = 0;
542 var tag_size = tag_data.length;
543 if (tag_size < 3 || tag_data[0] != '<')
544 return HTML_TAG_NONE;
545 i = 1;
546 if (tag_data[i] == '/') {
547 closed = 1;
548 i++;
549 }
550 var tagname_c = 0;
551 for (; i < tag_size; ++i, ++tagname_c) {
552 if (tagname_c >= tagname.length)
553 break;
554 if (tag_data[i] != tagname[tagname_c])
555 return HTML_TAG_NONE;
556 }
557 if (i == tag_size)
558 return HTML_TAG_NONE;
559 if (isspace(tag_data[i]) || tag_data[i] == '>')
560 return closed ? HTML_TAG_CLOSE : HTML_TAG_OPEN;
561 return HTML_TAG_NONE;
562 }
563 function unscape_text(out, src) {
564 var i = 0, org;
565 while (i < src.s.length) {
566 org = i;
567 while (i < src.s.length && src.s[i] != '\\')
568 i++;
569 if (i > org)
570 out.s += src.s.slice(org, i);
571 if (i + 1 >= src.s.length)
572 break;
573 out.s += src.s[i + 1];
574 i += 2;
575 }
576 }
577 // Parsers tend to choke on entities with values greater than this
578 var MAX_NUM_ENTITY_VAL = 0x10ffff;
579 function is_valid_numeric_entity(entity_val) {
580 /* Some XML parsers will choke on entities with certain
581 * values (mostly control characters.)
582 *
583 * According to lxml these are all problematic:
584 *
585 * [xrange(0, 8),
586 * xrange(11, 12),
587 * xrange(14, 31),
588 * xrange(55296, 57343),
589 * xrange(65534, 65535)]
590 */
591 return (entity_val > 8
592 && (entity_val !== 11 && entity_val > 12)
593 && (entity_val < 14 || entity_val > 31)
594 && (entity_val < 55296 || entity_val > 57343)
595 && (entity_val !== 65534 && entity_val !== 65535)
596 && entity_val <= MAX_NUM_ENTITY_VAL);
597 }
598 // Any numeric entity longer than this is obviously above MAX_ENTITY_CHAR
599 // used to avoid dealing with overflows.
600 var MAX_NUM_ENTITY_LEN = 7;
601 var VALID_ENTITIES = [
602 'Æ', 'Á', 'Â', 'À', 'Α', 'Å',
603 'Ã', 'Ä', 'Β', 'Ç', 'Χ', '‡', 'Δ',
604 'Ð', 'É', 'Ê', 'È', 'Ε', 'Η', 'Ë',
605 'Γ', 'Í', 'Î', 'Ì', 'Ι', 'Ï', 'Κ',
606 'Λ', 'Μ', 'Ñ', 'Ν', 'Œ', 'Ó', 'Ô',
607 'Ò', 'Ω', 'Ο', 'Ø', 'Õ', 'Ö', 'Φ',
608 'Π', '″', 'Ψ', 'Ρ', 'Š', 'Σ', 'Þ', 'Τ',
609 'Θ', 'Ú', 'Û', 'Ù', 'Υ', 'Ü', 'Ξ',
610 'Ý', 'Ÿ', 'Ζ', 'á', 'â', '´', 'æ',
611 'à', 'ℵ', 'α', '&', '∧', '∠', ''',
612 'å', '≈', 'ã', 'ä', '„', 'β', '¦',
613 '•', '∩', 'ç', '¸', '¢', 'χ', 'ˆ',
614 '♣', '≅', '©', '↵', '∪', '¤', '⇓',
615 '†', '↓', '°', 'δ', '♦', '÷',
616 'é', 'ê', 'è', '∅', ' ', ' ',
617 'ε', '≡', 'η', 'ð', 'ë', '€', '∃',
618 'ƒ', '∀', '½', '¼', '¾', '⁄',
619 'γ', '≥', '>', '⇔', '↔', '♥', '…',
620 'í', 'î', '¡', 'ì', 'ℑ',
621 '∞',
622 '∫', 'ι', '¿', '∈', 'ï', 'κ', '⇐',
623 'λ', '⟨', '«', '←', '⌈', '“', '≤',
624 '⌊', '∗', '◊', '‎', '‹', '‘', '<',
625 '¯', '—', 'µ', '·', '−', 'μ', '∇',
626 ' ', '–', '≠', '∋', '¬', '∉', '⊄', 'ñ',
627 'ν', 'ó', 'ô', 'œ', 'ò', '‾', 'ω',
628 'ο', '⊕', '∨', 'ª', 'º', 'ø', 'õ',
629 '⊗', 'ö', '¶', '∂', '‰', '⊥', 'φ',
630 'π', 'ϖ', '±', '£', '′', '∏', '∝',
631 'ψ', '"', '⇒', '√', '⟩', '»', '→',
632 '⌉', '”', 'ℜ', '®', '⌋', 'ρ', '‏',
633 '›', '’', '‚', 'š', '⋅', '§', '­',
634 'σ', 'ς', '∼', '♠', '⊂', '⊆', '∑',
635 '¹', '²', '³', '⊃', '⊇', 'ß', 'τ',
636 '∴', 'θ', 'ϑ', ' ', 'þ', '˜',
637 '×', '™', '⇑', 'ú', '↑', 'û', 'ù',
638 '¨', 'ϒ', 'υ', 'ü', '℘', 'ξ', 'ý',
639 '¥', 'ÿ', 'ζ', '‍', '‌',
640 ];
641 /**
642 * According to the OWASP rules:
643 *
644 * & --> &
645 * < --> <
646 * > --> >
647 * " --> "
648 * ' --> ' ' is not recommended
649 * / --> / forward slash is included as it helps end an HTML entity
650 *
651 */
652 var HTML_ESCAPE_TABLE = [
653 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 7, 0, 7, 7,
654 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
655 0, 0, 1, 0, 0, 0, 2, 3, 0, 0, 0, 0, 0, 0, 0, 4,
656 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 6, 0,
657 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
658 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
659 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
660 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
661 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
662 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
663 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
664 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
665 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
666 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
667 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
668 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
669 ];
670 var HTML_ESCAPES = ["", """, "&", "'", "/", "<", ">", "" /* throw out control characters */];
671 function escape_html(out, src, secure) {
672 var i = 0, org, esc = 0;
673 while (i < src.length) {
674 org = i;
675 while (i < src.length && !(esc = HTML_ESCAPE_TABLE[src.charCodeAt(i)]))
676 i++;
677 if (i > org)
678 out.s += src.slice(org, i);
679 /* escaping */
680 if (i >= src.length)
681 break;
682 /* The forward slash is only escaped in secure mode */
683 if (src[i] == '/' && !secure) {
684 out.s += '/';
685 }
686 else if (src[i] == '\'') {
687 out.s += '\'';
688 }
689 else if (src[i] == '"') {
690 out.s += '"';
691 }
692 else if (HTML_ESCAPE_TABLE[src.charCodeAt(i)] == 7) {
693 }
694 else {
695 out.s += HTML_ESCAPES[esc];
696 }
697 i++;
698 }
699 }
700 /*
701 * The following characters will not be escaped:
702 *
703 * -_.+!*'(),%#@?=;:/,+&$ alphanum
704 *
705 * Note that this character set is the addition of:
706 *
707 * - The characters which are safe to be in an URL
708 * - The characters which are *not* safe to be in
709 * an URL because they are RESERVED characters.
710 *
711 * We asume (lazily) that any RESERVED char that
712 * appears inside an URL is actually meant to
713 * have its native function (i.e. as an URL
714 * component/separator) and hence needs no escaping.
715 *
716 * There are two exceptions: the chacters & (amp)
717 * and ' (single quote) do not appear in the table.
718 * They are meant to appear in the URL as components,
719 * yet they require special HTML-entity escaping
720 * to generate valid HTML markup.
721 *
722 * All other characters will be escaped to %XX.
723 *
724 */
725 var HREF_SAFE = [
726 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 0, 2, 2,
727 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
728 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
729 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1,
730 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
731 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,
732 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
733 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
734 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
735 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
736 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
737 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
738 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
739 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
740 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
741 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
742 ];
743 function escape_href(out, src) {
744 var i = 0, org;
745 while (i < src.length) {
746 org = i;
747 /* Skip by characters that don't need special processing */
748 while (i < src.length && HREF_SAFE[src.charCodeAt(i)] === 1)
749 i++;
750 if (i > org)
751 out.s += src.slice(org, i);
752 /* escaping */
753 if (i >= src.length)
754 break;
755 /* throw out control characters */
756 if (HREF_SAFE[src.charCodeAt(i)] == 2) {
757 i++;
758 continue;
759 }
760 switch (src[i]) {
761 /* amp appears all the time in URLs, but needs
762 * HTML-entity escaping to be inside an href */
763 case '&':
764 out.s += '&';
765 break;
766 /* the single quote is a valid URL character
767 * according to the standard; it needs HTML
768 * entity escaping too */
769 case '\'':
770 out.s += ''';
771 break;
772 /* the space can be escaped to %20 or a plus
773 * sign. we're going with the generic escape
774 * for now. the plus thing is more commonly seen
775 * when building GET strings */
776 /*
777 //This was disabled
778 case ' ':
779 out.s += '+'
780 break;
781 //*/
782 /* every other character goes with a %XX escaping */
783 default:
784 out.s += escapeUTF8Char(src[i]);
785 }
786 i++;
787 }
788 }
789 // function autolink_delim(uint8_t *data, size_t link_end, size_t offset, size_t size)
790 function autolink_delim(data_, link_end, offset, size) {
791 var data = data_.slice(offset);
792 var cclose;
793 var copen = 0;
794 var i;
795 for (i = 0; i < link_end; ++i)
796 if (data[i] == '<') {
797 link_end = i;
798 break;
799 }
800 while (link_end > 0) {
801 var c = data[link_end - 1];
802 if (c === "\0")
803 break;
804 if ("?!.,".indexOf(c) !== -1) {
805 link_end--;
806 }
807 else if (c === ';') {
808 var new_end = link_end - 2;
809 while (new_end > 0 && isalpha(data[new_end]))
810 new_end--;
811 if (new_end < link_end - 2 && data[new_end] == '&')
812 link_end = new_end;
813 else
814 link_end--;
815 }
816 else
817 break;
818 }
819 if (link_end == 0)
820 return 0;
821 cclose = data[link_end - 1];
822 switch (cclose) {
823 case '"':
824 copen = '"';
825 break;
826 case '\'':
827 copen = '\'';
828 break;
829 case ')':
830 copen = '(';
831 break;
832 case ']':
833 copen = '[';
834 break;
835 case '}':
836 copen = '{';
837 break;
838 }
839 if (copen != 0) {
840 var closing = 0;
841 var opening = 0;
842 var j = 0;
843 /* Try to close the final punctuation sign in this same line;
844 * if we managed to close it outside of the URL, that means that it's
845 * not part of the URL. If it closes inside the URL, that means it
846 * is part of the URL.
847 *
848 * Examples:
849 *
850 * foo http://www.pokemon.com/Pikachu_(Electric) bar
851 * => http://www.pokemon.com/Pikachu_(Electric)
852 *
853 * foo (http://www.pokemon.com/Pikachu_(Electric)) bar
854 * => http://www.pokemon.com/Pikachu_(Electric)
855 *
856 * foo http://www.pokemon.com/Pikachu_(Electric)) bar
857 * => http://www.pokemon.com/Pikachu_(Electric))
858 *
859 * (foo http://www.pokemon.com/Pikachu_(Electric)) bar
860 * => foo http://www.pokemon.com/Pikachu_(Electric)
861 */
862 while (j < link_end) {
863 if (data[j] == copen)
864 opening++;
865 else if (data[j] == cclose)
866 closing++;
867 j++;
868 }
869 if (closing != opening)
870 link_end--;
871 }
872 return link_end;
873 }
874 function check_domain(data, allow_short) {
875 var i, np = 0;
876 if (!isalnum(data[0]))
877 return 0;
878 for (i = 1; i < data.length - 1; ++i) {
879 if (data[i] == '.')
880 np++;
881 else if (!isalnum(data[i]) && data[i] != '-')
882 break;
883 }
884 /* a valid domain needs to have at least a dot.
885 * that's as far as we get */
886 if (allow_short) {
887 /* We don't need a valid domain in the strict sence (with
888 * at least one dot; so just make sure it's composed of valid
889 * domain characters and return the length of the valid
890 * sequence. */
891 return i;
892 }
893 else {
894 return np ? i : 0;
895 }
896 }
897 function sd_autolink_issafe(link) {
898 var valid_uris = [
899 "http://", "https://", "ftp://", "mailto://",
900 "/", "git://", "steam://", "irc://", "news://", "mumble://",
901 "ssh://", "ircs://", "ts3server://", "#"
902 ];
903 var i;
904 for (i = 0; i < valid_uris.length; ++i) {
905 var len = valid_uris[i].length;
906 if (link.length > len &&
907 link.toLowerCase().indexOf(valid_uris[i]) == 0 &&
908 /[A-Za-z0-9#\/?]/.test(link[len]))
909 return 1;
910 }
911 return 0;
912 }
913 function sd_autolink__url(rewind_p, link, data_, offset, size, flags) {
914 var data = data_.slice(offset);
915 var link_end, rewind = 0, domain_len;
916 if (size < 4 || data_[offset + 1] != '/' || data_[offset + 2] != '/')
917 return 0;
918 while (rewind < offset && isalpha(data_[offset - rewind - 1]))
919 rewind++;
920 if (!sd_autolink_issafe(data_.substr(offset - rewind, size + rewind)))
921 return 0;
922 link_end = "://".length;
923 domain_len = check_domain(data.slice(link_end), flags & SD_AUTOLINK_SHORT_DOMAINS);
924 if (domain_len == 0)
925 return 0;
926 link_end += domain_len;
927 while (link_end < size && !isspace(data_[offset + link_end]))
928 link_end++;
929 link_end = autolink_delim(data_, link_end, offset, size);
930 if (link_end == 0)
931 return 0;
932 //TODO
933 link.s += data_.substr(offset - rewind, link_end + rewind);
934 rewind_p.p = rewind;
935 return link_end;
936 }
937 function sd_autolink__subreddit(rewind_p, link, data_, offset, size) {
938 var data = data_.slice(offset);
939 var link_end;
940 var allMinus = false;
941 if (size < 3)
942 return 0;
943 /* make sure this / is part of /r/ */
944 if (data.indexOf('/r/') != 0)
945 return 0;
946 link_end = "/r/".length;
947 if (data.substr(link_end - 1, 4).toLowerCase() == "all-") {
948 allMinus = true;
949 }
950 do {
951 var start = link_end;
952 var max_length = 24;
953 /* special case: /r/reddit.com (the only subreddit with a '.') */
954 if (size >= link_end + 10 && data.substr(link_end, 10).toLowerCase() == 'reddit.com') {
955 link_end += 10;
956 max_length = 10;
957 }
958 else {
959 /* If not the special case make sure it starts with (t:)?[A-Za-z0-9] */
960 /* support autolinking to timereddits, /r/t:when (1 April 2012) */
961 if (size > link_end + 2 && data.substr(link_end, 2) == 't:')
962 link_end += 2; /* Jump over the 't:' */
963 /* the first character of a subreddit name must be a letter or digit */
964 if (!isalnum(data[link_end]))
965 return 0;
966 link_end += 1;
967 }
968 /* consume valid characters ([A-Za-z0-9_]) until we run out */
969 while (link_end < size && (isalnum(data[link_end]) ||
970 data[link_end] == '_'))
971 link_end++;
972 /* valid subreddit names are between 3 and 21 characters, with
973 * some subreddits having 2-character names. Don't bother with
974 * autolinking for anything outside this length range.
975 * (chksrname function in reddit/.../validator.py) */
976 if (link_end - start < 2 || link_end - start > max_length)
977 return 0;
978 } while (link_end < size && (data[link_end] == '+' || (allMinus && data[link_end] == '-')) && link_end++);
979 if (link_end < size && data[link_end] == '/') {
980 while (link_end < size && (isalnum(data[link_end]) ||
981 data[link_end] == '_' ||
982 data[link_end] == '/' ||
983 data[link_end] == '-')) {
984 link_end++;
985 }
986 }
987 /* make the link */
988 link.s += data.slice(0, link_end);
989 rewind_p.p = 0;
990 return link_end;
991 }
992 function sd_autolink__username(rewind_p, link, data_, offset, size) {
993 var data = data_.slice(offset);
994 var link_end;
995 if (size < 6)
996 return 0;
997 /* make sure this / is part of /u/ */
998 if (data.indexOf('/u/') != 0)
999 return 0;
1000 /* the first letter of a username must... well, be valid, we don't care otherwise */
1001 link_end = "/u/".length;
1002 if (!isalnum(data[link_end]) && data[link_end] != '_' && data[link_end] != '-')
1003 return 0;
1004 link_end += 1;
1005 /* consume valid characters ([A-Za-z0-9_-/]) until we run out */
1006 while (link_end < size && (isalnum(data[link_end]) ||
1007 data[link_end] == '_' ||
1008 data[link_end] == '/' ||
1009 data[link_end] == '-'))
1010 link_end++;
1011 /* make the link */
1012 link.s += data.slice(0, link_end);
1013 rewind_p.p = 0;
1014 return link_end;
1015 }
1016 function sd_autolink__email(rewind_p, link, data_, offset, size, flags) {
1017 var data = data_.slice(offset);
1018 var link_end, rewind;
1019 var nb = 0, np = 0;
1020 for (rewind = 0; rewind < offset; ++rewind) {
1021 var c = data_[offset - rewind - 1];
1022 if (c == '\0')
1023 break;
1024 if (isalnum(c))
1025 continue;
1026 if (".+-_".indexOf(c) != -1)
1027 continue;
1028 break;
1029 }
1030 if (rewind == 0)
1031 return 0;
1032 for (link_end = 0; link_end < size; ++link_end) {
1033 var c = data_[offset + link_end];
1034 if (isalnum(c))
1035 continue;
1036 if (c == '@')
1037 nb++;
1038 else if (c == '.' && link_end < size - 1)
1039 np++;
1040 else if (c != '-' && c != '_')
1041 break;
1042 }
1043 if (link_end < 2 || nb != 1 || np == 0)
1044 return 0;
1045 //TODO
1046 link_end = autolink_delim(data_, link_end, offset, size);
1047 if (link_end == 0)
1048 return 0;
1049 // link.s += data_.slice(offset - rewind, link_end + rewind
1050 link.s += data_.substr(offset - rewind, link_end + rewind);
1051 rewind_p.p = rewind;
1052 return link_end;
1053 }
1054 function sd_autolink__www(rewind_p, link, data_, offset, size, flags) {
1055 var data = data_.slice(offset);
1056 var link_end;
1057 if (offset > 0 && !ispunct(data_[offset - 1]) && !isspace(data_[offset - 1]))
1058 return 0;
1059 // if (size < 4 || memcmp(data, "www.", strlen("www.")) != 0)
1060 if (size < 4 || (data.slice(0, 4) != 'www.'))
1061 return 0;
1062 link_end = check_domain(data, 0);
1063 if (link_end == 0)
1064 return 0;
1065 while (link_end < size && !isspace(data[link_end]))
1066 link_end++;
1067 link_end = autolink_delim(data_, link_end, offset, size);
1068 if (link_end == 0)
1069 return 0;
1070 link.s += data.slice(0, link_end);
1071 rewind_p.p = 0;
1072 return link_end;
1073 }
1074 /**
1075 Initialize a Callbacks object.
1076 @constructor
1077 @param {Object.<string, ?function>} callbacks A set of callbacks to use as the methods on this object.
1078 */
1079 function Callbacks(callbacks) {
1080 if (callbacks) {
1081 for (var name in callbacks) {
1082 if (name in this)
1083 this[name] = callbacks[name];
1084 }
1085 }
1086 }
1087 Callbacks.prototype = {
1088 /**
1089 Renders a code block.
1090 Syntax highlighting specific to lanugage may be performed here.
1091 @method
1092 @param {Buffer} out The output string buffer to append to.
1093 @param {Buffer} text The input text.
1094 @param {Buffer} language The name of the code langage.
1095 @param {?Object} context A renderer specific context object.
1096 */
1097 blockcode: null,
1098 /**
1099 Renders a blockquote.
1100 @method
1101 @param {Buffer} out The output string buffer to append to.
1102 @param {Buffer} text The input text.
1103 @param {?Object} context A renderer specific context object.
1104 */
1105 blockquote: null,
1106 /**
1107 Renders a block of HTML code.
1108 @method
1109 @param {Buffer} out The output string buffer to append to.
1110 @param {Buffer} text The input text.
1111 @param {?Object} context A renderer specific context object.
1112 */
1113 blockhtml: null,
1114 /**
1115 Renders a header.
1116 @method
1117 @param {Buffer} out The output string buffer to append to.
1118 @param {Buffer} text The input text.
1119 @param {Number} level The header level.
1120 @param {?Object} context A renderer specific context object.
1121 */
1122 header: null,
1123 /**
1124 Renders a horizontal rule.
1125 @method
1126 @param {Buffer} out The output string buffer to append to.
1127 @param {?Object} context A renderer specific context object.
1128 */
1129 hrule: null,
1130 /**
1131 Renders a list.
1132 <p>
1133 This method handles the list wrapper, which in terms of HTML would be <ol> or <ul>.
1134 This method is not responsible for handling list elements, all such processing should
1135 already have occured on text pased to the method . All that it is intended
1136 to do is to wrap the text parameter in anything needed.
1137 </p>
1138 @example
1139 out.s += "<ul>" + text.s + "</ul>"
1140 @method
1141 @param {Buffer} out The output string buffer to append to.
1142 @param {Buffer} text The input that goes inside the list.
1143 @param {Number} flags A bitfield holding a portion of the render state. The only bit that this should be concerned with is MKD_LIST_ORDERED
1144 @param {?Object} context A renderer specific context object.
1145 */
1146 list: null,
1147 /**
1148 Renders a list.
1149 <p>
1150 Wraps the text in a list element.
1151 </p>
1152 @example
1153 out.s += "<li>" + text.s + "</li>"
1154 @method
1155 @param {Buffer} out The output string buffer to append to.
1156 @param {Buffer} text The contents of the list element.
1157 @param {Number} flags A bitfield holding a portion of the render state. The only bit that this should be concerned with is MKD_LI_BLOCK.
1158 @param {?Object} context A renderer specific context object.
1159 */
1160 listitem: null,
1161 /**
1162 Renders a paragraph.
1163 @example
1164 out.s += "<p>" + text.s + "</p>";
1165 @method
1166 @param {Buffer} out The output string buffer to append to.
1167 @param {Buffer} text The input text.
1168 @param {?Object} context A renderer specific context object.
1169 */
1170 paragraph: null,
1171 /**
1172 Renders a table.
1173 @example
1174 out.s += "<table><thead>";
1175 out.s += header.s;
1176 out.s += "</thead><tbody>";
1177 out.s += body.s;
1178 out.s += "</tbody></table>";
1179 @method
1180 @param {Buffer} out The output string buffer to append to.
1181 @param {Buffer} head The table header.
1182 @param {Buffer} body The table body.
1183 @param {?Object} context A renderer specific context object.
1184 */
1185 table: null,
1186 /**
1187 Renders a table row.
1188 @example
1189 out.s += "<tr>" + text.s + "</tr>";
1190 @method
1191 @param {Buffer} out The output string buffer to append to.
1192 @param {Buffer} text The input text.
1193 @param {?Object} context A renderer specific context object.
1194 */
1195 table_row: null,
1196 /**
1197 Renders a table cell.
1198 @example
1199 out.s += "<td>" + text.s + "</td>";
1200 @method
1201 @param {Buffer} out The output string buffer to append to.
1202 @param {Buffer} text The input text.
1203 @param {Number} flags A bit filed indicating a portion of the output state. Relevant bits are: MKD_TABLE_HEADER, MKD_TABLE_ALIGN_CENTER. MKD_TABLE_ALIGN_L, and MKD_TABLE_ALIGN_R.
1204 @param {?Object} context A renderer specific context object.
1205 */
1206 table_cell: null,
1207 /**
1208 Renders a link that was autodetected.
1209 @example
1210 out.s += "<a href=\""+ text.s + "\">" + text.s + "</a>";
1211 @method
1212 @param {Buffer} out The output string buffer to append to.
1213 @param {Buffer} text The address being linked to.
1214 @param {Number} type Equal to MKDA_NORMAL or MKDA_EMAIL
1215 @param {?Object} context A renderer specific context object.
1216 @returns {Boolean} Whether or not the tag was rendered.
1217 */
1218 autolink: null,
1219 /**
1220 Renders inline code.
1221 @method
1222 @param {Buffer} out The output string buffer to append to.
1223 @param {Buffer} text The text being wrapped.
1224 @param {?Object} context A renderer specific context object.
1225 @returns {Boolean} Whether or not the tag was rendered.
1226 */
1227 codespan: null,
1228 /**
1229 Renders text with double emphasis. Default is equivalent to the HTML <strong> tag.
1230 @method
1231 @param {Buffer} out The output string buffer to append to.
1232 @param {Buffer} text The text being wrapped.
1233 @param {?Object} context A renderer specific context object.
1234 @returns {Boolean} Whether or not the tag was rendered.
1235 */
1236 double_emphasis: null,
1237 /**
1238 Renders text with single emphasis. Default is equivalent to the HTML <em> tag.
1239 @method
1240 @param {Buffer} out The output string buffer to append to.
1241 @param {Buffer} text The text being wrapped.
1242 @param {?Object} context A renderer specific context object.
1243 @returns {Boolean} Whether or not the tag was rendered.
1244 */
1245 emphasis: null,
1246 /**
1247 Renders an image.
1248 @example
1249 out.s = "<img src=\"" + link.s + "\" title=\"" + title.s + "\" alt=\"" + alt.s + "\"/>";"
1250 @method
1251 @param {Buffer} out The output string buffer to append to.
1252 @param {Buffer} link The address of the image.
1253 @param {Buffer} title Title text for the image
1254 @param {Buffer} alt Alt text for the image
1255 @param {?Object} context A renderer specific context object.
1256 @returns {Boolean} Whether or not the tag was rendered.
1257 */
1258 image: null,
1259 /**
1260 Renders line break.
1261 @example
1262 out.s += "<br/>";
1263 @method
1264 @param {Buffer} out The output string buffer to append to.
1265 @param {?Object} context A renderer specific context object.
1266 @returns {Boolean} Whether or not the tag was rendered.
1267 */
1268 linebreak: null,
1269 /**
1270 Renders a link.
1271 @example
1272 out.s = "<a href=\"" + link.s + "\" title=\"" + title.s + "\">" + content.s + "</a>";
1273 @method
1274 @param {Buffer} out The output string buffer to append to.
1275 @param {Buffer} link The link address.
1276 @param {Buffer} title Title text for the link.
1277 @param {Buffer} content Link text.
1278 @param {?Object} context A renderer specific context object.
1279 @returns {Boolean} Whether or not the tag was rendered.
1280 */
1281 link: null,
1282 /**
1283 Copies and potentially escapes some HTML.
1284 @method
1285 @param {Buffer} out The output string buffer to append to.
1286 @param {Buffer} text The input text.
1287 @param {?Object} context A renderer specific context object.
1288 @returns {Boolean} Whether or not the tag was rendered.
1289 */
1290 raw_html_tag: null,
1291 /**
1292 Renders text with triple emphasis. Default is equivalent to both the <em> and <strong> HTML tags.
1293 @method
1294 @param {Buffer} out The output string buffer to append to.
1295 @param {Buffer} text The text being wrapped.
1296 @param {?Object} context A renderer specific context object.
1297 @returns {Boolean} Whether or not the tag was rendered.
1298 */
1299 triple_emphasis: null,
1300 /**
1301 Renders text crossd out.
1302 @method
1303 @param {Buffer} out The output string buffer to append to.
1304 @param {Buffer} text The text being wrapped.
1305 @param {?Object} context A renderer specific context object.
1306 @returns {Boolean} Whether or not the tag was rendered.
1307 */
1308 strikethrough: null,
1309 /**
1310 Renders text as superscript.
1311 @method
1312 @param {Buffer} out The output string buffer to append to.
1313 @param {Buffer} text The text being wrapped.
1314 @param {?Object} context A renderer specific context object.
1315 @returns {Boolean} Whether or not the tag was rendered.
1316 */
1317 superscript: null,
1318 /**
1319 Escapes an HTML entity.
1320 @method
1321 @param {Buffer} out The output string buffer to append to.
1322 @param {Buffer} text The text being wrapped.
1323 @param {?Object} context A renderer specific context object.
1324 */
1325 entity: null,
1326 /**
1327 Renders plain text.
1328 @method
1329 @param {Buffer} out The output string buffer to append to.
1330 @param {Buffer} text The text being rendered.
1331 @param {?Object} context A renderer specific context object.
1332 */
1333 normal_text: null,
1334 /**
1335 Creates opening boilerplate for a table of contents.
1336 @method
1337 @param {Buffer} out The output string buffer to append to.
1338 @param {?Object} context A renderer specific context object.
1339 */
1340 doc_header: null,
1341 /**
1342 Creates closing boilerplate for a table of contents.
1343 @method
1344 @param {Buffer} out The output string buffer to append to.
1345 @param {?Object} context A renderer specific context object.
1346 */
1347 doc_footer: null
1348 };
1349 /**
1350 A renderer object
1351 @constructor
1352 @param {Callbacks} callbacks The callbacks object to use for the renderer.
1353 @param {?Callbacks} context Renderer specific context information.
1354 */
1355 function Renderer(callbacks, context) {
1356 this.callbacks = callbacks;
1357 this.context = context;
1358 }
1359 /**
1360 Instantiates a custom Renderer object.
1361 @param {Callbacks} callbacks The callbacks object to use for the renderer.
1362 @param {?Callbacks} context Renderer specific context information.
1363 @returns {Renderer}
1364 */
1365 function createCustomRenderer(callbacks, context) {
1366 return new Renderer(callbacks, context);
1367 }
1368 exports.createCustomRenderer = createCustomRenderer;
1369 function defaultRenderState() {
1370 return {
1371 nofollow: /*0*/ 1,
1372 target: null,
1373 tocData: {
1374 headerCount: 0,
1375 currentLevel: 0,
1376 levelOffset: 0
1377 },
1378 toc_id_prefix: null,
1379 html_element_whitelist: DEFAULT_HTML_ELEMENT_WHITELIST,
1380 html_attr_whitelist: DEFAULT_HTML_ATTR_WHITELIST,
1381 flags: 0,
1382 //(flags != undefined?flags:HTML_SKIP_HTML | HTML_SKIP_IMAGES | HTML_SAFELINK | HTML_ESCAPE | HTML_USE_XHTML),
1383 /* extra callbacks */
1384 // void (*link_attributes)(struct buf *ob, const struct buf *url, void *self);
1385 link_attributes: function link_attributes(out, url, options) {
1386 if (options.nofollow)
1387 out.s += ' rel="nofollow"';
1388 if (options.target != null) {
1389 out.s += ' target="' + options.target + '"';
1390 }
1391 }
1392 };
1393 }
1394 exports.defaultRenderState = defaultRenderState;
1395 /**
1396 Produces a renderer object that will match Reddit's output.
1397 @param {?Number=} flags A bitfield containing flags specific to the reddit HTML renderer. Passing undefined, null, or null value will produce reddit exact output.
1398 @returns {Renderer} A renderer object that will match Reddit's output.
1399 */
1400 function getRedditRenderer(flags) {
1401 if (flags === void 0) { flags = null; }
1402 var state = defaultRenderState();
1403 if (flags == null) {
1404 state.flags = DEFAULT_BODY_FLAGS;
1405 }
1406 else {
1407 state.flags = flags;
1408 }
1409 var renderer = new Renderer(getRedditCallbacks(), state);
1410 if (renderer.context.flags & HTML_SKIP_IMAGES)
1411 renderer.callbacks.image = null;
1412 if (renderer.context.flags & HTML_SKIP_LINKS) {
1413 renderer.callbacks.link = null;
1414 renderer.callbacks.autolink = null;
1415 }
1416 if (renderer.context.flags & HTML_SKIP_HTML || renderer.context.flags & HTML_ESCAPE)
1417 renderer.callbacks.blockhtml = null;
1418 return renderer;
1419 }
1420 exports.getRedditRenderer = getRedditRenderer;
1421 /**
1422 Produces a renderer object that will match Reddit's for a table of contents.
1423 @returns {Renderer} A renderer object that will match Reddit's output.
1424 */
1425 function getTocRenderer() {
1426 var state = defaultRenderState();
1427 state.flags = HTML_TOC | HTML_SKIP_HTML;
1428 var renderer = new Renderer(getTocCallbacks(), state);
1429 return renderer;
1430 }
1431 exports.getTocRenderer = getTocRenderer;
1432 /**
1433 Create a Callbacks object with the given callback table.
1434 @param {Object.<string, function>} callbacks A table of callbacks to place int a callbacks object.
1435 @returns {Callbacks} A callbacks object holding the provided callbacks.
1436 */
1437 function createCustomCallbacks(callbacks) {
1438 return new Callbacks(callbacks);
1439 }
1440 exports.createCustomCallbacks = createCustomCallbacks;
1441 /**
1442 Produce a callbacks object that matches Reddit's output.
1443 @returns {Callbacks} A callbacks object that matches Reddit's output.
1444 */
1445 function getRedditCallbacks() {
1446 return new Callbacks({
1447 blockcode: cb_blockcode,
1448 blockquote: cb_blockquote,
1449 blockhtml: cb_blockhtml,
1450 header: cb_header,
1451 hrule: cb_hrule,
1452 list: cb_list,
1453 listitem: cb_listitem,
1454 paragraph: cb_paragraph,
1455 table: cb_table,
1456 table_row: cb_table_row,
1457 table_cell: cb_table_cell,
1458 autolink: cb_autolink,
1459 codespan: cb_codespan,
1460 double_emphasis: cb_double_emphasis,
1461 emphasis: cb_emphasis,
1462 image: cb_image,
1463 linebreak: cb_linebreak,
1464 link: cb_link,
1465 raw_html_tag: cb_raw_html_tag,
1466 triple_emphasis: cb_triple_emphasis,
1467 strikethrough: cb_strikethrough,
1468 superscript: cb_superscript,
1469 entity: null,
1470 normal_text: cb_normal_text,
1471 doc_header: null,
1472 doc_footer: cb_reset_toc
1473 });
1474 }
1475 exports.getRedditCallbacks = getRedditCallbacks;
1476 /**
1477 Produce a callbacks object for rendering a table of contents.
1478 @returns {Callbacks} A callbacks object for rendering a table of contents.
1479 */
1480 function getTocCallbacks() {
1481 return new Callbacks({
1482 blockcode: null,
1483 blockquote: null,
1484 blockhtml: null,
1485 header: cb_toc_header,
1486 hrule: null,
1487 list: null,
1488 listitem: null,
1489 paragraph: null,
1490 table: null,
1491 table_row: null,
1492 table_cell: null,
1493 autolink: null,
1494 codespan: cb_codespan,
1495 double_emphasis: cb_double_emphasis,
1496 emphasis: cb_emphasis,
1497 image: null,
1498 linebreak: null,
1499 link: cb_toc_link,
1500 raw_html_tag: null,
1501 triple_emphasis: cb_triple_emphasis,
1502 strikethrough: cb_strikethrough,
1503 superscript: cb_superscript,
1504 entity: null,
1505 normal_text: null,
1506 doc_header: null,
1507 doc_footer: cb_toc_finalize
1508 });
1509 }
1510 exports.getTocCallbacks = getTocCallbacks;
1511 /* block level callbacks - NULL skips the block */
1512 // void (*blockcode)(struct buf *ob, const struct buf *text, const struct buf *lang, void *opaque);
1513 function cb_blockcode(out, text, lang, options) {
1514 if (out.s.length)
1515 out.s += '\n';
1516 if (lang && lang.s.length) {
1517 var i, cls;
1518 out.s += '<pre><code class="';
1519 for (i = 0, cls = 0; i < lang.s.length; ++i, ++cls) {
1520 while (i < lang.s.length && isspace(lang.s[i]))
1521 i++;
1522 if (i < lang.s.length) {
1523 var org = i;
1524 while (i < lang.s.length && !isspace(lang.s[i]))
1525 i++;
1526 if (lang.s[org] == '.')
1527 org++;
1528 if (cls)
1529 out.s += ' ';
1530 escape_html(out, lang.s.slice(org, i), false);
1531 }
1532 }
1533 out.s += '">';
1534 }
1535 else
1536 out.s += '<pre><code>';
1537 if (text)
1538 escape_html(out, text.s, false);
1539 out.s += '</code></pre>\n';
1540 }
1541 // void (*blockquote)(struct buf *ob, const struct buf *text, void *opaque);
1542 function cb_blockquote(out, text, options) {
1543 if (out.s.length)
1544 out.s += '\n';
1545 out.s += '<blockquote>\n';
1546 if (text)
1547 out.s += text.s;
1548 out.s += '</blockquote>\n';
1549 }
1550 // void (*blockhtml)(struct buf *ob,const struct buf *text, void *opaque);
1551 function cb_blockhtml(out, text, options) {
1552 var org, sz;
1553 if (!text)
1554 return;
1555 sz = text.s.length;
1556 while (sz > 0 && text.s[sz - 1] == '\n')
1557 sz--;
1558 org = 0;
1559 while (org < sz && text.s[org] == '\n')
1560 org++;
1561 if (org >= sz)
1562 return;
1563 if (out.s.length)
1564 out.s += '\n';
1565 out.s += text.s.slice(org, sz);
1566 out.s += '\n';
1567 }
1568 // header(Buffer out, Buffer text, int level, void *opaque);
1569 function cb_header(out, text, level, options) {
1570 if (out.s.length)
1571 out.s += '\n';
1572 if (options.flags & HTML_TOC) {
1573 out.s += '<h' + (+level) + ' id="';
1574 if (options.toc_id_prefix)
1575 out.s += options.toc_id_prefix;
1576 out.s += 'toc_' + (options.tocData.headerCount++) + '">';
1577 }
1578 else {
1579 out.s += '<h' + (+level) + '>';
1580 }
1581 if (text)
1582 out.s += text.s;
1583 out.s += '</h' + (+level) + '>\n';
1584 }
1585 // void (*hrule)(struct buf *ob, void *opaque);
1586 function cb_hrule(out, options) {
1587 if (out.s.length)
1588 out.s += '\n';
1589 out.s += (options.flags & HTML_USE_XHTML) ? '<hr/>\n' : '<hr>\n';
1590 }
1591 // void (*list)(struct buf *ob, const struct buf *text, int flags, void *opaque);
1592 function cb_list(out, text, flags, options) {
1593 if (out.s.length)
1594 out.s += '\n';
1595 out.s += (flags & MKD_LIST_ORDERED ? '<ol>\n' : '<ul>\n');
1596 if (text)
1597 out.s += text.s;
1598 out.s += (flags & MKD_LIST_ORDERED ? '</ol>\n' : '</ul>\n');
1599 }
1600 // void (*listitem)(struct buf *ob, const struct buf *text, int flags, void *opaque);
1601 function cb_listitem(out, text, flags, options) {
1602 out.s += '<li>';
1603 if (text) {
1604 var size = text.s.length;
1605 while (size && text.s[size - 1] == '\n')
1606 size--;
1607 out.s += text.s.slice(0, size);
1608 }
1609 out.s += '</li>\n';
1610 }
1611 // void (*paragraph)(struct buf *ob, const struct buf *text, void *opaque);
1612 function cb_paragraph(out, text, options) {
1613 var i = 0;
1614 if (out.s.length)
1615 out.s += '\n';
1616 if (!text || !text.s.length)
1617 return;
1618 while (i < text.s.length && isspace(text.s[i]))
1619 i++;
1620 if (i == text.s.length)
1621 return;
1622 out.s += '<p>';
1623 if (options.flags & HTML_HARD_WRAP) {
1624 var org;
1625 while (i < text.s.length) {
1626 org = i;
1627 while (i < text.s.length && text.data[i] != '\n')
1628 i++;
1629 if (i > org)
1630 out.s += text.s.slice(org, i);
1631 /*
1632 * do not insert a line break if this newline
1633 * is the last character on the paragraph
1634 */
1635 if (i >= text.s.length - 1)
1636 break;
1637 cb_linebreak(out, options);
1638 i++;
1639 }
1640 }
1641 else {
1642 out.s += text.s.slice(i);
1643 }
1644 out.s += '</p>\n';
1645 }
1646 // void (*table)(struct buf *ob, const struct buf *header, const struct buf *body, void *opaque);
1647 function cb_table(out, header, body, options) {
1648 if (out.s.length)
1649 out.s += '\n';
1650 out.s += '<table><thead>\n';
1651 if (header)
1652 out.s += header.s;
1653 out.s += '</thead><tbody>\n';
1654 if (body)
1655 out.s += body.s;
1656 out.s += '</tbody></table>\n';
1657 }
1658 // void (*table_row)(struct buf *ob, const struct buf *text, void *opaque);
1659 function cb_table_row(out, text, options) {
1660 out.s += '<tr>\n';
1661 if (text)
1662 out.s += text.s;
1663 out.s += '</tr>\n';
1664 }
1665 // void (*table_cell)(struct buf *ob, const struct buf *text, int flags, void *opaque);
1666 function cb_table_cell(out, text, flags, options, col_span) {
1667 if (flags & MKD_TABLE_HEADER) {
1668 out.s += '<th';
1669 }
1670 else {
1671 out.s += '<td';
1672 }
1673 if (col_span > 1) {
1674 out.s += " colspan=\"" + col_span + "\" ";
1675 }
1676 switch (flags & MKD_TABLE_ALIGNMASK) {
1677 case MKD_TABLE_ALIGN_CENTER:
1678 out.s += ' align="center">';
1679 break;
1680 case MKD_TABLE_ALIGN_L:
1681 out.s += ' align="left">';
1682 break;
1683 case MKD_TABLE_ALIGN_R:
1684 out.s += ' align="right">';
1685 break;
1686 default:
1687 out.s += '>';
1688 }
1689 if (text)
1690 out.s += text.s;
1691 if (flags & MKD_TABLE_HEADER) {
1692 out.s += '</th>\n';
1693 }
1694 else {
1695 out.s += '</td>\n';
1696 }
1697 }
1698 /* span level callbacks - NULL or return 0 prints the span verbatim */
1699 // int (*autolink)(struct buf *ob, const struct buf *link, enum mkd_autolink type, void *opaque);
1700 function cb_autolink(out, link, type, options) {
1701 var offset = 0;
1702 if (!link || !link.s.length)
1703 return 0;
1704 if ((options.flags & HTML_SAFELINK) != 0 &&
1705 !sd_autolink_issafe(link.s) && type != MKDA_EMAIL)
1706 return 0;
1707 out.s += '<a href="';
1708 if (type == MKDA_EMAIL)
1709 out.s += 'mailto:';
1710 escape_href(out, link.s.slice(offset));
1711 if (options.link_attributes) {
1712 out.s += '"';
1713 options.link_attributes(out, link, options);
1714 out.s += '>';
1715 }
1716 else {
1717 out.s += '">';
1718 }
1719 /*
1720 * Pretty printing: if we get an email address as
1721 * an actual URI, e.g. `mailto:foo@bar.com`, we don't
1722 * want to print the `mailto:` prefix
1723 */
1724 if (link.s.indexOf('mailto:') == 0) {
1725 escape_html(out, link.s.slice(7), false);
1726 }
1727 else {
1728 escape_html(out, link.s, false);
1729 }
1730 out.s += '</a>';
1731 return 1;
1732 }
1733 // int (*codespan)(struct buf *ob, const struct buf *text, void *opaque);
1734 function cb_codespan(out, text, options) {
1735 out.s += '<code>';
1736 if (text)
1737 escape_html(out, text.s, false);
1738 out.s += '</code>';
1739 return 1;
1740 }
1741 // int (*double_emphasis)(struct buf *ob, const struct buf *text, void *opaque);
1742 function cb_double_emphasis(out, text, options) {
1743 if (!text || !text.s.length)
1744 return 0;
1745 out.s += '<strong>' + text.s + '</strong>';
1746 return 1;
1747 }
1748 // int (*emphasis)(struct buf *ob, const struct buf *text, void *opaque);
1749 function cb_emphasis(out, text, options) {
1750 if (!text || !text.s.length)
1751 return 0;
1752 out.s += '<em>' + text.s + '</em>';
1753 return 1;
1754 }
1755 // int (*image)(struct buf *ob, const struct buf *link, const struct buf *title, const struct buf *alt, void *opaque);
1756 function cb_image(out, link, title, alt, options) {
1757 if (!link || !link.s.length)
1758 return 0;
1759 out.s += '<img src="';
1760 escape_href(out, link.s);
1761 out.s += '" alt="';
1762 if (alt && alt.s.length)
1763 escape_html(out, alt.s, false);
1764 if (title && title.s.length) {
1765 out.s += '" title="';
1766 escape_html(out, title.s, false);
1767 }
1768 out.s += (options.flags & HTML_USE_XHTML ? '"/>' : '">');
1769 return 1;
1770 }
1771 // int (*linebreak)(struct buf *ob, void *opaque);
1772 function cb_linebreak(out, options) {
1773 out.s += (options.flags & HTML_USE_XHTML ? '<br/>\n' : '<br>\n');
1774 return 1;
1775 }
1776 // int (*link)(struct buf *ob, const struct buf *link, const struct buf *title, const struct buf *content, void *opaque);
1777 function cb_link(out, link, title, content, options) {
1778 if (link != null && (options.flags & HTML_SAFELINK) != 0 && !sd_autolink_issafe(link.s))
1779 return 0;
1780 out.s += '<a href="';
1781 if (link && link.s.length)
1782 escape_href(out, link.s);
1783 if (title && title.s.length) {
1784 out.s += '" title="';
1785 escape_html(out, title.s, false);
1786 }
1787 if (options.link_attributes) {
1788 out.s += '"';
1789 options.link_attributes(out, link, options);
1790 out.s += '>';
1791 }
1792 else {
1793 out.s += '">';
1794 }
1795 if (content && content.s.length)
1796 out.s += content.s;
1797 out.s += '</a>';
1798 return 1;
1799 }
1800 // rndr_html_tag(struct buf *ob, const struct buf *text, void *opaque, char* tagname, char** whitelist, int tagtype)
1801 //NOT A CALLBACK!
1802 function rndr_html_tag(out, text, options, tagname, whitelist, tagtype) {
1803 var i, x, z, in_str = 0, seen_equals = 0, done = 0, done_attr = 0, reset = 0;
1804 var attr, value;
1805 var c;
1806 out.s += '<';
1807 if (tagtype == HTML_TAG_CLOSE) {
1808 out.s += "/" + tagname + ">";
1809 return;
1810 }
1811 out.s += tagname;
1812 var i = 1 + tagname.length;
1813 attr = new Buffer;
1814 value = new Buffer;
1815 for (; i < text.s.length && !done; i++) {
1816 c = text.s[i];
1817 done = 0;
1818 reset = 0;
1819 done_attr = 0;
1820 switch (c) {
1821 case '>':
1822 done = 1;
1823 break;
1824 case '\'':
1825 case '"':
1826 if (!seen_equals) {
1827 reset = 1;
1828 }
1829 else if (!in_str) {
1830 in_str = c;
1831 }
1832 else if (in_str == c) {
1833 in_str = 0;
1834 done_attr = 1;
1835 }
1836 else {
1837 value.s += c;
1838 }
1839 break;
1840 case ' ':
1841 if (in_str) {
1842 value.s += ' ';
1843 }
1844 else {
1845 reset = 1;
1846 }
1847 break;
1848 case '=':
1849 if (seen_equals) {
1850 reset = 1;
1851 break;
1852 }
1853 seen_equals = 1;
1854 break;
1855 default:
1856 if (seen_equals && in_str || !seen_equals) {
1857 if (seen_equals) {
1858 value.s += c;
1859 }
1860 else {
1861 attr.s += c;
1862 }
1863 }
1864 break;
1865 }
1866 if (done_attr) {
1867 var valid = 0;
1868 for (z = 0; whitelist[z]; z++) {
1869 if (whitelist[z].length != attr.s.length) {
1870 continue;
1871 }
1872 for (x = 0; x < attr.s.length; x++) {
1873 if (whitelist[z][x].toLowerCase() != attr.s[x].toLowerCase()) {
1874 break;
1875 }
1876 }
1877 if (x == attr.s.length) {
1878 valid = 1;
1879 break;
1880 }
1881 }
1882 if (valid && value.s.length && attr.s.length) {
1883 // console.log("VALD", value.s.length, attr.s.length);
1884 out.s += ' ';
1885 escape_html(out, attr.s, false);
1886 out.s += '="';
1887 escape_html(out, value.s, false);
1888 out.s += '"';
1889 }
1890 reset = 1;
1891 }
1892 if (reset) {
1893 seen_equals = 0;
1894 in_str = 0;
1895 attr = new Buffer;
1896 value = new Buffer;
1897 }
1898 }
1899 out.s += '>';
1900 }
1901 // int (*raw_html_tag)(struct buf *ob, const struct buf *tag, void *opaque);
1902 function cb_raw_html_tag(out, text, options) {
1903 var whitelist = options.html_element_whitelist;
1904 /* Items on the whitelist ignore all other flags and just output */
1905 if (((options.flags & HTML_ALLOW_ELEMENT_WHITELIST) != 0) && whitelist) {
1906 for (var i = 0; whitelist[i]; i++) {
1907 var tagtype = sdhtml_is_tag(text.s, whitelist[i]);
1908 if (tagtype != HTML_TAG_NONE) {
1909 rndr_html_tag(out, text, options, whitelist[i], options.html_attr_whitelist, tagtype);
1910 return 1;
1911 }
1912 }
1913 }
1914 /* HTML_ESCAPE overrides SKIP_HTML, SKIP_STYLE, SKIP_LINKS and SKIP_IMAGES
1915 * It doens't see if there are any valid tags, just escape all of them. */
1916 if ((options.flags & HTML_ESCAPE) != 0) {
1917 escape_html(out, text.s, false);
1918 return 1;
1919 }
1920 if ((options.flags & HTML_SKIP_HTML) != 0)
1921 return 1;
1922 if ((options.flags & HTML_SKIP_STYLE) != 0 &&
1923 sdhtml_is_tag(text.s, "style"))
1924 return 1;
1925 if ((options.flags & HTML_SKIP_LINKS) != 0 &&
1926 sdhtml_is_tag(text.s, "a"))
1927 return 1;
1928 if ((options.flags & HTML_SKIP_IMAGES) != 0 &&
1929 sdhtml_is_tag(text.s, "img"))
1930 return 1;
1931 out.s += text.s;
1932 return 1;
1933 }
1934 // int (*triple_emphasis)(struct buf *ob, const struct buf *text, void *opaque);
1935 function cb_triple_emphasis(out, text, options) {
1936 if (!text || !text.s.length)
1937 return 0;
1938 out.s += '<strong><em>' + text.s + '</em></strong>';
1939 return 1;
1940 }
1941 // int (*strikethrough)(struct buf *ob, const struct buf *text, void *opaque);
1942 function cb_strikethrough(out, text, options) {
1943 if (!text || !text.s.length)
1944 return 0;
1945 out.s += '<del>' + text.s + '</del>';
1946 return 1;
1947 }
1948 // int (*superscript)(struct buf *ob, const struct buf *text, void *opaque);
1949 function cb_superscript(out, text, options) {
1950 if (!text || !text.s.length)
1951 return 0;
1952 out.s += '<sup>' + text.s + '</sup>';
1953 return 1;
1954 }
1955 /* low level callbacks - NULL copies input directly into the output */
1956 //do not use
1957 // void (*entity)(struct buf *ob, const struct buf *entity, void *opaque);
1958 // function cb_entity(out, entity, options) {}
1959 // void (*normal_text)(struct buf *ob, const struct buf *text, void *opaque);
1960 function cb_normal_text(out, text, options) {
1961 if (text)
1962 escape_html(out, text.s, false);
1963 }
1964 // toc_header(struct buf *ob, const struct buf *text, int level, void *opaque)
1965 function cb_toc_header(out, text, level, options) {
1966 /* set the level offset if this is the first header
1967 * we're parsing for the document */
1968 if (options.tocData.currentLevel == 0) {
1969 out.s += '<div class="toc">\n';
1970 options.tocData.levelOffset = level - 1;
1971 }
1972 level -= options.tocData.levelOffset;
1973 if (level > options.tocData.currentLevel) {
1974 while (level > options.tocData.currentLevel) {
1975 out.s += '<ul>\n<li>\n';
1976 options.tocData.currentLevel++;
1977 }
1978 }
1979 else if (level < options.tocData.currentLevel) {
1980 out.s += '</li>\n';
1981 while (level < options.tocData.currentLevel) {
1982 out.s += '</ul>\n</li>\n';
1983 options.tocData.currentLevel--;
1984 }
1985 out.s += '<li>\n';
1986 }
1987 else {
1988 out.s += '</li>\n<li>\n';
1989 }
1990 out.s += '<a href="#';
1991 if (options.toc_id_prefix)
1992 out.s += options.toc_id_prefix;
1993 out.s += 'toc_' + (options.tocData.headerCount++) + '">';
1994 if (text)
1995 escape_html(out, text.s, false);
1996 out.s += '</a>\n';
1997 }
1998 //toc_link(struct buf *ob, const struct buf *link, const struct buf *title, const struct buf *content, void *opaque)
1999 function cb_toc_link(out, link, title, content, options) {
2000 if (content && content.s)
2001 out.s += content.s;
2002 return 1;
2003 }
2004 // reset_toc(struct buf *ob, void *opaque)
2005 function cb_reset_toc(out, options) {
2006 options.tocData = {
2007 headerCount: 0,
2008 currentLevel: 0,
2009 levelOffset: 0
2010 };
2011 }
2012 //toc_finalize(struct buf *ob, void *opaque)
2013 function cb_toc_finalize(out, options) {
2014 var hasToc = false;
2015 while (options.tocData.currentLevel > 0) {
2016 out.s += '</li>\n</ul>\n';
2017 options.tocData.currentLevel--;
2018 hasToc = true;
2019 }
2020 if (hasToc) {
2021 out.s += '</div>\n';
2022 }
2023 cb_reset_toc(out, options);
2024 }
2025 /* header and footer */
2026 // doc_header(Buffer out}, context);
2027 // doc_header: null,
2028 // doc_footer(Buffer out, context);
2029 // doc_footer: null
2030 /* char_emphasis • single and double emphasis parsing */
2031 //Buffer, md, str, int
2032 function char_emphasis(out, md, data_, offset) {
2033 var data = data_.slice(offset);
2034 var size = data.length;
2035 var c = data[0];
2036 var ret;
2037 if (size > 2 && data[1] != c) {
2038 /* whitespace cannot follow an opening emphasis;
2039 * strikethrough only takes two characters '~~' */
2040 if (c == '~' || _isspace(data[1]) || (ret = parse_emph1(out, md, data, c)) == 0)
2041 return 0;
2042 return ret + 1;
2043 }
2044 if (data.length > 3 && data[1] == c && data[2] != c) {
2045 if (_isspace(data[2]) || (ret = parse_emph2(out, md, data, c)) == 0)
2046 return 0;
2047 return ret + 2;
2048 }
2049 if (data.length > 4 && data[1] == c && data[2] == c && data[3] != c) {
2050 if (c == '~' || _isspace(data[3]) || (ret = parse_emph3(out, md, data, c)) == 0)
2051 return 0;
2052 return ret + 3;
2053 }
2054 return 0;
2055 }
2056 /* char_codespan - '`' parsing a code span (assuming codespan != 0) */
2057 function char_codespan(out, md, data_, offset) {
2058 var data = data_.slice(offset);
2059 var end, nb = 0, i, f_begin, f_end;
2060 /* counting the number of backticks in the delimiter */
2061 while (nb < data.length && data[nb] == '`')
2062 nb++;
2063 /* finding the next delimiter */
2064 i = 0;
2065 for (end = nb; end < data.length && i < nb; end++) {
2066 if (data[end] == '`')
2067 i++;
2068 else
2069 i = 0;
2070 }
2071 if (i < nb && end >= data.length)
2072 return 0; /* no matching delimiter */
2073 /* trimming outside whitespaces */
2074 f_begin = nb;
2075 while (f_begin < end && data[f_begin] == ' ')
2076 f_begin++;
2077 f_end = end - nb;
2078 while (f_end > nb && data[f_end - 1] == ' ')
2079 f_end--;
2080 /* real code span */
2081 if (f_begin < f_end) {
2082 var work = new Buffer(data.slice(f_begin, f_end));
2083 if (!md.callbacks.codespan(out, work, md.context))
2084 end = 0;
2085 }
2086 else {
2087 if (!md.callbacks.codespan(out, null, md.context))
2088 end = 0;
2089 }
2090 return end;
2091 }
2092 /* char_linebreak - '\n' preceded by two spaces (assuming linebreak != 0) */
2093 function char_linebreak(out, md, data_, offset) {
2094 var data = data_.slice(offset);
2095 if (offset < 2 || data_[offset - 1] != ' ' || data_[offset - 2] != ' ')
2096 return 0;
2097 /* removing the last space from ob and rendering */
2098 var len = out.s.length;
2099 while (len && out.s[len - 1] == ' ')
2100 len--;
2101 out.s = out.s.slice(0, len);
2102 return md.callbacks.linebreak(out, md.context) ? 1 : 0;
2103 }
2104 /* char_link - '[': parsing a link or an image */
2105 function char_link(out, md, data_, offset) {
2106 var data = data_.slice(offset);
2107 var is_img = (offset && data_[offset - 1] == '!'), level;
2108 var i = 1, txt_e, link_b = 0, link_e = 0, title_b = 0, title_e = 0;
2109 //4 bufs
2110 var content = null;
2111 var link = null;
2112 var title = null;
2113 var u_link = null;
2114 var org_work_size = md.spanStack.length;
2115 var text_has_nl = 0, ret = 0;
2116 var in_title = 0, qtype = 0;
2117 function cleanup() {
2118 md.spanStack.length = org_work_size;
2119 return ret ? i : 0;
2120 }
2121 /* checking whether the correct renderer exists */
2122 if ((is_img && !md.callbacks.image) || (!is_img && !md.callbacks.link))
2123 return cleanup();
2124 /* looking for the matching closing bracket */
2125 for (level = 1; i < data.length; i++) {
2126 if (data[i] == '\n')
2127 text_has_nl = 1;
2128 else if (data[i - 1] == '\\')
2129 continue;
2130 else if (data[i] == '[')
2131 level++;
2132 else if (data[i] == ']') {
2133 level--;
2134 if (level <= 0)
2135 break;
2136 }
2137 }
2138 if (i >= data.length)
2139 return cleanup();
2140 txt_e = i;
2141 i++;
2142 /* skip any amount of whitespace or newline */
2143 /* (this is much more laxist than original markdown syntax) */
2144 while (i < data.length && _isspace(data[i]))
2145 i++;
2146 /* inline style link */
2147 if (i < data.length && data[i] == '(') {
2148 /* skipping initial whitespace */
2149 i++;
2150 while (i < data.length && _isspace(data[i]))
2151 i++;
2152 link_b = i;
2153 /* looking for link end: ' " ) */
2154 while (i < data.length) {
2155 if (data[i] == '\\')
2156 i += 2;
2157 else if (data[i] == ')')
2158 break;
2159 else if (i >= 1 && _isspace(data[i - 1]) && (data[i] == '\'' || data[i] == '"'))
2160 break;
2161 else
2162 i++;
2163 }
2164 if (i >= data.length)
2165 return cleanup();
2166 link_e = i;
2167 /* looking for title end if present */
2168 if (data[i] == '\'' || data[i] == '"') {
2169 qtype = data[i];
2170 in_title = 1;
2171 i++;
2172 title_b = i;
2173 while (i < data.length) {
2174 if (data[i] == '\\')
2175 i += 2;
2176 else if (data[i] == qtype) {
2177 in_title = 0;
2178 i++;
2179 }
2180 else if ((data[i] == ')') && !in_title)
2181 break;
2182 else
2183 i++;
2184 }
2185 if (i >= data.length)
2186 return cleanup();
2187 /* skipping whitespaces after title */
2188 title_e = i - 1;
2189 while (title_e > title_b && _isspace(data[title_e]))
2190 title_e--;
2191 /* checking for closing quote presence */
2192 if (data[title_e] != '\'' && data[title_e] != '"') {
2193 title_b = title_e = 0;
2194 link_e = i;
2195 }
2196 }
2197 /* remove whitespace at the end of the link */
2198 while (link_e > link_b && _isspace(data[link_e - 1]))
2199 link_e--;
2200 /* remove optional angle brackets around the link */
2201 if (data[link_b] == '<')
2202 link_b++;
2203 if (data[link_e - 1] == '>')
2204 link_e--;
2205 /* building escaped link and title */
2206 if (link_e > link_b) {
2207 link = new Buffer();
2208 md.spanStack.push(link);
2209 link.s += data.slice(link_b, link_e);
2210 }
2211 if (title_e > title_b) {
2212 title = new Buffer();
2213 md.spanStack.push(title);
2214 title.s += data.slice(title_b, title_e);
2215 }
2216 i++;
2217 }
2218 else if (i < data.length && data[i] == '[') {
2219 var id = new Buffer();
2220 var lr = null;
2221 /* looking for the id */
2222 i++;
2223 link_b = i;
2224 while (i < data.length && data[i] != ']')
2225 i++;
2226 if (i >= data.length)
2227 return cleanup();
2228 link_e = i;
2229 /* finding the link_ref */
2230 if (link_b == link_e) {
2231 if (text_has_nl) {
2232 var b = new Buffer();
2233 md.spanStack.push(b);
2234 var j;
2235 for (j = 1; j < txt_e; j++) {
2236 if (data[j] != '\n')
2237 b.s += data[j];
2238 else if (data[j - 1] != ' ')
2239 b.s += ' ';
2240 }
2241 id.s = b.s;
2242 }
2243 else {
2244 id.s = data.slice(1);
2245 }
2246 }
2247 else {
2248 id.s = data.slice(link_b, link_e);
2249 }
2250 //TODO
2251 lr = md.refs[id.s];
2252 if (!lr)
2253 return cleanup();
2254 /* keeping link and title from link_ref */
2255 link = lr.link;
2256 title = lr.title;
2257 i++;
2258 }
2259 else {
2260 var id = new Buffer();
2261 var lr = null;
2262 /* crafting the id */
2263 if (text_has_nl) {
2264 var b = new Buffer();
2265 md.spanStack.push(b);
2266 var j;
2267 for (j = 1; j < txt_e; j++) {
2268 if (data[j] != '\n')
2269 b.s += data[j];
2270 else if (data[j - 1] != ' ')
2271 b.s += ' ';
2272 }
2273 id.s = b.s;
2274 }
2275 else {
2276 id.s = data.slice(1, txt_e);
2277 }
2278 /* finding the link_ref */
2279 lr = md.refs[id.s];
2280 if (!lr)
2281 return cleanup();
2282 /* keeping link and title from link_ref */
2283 link = lr.link;
2284 title = lr.title;
2285 /* rewinding the whitespace */
2286 i = txt_e + 1;
2287 }
2288 /* building content: img alt is escaped, link content is parsed */
2289 if (txt_e > 1) {
2290 content = new Buffer();
2291 md.spanStack.push(content);
2292 if (is_img) {
2293 content.s += data.slice(1, txt_e);
2294 }
2295 else {
2296 /* disable autolinking when parsing inline the
2297 * content of a link */
2298 md.inLinkBody = 1;
2299 parse_inline(content, md, data.slice(1, txt_e));
2300 md.inLinkBody = 0;
2301 }
2302 }
2303 if (link) {
2304 u_link = new Buffer();
2305 md.spanStack.push(u_link);
2306 unscape_text(u_link, link);
2307 }
2308 else {
2309 return cleanup();
2310 }
2311 /* calling the relevant rendering function */
2312 if (is_img) {
2313 if (out.s.length && out.s[out.s.length - 1] == '!')
2314 out.s = out.s.slice(0, -1);
2315 ret = md.callbacks.image(out, u_link, title, content, md.context);
2316 }
2317 else {
2318 ret = md.callbacks.link(out, u_link, title, content, md.context);
2319 }
2320 /* cleanup */
2321 // cleanup:
2322 // rndr->work_bufs[BUFFER_SPAN].size = (int)org_work_size;
2323 // return ret ? i : 0;
2324 return cleanup();
2325 }
2326 /* char_langle_tag - '<' when tags or autolinks are allowed */
2327 function char_langle_tag(out, md, data_, offset) {
2328 var data = data_.slice(offset);
2329 var altype = { p: MKDA_NOT_AUTOLINK };
2330 var end = tag_length(data, altype);
2331 var work = new Buffer(data.slice(0, end));
2332 var ret = 0;
2333 if (end > 2) {
2334 if (md.callbacks.autolink && altype.p != MKDA_NOT_AUTOLINK) {
2335 var u_link = new Buffer();
2336 md.spanStack.push(u_link);
2337 work.s = data.substr(1, end - 2);
2338 unscape_text(u_link, work);
2339 ret = md.callbacks.autolink(out, u_link, altype.p, md.context);
2340 md.spanStack.pop();
2341 }
2342 else if (md.callbacks.raw_html_tag)
2343 ret = md.callbacks.raw_html_tag(out, work, md.context);
2344 }
2345 if (!ret)
2346 return 0;
2347 else
2348 return end;
2349 }
2350 /* char_escape - '\\' backslash escape */
2351 function char_escape(out, md, data_, offset) {
2352 var data = data_.slice(offset);
2353 var escape_chars = "\\`*_{}[]()#+-.!:|&<>/^~";
2354 var work = new Buffer();
2355 if (data.length > 1) {
2356 if (escape_chars.indexOf(data[1]) == -1)
2357 return 0;
2358 if (md.callbacks.normal_text) {
2359 work.s = data[1];
2360 md.callbacks.normal_text(out, work, md.context);
2361 }
2362 else
2363 out.s += data[1];
2364 }
2365 else if (data.length == 1) {
2366 out.s += data[0];
2367 }
2368 return 2;
2369 }
2370 /* char_entity - '&' escaped when it doesn't belong to an entity */
2371 //-/* valid entities are assumed to be anything matching &#?[A-Za-z0-9]+; */
2372 function char_entity(out, md, data_, offset) {
2373 var data = data_.slice(offset);
2374 var end = 1, content_start, content_end;
2375 var numeric = false, hex = false, entity_base, entity_val;
2376 var work = new Buffer();
2377 if (end < data.length && data[end] === '#') {
2378 numeric = true;
2379 end++;
2380 }
2381 if (end < data.length && numeric && data[end].toLowerCase() === 'x') {
2382 hex = true;
2383 end++;
2384 }
2385 content_start = end;
2386 while (end < data.length) {
2387 var c = data[end];
2388 if (hex) {
2389 if (!isxdigit(c))
2390 break;
2391 }
2392 else if (numeric) {
2393 if (!isdigit(c))
2394 break;
2395 }
2396 else if (!isalnum(c)) {
2397 break;
2398 }
2399 end++;
2400 }
2401 if (end > content_start && end < data.length && data[end] === ';') {
2402 /* well formed entity */
2403 end++;
2404 }
2405 else {
2406 return 0; /* not an entity */
2407 }
2408 /* way too long to be a valid numeric entity */
2409 if (numeric && content_end - content_start > MAX_NUM_ENTITY_LEN) {
2410 return 0;
2411 }
2412 /* Validate the entity's contents */
2413 if (numeric) {
2414 if (hex)
2415 entity_base = 16;
2416 else
2417 entity_base = 10;
2418 entity_val = parseInt(data.slice(content_start), entity_base);
2419 if (!is_valid_numeric_entity(entity_val))
2420 return 0;
2421 }
2422 else {
2423 if (VALID_ENTITIES.indexOf(data.slice(0, end)) === -1)
2424 return 0;
2425 }
2426 if (md.callbacks.entity) {
2427 work.s = data.slice(0, end);
2428 md.callbacks.entity(out, work, md.context);
2429 }
2430 else
2431 out.s += data.slice(0, end);
2432 return end;
2433 }
2434 function char_autolink_url(out, md, data_, offset) {
2435 var data = data_.slice(offset);
2436 var link = null;
2437 var link_len, rewind = { p: null };
2438 if (!md.callbacks.autolink || md.inLinkBody)
2439 return 0;
2440 link = new Buffer();
2441 md.spanStack.push(link);
2442 if ((link_len = sd_autolink__url(rewind, link, data_, offset, data.length, 0)) > 0) {
2443 if (rewind.p > 0)
2444 out.truncate(out.s.length - rewind.p);
2445 md.callbacks.autolink(out, link, MKDA_NORMAL, md.context);
2446 }
2447 md.spanStack.pop();
2448 return link_len;
2449 }
2450 function char_autolink_email(out, md, data_, offset) {
2451 var data = data_.slice(offset);
2452 var link = null;
2453 var link_len, rewind = { p: null };
2454 if (!md.callbacks.autolink || md.inLinkBody)
2455 return 0;
2456 link = new Buffer();
2457 md.spanStack.push(link);
2458 if ((link_len = sd_autolink__email(rewind, link, data_, offset, data.length, 0)) > 0) {
2459 if (rewind.p > 0)
2460 out.truncate(out.s.length - rewind.p);
2461 md.callbacks.autolink(out, link, MKDA_EMAIL, md.context);
2462 }
2463 md.spanStack.pop();
2464 return link_len;
2465 }
2466 function char_autolink_www(out, md, data_, offset) {
2467 var data = data_.slice(offset);
2468 var link = null, link_url = null, link_text = null;
2469 var link_len, rewind = { p: null };
2470 if (!md.callbacks.link || md.inLinkBody)
2471 return 0;
2472 link = new Buffer();
2473 md.spanStack.push(link);
2474 if ((link_len = sd_autolink__www(rewind, link, data_, offset, data.length, 0)) > 0) {
2475 link_url = new Buffer();
2476 md.spanStack.push(link_url);
2477 link_url.s += 'http://';
2478 link_url.s += link.s;
2479 if (rewind.p > 0)
2480 out.truncate(out.s.length - rewind.p);
2481 if (md.callbacks.normal_text) {
2482 link_text = new Buffer();
2483 md.spanStack.push(link_text);
2484 md.callbacks.normal_text(link_text, link, md.context);
2485 md.callbacks.link(out, link_url, null, link_text, md.context);
2486 md.spanStack.pop();
2487 }
2488 else {
2489 md.callbacks.link(out, link_url, null, link, md.context);
2490 }
2491 md.spanStack.pop();
2492 }
2493 md.spanStack.pop();
2494 return link_len;
2495 }
2496 function char_autolink_subreddit_or_username(out, md, data_, offset) {
2497 var data = data_.slice(offset);
2498 var link = null;
2499 var link_len, rewind = { p: null };
2500 if (!md.callbacks.autolink || md.inLinkBody)
2501 return 0;
2502 link = new Buffer();
2503 md.spanStack.push(link);
2504 if ((link_len = sd_autolink__subreddit(rewind, link, data_, offset, data.length)) > 0) {
2505 //don't slice because the rewind pointer will always be 0
2506 if (rewind.p > 0)
2507 out.truncate(out.s.length - rewind.p);
2508 md.callbacks.autolink(out, link, MKDA_NORMAL, md.context);
2509 }
2510 else if ((link_len = sd_autolink__username(rewind, link, data_, offset, data.length)) > 0) {
2511 //don't slice because the rewind pointer will always be 0
2512 if (rewind.p > 0)
2513 out.truncate(out.s.length - rewind.p);
2514 md.callbacks.autolink(out, link, MKDA_NORMAL, md.context);
2515 }
2516 md.spanStack.pop();
2517 return link_len;
2518 }
2519 function char_superscript(out, md, data_, offset) {
2520 var data = data_.slice(offset);
2521 var size = data.length;
2522 var sup_start, sup_len;
2523 var sup = null;
2524 if (!md.callbacks.superscript)
2525 return 0;
2526 if (size < 2)
2527 return 0;
2528 if (data[1] == '(') {
2529 sup_start = sup_len = 2;
2530 while (sup_len < size && data[sup_len] != ')' && data[sup_len - 1] != '\\')
2531 sup_len++;
2532 if (sup_len == size)
2533 return 0;
2534 }
2535 else {
2536 sup_start = sup_len = 1;
2537 while (sup_len < size && !_isspace(data[sup_len]))
2538 sup_len++;
2539 }
2540 if (sup_len - sup_start == 0)
2541 return (sup_start == 2) ? 3 : 0;
2542 sup = new Buffer();
2543 md.spanStack.push(sup);
2544 parse_inline(sup, md, data.slice(sup_start, sup_len));
2545 md.callbacks.superscript(out, sup, md.context);
2546 md.spanStack.pop();
2547 return (sup_start == 2) ? sup_len + 1 : sup_len;
2548 }
2549 var markdown_char_ptrs = [
2550 null,
2551 char_emphasis,
2552 char_codespan,
2553 char_linebreak,
2554 char_link,
2555 char_langle_tag,
2556 char_escape,
2557 char_entity,
2558 char_autolink_url,
2559 char_autolink_email,
2560 char_autolink_www,
2561 char_autolink_subreddit_or_username,
2562 char_superscript
2563 ];
2564 var MKD_LIST_ORDERED = 1;
2565 var MKD_LI_BLOCK = 2; /* <li> containing block data */
2566 var MKD_LI_END = 8; /* internal list flag */
2567 var enumCounter = 0;
2568 var MD_CHAR_NONE = enumCounter++;
2569 var MD_CHAR_EMPHASIS = enumCounter++;
2570 var MD_CHAR_CODESPAN = enumCounter++;
2571 var MD_CHAR_LINEBREAK = enumCounter++;
2572 var MD_CHAR_LINK = enumCounter++;
2573 var MD_CHAR_LANGLE = enumCounter++;
2574 var MD_CHAR_ESCAPE = enumCounter++;
2575 var MD_CHAR_ENTITITY = enumCounter++;
2576 var MD_CHAR_AUTOLINK_URL = enumCounter++;
2577 var MD_CHAR_AUTOLINK_EMAIL = enumCounter++;
2578 var MD_CHAR_AUTOLINK_WWW = enumCounter++;
2579 var MD_CHAR_AUTOLINK_SUBREDDIT_OR_USERNAME = enumCounter++;
2580 var MD_CHAR_SUPERSCRIPT = enumCounter++;
2581 var SD_AUTOLINK_SHORT_DOMAINS = (1 << 0);
2582 enumCounter = 0;
2583 var MKDA_NOT_AUTOLINK = enumCounter++; /* used internally when it is not an autolink*/
2584 var MKDA_NORMAL = enumCounter++; /* normal http/http/ftp/mailto/etc link */
2585 var MKDA_EMAIL = enumCounter++; /* e-mail link without explit mailto: */
2586 var MKDEXT_NO_INTRA_EMPHASIS = (1 << 0);
2587 var MKDEXT_TABLES = (1 << 1);
2588 var MKDEXT_FENCED_CODE = (1 << 2);
2589 var MKDEXT_AUTOLINK = (1 << 3);
2590 var MKDEXT_STRIKETHROUGH = (1 << 4);
2591 // var MKDEXT_LAX_HTML_BLOCKS = (1 << 5);
2592 var MKDEXT_SPACE_HEADERS = (1 << 6);
2593 var MKDEXT_SUPERSCRIPT = (1 << 7);
2594 var MKDEXT_LAX_SPACING = (1 << 8);
2595 var MKDEXT_NO_EMAIL_AUTOLINK = (1 << 9);
2596 var HTML_SKIP_HTML = (1 << 0);
2597 var HTML_SKIP_STYLE = (1 << 1);
2598 var HTML_SKIP_IMAGES = (1 << 2);
2599 var HTML_SKIP_LINKS = (1 << 3);
2600 var HTML_EXPAND_TABS = (1 << 4);
2601 var HTML_SAFELINK = (1 << 5);
2602 var HTML_TOC = (1 << 6);
2603 var HTML_HARD_WRAP = (1 << 7);
2604 var HTML_USE_XHTML = (1 << 8);
2605 var HTML_ESCAPE = (1 << 9);
2606 var HTML_ALLOW_ELEMENT_WHITELIST = (1 << 10);
2607 var MKD_TABLE_ALIGN_L = 1;
2608 var MKD_TABLE_ALIGN_R = 2;
2609 var MKD_TABLE_ALIGN_CENTER = 3;
2610 var MKD_TABLE_ALIGNMASK = 3;
2611 var MKD_TABLE_HEADER = 4;
2612 var HTML_TAG_NONE = 0;
2613 var HTML_TAG_OPEN = 1;
2614 var HTML_TAG_CLOSE = 2;
2615 /**
2616 * A string buffer wrapper because JavaScript doesn't have mutable strings.
2617 * @constructor
2618 * @param {string=} str Optional string to initialize the Buffer with.
2619 */
2620 var Buffer = function (str) {
2621 this.s = str || "";
2622 };
2623 /**
2624 */
2625 Buffer.prototype.truncate = function (size) {
2626 if (this.s.length < size)
2627 throw new RangeError("Buffer smaller than desired size");
2628 if (size < 0)
2629 throw new RangeError("Size argument is negative");
2630 this.s = this.s.slice(0, size);
2631 };
2632 /**
2633 * A Markdown parser object.
2634 * @constructor
2635 */
2636 function Markdown() {
2637 //Becase javascript strings are immutable they must be wrapped with Buffer()
2638 this.spanStack = [];
2639 this.blockStack = [];
2640 this.extensions = MKDEXT_NO_INTRA_EMPHASIS | MKDEXT_SUPERSCRIPT | MKDEXT_AUTOLINK | MKDEXT_STRIKETHROUGH | MKDEXT_TABLES | MKDEXT_TABLES;
2641 var renderer = getRedditRenderer();
2642 this.context = renderer.context;
2643 this.callbacks = renderer.callbacks;
2644 this.inLinkBody = 0;
2645 this.activeChars = {};
2646 this.refs = {};
2647 this.nestingLimit = 16;
2648 this.maxTableCols = 64;
2649 }
2650 ;
2651 /* is_empty - returns the line length when it is empty, 0 otherwise */
2652 function is_empty(data) {
2653 var i;
2654 for (i = 0; i < data.length && data[i] != '\n'; i++)
2655 if (data[i] != ' ')
2656 return 0;
2657 return i + 1;
2658 }
2659 /* is_hrule - returns whether a line is a horizontal rule */
2660 function is_hrule(data) {
2661 var i = 0, n = 0;
2662 var c;
2663 /* skipping initial spaces */
2664 if (data.length < 3)
2665 return 0;
2666 if (data[0] == ' ') {
2667 i++;
2668 if (data[1] == ' ') {
2669 i++;
2670 if (data[2] == ' ') {
2671 i++;
2672 }
2673 }
2674 }
2675 /* looking at the hrule uint8_t */
2676 if (i + 2 >= data.length
2677 || (data[i] != '*' && data[i] != '-' && data[i] != '_'))
2678 return 0;
2679 c = data[i];
2680 /* the whole line must be the char or whitespace */
2681 while (i < data.length && data[i] != '\n') {
2682 if (data[i] == c)
2683 n++;
2684 else if (data[i] != ' ')
2685 return 0;
2686 i++;
2687 }
2688 return n >= 3;
2689 }
2690 /* check if a line begins with a code fence; return the
2691 * width if it is */
2692 function prefix_codefence(data) {
2693 var i = 0, n = 0;
2694 var c;
2695 /* skipping initial spaces */
2696 if (data.length < 3)
2697 return 0;
2698 if (data[0] == ' ') {
2699 i++;
2700 if (data[1] == ' ') {
2701 i++;
2702 if (data[2] == ' ') {
2703 i++;
2704 }
2705 }
2706 }
2707 /* looking at the hrule uint8_t */
2708 if (i + 2 >= data.length || !(data[i] == '~' || data[i] == '`'))
2709 return 0;
2710 c = data[i];
2711 /* the whole line must be the uint8_t or whitespace */
2712 while (i < data.length && data[i] == c) {
2713 n++;
2714 i++;
2715 }
2716 if (n < 3)
2717 return 0;
2718 return i;
2719 }
2720 /* check if a line is a code fence; return its size if it */
2721 function is_codefence(data, syntax) {
2722 var i = 0, syn_len = 0;
2723 i = prefix_codefence(data);
2724 if (i == 0)
2725 return 0;
2726 while (i < data.length && data[i] == ' ')
2727 i++;
2728 var syn_start;
2729 //syn_start = data + i;
2730 syn_start = i;
2731 if (i < data.length && data[i] == '{') {
2732 i++;
2733 syn_start++;
2734 while (i < data.length && data[i] != '}' && data[i] != '\n') {
2735 syn_len++;
2736 i++;
2737 }
2738 if (i == data.length || data[i] != '}')
2739 return 0;
2740 /* strip all whitespace at the beginning and the end
2741 * of the {} block */
2742 /*remember not to remove the +0, it helps me keep syncronised with snudown*/
2743 while (syn_len > 0 && _isspace(data[syn_start + 0])) {
2744 syn_start++;
2745 syn_len--;
2746 }
2747 // while (syn_len > 0 && _isspace(syn_start[syn_len - 1]))
2748 while (syn_len > 0 && _isspace(data[syn_start + syn_len - 1]))
2749 syn_len--;
2750 i++;
2751 }
2752 else {
2753 while (i < data.length && !_isspace(data[i])) {
2754 syn_len++;
2755 i++;
2756 }
2757 }
2758 if (syntax)
2759 syntax.s = data.substr(syn_start, syn_len);
2760 // syntax->size = syn;
2761 while (i < data.length && data[i] != '\n') {
2762 if (!_isspace(data[i]))
2763 return 0;
2764 i++;
2765 }
2766 return i + 1;
2767 }
2768 /* find_emph_char - looks for the next emph uint8_t, skipping other constructs */
2769 function find_emph_char(data, c) {
2770 var i = 1;
2771 while (i < data.length) {
2772 while (i < data.length && data[i] != c && data[i] != '`' && data[i] != '[')
2773 i++;
2774 if (i == data.length)
2775 return 0;
2776 if (data[i] == c)
2777 return i;
2778 /* not counting escaped chars */
2779 if (i && data[i - 1] == '\\') {
2780 i++;
2781 continue;
2782 }
2783 if (data[i] == '`') {
2784 var span_nb = 0, bt;
2785 var tmp_i = 0;
2786 /* counting the number of opening backticks */
2787 while (i < data.length && data[i] == '`') {
2788 i++;
2789 span_nb++;
2790 }
2791 if (i >= data.length)
2792 return 0;
2793 /* finding the matching closing sequence */
2794 bt = 0;
2795 while (i < data.length && bt < span_nb) {
2796 if (!tmp_i && data[i] == c)
2797 tmp_i = i;
2798 if (data[i] == '`')
2799 bt++;
2800 else
2801 bt = 0;
2802 i++;
2803 }
2804 if (i >= data.length)
2805 return tmp_i;
2806 }
2807 else if (data[i] == '[') {
2808 var tmp_i = 0;
2809 var cc;
2810 i++;
2811 while (i < data.length && data[i] != ']') {
2812 if (!tmp_i && data[i] == c)
2813 tmp_i = i;
2814 i++;
2815 }
2816 i++;
2817 while (i < data.length && (data[i] == ' ' || data[i] == '\n'))
2818 i++;
2819 if (i >= data.length)
2820 return tmp_i;
2821 switch (data[i]) {
2822 case '[':
2823 cc = ']';
2824 break;
2825 case '(':
2826 cc = ')';
2827 break;
2828 default:
2829 if (tmp_i)
2830 return tmp_i;
2831 else
2832 continue;
2833 }
2834 i++;
2835 while (i < data.length && data[i] != cc) {
2836 if (!tmp_i && data[i] == c)
2837 tmp_i = i;
2838 i++;
2839 }
2840 if (i >= data.length)
2841 return tmp_i;
2842 i++;
2843 }
2844 }
2845 return 0;
2846 }
2847 /* parse_emph1 - parsing single emphase */
2848 /* closed by a symbol not preceded by whitespace and not followed by symbol */
2849 function parse_emph1(out, md, data_, c) {
2850 var data = data_.slice(1);
2851 var i = 0, len;
2852 var r;
2853 if (!md.callbacks.emphasis)
2854 return 0;
2855 /* skipping one symbol if coming from emph3 */
2856 if (data.length > 1 && data[0] == c && data[1] == c)
2857 i = 1;
2858 while (i < data.length) {
2859 len = find_emph_char(data.slice(i), c);
2860 if (!len)
2861 return 0;
2862 i += len;
2863 if (i >= data.length)
2864 return 0;
2865 if (data[i] == c && !_isspace(data[i - 1])) {
2866 if ((md.extensions & MKDEXT_NO_INTRA_EMPHASIS) && (c == '_')) {
2867 if (!(i + 1 == data.length || _isspace(data[i + 1]) || ispunct(data[i + 1])))
2868 continue;
2869 }
2870 var work = new Buffer();
2871 md.spanStack.push(work);
2872 parse_inline(work, md, data.slice(0, i));
2873 r = md.callbacks.emphasis(out, work, md.context);
2874 md.spanStack.pop();
2875 return r ? i + 1 : 0;
2876 }
2877 }
2878 return 0;
2879 }
2880 /* parse_emph2 - parsing single emphase */
2881 function parse_emph2(out, md, data_, c) {
2882 var data = data_.slice(2);
2883 var i = 0, len;
2884 var r;
2885 var render_method = (c == '~') ? md.callbacks.strikethrough : md.callbacks.double_emphasis;
2886 if (!render_method)
2887 return 0;
2888 while (i < data.length) {
2889 len = find_emph_char(data.slice(i), c);
2890 if (!len)
2891 return 0;
2892 i += len;
2893 if (i + 1 < data.length && data[i] == c && data[i + 1] == c && i && !_isspace(data[i - 1])) {
2894 var work = new Buffer();
2895 md.spanStack.push(work);
2896 parse_inline(work, md, data.slice(0, i));
2897 r = render_method(out, work, md.context);
2898 md.spanStack.pop();
2899 return r ? i + 2 : 0;
2900 }
2901 i++;
2902 }
2903 return 0;
2904 }
2905 /* parse_emph3 • parsing single emphase */
2906 /* finds the first closing tag, and delegates to the other emph */
2907 function parse_emph3(out, md, data_, c) {
2908 var data = data_.slice(3);
2909 var i = 0, len;
2910 var r;
2911 while (i < data.length) {
2912 len = find_emph_char(data.slice(i), c);
2913 if (!len)
2914 return 0;
2915 i += len;
2916 /* skip whitespace preceded symbols */
2917 if (data[i] != c || _isspace(data[i - 1]))
2918 continue;
2919 if (i + 2 < data.length && data[i + 1] == c && data[i + 2] == c && md.callbacks.triple_emphasis) {
2920 /* triple symbol found */
2921 var work = new Buffer();
2922 md.spanStack.push(work);
2923 parse_inline(work, md, data.slice(0, i));
2924 r = md.callbacks.triple_emphasis(out, work, md.context);
2925 md.spanStack.pop();
2926 return r ? i + 3 : 0;
2927 }
2928 else if (i + 1 < data.length && data[i + 1] == c) {
2929 /* double symbol found, handing over to emph1 */
2930 len = parse_emph1(out, md, data_, c);
2931 if (!len)
2932 return 0;
2933 else
2934 return len - 2;
2935 }
2936 else {
2937 /* single symbol found, handing over to emph2 */
2938 len = parse_emph2(out, md, data_, c);
2939 if (!len)
2940 return 0;
2941 else
2942 return len - 1;
2943 }
2944 }
2945 return 0;
2946 }
2947 function is_atxheader(md, data) {
2948 if (data[0] != '#')
2949 return false;
2950 if (md.extensions & MKDEXT_SPACE_HEADERS) {
2951 var level = 0;
2952 while (level < data.length && level < 6 && data[level] == '#')
2953 level++;
2954 if (level < data.length && data[level] != ' ')
2955 return false;
2956 }
2957 return true;
2958 }
2959 /* is_headerline . returns whether the line is a setext-style hdr underline */
2960 function is_headerline(data) {
2961 var i = 0;
2962 var size = data.length;
2963 /* test of level 1 header */
2964 if (data[i] == '=') {
2965 for (i = 1; i < size && data[i] == '='; i++) { }
2966 while (i < size && data[i] == ' ')
2967 i++;
2968 return (i >= size || data[i] == '\n') ? 1 : 0;
2969 }
2970 /* test of level 2 header */
2971 if (data[i] == '-') {
2972 for (i = 1; i < size && data[i] == '-'; i++) { }
2973 while (i < size && data[i] == ' ')
2974 i++;
2975 return (i >= size || data[i] == '\n') ? 2 : 0;
2976 }
2977 return 0;
2978 }
2979 function is_next_headerline(data) {
2980 var size = data.length;
2981 var i = 0;
2982 while (i < size && data[i] != '\n')
2983 i++;
2984 if (++i >= size)
2985 return 0;
2986 return is_headerline(data.slice(i));
2987 }
2988 /* prefix_quote - returns blockquote prefix length */
2989 function prefix_quote(data) {
2990 var i = 0;
2991 var size = data.length;
2992 if (i < size && data[i] == ' ')
2993 i++;
2994 if (i < size && data[i] == ' ')
2995 i++;
2996 if (i < size && data[i] == ' ')
2997 i++;
2998 if (i < size && data[i] == '>') {
2999 if (i + 1 < size && data[i + 1] == ' ')
3000 return i + 2;
3001 return i + 1;
3002 }
3003 return 0;
3004 }
3005 /* prefix_code • returns prefix length for block code*/
3006 function prefix_code(data) {
3007 if (data.length > 3 && data[0] == ' ' && data[1] == ' '
3008 && data[2] == ' ' && data[3] == ' ')
3009 return 4;
3010 return 0;
3011 }
3012 /* prefix_oli - returns ordered list item prefix */
3013 function prefix_oli(data) {
3014 var size = data.length;
3015 var i = 0;
3016 if (i < size && data[i] == ' ')
3017 i++;
3018 if (i < size && data[i] == ' ')
3019 i++;
3020 if (i < size && data[i] == ' ')
3021 i++;
3022 if (i >= size || data[i] < '0' || data[i] > '9')
3023 return 0;
3024 while (i < size && data[i] >= '0' && data[i] <= '9')
3025 i++;
3026 if (i + 1 >= size || data[i] != '.' || data[i + 1] != ' ')
3027 return 0;
3028 if (is_next_headerline(data.slice(i)))
3029 return 0;
3030 return i + 2;
3031 }
3032 /* prefix_uli - returns ordered list item prefix */
3033 function prefix_uli(data) {
3034 var size = data.length;
3035 var i = 0;
3036 if (i < size && data[i] == ' ')
3037 i++;
3038 if (i < size && data[i] == ' ')
3039 i++;
3040 if (i < size && data[i] == ' ')
3041 i++;
3042 if (i + 1 >= size ||
3043 (data[i] != '*' && data[i] != '+' && data[i] != '-') ||
3044 data[i + 1] != ' ')
3045 return 0;
3046 if (is_next_headerline(data.slice(i)))
3047 return 0;
3048 return i + 2;
3049 }
3050 /* is_mail_autolink - looks for the address part of a mail autolink and '>' */
3051 /* this is less strict than the original markdown e-mail address matching */
3052 function is_mail_autolink(data) {
3053 var i = 0, nb = 0;
3054 /* address is assumed to be: [-@._a-zA-Z0-9]+ with exactly one '@' */
3055 for (i = 0; i < data.length; ++i) {
3056 if (isalnum(data[i]))
3057 continue;
3058 switch (data[i]) {
3059 case '@':
3060 nb++;
3061 case '-':
3062 case '.':
3063 case '_':
3064 break;
3065 case '>':
3066 return (nb == 1) ? i + 1 : 0;
3067 default:
3068 return 0;
3069 }
3070 }
3071 return 0;
3072 }
3073 /* tag_length - returns the length of the given tag, or 0 is it's not valid */
3074 function tag_length(data, autolink) {
3075 var i, j;
3076 /* a valid tag can't be shorter than 3 chars */
3077 if (data.length < 3)
3078 return 0;
3079 /* begins with a '<' optionally followed by '/', followed by letter or number */
3080 if (data[0] != '<')
3081 return 0;
3082 i = (data[1] == '/') ? 2 : 1;
3083 if (!isalnum(data[i]))
3084 return 0;
3085 /* scheme test */
3086 autolink.p = MKDA_NOT_AUTOLINK;
3087 /* try to find the beginning of an URI */
3088 while (i < data.length && (isalnum(data[i]) || data[i] == '.' || data[i] == '+' || data[i] == '-'))
3089 i++;
3090 if (i > 1 && data[i] == '@') {
3091 if ((j = is_mail_autolink(data.slice(i))) != 0) {
3092 autolink.p = MKDA_EMAIL;
3093 return i + j;
3094 }
3095 }
3096 if (i > 2 && data[i] == ':') {
3097 autolink.p = MKDA_NORMAL;
3098 i++;
3099 }
3100 /* completing autolink test: no whitespace or ' or " */
3101 if (i >= data.length)
3102 autolink.p = MKDA_NOT_AUTOLINK;
3103 else if (autolink.p) {
3104 j = i;
3105 while (i < data.length) {
3106 if (data[i] == '\\')
3107 i += 2;
3108 else if (data[i] == '>' || data[i] == '\'' ||
3109 data[i] == '"' || data[i] == ' ' || data[i] == '\n')
3110 break;
3111 else
3112 i++;
3113 }
3114 if (i >= data.length)
3115 return 0;
3116 if (i > j && data[i] == '>')
3117 return i + 1;
3118 /* one of the forbidden chars has been found */
3119 autolink.p = MKDA_NOT_AUTOLINK;
3120 }
3121 /* looking for sometinhg looking like a tag end */
3122 while (i < data.length && data[i] != '>')
3123 i++;
3124 if (i >= data.length)
3125 return 0;
3126 return i + 1;
3127 }
3128 // parse_inline - parses inline markdown elements
3129 //Buffer, md, String
3130 function parse_inline(out, md, data) {
3131 var i = 0, end = 0;
3132 var action = 0;
3133 var work = new Buffer();
3134 if (md.spanStack.length + md.blockStack.length > md.nestingLimit)
3135 return;
3136 while (i < data.length) {
3137 /* copying inactive chars into the output */
3138 while (end < data.length && !(action = md.activeChars[data[end]])) {
3139 end++;
3140 }
3141 if (md.callbacks.normal_text) {
3142 work.s = data.slice(i, end);
3143 md.callbacks.normal_text(out, work, md.context);
3144 }
3145 else
3146 out.s += data.slice(i, end);
3147 if (end >= data.length)
3148 break;
3149 i = end;
3150 end = markdown_char_ptrs[action](out, md, data, i);
3151 if (!end)
3152 end = i + 1;
3153 else {
3154 i += end;
3155 end = i;
3156 }
3157 }
3158 }
3159 /* parse_atxheader - parsing of atx-style headers */
3160 function parse_atxheader(out, md, data) {
3161 var level = 0;
3162 var i, end, skip;
3163 while (level < data.length && level < 6 && data[level] == '#')
3164 level++;
3165 for (i = level; i < data.length && data[i] == ' '; i++) { }
3166 for (end = i; end < data.length && data[end] != '\n'; end++) { }
3167 skip = end;
3168 while (end && data[end - 1] == '#')
3169 end--;
3170 while (end && data[end - 1] == ' ')
3171 end--;
3172 if (end > i) {
3173 var work = new Buffer();
3174 md.spanStack.push(work);
3175 parse_inline(work, md, data.slice(i, end));
3176 if (md.callbacks.header)
3177 md.callbacks.header(out, work, level, md.context);
3178 md.spanStack.pop();
3179 }
3180 return skip;
3181 }
3182 /* htmlblock_end - checking end of HTML block : </tag>[ \t]*\n[ \t*]\n */
3183 /* returns the length on match, 0 otherwise */
3184 // htmlblock_end(const char *tag, size_t tag_len, struct sd_markdown *rndr, uint8_t *data, size_t size)
3185 function htmlblock_end(tag, md, data) {
3186 var i, w;
3187 /* checking if tag is a match */
3188 //tag should already be lowercase
3189 if (tag.length + 3 >= data.length ||
3190 data.slice(2).toLowerCase() != tag ||
3191 data[tag.length + 2] != '>')
3192 return 0;
3193 /* checking white lines */
3194 i = tag.length + 3;
3195 w = 0;
3196 if (i < data.length && (w = is_empty(data.slice(i))) == 0)
3197 return 0; /* non-blank after tag */
3198 i += w;
3199 w = 0;
3200 if (i < data.length)
3201 w = is_empty(data.slice(i));
3202 return i + w;
3203 }
3204 /* parse_htmlblock - parsing of inline HTML block */
3205 //TODO
3206 function parse_htmlblock(out, md, data, do_render) {
3207 var i, j = 0;
3208 var curtag = null;
3209 var found;
3210 var work = new Buffer(data);
3211 /* identification of the opening tag */
3212 if (data.length < 2 || data[0] != '<')
3213 return 0;
3214 i = 1;
3215 while (i < data.length && data[i] != '>' && data[i] != ' ')
3216 i++;
3217 if (i < data.length)
3218 curtag = find_block_tag(data.slice(1));
3219 /* handling of special cases */
3220 if (!curtag) {
3221 /* HTML comment, laxist form */
3222 if (data.length > 5 && data[1] == '!' && data[2] == '-' && data[3] == '-') {
3223 i = 5;
3224 while (i < data.length && !(data[i - 2] == '-' && data[i - 1] == '-' && data[i] == '>'))
3225 i++;
3226 i++;
3227 if (i < data.length)
3228 j = is_empty(data.slice(i));
3229 if (j) {
3230 //TODO: HANDLE WORK!!!
3231 // work.size = i + j;
3232 work.s = data.slice(0, i + j);
3233 if (do_render && md.callbacks.blockhtml)
3234 md.callbacks.blockhtml(out, work, md.context);
3235 return work.s.length;
3236 }
3237 }
3238 /* HR, which is the only self-closing block tag considered */
3239 if (data.length > 4 && (data[1] == 'h' || data[1] == 'H') && (data[2] == 'r' || data[2] == 'R')) {
3240 i = 3;
3241 while (i < data.length && data[i] != '>')
3242 i++;
3243 if (i + 1 < data.length) {
3244 i++;
3245 j = is_empty(data.slice(i));
3246 if (j) {
3247 work.s = data.slice(0, i + j);
3248 if (do_render && md.callbacks.blockhtml)
3249 md.callbacks.blockhtml(out, work, md.context);
3250 return work.s.length;
3251 }
3252 }
3253 }
3254 /* no special case recognised */
3255 return 0;
3256 }
3257 /* looking for an unindented matching closing tag */
3258 /* followed by a blank line */
3259 i = 1;
3260 found = 0;
3261 /* if not found, trying a second pass looking for indented match */
3262 /* but not if tag is "ins" or "del" (following original Markdown.pl) */
3263 if (curtag != 'ins' && curtag != 'del') {
3264 var tag_size = curtag.length;
3265 i = 1;
3266 while (i < data.length) {
3267 i++;
3268 while (i < data.length && !(data[i - 1] == '<' && data[i] == '/'))
3269 i++;
3270 if (i + 2 + tag_size >= data.length)
3271 break;
3272 // j = htmlblock_end(tag, md, data + i - 1, size - i + 1);
3273 //TODO
3274 j = htmlblock_end(curtag, md, data.slice(i - 1));
3275 if (j) {
3276 i += j - 1;
3277 found = 1;
3278 break;
3279 }
3280 }
3281 }
3282 if (!found)
3283 return 0;
3284 /* the end of the block has been found */
3285 //TODO:
3286 work.s = work.s.slice(0, i);
3287 if (do_render && md.callbacks.blockhtml)
3288 md.callbacks.blockhtml(out, work, md.context);
3289 return i;
3290 }
3291 /* parse_blockquote - handles parsing of a blockquote fragment */
3292 function parse_blockquote(out, md, data) {
3293 var size = data.length;
3294 var beg, end = 0, pre, work_size = 0;
3295 // uint8_t *work_data = 0;
3296 var work_data = "";
3297 var work_data_cursor = 0;
3298 var out_ = new Buffer();
3299 md.blockStack.push(out_);
3300 beg = 0;
3301 while (beg < size) {
3302 for (end = beg + 1; end < size && data[end - 1] != '\n'; end++) { }
3303 pre = prefix_quote(data.slice(beg, end));
3304 if (pre)
3305 beg += pre; /* skipping prefix */
3306 else if (is_empty(data.slice(beg, end)) &&
3307 (end >= size || (prefix_quote(data.slice(end)) == 0 &&
3308 !is_empty(data.slice(end)))))
3309 break;
3310 if (beg < end) {
3311 /* bufput(work, data + beg, end - beg); */
3312 //TODO:!!! FIX THIS!!!
3313 // if (!work_data) work_data = data.slice(beg, end);
3314 // work_data = data + beg;
3315 work_data += data.slice(beg, end);
3316 /*
3317 if (!work_data) work_data_cursor = beg;
3318 else if (beg != work_data_cursor + work_size)
3319 work_data += data.slice(beg, end);
3320 */
3321 // memmove(work_data + work_size, data + beg, end - beg);
3322 work_size += end - beg;
3323 }
3324 beg = end;
3325 }
3326 parse_block(out_, md, work_data);
3327 if (md.callbacks.blockquote)
3328 md.callbacks.blockquote(out, out_, md.context);
3329 md.blockStack.pop();
3330 return end;
3331 }
3332 /* parse_paragraph - handles parsing of a regular paragraph */
3333 function parse_paragraph(out, md, data) {
3334 var i = 0, end = 0;
3335 var level = 0;
3336 var size = data.length;
3337 var work = new Buffer(data);
3338 while (i < size) {
3339 for (end = i + 1; end < size && data[end - 1] != '\n'; end++) { }
3340 if (prefix_quote(data.slice(i, end)) != 0) {
3341 end = i;
3342 break;
3343 }
3344 var tempdata = data.slice(i);
3345 if (is_empty(tempdata) || (level = is_headerline(tempdata)) != 0)
3346 break;
3347 if (is_empty(tempdata))
3348 break;
3349 if ((level = is_headerline(tempdata)) != 0)
3350 break;
3351 if (is_atxheader(md, tempdata)
3352 || is_hrule(tempdata)
3353 || prefix_quote(tempdata)) {
3354 end = i;
3355 break;
3356 }
3357 /*
3358 * Early termination of a paragraph with the same logic
3359 * as markdown 1.0.0. If this logic is applied, the
3360 * Markdown 1.0.3 test suite wont pass cleanly.
3361 *
3362 * :: If the first character in a new line is not a letter
3363 * lets check to see if there's some kind of block starting here
3364 */
3365 if ((md.extensions & MKDEXT_LAX_SPACING) && !isalnum(data[i])) {
3366 if (prefix_oli(tempdata)
3367 || prefix_uli(tempdata)) {
3368 end = i;
3369 break;
3370 }
3371 /* see if an html block starts here */
3372 if (data[i] == '<' && md.callbacks.blockhtml
3373 && parse_htmlblock(out, md, tempdata, 0)) {
3374 end = i;
3375 break;
3376 }
3377 /* see if a code fence starts here */
3378 if ((md.extensions && MKDEXT_FENCED_CODE) != 0
3379 && is_codefence(tempdata, null) != 0) {
3380 end = i;
3381 break;
3382 }
3383 }
3384 i = end;
3385 }
3386 var work_size = i;
3387 while (work_size && data[work_size - 1] == '\n')
3388 work_size--;
3389 work.s = work.s.slice(0, work_size);
3390 if (!level) {
3391 var tmp = new Buffer();
3392 md.blockStack.push(tmp);
3393 parse_inline(tmp, md, work.s);
3394 if (md.callbacks.paragraph)
3395 md.callbacks.paragraph(out, tmp, md.context);
3396 md.blockStack.pop();
3397 }
3398 else {
3399 var header_work = null;
3400 if (work.size) {
3401 var beg;
3402 i = work.s.length;
3403 // var work_size = work.s.length - 1;
3404 // work.size -= 1;
3405 while (work_size && data[work_size] != '\n')
3406 work_size -= 1;
3407 beg = work_size + 1;
3408 while (work_size && data[work_size - 1] == '\n')
3409 work_size -= 1;
3410 work.s = work.s.slice(0, work_size);
3411 if (work_size > 0) {
3412 var tmp = new Buffer();
3413 md.blockStack.push(tmp);
3414 parse_inline(tmp, md, work.s);
3415 if (md.callbacks.paragraph)
3416 md.callbacks.paragraph(out, tmp, md.context);
3417 md.blockStack.pop();
3418 work.s = work.s.slice(beg, i);
3419 }
3420 else
3421 work.s = work.s.slice(0, i);
3422 }
3423 header_work = new Buffer();
3424 md.spanStack.push(header_work);
3425 parse_inline(header_work, md, work.s);
3426 if (md.callbacks.header)
3427 md.callbacks.header(out, header_work, level, md.context);
3428 md.spanStack.pop();
3429 }
3430 return end;
3431 }
3432 /* parse_fencedcode - handles parsing of a block-level code fragment */
3433 function parse_fencedcode(out, md, data) {
3434 var beg, end;
3435 var work = null;
3436 var lang = new Buffer();
3437 beg = is_codefence(data, lang);
3438 if (beg == 0)
3439 return 0;
3440 work = new Buffer();
3441 md.blockStack.push(work);
3442 while (beg < data.length) {
3443 var fence_end;
3444 var fence_trail = new Buffer();
3445 fence_end = is_codefence(data.slice(beg), fence_trail);
3446 if (fence_end != 0 && fence_trail.s.length == 0) {
3447 beg += fence_end;
3448 break;
3449 }
3450 for (end = beg + 1; end < data.length && data[end - 1] != '\n'; end++) { }
3451 if (beg < end) {
3452 /* verbatim copy to the working buffer,
3453 escaping entities */
3454 var tempData = data.slice(beg, end);
3455 if (is_empty(tempData))
3456 work.s += '\n';
3457 else
3458 work.s += tempData;
3459 }
3460 beg = end;
3461 }
3462 if (work.s.length && work.s[work.s.length - 1] != '\n')
3463 work.s += '\n';
3464 if (md.callbacks.blockcode)
3465 md.callbacks.blockcode(out, work, lang.s.length ? lang : null, md.context);
3466 md.blockStack.pop();
3467 return beg;
3468 }
3469 function parse_blockcode(out, md, data) {
3470 var size = data.length;
3471 var beg, end, pre;
3472 var work = null;
3473 md.blockStack.push(work = new Buffer());
3474 beg = 0;
3475 while (beg < size) {
3476 for (end = beg + 1; end < size && data[end - 1] != '\n'; end++) { }
3477 ;
3478 pre = prefix_code(data.slice(beg, end));
3479 if (pre)
3480 beg += pre; /* skipping prefix */
3481 else if (!is_empty(data.slice(beg, end)))
3482 /* non-empty non-prefixed line breaks the pre */
3483 break;
3484 if (beg < end) {
3485 /* verbatim copy to the working buffer,
3486 escaping entities */
3487 if (is_empty(data.slice(beg, end)))
3488 work.s += '\n';
3489 else
3490 work.s += data.slice(beg, end);
3491 }
3492 beg = end;
3493 }
3494 var work_size = work.s.length;
3495 while (work_size && work.s[work_size - 1] == '\n')
3496 work_size -= 1;
3497 work.s = work.s.slice(0, work_size);
3498 work.s += '\n';
3499 if (md.callbacks.blockcode)
3500 md.callbacks.blockcode(out, work, null, md.context);
3501 md.blockStack.pop();
3502 return beg;
3503 }
3504 /* parse_listitem - parsing of a single list item */
3505 /* assuming initial prefix is already removed */
3506 //FLAGS is pointer
3507 function parse_listitem(out, md, data, flags) {
3508 var size = data.length;
3509 var work = null, inter = null;
3510 var beg = 0, end, pre, sublist = 0, orgpre = 0, i;
3511 var in_empty = 0, has_inside_empty = 0;
3512 var in_fence = 0;
3513 /* keeping track of the first indentation prefix */
3514 while (orgpre < 3 && orgpre < size && data[orgpre] == ' ')
3515 orgpre++;
3516 //TODO
3517 beg = prefix_uli(data);
3518 if (!beg)
3519 beg = prefix_oli(data);
3520 if (!beg)
3521 return 0;
3522 /* skipping to the beginning of the following line */
3523 end = beg;
3524 while (end < size && data[end - 1] != '\n')
3525 end++;
3526 /* getting working buffers */
3527 md.spanStack.push(work = new Buffer());
3528 md.spanStack.push(inter = new Buffer());
3529 /* putting the first line into the working buffer */
3530 work.s += data.slice(beg, end);
3531 beg = end;
3532 /* process the following lines */
3533 while (beg < size) {
3534 var has_next_uli, has_next_oli;
3535 end++;
3536 while (end < size && data[end - 1] != '\n')
3537 end++;
3538 /* process an empty line */
3539 if (is_empty(data.slice(beg, end))) {
3540 in_empty = 1;
3541 beg = end;
3542 continue;
3543 }
3544 /* calculating the indentation */
3545 i = 0;
3546 while (i < 4 && beg + i < end && data[beg + i] == ' ')
3547 i++;
3548 pre = i;
3549 //TODO: Cache this slice?
3550 if (md.flags & MKDEXT_FENCED_CODE) {
3551 if (is_codefence(data.slice(beg + i, end), null) != 0) {
3552 in_fence = !in_fence;
3553 }
3554 }
3555 /* only check for new list items if we are **not** in a fenced code block */
3556 if (!in_fence) {
3557 has_next_uli = prefix_uli(data.slice(beg + i, end));
3558 has_next_oli = prefix_oli(data.slice(beg + i, end));
3559 }
3560 /* checking for ul/ol switch */
3561 if (in_empty && (((flags.p & MKD_LIST_ORDERED) && has_next_uli) ||
3562 (!(flags.p & MKD_LIST_ORDERED) && has_next_oli))) {
3563 flags.p |= MKD_LI_END;
3564 break; /* the following item must have same list type */
3565 }
3566 /* checking for a new item */
3567 if ((has_next_uli && !is_hrule(data.slice(beg + i, end))) || has_next_oli) {
3568 if (in_empty)
3569 has_inside_empty = 1;
3570 if (pre == orgpre)
3571 break; /* the same indentation */
3572 if (!sublist)
3573 sublist = work.s.length;
3574 }
3575 else if (in_empty && pre == 0) {
3576 flags.p |= MKD_LI_END;
3577 break;
3578 }
3579 else if (in_empty) {
3580 work.s += '\n';
3581 has_inside_empty = 1;
3582 }
3583 in_empty = 0;
3584 /* adding the line without prefix into the working buffer */
3585 work.s += data.slice(beg + i, end);
3586 beg = end;
3587 }
3588 /* render of li contents */
3589 if (has_inside_empty)
3590 flags.p |= MKD_LI_BLOCK;
3591 if (flags.p & MKD_LI_BLOCK) {
3592 /* intermediate render of block li */
3593 if (sublist && sublist < work.s.length) {
3594 parse_block(inter, md, work.s.slice(0, sublist));
3595 parse_block(inter, md, work.s.slice(sublist));
3596 }
3597 else
3598 parse_block(inter, md, work.s);
3599 }
3600 else {
3601 //TODO:
3602 /* intermediate render of inline li */
3603 if (sublist && sublist < work.s.length) {
3604 parse_inline(inter, md, work.s.slice(0, sublist));
3605 parse_block(inter, md, work.s.slice(sublist));
3606 }
3607 else
3608 parse_inline(inter, md, work.s);
3609 }
3610 /* render of li itself */
3611 if (md.callbacks.listitem)
3612 md.callbacks.listitem(out, inter, flags.p, md.context);
3613 md.spanStack.pop();
3614 md.spanStack.pop();
3615 return beg;
3616 }
3617 /* parse_list - parsing ordered or unordered list block */
3618 function parse_list(out, md, data, flags) {
3619 var size = data.length;
3620 var i = 0, j;
3621 var work = null;
3622 md.blockStack.push(work = new Buffer());
3623 while (i < size) {
3624 var flag_p = { p: flags };
3625 j = parse_listitem(work, md, data.slice(i), flag_p);
3626 flags = flag_p.p;
3627 i += j;
3628 if (!j || (flags & MKD_LI_END))
3629 break;
3630 }
3631 if (md.callbacks.list)
3632 md.callbacks.list(out, work, flags, md.context);
3633 md.blockStack.pop();
3634 return i;
3635 }
3636 function parse_table_row(out, md, data, columns, header_flag) {
3637 var i = 0, col, cols_left;
3638 var row_work = null;
3639 if (!md.callbacks.table_cell || !md.callbacks.table_row)
3640 return;
3641 md.spanStack.push(row_work = new Buffer());
3642 if (i < data.length && data[i] == '|')
3643 i++;
3644 for (col = 0; col < columns.length && i < data.length; ++col) {
3645 var cell_start, cell_end;
3646 var cell_work;
3647 md.spanStack.push(cell_work = new Buffer());
3648 while (i < data.length && _isspace(data[i]))
3649 i++;
3650 cell_start = i;
3651 while (i < data.length && data[i] != '|')
3652 i++;
3653 cell_end = i - 1;
3654 while (cell_end > cell_start && _isspace(data[cell_end]))
3655 cell_end--;
3656 // parse_inline(cell_work, rndr, data + cell_start, 1 + cell_end - cell_start);
3657 parse_inline(cell_work, md, data.slice(cell_start, 1 + cell_end));
3658 md.callbacks.table_cell(row_work, cell_work, columns[col] | header_flag, md.context, 0);
3659 md.spanStack.pop();
3660 i++;
3661 }
3662 cols_left = columns.length - col;
3663 // for (; col < columns.length; ++col) {
3664 if (cols_left > 0) {
3665 var empty_cell = null;
3666 md.callbacks.table_cell(row_work, empty_cell, columns[col] | header_flag, md.context, cols_left);
3667 }
3668 md.callbacks.table_row(out, row_work, md.context);
3669 md.spanStack.pop();
3670 }
3671 function parse_table_header(out, md, data, columns) {
3672 var i = 0, col, header_end, under_end;
3673 var pipes = 0;
3674 while (i < data.length && data[i] != '\n')
3675 if (data[i++] == '|')
3676 pipes++;
3677 if (i == data.length || pipes == 0)
3678 return 0;
3679 header_end = i;
3680 while (header_end > 0 && _isspace(data[header_end - 1]))
3681 header_end--;
3682 if (data[0] == '|')
3683 pipes--;
3684 if (header_end && data[header_end - 1] == '|')
3685 pipes--;
3686 if (pipes + 1 > md.maxTableCols)
3687 return 0;
3688 // columns.p = pipes + 1;
3689 // column_data.p = new Array(columns.p);
3690 columns.p = new Array(pipes + 1);
3691 for (var k = 0; k < columns.p.length; k++)
3692 columns.p[k] = 0;
3693 /* Parse the header underline */
3694 i++;
3695 if (i < data.length && data[i] == '|')
3696 i++;
3697 under_end = i;
3698 while (under_end < data.length && data[under_end] != '\n')
3699 under_end++;
3700 for (col = 0; col < columns.p.length && i < under_end; ++col) {
3701 var dashes = 0;
3702 while (i < under_end && data[i] == ' ')
3703 i++;
3704 if (data[i] == ':') {
3705 i++;
3706 columns.p[col] |= MKD_TABLE_ALIGN_L;
3707 dashes++;
3708 }
3709 while (i < under_end && data[i] == '-') {
3710 i++;
3711 dashes++;
3712 }
3713 if (i < under_end && data[i] == ':') {
3714 i++;
3715 columns.p[col] |= MKD_TABLE_ALIGN_R;
3716 dashes++;
3717 }
3718 while (i < under_end && data[i] == ' ')
3719 i++;
3720 if (i < under_end && data[i] != '|')
3721 break;
3722 if (dashes < 1)
3723 break;
3724 i++;
3725 }
3726 if (col < columns.p.length)
3727 return 0;
3728 parse_table_row(out, md, data.slice(0, header_end), columns.p, MKD_TABLE_HEADER);
3729 return under_end + 1;
3730 }
3731 function parse_table(out, md, data) {
3732 var i;
3733 var header_work, body_work;
3734 var columns = { p: null };
3735 md.spanStack.push(header_work = new Buffer());
3736 md.blockStack.push(body_work = new Buffer());
3737 i = parse_table_header(header_work, md, data, columns);
3738 if (i > 0) {
3739 while (i < data.length) {
3740 var row_start;
3741 var pipes = 0;
3742 row_start = i;
3743 while (i < data.length && data[i] != '\n')
3744 if (data[i++] == '|')
3745 pipes++;
3746 if (pipes == 0 || i == data.length) {
3747 i = row_start;
3748 break;
3749 }
3750 parse_table_row(body_work, md, data.slice(row_start, i), columns.p, 0);
3751 i++;
3752 }
3753 if (md.callbacks.table)
3754 md.callbacks.table(out, header_work, body_work, md.context);
3755 }
3756 md.spanStack.pop();
3757 md.blockStack.pop();
3758 return i;
3759 }
3760 function parse_block(out, md, data) {
3761 var beg = 0, end, i;
3762 var textData;
3763 if (md.spanStack.length +
3764 md.blockStack.length > md.nestingLimit)
3765 return;
3766 while (beg < data.length) {
3767 textData = data.slice(beg);
3768 end = data.length - beg;
3769 if (is_atxheader(md, textData))
3770 beg += parse_atxheader(out, md, textData);
3771 else if (data[beg] == '<' && md.callbacks.blockhtml &&
3772 (i = parse_htmlblock(out, md, textData, 1)) != 0)
3773 beg += i;
3774 else if ((i = is_empty(textData)) != 0)
3775 beg += i;
3776 else if (is_hrule(textData)) {
3777 if (md.callbacks.hrule)
3778 md.callbacks.hrule(out, md.context);
3779 while (beg < data.length && data[beg] != '\n')
3780 beg++;
3781 beg++;
3782 }
3783 else if ((md.extensions & MKDEXT_FENCED_CODE) != 0 &&
3784 (i = parse_fencedcode(out, md, textData)) != 0)
3785 beg += i;
3786 else if ((md.extensions & MKDEXT_TABLES) != 0 &&
3787 (i = parse_table(out, md, textData)) != 0)
3788 beg += i;
3789 else if (prefix_quote(textData))
3790 beg += parse_blockquote(out, md, textData);
3791 else if (prefix_code(textData))
3792 beg += parse_blockcode(out, md, textData);
3793 else if (prefix_uli(textData))
3794 beg += parse_list(out, md, textData, 0);
3795 else if (prefix_oli(textData))
3796 beg += parse_list(out, md, textData, MKD_LIST_ORDERED);
3797 else {
3798 beg += parse_paragraph(out, md, textData);
3799 }
3800 }
3801 }
3802 function is_ref(data, beg, end, md) {
3803 /* int n; */
3804 var i = 0;
3805 var idOffset, idEnd;
3806 var linkOffset, linkEnd;
3807 var titleOffset, titleEnd;
3808 var lineEnd;
3809 /* up to 3 optional leading spaces */
3810 if (beg + 3 >= end)
3811 return 0;
3812 if (data[beg] == ' ') {
3813 i = 1;
3814 if (data[beg + 1] == ' ') {
3815 i = 2;
3816 if (data[beg + 2] == ' ') {
3817 i = 3;
3818 if (data[beg + 3] == ' ')
3819 return 0;
3820 }
3821 }
3822 }
3823 i += beg;
3824 /* id part: anything but a newline between brackets */
3825 if (data[i] != '[')
3826 return 0;
3827 i++;
3828 idOffset = i;
3829 while (i < end && data[i] != '\n' && data[i] != '\r' && data[i] != ']')
3830 i++;
3831 if (i >= end || data[i] != ']')
3832 return 0;
3833 idEnd = i;
3834 /* spacer: colon (space | tab)* newline? (space | tab)* */
3835 i++;
3836 if (i >= end || data[i] != ':')
3837 return 0;
3838 i++;
3839 while (i < end && data[i] == ' ')
3840 i++;
3841 if (i < end && (data[i] == '\n' || data[i] == '\r')) {
3842 i++;
3843 if (i < end && data[i] == '\r' && data[i - 1] == '\n')
3844 i++;
3845 }
3846 while (i < end && data[i] == ' ')
3847 i++;
3848 if (i >= end)
3849 return 0;
3850 /* link: whitespace-free sequence, optionally between angle brackets */
3851 if (data[i] == '<')
3852 i++;
3853 linkOffset = i;
3854 while (i < end && data[i] != ' ' && data[i] != '\n' && data[i] != '\r')
3855 i++;
3856 if (data[i - 1] == '>')
3857 linkEnd = i - 1;
3858 else
3859 linkEnd = i;
3860 /* optional spacer: (space | tab)* (newline | '\'' | '"' | '(' ) */
3861 while (i < end && data[i] == ' ')
3862 i++;
3863 if (i < end && data[i] != '\n' && data[i] != '\r'
3864 && data[i] != '\'' && data[i] != '"' && data[i] != '(')
3865 return 0;
3866 lineEnd = 0;
3867 /* computing end-of-line */
3868 if (i >= end || data[i] == '\r' || data[i] == '\n')
3869 lineEnd = i;
3870 if (i + 1 < end && data[i] == '\n' && data[i + 1] == '\r')
3871 lineEnd = i + 1;
3872 /* optional (space|tab)* spacer after a newline */
3873 if (lineEnd) {
3874 i = lineEnd + 1;
3875 while (i < end && data[i] == ' ')
3876 i++;
3877 }
3878 /* optional title: any non-newline sequence enclosed in '"()
3879 alone on its line */
3880 titleOffset = titleEnd = 0;
3881 if (i + 1 < end && (data[i] == '\'' || data[i] == '"' || data[i] == '(')) {
3882 i++;
3883 titleOffset = i;
3884 /* looking for EOL */
3885 while (i < end && data[i] != '\n' && data[i] != '\r')
3886 i++;
3887 if (i + 1 < end && data[i] == '\n' && data[i + 1] == '\r')
3888 titleEnd = i + 1;
3889 else
3890 titleEnd = i;
3891 /* stepping back */
3892 i -= 1;
3893 while (i > titleOffset && data[i] == ' ')
3894 i -= 1;
3895 if (i > titleOffset && (data[i] == '\'' || data[i] == '"' || data[i] == ')')) {
3896 lineEnd = titleEnd;
3897 titleEnd = i;
3898 }
3899 }
3900 if (!lineEnd || linkEnd == linkOffset)
3901 return 0; /* garbage after the link empty link */
3902 var id = data.slice(idOffset, idEnd);
3903 var link = data.slice(linkOffset, linkEnd);
3904 var title = null;
3905 if (titleEnd > titleOffset)
3906 title = data.slice(titleOffset, titleEnd);
3907 md.refs[id] = {
3908 id: id,
3909 link: new Buffer(link),
3910 title: new Buffer(title)
3911 };
3912 return lineEnd;
3913 }
3914 function expand_tabs(out, line) {
3915 var i = 0, tab = 0;
3916 while (i < line.length) {
3917 var org = i;
3918 while (i < line.length && line[i] != '\t') {
3919 i++;
3920 tab++;
3921 }
3922 if (i > org)
3923 out.s += line.slice(org, i);
3924 if (i >= line.length)
3925 break;
3926 do {
3927 out.s += ' ';
3928 tab++;
3929 } while (tab % 4);
3930 i++;
3931 }
3932 }
3933 /**
3934 Render markdown code to HTML.
3935 @param {string} source Markdown code.
3936 @returns {string} HTML code.
3937 */
3938 function render(source) {
3939 var text = new Buffer();
3940 var beg = 0, end;
3941 this.refs = {};
3942 while (beg < source.length) {
3943 if (end = is_ref(source, beg, source.length, this))
3944 beg = end;
3945 else {
3946 end = beg;
3947 while (end < source.length && source[end] != '\n' && source[end] != '\r')
3948 end++;
3949 /* adding the line body if present */
3950 if (end > beg)
3951 expand_tabs(text, source.slice(beg, end));
3952 while (end < source.length && (source[end] == '\n' || source[end] == '\r')) {
3953 /* add one \n per newline */
3954 if (source[end] == '\n' || (end + 1 < source.length && source[end + 1] != '\n'))
3955 text.s += '\n';
3956 end++;
3957 }
3958 beg = end;
3959 }
3960 }
3961 var out = new Buffer();
3962 /* second pass: actual rendering */
3963 if (this.callbacks.doc_header)
3964 this.callbacks.doc_header(out, this.context);
3965 if (text.s.length) {
3966 /* adding a final newline if not already present */
3967 if (text.s[text.s.length - 1] != '\n' && text.s[text.s.length - 1] != '\r')
3968 text.s += '\n';
3969 parse_block(out, this, text.s);
3970 }
3971 if (this.callbacks.doc_footer)
3972 this.callbacks.doc_footer(out, this.context);
3973 return out.s;
3974 }
3975 Markdown.prototype['render'] = render;
3976 /**
3977 Create a parser object using the given configuration parameters.
3978 To get a Reddit equivelent configuration, pass no arguments.
3979 @param {?Renderer=} renderer A renderer object.
3980 @param {?Number=} extensions A series of OR'd extension flags. (Extension flags start with MKDEXT_)
3981 @param {?Number=} nestingLimit The maximum depth to which inline elements can be nested.
3982 @return {Markdown} A configured markdown object.
3983 */
3984 exports.getParser = function getParser(renderer, extensions, nestingLimit, columnLimit) {
3985 var md = new Markdown();
3986 if (renderer)
3987 md.callbacks = renderer.callbacks;
3988 if (nestingLimit)
3989 md.nestingLimit = nestingLimit;
3990 if (nestingLimit)
3991 md.maxTableCols = columnLimit;
3992 if (renderer)
3993 md.context = renderer.context;
3994 if (extensions != undefined && extensions != null)
3995 md.extensions = extensions;
3996 // if (!(nestingLimit > 0 && columnLimit > 0 && callbacks)) throw new Error;
3997 var cb = md.callbacks;
3998 if (cb.emphasis || cb.double_emphasis || cb.triple_emphasis) {
3999 md.activeChars['*'] = MD_CHAR_EMPHASIS;
4000 md.activeChars['_'] = MD_CHAR_EMPHASIS;
4001 if (md.extensions & MKDEXT_STRIKETHROUGH)
4002 md.activeChars['~'] = MD_CHAR_EMPHASIS;
4003 }
4004 if (cb.codespan)
4005 md.activeChars['`'] = MD_CHAR_CODESPAN;
4006 if (cb.linebreak)
4007 md.activeChars['\n'] = MD_CHAR_LINEBREAK;
4008 if (cb.image || cb.link)
4009 md.activeChars['['] = MD_CHAR_LINK;
4010 md.activeChars['<'] = MD_CHAR_LANGLE;
4011 md.activeChars['\\'] = MD_CHAR_ESCAPE;
4012 md.activeChars['&'] = MD_CHAR_ENTITITY;
4013 if (md.extensions & MKDEXT_AUTOLINK) {
4014 if (!(md.extensions & MKDEXT_NO_EMAIL_AUTOLINK)) {
4015 md.activeChars['@'] = MD_CHAR_AUTOLINK_EMAIL;
4016 }
4017 md.activeChars[':'] = MD_CHAR_AUTOLINK_URL;
4018 md.activeChars['w'] = MD_CHAR_AUTOLINK_WWW;
4019 md.activeChars['/'] = MD_CHAR_AUTOLINK_SUBREDDIT_OR_USERNAME;
4020 }
4021 if (md.extensions & MKDEXT_SUPERSCRIPT)
4022 md.activeChars['^'] = MD_CHAR_SUPERSCRIPT;
4023 return md;
4024 };
4025 var DEFAULT_BODY_FLAGS = HTML_SKIP_HTML | HTML_SKIP_IMAGES | HTML_SAFELINK | HTML_ESCAPE | HTML_USE_XHTML;
4026 var DEFAULT_WIKI_FLAGS = HTML_SKIP_HTML | HTML_SAFELINK | HTML_ALLOW_ELEMENT_WHITELIST | HTML_ESCAPE | HTML_USE_XHTML;
4027 var DEFAULT_HTML_ATTR_WHITELIST = ['colspan', 'rowspan', 'cellspacing', 'cellpadding', 'scope'];
4028 var DEFAULT_HTML_ELEMENT_WHITELIST = ['tr', 'th', 'td', 'table', 'tbody', 'thead', 'tfoot', 'caption'];
4029 exports.DEFAULT_HTML_ELEMENT_WHITELIST = DEFAULT_HTML_ELEMENT_WHITELIST;
4030 exports.DEFAULT_HTML_ATTR_WHITELIST = DEFAULT_HTML_ATTR_WHITELIST;
4031 exports.DEFAULT_BODY_FLAGS = DEFAULT_BODY_FLAGS;
4032 exports.DEFAULT_WIKI_FLAGS = DEFAULT_WIKI_FLAGS;
4033 exports.HTML_SKIP_HTML = HTML_SKIP_HTML;
4034 exports.HTML_SKIP_STYLE = HTML_SKIP_STYLE;
4035 exports.HTML_SKIP_IMAGES = HTML_SKIP_IMAGES;
4036 exports.HTML_SKIP_LINKS = HTML_SKIP_LINKS;
4037 exports.HTML_EXPAND_TABS = HTML_EXPAND_TABS;
4038 exports.HTML_SAFELINK = HTML_SAFELINK;
4039 exports.HTML_TOC = HTML_TOC;
4040 exports.HTML_HARD_WRAP = HTML_HARD_WRAP;
4041 exports.HTML_USE_XHTML = HTML_USE_XHTML;
4042 exports.HTML_ESCAPE = HTML_ESCAPE;
4043 exports.HTML_ALLOW_ELEMENT_WHITELIST = HTML_ALLOW_ELEMENT_WHITELIST;
4044 exports.MKDEXT_NO_INTRA_EMPHASIS = MKDEXT_NO_INTRA_EMPHASIS;
4045 exports.MKDEXT_TABLES = MKDEXT_TABLES;
4046 exports.MKDEXT_FENCED_CODE = MKDEXT_FENCED_CODE;
4047 exports.MKDEXT_AUTOLINK = MKDEXT_AUTOLINK;
4048 exports.MKDEXT_STRIKETHROUGH = MKDEXT_STRIKETHROUGH;
4049 exports.MKDEXT_SPACE_HEADERS = MKDEXT_SPACE_HEADERS;
4050 exports.MKDEXT_SUPERSCRIPT = MKDEXT_SUPERSCRIPT;
4051 exports.MKDEXT_LAX_SPACING = MKDEXT_LAX_SPACING;
4052 exports.MKDEXT_NO_EMAIL_AUTOLINK = MKDEXT_NO_EMAIL_AUTOLINK;
4053 exports['SD_AUTOLINK_SHORT_DOMAINS'] = SD_AUTOLINK_SHORT_DOMAINS;
4054 exports.MKDA_NOT_AUTOLINK = MKDA_NOT_AUTOLINK;
4055 exports.MKDA_NORMAL = MKDA_NORMAL;
4056 exports.MKDA_EMAIL = MKDA_EMAIL;
4057})(SnuOwnd);
4058///////////////
4059// Cookie.ts //
4060///////////////
4061// Uses the js-cookie library (lib/cookies.ts) for specialised cookie operations and intialization
4062var Cookie;
4063(function (Cookie) {
4064 // INITIALIZATION
4065 var cookieName = "LCE_" + THREAD;
4066 var cookieVersion = '10';
4067 // Try to load existing cookie save data, or create a cookie with default data
4068 Cookie.saveDefaultOptions = true;
4069 var save_default = {
4070 version: cookieVersion,
4071 options: {},
4072 stats: {},
4073 collapsed: [false, false, false, true, true]
4074 };
4075 Cookie.save = Cookies.getJSON(cookieName);
4076 // In versions prior to 1.5.3, the extension used the cookie 'live-counting-extension'
4077 // instead of 'LCE_{THREAD}'.
4078 // To provide support for clients who had last used the extension at that point in time,
4079 // we shall copy the contents of the cookie 'live-counting-extension' to 'LCE_{THREAD}'.
4080 var oldCookie = Cookies.get('live-counting-extension');
4081 if (oldCookie !== undefined && oldCookie !== null) {
4082 if (Cookie.save === undefined || Cookie.save === null) {
4083 Cookies.set(cookieName, oldCookie, { expires: 9000, path: '' });
4084 Cookie.save = Cookies.getJSON(cookieName);
4085 }
4086 Cookies.remove('live-counting-extension', { path: '' });
4087 }
4088 // Create new cookie as it does not exist
4089 if (Cookie.save === undefined || Cookie.save === null) {
4090 Cookie.saveDefaultOptions = true;
4091 Cookie.save = save_default;
4092 update();
4093 }
4094 else if (Cookie.save.version != cookieVersion) {
4095 Cookie.saveDefaultOptions = true;
4096 Cookie.save.version = cookieVersion;
4097 // If the current save is missing a few keys, add these keys, set to the default
4098 for (var k in save_default) {
4099 if (!Cookie.save.hasOwnProperty(k))
4100 Cookie.save[k] = save_default[k];
4101 }
4102 update();
4103 }
4104 // METHODS
4105 // Set the cookie value to `save`
4106 function update() {
4107 Cookies.set(cookieName, Cookie.save, { expires: 9000, path: '' });
4108 }
4109 Cookie.update = update;
4110})(Cookie || (Cookie = {}));
4111/////////////////
4112// Elements.ts //
4113/////////////////
4114var Elements;
4115(function (Elements) {
4116 // PROPERTIES
4117 // Important elements
4118 Elements.$head = $('head');
4119 Elements.$body = $('body');
4120 Elements.$content = $('div.content');
4121 Elements.$updates = $('.liveupdate-listing');
4122 Elements.$options = $('#liveupdate-options');
4123 Elements.$sidebar = $('aside.sidebar');
4124 Elements.$form = $('#new-update-form');
4125 Elements.$textarea = Elements.$form.find('textarea');
4126 Elements.$submitBtn = Elements.$form.find('.save-button button');
4127 Elements.$submitError = Elements.$form.find('.save-button .error');
4128 // INITIALIZATION
4129 Elements.$body.attr('id', 'lc-body');
4130 // Prevent the larger $options from displacing the sidebar
4131 // with different behaviour depending on whether or not textbox exists
4132 if (Elements.$form.length) {
4133 Elements.$form.after('<div style="clear:both;"></div>');
4134 }
4135 else {
4136 Elements.$options.after('<div style="clear:both;"></div>');
4137 }
4138 // Make the submitError display default to none (important in RemoveSubmissionLag)
4139 Elements.$submitError.css('display', 'inline');
4140})(Elements || (Elements = {}));
4141;
4142///////////////
4143// Styles.ts //
4144///////////////
4145var Styles;
4146(function (Styles) {
4147 // STYLESHEET
4148 var $css = $("<style>\n\n\t/* General styles */\n\t#lc-body, #lc-body .liveupdate-listing {\n\t\tmin-width: 0px;\n\t}\n\n\t/* Prevent the button row from always showing up when screen is small */\n\t#lc-body li.liveupdate ul.buttonrow {\n\t\tdisplay: none !important;\n\t}\n\n\t#lc-body li.liveupdate:hover ul.buttonrow {\n\t\tdisplay: block !important;\n\t}\n\n\t/* Disable the transition entrance fade effect when an update is sent */\n\t#lc-body li.liveupdate * {\n\t\ttransition: none;\n\t}\n\n\t</style>");
4149 // INITIALIZATION
4150 $('head').append($css);
4151 // METHODS
4152 // Add code to stylesheet
4153 function add(code) {
4154 $css.append(code);
4155 }
4156 Styles.add = add;
4157})(Styles || (Styles = {}));
4158////////////////
4159// Options.ts //
4160////////////////
4161var Options;
4162(function (Options) {
4163 // INITIALIZATION
4164 // Initialize new content in the options box
4165 // TODO: move the $all to another core file since it will be used for stats as well
4166 var $all_heading = $("\n\t\t<h1 style=\"font-size:16px;\">\n\t\t\t<a id=\"lceversion\" href=\"https://github.com/co3carbonate/live-counting-extension/blob/master/README.md#readme\" target=\"_blank\">Live Counting Extension " + VERSION + "</a> \n\t\t</h1>\n\t");
4167// var $options_heading = $("<h2>Options </h2>");
4168 var $options_basic_heading = $("<h2>Basic </h2>");
4169 var $options_advanced_heading = $("<h2>Advanced </h2>");
4170 var $options_advanced2_heading = $("<h2>Advanced 2 </h2>");
4171 var $all_toggle = $("<span class=\"toggle-trigger\" style=\"font-size:15px;\">[-]</span>");
4172 var $options_toggle = $("<span class=\"toggle-trigger\">[-]</span>");
4173 var $options_basic_toggle = $("<span class=\"toggle-trigger\">[-]</span>");
4174 var $options_advanced_toggle = $("<span class=\"toggle-trigger\">[-]</span>");
4175 var $options_advanced2_toggle = $("<span class=\"toggle-trigger\">[-]</span>");
4176 var $all = $("<div id='live-counting-extension'></div>");
4177 var $options = $("<div></div>");
4178 var $options_basic = $("<div></div>");
4179 var $options_advanced = $("<div></div>");
4180 var $options_advanced2 = $("<div></div>");
4181 $all_heading.append($all_toggle);
4182 $all.append($options);
4183// $options_heading.append($options_toggle);
4184 $options_basic_heading.append($options_basic_toggle);
4185 $options_advanced_heading.append($options_advanced_toggle);
4186 $options_advanced2_heading.append($options_advanced2_toggle);
4187 $options.append($options_basic_heading, $options_basic, $options_advanced_heading, $options_advanced, $options_advanced2_heading, $options_advanced2);
4188 Elements.$options.append($all_heading, $all);
4189 var all_innerWidth = $all.innerWidth();
4190 var all_offsetLeft = $all.offset().left;
4191 // Handling toggle buttons ([-] and [+])
4192 function toggle($trigger, $change, index) {
4193 // bind click event listeners to the trigger
4194 $trigger.on('click', function () {
4195 if ($change.css('display') == 'none') {
4196 // show
4197 $trigger.html('[-]');
4198 $change.slideDown(500);
4199 Cookie.save.collapsed[index] = false;
4200 }
4201 else {
4202 // hide
4203 $trigger.html('[+]');
4204 $change.slideUp(500);
4205 Cookie.save.collapsed[index] = true;
4206 }
4207 Cookie.update();
4208 });
4209 // immediately trigger the click event if current cookie save is true
4210 if (Cookie.save.collapsed[index])
4211 $trigger.trigger('click');
4212 }
4213 // call
4214 toggle($all_toggle, $all, 0);
4215 toggle($options_toggle, $options, 1);
4216 toggle($options_basic_toggle, $options_basic, 2);
4217 toggle($options_advanced_toggle, $options_advanced, 3);
4218 toggle($options_advanced2_toggle, $options_advanced2, 4);
4219 // Styles
4220 Styles.add("\n\n\t/* Subheadings */\n\t#live-counting-extension h2 {\n\t\tcolor: #4F4F4F;\n\t\tfont-size: 14px;\n\t\tfont-weight: bold;\n\t\tmargin: 8px 0px;\n\t}\n\n\t/* Toggle triggers */\n\t/* Don't specify #live-counting-extension for this, because the first trigger is actually outside the #live-counting-extension element */\n\t\n\t.toggle-trigger {\n\t\tcursor: pointer;\n\t\tcolor: #656565;\n\t\tfont-weight: normal;\n\t}\n\n\n\t/* Labels */\n\t#live-counting-extension label {\n\t\tdisplay: block;\n\t\tmargin-bottom: 10px;\n\t\tline-height: 160%;\n\t}\n\t\n\t");
4221 // METHODS
4222 // Add a checkbox option
4223 // Returns the newly created checkbox
4224 function addCheckbox(properties) {
4225 // Handling properties
4226 if (!properties.hasOwnProperty('section'))
4227 properties.section = 'Basic';
4228 if (!properties.hasOwnProperty('onchange'))
4229 properties.onchange = null;
4230 if (!properties.hasOwnProperty('default'))
4231 properties["default"] = false;
4232 if (!properties.hasOwnProperty('help'))
4233 properties.help = '';
4234 var label = properties["label"], section = properties["section"], onchange = properties["onchange"], defaultChecked = properties["default"], help = properties["help"];
4235 // Default value handling (cookie)
4236 var checked = defaultChecked;
4237 if (Cookie.saveDefaultOptions && !Cookie.save.options.hasOwnProperty(label)) {
4238 Cookie.save.options[label] = checked;
4239 Cookie.update();
4240 }
4241 else
4242 checked = Cookie.save.options[label];
4243 // Create label and checkbox
4244 var $elem = $("<input type=\"checkbox\"" + (checked ? ' checked="true"' : '') + "/>");
4245 // Add option
4246 var $options_section = $options_basic;
4247 if (section == 'Basic')
4248 $options_section = $options_basic;
4249 else if (section == 'Advanced')
4250 $options_section = $options_advanced;
4251 else if (section == 'Advanced 2')
4252 $options_section = $options_advanced2;
4253 $options_section.append($("<label>" + label + "</label>")
4254 .attr('title', help)
4255 .prepend($elem));
4256 // Handle onchange
4257 $elem.on('change', function () {
4258 Cookie.save.options[label] = $elem.prop('checked');
4259 Cookie.update();
4260 if (onchange != null)
4261 onchange.call($elem);
4262 });
4263 // Trigger change event if the value != default
4264 if (defaultChecked != checked)
4265 $elem.trigger('change');
4266 return $elem;
4267 }
4268 Options.addCheckbox = addCheckbox;
4269 // Add select option
4270 // Returns the newly created select
4271 function addSelect(properties) {
4272 // Handling properties
4273 if (!properties.hasOwnProperty('section'))
4274 properties.section = 'Basic';
4275 if (!properties.hasOwnProperty('onchange'))
4276 properties.onchange = null;
4277 if (!properties.hasOwnProperty('default'))
4278 properties["default"] = 0;
4279 if (!properties.hasOwnProperty('help'))
4280 properties.help = '';
4281 var label = properties["label"], options = properties["options"], section = properties["section"], onchange = properties["onchange"], selectedIndex = properties["default"], help = properties["help"];
4282 // Default value handling (cookie)
4283 var defaultVal = options[selectedIndex];
4284 var selectedVal = defaultVal;
4285 if (Cookie.saveDefaultOptions && !Cookie.save.options.hasOwnProperty(label)) {
4286 Cookie.save.options[label] = selectedVal;
4287 Cookie.update();
4288 }
4289 else
4290 selectedVal = Cookie.save.options[label];
4291 // Create label and select
4292 var $options_section;
4293 var $elem = $("<select></select>");
4294 if (section == 'Basic')
4295 $options_section = $options_basic;
4296 else if (section == 'Advanced')
4297 $options_section = $options_advanced;
4298 else if (section == 'Advanced 2')
4299 $options_section = $options_advanced2;
4300 $options_section.append($("<label>" + label + ": </label>")
4301 .attr('title', help)
4302 .append($elem));
4303 // Configure the max-width of the select to ensure that it doesn't end up getting wrapped
4304 // onto the next line
4305 $elem.css('max-width', all_innerWidth - ($elem.offset().left - all_offsetLeft) + 'px');
4306 // Set options of select
4307 var elem_contents = '';
4308 for (var i = 0; i < options.length; i++) {
4309 elem_contents +=
4310 "<option value=\"" + options[i] + "\"" + ((options[i] == selectedVal) ? ' selected="true"' : '') + ">" + options[i] + "</option>";
4311 }
4312 $elem.html(elem_contents);
4313 // Handle onchange
4314 $elem.on('change', function () {
4315 Cookie.save.options[label] = $elem.val();
4316 Cookie.update();
4317 if (onchange != null)
4318 onchange.call($elem);
4319 });
4320 // Trigger change event if the value != default
4321 if (defaultVal != selectedVal)
4322 $elem.trigger('change');
4323 return $elem;
4324 }
4325 Options.addSelect = addSelect;
4326 // WINDOW SIZE
4327 // If sidebar turns into '[+] more about this live thread',
4328 // (or window width < 700px according to CSS),
4329 // move options to inside .sidebar
4330 // New section in the sidebar for options
4331 var $section = $("<section>\n\t\t<h2>options</h2>\n\t\t<div class='md'></div>\n\t</section>");
4332 var $section_md = $section.children('.md');
4333 $section.css('display', 'none').css('margin-top', '20px');
4334 Elements.$sidebar.children('.sidebar-expand').after($section);
4335 // Window resized
4336 $(window).on('load resize', function () {
4337 if (window.innerWidth <= 700) {
4338 // add the options to '[+] more about this live thread'
4339 if ($section.css('display') == 'none') {
4340 $section.css('display', '');
4341 $all.detach().appendTo($section_md);
4342 }
4343 }
4344 else {
4345 // remove the options from '[+] more about this live thread'
4346 if ($section.css('display') != 'none') {
4347 $section.css('display', 'none');
4348 $all.detach().insertAfter($all_heading);
4349 }
4350 }
4351 });
4352})(Options || (Options = {}));
4353;
4354/////////////////////////
4355// april2020Enable.ts //
4356/////////////////////////
4357var april2020Enable;
4358(function (april2020Enable) {
4359 // INITIALIZATION
4360 // Options
4361 var enabled2020 = true;
4362 Options.addCheckbox({
4363 label: 'APRIL FOOLS 2020',
4364 "default": true,
4365 section: 'Advanced 2',
4366 help: 'Enables the april fools.',
4367 onchange: function () {
4368 enabled2020 = this.prop('checked');
4369april20202 = enabled2020;
4370 }
4371 });
4372
4373})(april2020Enable || (april2020Enable = {}));
4374/////////////////////////
4375// aprilboolsEnable.ts //
4376/////////////////////////
4377var aprilboolsEnable;
4378(function (aprilboolsEnable) {
4379 // INITIALIZATION
4380 // Options
4381 var enableda = false;
4382 Options.addCheckbox({
4383 label: 'APRIL FOOLS 2019',
4384 "default": false,
4385 section: 'Advanced 2',
4386 help: 'Enables the april fools.',
4387 onchange: function () {
4388 enableda = this.prop('checked');
4389aprilbools2 = enableda;
4390 }
4391 });
4392 // EVENTS
4393
4394//if (enableda == false) {
4395//aprilbools2 = 0;
4396//} else {
4397//aprilbools2 = '';
4398//}
4399
4400})(aprilboolsEnable || (aprilboolsEnable = {}));
4401/////////////////////////
4402// dailyHocColorNames.ts //
4403/////////////////////////
4404var dailyHocColorNamesEnable;
4405(function (dailyHocColorNamesEnable) {
4406 // INITIALIZATION
4407 // Options
4408 var enabledcoloryo = true;
4409 Options.addCheckbox({
4410 label: 'ENABLE DAILY HOC COLORED NAMES',
4411 "default": true,
4412 section: 'Advanced 2',
4413 help: 'Enables the daily HoC colored usernames.',
4414 onchange: function () {
4415 enabledcoloryo = this.prop('checked');
4416dailyHocColorNamesEnable2 = enabledcoloryo;
4417 }
4418 });
4419
4420})(dailyHocColorNamesEnable || (dailyHocColorNamesEnable = {}));
4421
4422////////////////////// APRIL FOOLS 2020 april2020
4423
4424if (april20202 == true && window.location.href.toLowerCase().indexOf("graphite") > -1 && window.location.href.toLowerCase().indexOf("ta535s1hq2je") > -1) {
4425 april2020 = 16;
4426} else if (april20202 == true && window.location.href.toLowerCase().indexOf("riverbot") > -1 && window.location.href.toLowerCase().indexOf("ta535s1hq2je") > -1) {
4427 april2020 = 16;
4428} else if (april20202 == true && window.location.href.toLowerCase().indexOf("ta535s1hq2je") > -1) {
4429
4430foolsprob2020 = Math.floor(Math.random() * 100) + 1;
4431if (0 < foolsprob2020 && foolsprob2020 < 10) {
4432april2020 = 1;
4433foolsprob2020t = ' (9%)';
4434} else if (9 < foolsprob2020 && foolsprob2020 < 19) {
4435april2020 = 2;
4436foolsprob2020t = ' (9%)';
4437} else if (18 < foolsprob2020 && foolsprob2020 < 28) {
4438april2020 = 3;
4439foolsprob2020t = ' (9%)';
4440} else if (27 < foolsprob2020 && foolsprob2020 < 37) {
4441april2020 = 4;
4442foolsprob2020t = ' (9%)';
4443} else if (36 < foolsprob2020 && foolsprob2020 < 41) {
4444april2020 = 5;
4445foolsprob2020t = ' (4%)';
4446} else if (40 < foolsprob2020 && foolsprob2020 < 50) {
4447april2020 = 6;
4448foolsprob2020t = ' (9%) (nice)';
4449} else if (49 < foolsprob2020 && foolsprob2020 < 54) {
4450april2020 = 7;
4451foolsprob2020t = ' (4%)';
4452} else if (53 < foolsprob2020 && foolsprob2020 < 63) {
4453april2020 = 8;
4454foolsprob2020t = ' (9%)';
4455} else if (62 < foolsprob2020 && foolsprob2020 < 67) {
4456april2020 = 9;
4457foolsprob2020t = ' (4%)';
4458} else if (66 < foolsprob2020 && foolsprob2020 < 76) {
4459april2020 = 10;
4460foolsprob2020t = ' (9%)';
4461} else if (75 < foolsprob2020 && foolsprob2020 < 79) {
4462april2020 = 11;
4463foolsprob2020t = ' (3%)';
4464} else if (78 < foolsprob2020 && foolsprob2020 < 88) {
4465april2020 = 12;
4466foolsprob2020t = ' (9%)';
4467} else if (87 < foolsprob2020 && foolsprob2020 < 91) {
4468april2020 = 13;
4469foolsprob2020t = ' (3%)';
4470} else if (90 < foolsprob2020 && foolsprob2020 < 94) {
4471april2020 = 14;
4472foolsprob2020t = ' (3%)';
4473} else if (93 < foolsprob2020 && foolsprob2020 < 98) {
4474april2020 = 15;
4475foolsprob2020t = ' (4%)';
4476} else if (97 < foolsprob2020 && foolsprob2020 < 101) {
4477april2020 = 16;
4478foolsprob2020t = ' (3%)';
4479}
4480
4481$('#liveupdate-title').text(`[Live Counting `+april2020+foolsprob2020t+`]`);
4482
4483}
4484
4485//april2020 = 1;
4486
4487
4488/////////////////////april 2020 1
4489
4490if (april2020 == 1) {
4491
4492$(".usertext .usertext-edit textarea").css('font-family','Wingdings');
4493
4494 $( "#liveupdate-description .md" ).append('<b>Sadly this one does not work on firefox :(</b> <p id="code_input"></p>');
4495 setTimeout(function () {
4496 var resull = 'VG8gdW5sb2NrIHRoZSBzcGVjaWFsIGFjaGlldmVtZW50LCBjb3B5IHRoaXMgYW5kIHB1dCBpdCBpbiB5b3VyIHBvc3Q6IDxjb2RlPl5eXl5eXl5eXl5eXl5eXl4hbm9jaGF0IF5eXl5eXl5eXl5eXl5eXl53aW5nZGluZ3M8L2NvZGU+';
4497 document.getElementById('code_input').innerHTML = atob(resull);
4498 $('#code_input').css('background','#fffb55');
4499
4500}, 120000);
4501
4502}
4503
4504/////////////////////april 2020 1
4505
4506/////////////////////april 2020 2
4507
4508if (april2020 == 2) {
4509
4510 $( "#liveupdate-description .md" ).append('<p id="code_input"></p>');
4511 setTimeout(function () {
4512 var resull = 'VG8gdW5sb2NrIHRoZSBzcGVjaWFsIGFjaGlldmVtZW50LCBjb3B5IHRoaXMgYW5kIHB1dCBpdCBpbiB5b3VyIHBvc3Q6IDxjb2RlPl5eXl5eXl5eXl5eXl5eXl4hbm9jaGF0IF5eXl5eXl5eXl5eXl5eXl5jcmF6eTwvY29kZT4=';
4513 document.getElementById('code_input').innerHTML = atob(resull);
4514 $('#code_input').css('background','#fffb55');
4515
4516}, 120000);
4517
4518}
4519
4520/////////////////////april 2020 2
4521
4522/////////////////////april 2020 3
4523
4524if (april2020 == 3) {
4525
4526Styles.add(`
4527#lc-body li.liveupdate * { display: contents; }
4528.liveupdate-listing li.liveupdate { display: inline-grid; }
4529`);
4530
4531 $( "#liveupdate-description .md" ).append('<p id="code_input"></p>');
4532 setTimeout(function () {
4533 var resull = 'VG8gdW5sb2NrIHRoZSBzcGVjaWFsIGFjaGlldmVtZW50LCBjb3B5IHRoaXMgYW5kIHB1dCBpdCBpbiB5b3VyIHBvc3Q6IDxjb2RlPl5eXl5eXl5eXl5eXl5eXl4hbm9jaGF0IF5eXl5eXl5eXl5eXl5eXl5ncmlkPC9jb2RlPg==';
4534 document.getElementById('code_input').innerHTML = atob(resull);
4535 $('#code_input').css('background','#fffb55');
4536
4537}, 120000);
4538
4539}
4540
4541/////////////////////april 2020 3
4542
4543/////////////////////april 2020 4
4544
4545if (april2020 == 4) {
4546
4547var bruhcounter = 0;
4548
4549 $( "#liveupdate-description .md" ).append('<p id="code_input"></p>');
4550
4551 $('#liveupdate-description .md p').append(`
4552<div id='bruh1' class='unmomento'>Get back up here</div>
4553<div id='bruh2' class='unmomento'>What are you doing</div>
4554<div id='bruh3' class='unmomento'>You must pay $5.99 to unlock scrolling features</div>
4555<div id='bruh4' class='unmomento'>Bro thats kinda cringe stop scrolling</div>
4556<div id='bruh5' class='unmomento'>Stop! You violated the law. Pay the court a fine or serve your sentence.</div>
4557<div id='bruh6' class='unmomento'>New federal regulations require that we limit excessive scrolling</div>
4558<div id='bruh7' class='unmomento'>Don't leave me!</div>
4559<div id='bruh8' class='unmomento'>Why are you running?</div>
4560<div id='bruh9' class='unmomento'>MRW you keep trying to scroll: https://www.youtube.com/watch?v=oHg5SJYRHA0</div>
4561<div id='bruh10' class='unmomento'>ERROR: Scrolling has been postponed until a later date. Please check back later.</div>
4562<div id='bruh11' class='unmomento'>? Go on. Keep trying to scroll down. ?</div>
4563<div id='bruh12' class='unmomento'>Is this what Scroll Lock does? Who knows?</div>
4564<div id='bruh13' class='unmomento'>Under maintenance. Try again later.</div>
4565<div id='bruh14' class='unmomento'>Trust me, you don't wanna see what's down there anyway.</div>
4566<div id='bruh15' class='unmomento'>Bruh Sound Effect #2</div>
4567<div id='bruh16' class='unmomento'>I'm gonna have to stop you right there.</div>
4568<div id='bruh17' class='unmomento'>Scroll down again. Scroll down again. I dare you. I double dare you, ...</div>
4569<div id='bruh18' class='unmomento'>You could not scroll down. Where did that bring you? Back to me.</div>
4570<div id='bruh19' class='unmomento'>You were this close. Try again.</div>
4571<div id='bruh20' class='unmomento'>You must construct additional pylons!</div>
4572`);
4573
4574 Styles.add(`
4575.unmomento {background:black; color:white; padding-top:5px; padding-bottom:5px; display:none; text-align: center;}
4576.stop-scrolling { height: 100%; overflow: hidden; }
4577`);
4578
4579 var timeoutbruh;
4580
4581document.body.onscroll = function(){
4582 clearTimeout(timeoutbruh);
4583 timeoutbruh = setTimeout(function() {
4584 var s_h = window.pageYOffset;
4585 if(s_h > 299) {
4586 bruhcounter++;
4587 if(bruhcounter == 5) {
4588 var resull = 'VG8gdW5sb2NrIHRoZSBzcGVjaWFsIGFjaGlldmVtZW50LCBjb3B5IHRoaXMgYW5kIHB1dCBpdCBpbiB5b3VyIHBvc3Q6IDxjb2RlPl5eXl5eXl5eXl5eXl5eXl4hbm9jaGF0IF5eXl5eXl5eXl5eXl5eXl5zY3JvbGw8L2NvZGU+';
4589 document.getElementById('code_input').innerHTML = atob(resull);
4590 $('#code_input').css('background','#fffb55');
4591 }
4592 var randbruh = Math.floor(Math.random() * 20) + 1;
4593 $("html, body").animate({ scrollTop: 0 }, 1);
4594 $('body').addClass('stop-scrolling');
4595 $("#bruh"+randbruh).css('display','block').css('opacity','1');
4596 $("#bruh"+randbruh).animate({ opacity: 0 }, 3000);
4597 setTimeout(function() {
4598 $('body').removeClass('stop-scrolling')
4599 $("#bruh"+randbruh).css('display','none');
4600 }, 3000);
4601 }
4602
4603
4604 }, 50);
4605};
4606
4607}
4608
4609/////////////////////april 2020 4
4610
4611
4612
4613
4614/////////////////////april 2020 5
4615
4616if (april2020 == 5) {
4617
4618 $('#liveupdate-description').append(`
4619<div id='timetravel' class='timetraveling'>go back in time!</div>
4620`);
4621 $('#timetravel').css('cursor','pointer').css('background','black').css('color','white');
4622$('#timetravel').click(function(){
4623 $('#timetravel').css('display','none');
4624 $("html").prepend("<body2 id=abcd></body2>");
4625$('body').fadeOut(5000);
4626setTimeout(function(){
4627$('body').fadeIn(5000);
4628 },5000);
4629 setTimeout(function(){
4630 $('.viewer-count').text('114917 viewers');
4631 },5000);
4632 setTimeout(function(){
4633 $(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Whoa guys! The time traveling device worked!?</p></div><a href="/user/rideride" class="deadauthor" style="font-weight: bold; color: #069420;"> /u/rideride</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>this is fake lol</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
4634 },12000);
4635 setTimeout(function(){
4636 $(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>If my calculations are correct, we should be back in October 2018!</p></div><a href="/user/rideride" class="deadauthor" style="font-weight: bold; color: #069420;"> /u/rideride</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>this is fake lol</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
4637 },17000);
4638 setTimeout(function(){
4639 $(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>I wonder where the count is at...</p></div><a href="/user/rideride" class="deadauthor" style="font-weight: bold; color: #069420;"> /u/rideride</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>this is fake lol</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
4640 },22000);
4641 setTimeout(function(){
4642 $(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>9 999 997</p></div><a href="/user/rideride" class="deadauthor" style="color: #ffc130;"> /u/treje</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>this is fake lol</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
4643 },24000);
4644 setTimeout(function(){
4645 $(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Wait... are we about to hit 10 million?</p></div><a href="/user/rideride" class="deadauthor" style="font-weight: bold; color: #069420;"> /u/rideride</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>this is fake lol</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
4646 },28000);
4647 setTimeout(function(){
4648 $(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Wasn't there a ton of spam right before that?</p></div><a href="/user/rideride" class="deadauthor" style="font-weight: bold; color: #069420;"> /u/rideride</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>this is fake lol</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
4649 },34000);
4650 setTimeout(function(){
4651 $(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>WAIT FUCK GO BACK</p></div><a href="/user/rideride" class="deadauthor" style="font-weight: bold; color: #069420;"> /u/rideride</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>this is fake lol</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
4652 },38000);
4653
4654 setTimeout(function(){
4655var post1 = setInterval(function(){
4656$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>10000000</p></div><a href="/user/rideride" class="deadauthor" style="color: SeaGreen;"> /u/dmn002</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>this is fake lol</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
4657 },125);
4658var post2 = setInterval(function(){
4659$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>10000000 :o</p></div><a href="/user/rideride" class="deadauthor" style="color: DodgerBlue;"> /u/StanRichson</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>this is fake lol</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
4660 },923);
4661var post3 = setInterval(function(){
4662$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>10,000,000</p></div><a href="/user/rideride" class="deadauthor" style="color: Green;"> /u/nyantick</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>this is fake lol</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
4663 },1202);
4664var post4 = setInterval(function(){
4665$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>10,000,000</p></div><a href="/user/rideride" class="deadauthor" style="color: Red;"> /u/Markolie</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>this is fake lol</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
4666 },769);
4667var post5 = setInterval(function(){
4668$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>10,000,000</p></div><a href="/user/rideride" class="deadauthor" style="color: Firebrick;"> /u/Zaxaramas</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>this is fake lol</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
4669 },695);
4670var post6 = setInterval(function(){
4671$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>10,000,000</p></div><a href="/user/rideride" class="deadauthor" style="color: SpringGreen;"> /u/MrPotaitoh</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>this is fake lol</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
4672 },1031);
4673var post7 = setInterval(function(){
4674$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>10,000,000</p></div><a href="/user/rideride" class="deadauthor" style="color: Chocolate;"> /u/GusBus135</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>this is fake lol</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
4675 },1666);
4676 setTimeout(function(){
4677 $('#liveupdate-description').append(`
4678<div id='timetravel2' class='timetraveling2'>GO BACK</div>
4679`);
4680 $('#timetravel2').css('cursor','pointer').css('background','black').css('color','white');
4681
4682$('#timetravel2').click(function(){
4683 setTimeout(function(){
4684 clearInterval(post1);
4685 clearInterval(post2);
4686 clearInterval(post3);
4687 clearInterval(post4);
4688 clearInterval(post5);
4689 clearInterval(post6);
4690 clearInterval(post7);
4691 },5000);
4692 $('#timetravel2').css('display','none');
4693 $("html").prepend("<body2 id=abcd></body2>");
4694$('body').fadeOut(5000);
4695setTimeout(function(){
4696$('body').fadeIn(5000);
4697 },5000);
4698 setTimeout(function(){
4699 $('.viewer-count').text('8 viewers');
4700 },5000);
4701 setTimeout(function(){
4702 $(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Welp I hope you learned an important lesson here. Never time travel. <span class="md-spoiler-text">You probably should refresh the page at this point lol</span></p><p><span class="md-spoiler-text">To unlock the special achievement, copy this and put it in your post: <code>^^^^^^^^^^^^^^^^!nochat ^^^^^^^^^^^^^^^^timetravel</code></span></p></div><a href="/user/rideride" class="deadauthor" style="font-weight: bold; color: #069420;"> /u/rideride</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>this is fake lol</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
4703 },12000);
4704 });
4705},3000);
4706 },40000);
4707});
4708
4709}
4710
4711/////////////////////april 2020 5
4712
4713/////////////////////april 2020 6
4714
4715if (april2020 == 6) {
4716
4717 $( "#liveupdate-description .md" ).append('<p id="code_input"></p>');
4718 setTimeout(function () {
4719 var resull = 'VG8gdW5sb2NrIHRoZSBzcGVjaWFsIGFjaGlldmVtZW50LCBjb3B5IHRoaXMgYW5kIHB1dCBpdCBpbiB5b3VyIHBvc3Q6IDxjb2RlPl5eXl5eXl5eXl5eXl5eXl4hbm9jaGF0IF5eXl5eXl5eXl5eXl5eXl5uaWNlPC9jb2RlPg==';
4720 document.getElementById('code_input').innerHTML = atob(resull);
4721 $('#code_input').css('background','#fffb55');
4722
4723}, 120000);
4724
4725}
4726
4727/////////////////////april 2020 6
4728
4729/////////////////////april 2020 7
4730
4731if (april2020 == 7) {
4732
4733 $('.choice').text('Sponsored by RAID: SHADOW LEGENDS');
4734 $('.viewer-count').text('9 viewers playing RAID: SHADOW LEGENDS');
4735
4736 setTimeout(function(){
4737 $('#liveupdate-description .md p').append(`
4738<div id='suh3' class='dedede2'>Start with?50K silver and get a Free Epic Champion ? on day 7 of “New Player Rewards” program</div>
4739`);
4740 },9000);
4741 setTimeout(function(){
4742 $('#liveupdate-description .md p').append(`
4743<div id='suh1' class='dedede'>? BREAKING NEWS ?</div>
4744`);
4745 },300000);
4746 setTimeout(function(){
4747 $('#liveupdate-description .md p').append(`
4748<div id='suh2' class='dedede'>https://pbs.twimg.com/media/ELiIqRfWoAIq71A.jpg</div>
4749`);
4750 },306000);
4751 $( "#liveupdate-description .md" ).append('<p id="code_input"></p>');
4752 setTimeout(function () {
4753 var resull = 'VG8gdW5sb2NrIHRoZSBzcGVjaWFsIGFjaGlldmVtZW50LCBjb3B5IHRoaXMgYW5kIHB1dCBpdCBpbiB5b3VyIHBvc3Q6IDxjb2RlPl5eXl5eXl5eXl5eXl5eXl4hbm9jaGF0IF5eXl5eXl5eXl5eXl5eXl5yYWlkc2hhZG93bGVnZW5kczwvY29kZT4=';
4754 document.getElementById('code_input').innerHTML = atob(resull);
4755 $('#code_input').css('background','#fffb55');
4756
4757}, 320000);
4758
4759 Styles.add(`
4760.dedede {background:black; color:white; padding-top:5px; padding-bottom:5px; text-align: center;}
4761.dedede2 {background:black; color:white; padding-top:5px; padding-bottom:5px; text-align: center;position:fixed;top:50px;left: 400px;z-index: 999999999999999;}
4762`);
4763
4764 Styles.add(`
4765.content {
4766 background-image: url(https://raidshadowlegends.pro/wp-content/uploads/2019/11/Raid-Shadow-Legends-logo.png);
4767}
4768
4769#header-img.default-header {
4770 text-indent: -9999px;
4771 background-image: url(https://media.pocketgamer.biz/2019/3/96424/plarium-raidicon-r225x.jpg);
4772 background-repeat: no-repeat;
4773 height: 160px;
4774 width: 180px;
4775 display: inline-block;
4776 vertical-align: bottom;
4777 margin-bottom: 3px;
4778background-position: 0;
4779}
4780
4781`);
4782
4783}
4784
4785/////////////////////april 2020 7
4786
4787/////////////////////april 2020 8
4788
4789if (april2020 == 8) {
4790
4791 $( "#liveupdate-description .md" ).append('<p id="code_input"></p>');
4792 setTimeout(function () {
4793 var resull = 'VG8gdW5sb2NrIHRoZSBzcGVjaWFsIGFjaGlldmVtZW50LCBjb3B5IHRoaXMgYW5kIHB1dCBpdCBpbiB5b3VyIHBvc3Q6IDxjb2RlPl5eXl5eXl5eXl5eXl5eXl4hbm9jaGF0IF5eXl5eXl5eXl5eXl5eXl5leWVzPC9jb2RlPg==';
4794 document.getElementById('code_input').innerHTML = atob(resull);
4795 $('#code_input').css('background','#fffb55');
4796
4797}, 120000);
4798
4799$('#liveupdate-description').append(`<section class="move-area"> <div class='container'> <div class='eye'></div> <div class='eye'></div> <span id='eyeshov'>Don't mind me...</span> </div> </section>`);
4800 Styles.add(`
4801.container {
4802 width: 100%;
4803}
4804.eye {
4805 position: relative;
4806 display: inline-block;
4807 border-radius: 50%;
4808 height: 30px;
4809 width: 30px;
4810 background: #CCC;
4811}
4812.eye:after { /*pupil*/
4813 position: absolute;
4814 bottom: 17px;
4815 right: 10px;
4816 width: 10px;
4817 height: 10px;
4818 background: #000;
4819 border-radius: 50%;
4820 content: " ";
4821}
4822`);
4823 $("body").mousemove(function(event) {
4824 var eye = $(".eye");
4825 var x = (eye.offset().left) + (eye.width() / 2);
4826 var y = (eye.offset().top) + (eye.height() / 2);
4827 var rad = Math.atan2(event.pageX - x, event.pageY - y);
4828 var rot = (rad * (180 / Math.PI) * -1) + 180;
4829 eye.css({
4830 '-webkit-transform': 'rotate(' + rot + 'deg)',
4831 '-moz-transform': 'rotate(' + rot + 'deg)',
4832 '-ms-transform': 'rotate(' + rot + 'deg)',
4833 'transform': 'rotate(' + rot + 'deg)'
4834 });
4835});
4836 $( '#eyeshov' ).css('opacity','0');
4837 $( ".container" ).hover(
4838 function() {
4839 $( '#eyeshov' ).css('opacity','1');
4840 }, function() {
4841 $( '#eyeshov' ).css('opacity','0');
4842 }
4843);
4844
4845}
4846
4847/////////////////////april 2020 8
4848
4849
4850/////////////////////april 2020 9
4851
4852if (april2020 == 9) {
4853
4854 $( "#liveupdate-description .md" ).append('<p id="code_input"></p>');
4855 setTimeout(function () {
4856 var resull = 'VG8gdW5sb2NrIHRoZSBzcGVjaWFsIGFjaGlldmVtZW50LCBjb3B5IHRoaXMgYW5kIHB1dCBpdCBpbiB5b3VyIHBvc3Q6IDxjb2RlPl5eXl5eXl5eXl5eXl5eXl4hbm9jaGF0IF5eXl5eXl5eXl5eXl5eXl5qYXdzPC9jb2RlPg==';
4857 document.getElementById('code_input').innerHTML = atob(resull);
4858 $('#code_input').css('background','#fffb55');
4859
4860}, 140000);
4861$("body").prepend('<div id="blocc"></div>');
4862$('#blocc').css('background','white').css('height','100%').css('width','100%').css('position','absolute').css('z-index','999999999999999999')
4863$('#blocc').click(function(){
4864$('#blocc').css('display','none');
4865$("body").css('transform','scale(0.01)');
4866 $('#liveupdate-header').prepend("<iframe class=embed-responsive-item id=jaws allow=autoplay type=text/html width=420 height=345 src=https://www.youtube.com/embed/1kbvYjuwiMQ?&autoplay=1&rel=0&showinfo=0&color=white&iv_load_policy=3></iframe>");
4867$( '#jaws' ).css('display', 'none');
4868 // $("body").animate({ transform: "scale(1)" }, 3000);
4869 Styles.add(`
4870@keyframes scl {
4871 0% {
4872 transform: scale(0.0);
4873 }
4874 100% {
4875 transform: scale(1.0);
4876 }
4877}
4878
4879#jumpToContent {
4880 display: none;
4881}
4882
4883body {
4884height: 100%;
4885width: 100%;
4886 animation: scl 132s ease-in-out normal forwards;
4887 -webkit-animation: scl 132s ease-in-out normal forwards;
4888 }
4889`);
4890});
4891
4892}
4893
4894/////////////////////april 2020 9
4895
4896/////////////////////april 2020 10
4897
4898if (april2020 == 10) {
4899
4900 $( "#liveupdate-description .md" ).append('<p id="code_input"></p>');
4901 setTimeout(function () {
4902 var resull = 'VG8gdW5sb2NrIHRoZSBzcGVjaWFsIGFjaGlldmVtZW50LCBjb3B5IHRoaXMgYW5kIHB1dCBpdCBpbiB5b3VyIHBvc3Q6IDxjb2RlPl5eXl5eXl5eXl5eXl5eXl4hbm9jaGF0IF5eXl5eXl5eXl5eXl5eXl5uYW1lczwvY29kZT4=';
4903 document.getElementById('code_input').innerHTML = atob(resull);
4904 $('#code_input').css('background','#fffb55');
4905
4906}, 120000);
4907
4908}
4909
4910/////////////////////april 2020 10
4911
4912/////////////////////april 2020 11
4913
4914if (april2020 == 11) {
4915
4916 $( "#liveupdate-description .md" ).append('<p id="code_input"></p>');
4917 setTimeout(function () {
4918 var resull = 'VG8gdW5sb2NrIHRoZSBzcGVjaWFsIGFjaGlldmVtZW50LCB5b3UgbXVzdCBiZWF0IHRoZSBwb25nIGdhbWUuIE9uY2UgeW91IHdpbiwgYSBzY3JlZW4gd2lsbCBwb3AgdXAgc2F5aW5nIHRoYXQgeW91IHdpbiwgZm9sbG93ZWQgYnkgYSByYW5kb20gd29yZC4gUHV0IHRoZSByYW5kb20gd29yZCBhdCB0aGUgZW5kIG9mIHRoaXMgdG8gdW5sb2NrIHRoZSBhY2hpZXZlbWVudDogPGNvZGU+Xl5eXl5eXl5eXl5eXl5eXiFub2NoYXQgXl5eXl5eXl5eXl5eXl5eXlBMQUNFSE9MREVSPC9jb2RlPg==';
4919 document.getElementById('code_input').innerHTML = atob(resull);
4920 $('#code_input').css('background','#fffb55');
4921
4922}, 1000);
4923
4924$( ".viewer-count" ).parent().html(`<canvas id="canvas" style="background-color:#1b1b1b"></canvas>`);
4925 // $("body").animate({ transform: "scale(1)" }, 3000);
4926// Styles.add(`
4927//`);
4928
4929var canvas = document.getElementById('canvas');
4930var ctx = canvas.getContext('2d');
4931
4932canvas.width = 470;
4933canvas.height = 200;
4934
4935var score1 = 0;
4936var score2 = 0;
4937
4938var keys = {};
4939var gameState = 0; // 0: initial, 1: running, 2: idle, 3: win, 4:over
4940
4941
4942document.addEventListener('keydown', function (e) {
4943 // $("document").keydown(function(e) {
4944 // document.querySelector("canvas").addEventListener('keydown', function (e) {
4945 if(gameState == 0){
4946 if(38 == e.keyCode)
4947 gameState = 1;
4948 }
4949
4950 if(gameState == 3 || gameState == 4){
4951 if(38 == e.keyCode){
4952 init();
4953 gameState = 1;
4954 }
4955 }
4956 if(38 == e.keyCode){
4957 e.preventDefault();
4958 }
4959 if(40 == e.keyCode){
4960 e.preventDefault();
4961 }
4962 keys[e.keyCode] = true;
4963 // e.preventDefault();
4964});
4965
4966document.addEventListener('keyup', function (e) {
4967 delete keys[e.keyCode];
4968});
4969
4970function input() {
4971
4972 if (38 in keys) { //If the up arrow key is pressed
4973 if (player1.y - player1.gravity > 0) {
4974 player1.y -= player1.gravity;
4975 }
4976 } else if (40 in keys) { //If the down arrow key is pressed
4977 if (player1.y + player1.height + player2.gravity < canvas.height) {
4978 player1.y += player1.gravity;
4979 }
4980 }
4981
4982}
4983
4984function movePlayer2(){
4985
4986 if(theBall.y < player2.y){
4987 if (player2.y - player2.gravity > 0) {
4988 player2.y -= player2.gravity;
4989 }
4990 }
4991 else{
4992 if (player2.y + player2.height + player2.gravity < canvas.height) {
4993 player2.y += player2.gravity;
4994 }
4995 }
4996}
4997
4998function Box(options){ /*Constructor of Box object*/
4999 this.x = options.x || 10;
5000 this.y = options.y || 10;
5001 this.width = options.width || 40;
5002 this.height = options.height || 50;
5003 this.color = options.color || '#FFFFFF';
5004 this.speed = options.speed || 3;
5005 this.gravity = options.gravity || 3;
5006
5007}
5008
5009var player1 = new Box({ /*player paddle*/
5010 x: 20,
5011 y: canvas.height/2-40,
5012 width: 6,
5013 height: 40,
5014 color: '#F00',
5015 gravity: 4
5016});
5017
5018var player2 = new Box({ /*player paddle*/
5019 x: canvas.width-20-12,
5020 y: canvas.height/2-40,
5021 width: 6,
5022 height: 40,
5023 color: '#0F0',
5024 gravity: 3.5
5025});
5026
5027var midLine = new Box({ /*The net*/
5028 x: (canvas.width/2)-2.5,
5029 y: 20,
5030 width: 5,
5031 height: canvas.height-40,
5032 color: '#FFFFFF'
5033});
5034
5035var theBall = new Box({
5036 x: (canvas.width / 2),
5037 y: (canvas.height / 2),
5038 width: 6,
5039 height: 6,
5040 color: '#f5ff00',
5041 speed: 1.5,
5042 gravity: 2
5043});
5044
5045function createNewBall(){
5046
5047 theBall.x = (canvas.width / 2 - 6);
5048 theBall.y = (canvas.height / 2);
5049 theBall.width = 6;
5050 theBall.height = 6;
5051 theBall.color = '#f5ff00';
5052
5053 var s = Math.floor((Math.random() * 1) ) * 2;
5054 var g = Math.floor((Math.random() * 2) ) * 2;
5055 s = (s == 0 ? -3 : s);
5056 g = (g == 0 ? -3 : g);
5057 theBall.speed = s;
5058 theBall.gravity = g;
5059
5060}
5061
5062function ballBounce() {
5063
5064 // platform collision
5065 if (((theBall.y+theBall.gravity) <= 0) || ((theBall.y+theBall.gravity+theBall.height) >= canvas.height)){
5066 theBall.gravity = (theBall.gravity) * (-1); /*If it does, change the gravity value to move in the opposite direction*/
5067 theBall.y += theBall.gravity; // Move theBall
5068 theBall.x += theBall.speed;
5069 } else { // If the ball doesn’t hit the top or bottom, then move theBall as normal
5070 theBall.x += theBall.speed;
5071 theBall.y += theBall.gravity
5072 }
5073
5074 // player1 collision
5075
5076 if (theBall.x <= player1.x + player1.width && theBall.x + theBall.width >= player1.x ) {
5077 if (theBall.y + theBall.height >= player1.y && theBall.y <= player1.y + player1.height) {
5078 theBall.x = (player1.x + theBall.width);
5079 theBall.speed *= (-1);
5080 }
5081
5082 }
5083
5084 if (theBall.x + theBall.width >= player2.x && theBall.x + theBall.width <= player2.x + player2.width) {
5085 if (theBall.y + theBall.height >= player2.y && theBall.y <= player2.y + player2.height) {
5086 theBall.x = (player2.x - theBall.width);
5087 theBall.speed *= (-1);
5088 }
5089
5090 }
5091
5092
5093 if (theBall.x + theBall.width < player1.x - 5) {
5094 score2 += 1;
5095 gameState = 2;
5096 } else if (theBall.x > player2.x + player2.width + 5) {
5097 score1 += 1;
5098 gameState = 2;
5099 } else {
5100 theBall.x += theBall.speed;
5101 theBall.y += theBall.gravity;
5102 }
5103 if(gameState==2){
5104 createNewBall();
5105 }
5106 if(score2 >= 5){
5107 gameState = 3;
5108 }
5109 if(score1 >= 5){
5110 gameState = 4;
5111 }
5112 draw();
5113}
5114
5115
5116
5117function drawBox(box) { /* draw each box*/
5118 ctx.fillStyle = box.color;
5119 ctx.fillRect(box.x, box.y, box.width, box.height);
5120}
5121
5122function displayScore1() { /* play1 score*/
5123 ctx.font = "20px Arial";
5124 ctx.fillStyle = "rgb(255,0,0)";
5125 var str1 = score1;
5126 ctx.fillText(str1, (canvas.width/2) - 50, 30);
5127}
5128
5129function displayScore2() { /*player2 score*/
5130 ctx.font = "20px Arial";
5131 ctx.fillStyle = "rgb(0,255,0)";
5132 var str2 = score2;
5133 ctx.fillText(str2, (canvas.width / 2) + 50, 30);
5134}
5135
5136
5137function draw() {
5138 ctx.clearRect(0, 0, canvas.width, canvas.height);
5139
5140 displayScore1();
5141 displayScore2();
5142 drawBox(player1);
5143 drawBox(player2);
5144 drawBox(midLine);
5145
5146
5147 if(gameState==0){
5148
5149 drawStartMenu();
5150 }
5151 if(gameState==1 || gameState==2){ // running
5152
5153 drawBox(theBall);
5154 }
5155 if(gameState==3){
5156
5157 drawOverMenu();
5158 }
5159 if(gameState==4){
5160 drawWinMenu();
5161 }
5162
5163}
5164
5165function drawStartMenu(){
5166 ctx.font="15px monospace";
5167 ctx.fillStyle = "#ffffff";
5168 ctx.textAlign = "center";
5169 ctx.clearRect(canvas.width/2-10,canvas.height/2-40, 20,60);
5170 ctx.fillText("Press the up key to start", canvas.width/2, canvas.height/2);
5171}
5172
5173function drawOverMenu(){
5174 ctx.font="15px monospace";
5175 ctx.fillStyle = "#ffffff";
5176 ctx.textAlign = "center";
5177 ctx.fillText("Game Over", canvas.width/2, canvas.height/2);
5178 ctx.fillText("Press the up key to restart", canvas.width/2, canvas.height/2 + 40);
5179
5180}
5181
5182function drawWinMenu(){
5183 ctx.font="15px monospace";
5184 ctx.fillStyle = "#ffffff";
5185 ctx.textAlign = "center";
5186 ctx.fillText("You Win. FISH", canvas.width/2, canvas.height/2);
5187 ctx.fillText("Press the up key to restart", canvas.width/2, canvas.height/2 + 40);
5188}
5189
5190
5191function sleep(milliseconds) {
5192 var start = new Date().getTime();
5193 for (var i = 0; i < 1e7; i++) {
5194 if ((new Date().getTime() - start) > milliseconds){
5195 break;
5196 }
5197 }
5198}
5199
5200function resetPlayers(){
5201 player1.x = 20;
5202 player1.y = canvas.height/2-40;
5203 player2.x = canvas.width-20-12;
5204 player2.y = canvas.height/2-40;
5205}
5206function init(){
5207 score1 = 0;
5208 score2 = 0;
5209 resetPlayers();
5210 createNewBall();
5211}
5212
5213function loop() { /*The loop function will continuously call the draw function and update our screen*/
5214 if(gameState == 0){
5215 init();
5216 }
5217
5218 draw();
5219 if(gameState == 1){
5220 ballBounce(); // collision detection
5221 input(player1);
5222 movePlayer2();
5223
5224 }
5225 else if(gameState == 2){
5226 sleep(1000);
5227 gameState = 1;
5228 }
5229
5230 requestAnimationFrame(loop);
5231}
5232
5233loop();
5234
5235
5236}
5237
5238/////////////////////april 2020 11
5239
5240
5241/////////////////////april 2020 12
5242
5243if (april2020 == 12) {
5244//hsl(180, 100%, 92%);
5245 $( "#liveupdate-description .md" ).append('<p id="code_input"></p>');
5246 setTimeout(function () {
5247 var resull = 'VG8gdW5sb2NrIHRoZSBzcGVjaWFsIGFjaGlldmVtZW50LCBjb3B5IHRoaXMgYW5kIHB1dCBpdCBpbiB5b3VyIHBvc3Q6IDxjb2RlPl5eXl5eXl5eXl5eXl5eXl4hbm9jaGF0IF5eXl5eXl5eXl5eXl5eXl5iYWNrZ3JvdW5kPC9jb2RlPg==';
5248 document.getElementById('code_input').innerHTML = atob(resull);
5249 $('#code_input').css('background','#fffb55');
5250
5251}, 120000);
5252
5253$(document).mousemove(function(getCurrentPos){
5254 var xCord = getCurrentPos.clientX;
5255 var yCord = getCurrentPos.clientY;
5256
5257 var xPercent = xCord/window.innerWidth;
5258 var yPercent = yCord/window.innerHeight;
5259
5260 var backcolor = xPercent*180 + yPercent*180
5261
5262 $( "#liveupdate-statusbar" ).css('background-color','hsl('+backcolor+', 100%, 92%)')
5263});
5264}
5265
5266/////////////////////april 2020 12
5267
5268/////////////////////april 2020 13
5269
5270if (april2020 == 13) {
5271//hsl(180, 100%, 92%);
5272
5273 $( "#liveupdate-description .md" ).append('<p id="code_input"></p>');
5274 setTimeout(function () {
5275 var resull = 'VG8gdW5sb2NrIHRoZSBzcGVjaWFsIGFjaGlldmVtZW50LCBjb3B5IHRoaXMgYW5kIHB1dCBpdCBpbiB5b3VyIHBvc3Q6IDxjb2RlPl5eXl5eXl5eXl5eXl5eXl4hbm9jaGF0IF5eXl5eXl5eXl5eXl5eXl5yZXZlcnNlPC9jb2RlPg==';
5276 document.getElementById('code_input').innerHTML = atob(resull);
5277 $('#code_input').css('background','#fffb55');
5278
5279}, 120000);
5280
5281 var thehtml = $( ".liveupdate-listing" ).html();
5282 $( ".main-content" ).prepend('<ol class="bruuuh" id="fakeyfake">'+thehtml+'</ol>');
5283// $('.liveupdate-listing').on('DOMNodeInserted', function (e) {
5284
5285// var thehtml = $( ".liveupdate-listing" ).html();
5286 // $( ".bruuuh" ).html(thehtml);
5287 // });
5288
5289 var target = document.querySelector('.liveupdate-listing');
5290
5291var observer = new MutationObserver(function(mutations) {
5292
5293 mutations.forEach(function(mutation) {
5294 var thehtml = $( ".liveupdate-listing" ).html();
5295 $( ".bruuuh" ).html(thehtml);
5296
5297 });
5298});
5299
5300var config = {
5301 childList: true
5302};
5303
5304observer.observe(target, config);
5305
5306// otherwise
5307observer.disconnect();
5308observer.observe(target, config);
5309
5310 $( ".bruuuh" ).scrollTop = $( ".bruuuh" ).scrollHeight;
5311
5312 Styles.add(`
5313.bruuuh {display: flex;
5314 flex-direction: column-reverse;
5315position: absolute;
5316 margin-bottom: 200px;
5317overflow: hidden;
5318}
5319
5320#new-update-form .usertext .usertext-edit textarea {
5321 position: fixed;
5322bottom: 30px;
5323 max-width: 600px;
5324}
5325
5326.liveupdate-listing {display: none;
5327}
5328
5329.save-button {
5330 position: fixed;
5331 left: 890px;
5332 bottom: 30px;
5333}
5334`);
5335}
5336
5337/////////////////////april 2020 13
5338
5339
5340/////////////////////april 2020 14
5341
5342if (april2020 == 14) {
5343
5344 $( "#liveupdate-resources" ).prepend('<p id="code_input"></p>');
5345 var resull = 'VG8gdW5sb2NrIHRoZSBzcGVjaWFsIGFjaGlldmVtZW50LCBjb3B5IHRoaXMgYW5kIHB1dCBpdCBpbiB5b3VyIHBvc3Q6IDxjb2RlPl5eXl5eXl5eXl5eXl5eXl4hbm9jaGF0IF5eXl5eXl5eXl5eXl5eXl5leGNlbDwvY29kZT4=';
5346 document.getElementById('code_input').innerHTML = atob(resull);
5347 $('#code_input').css('background','#fffb55');
5348
5349
5350 $( ".main-content" ).prepend( "<div id='datestuff'></div>" );
5351 $( ".main-content" ).prepend( "<div id='timestuff'></div>" );
5352 $( ".main-content" ).prepend( "<div id='bottomhidden'></div>" );
5353 $( ".main-content" ).prepend( "<div id='tophidden'></div>" );
5354 $( ".main-content" ).prepend( "<div id='showhidestuff'></div>" );
5355 $( "#header" ).prepend( "<div id='cells2'></div>" );
5356 $( "#header" ).prepend( "<div id='cells1'></div>" );
5357 $( "#header" ).prepend( "<div id='bottompart'></div>" );
5358 $( "#header" ).prepend( "<div id='submitrow'></div>" );
5359 $( "#header" ).prepend( "<div id='filerow'></div>" );
5360 $( "#header" ).prepend( "<div id='preheader'></div>" );
5361
5362 $( "#sr-header-area" ).css({
5363 'z-index':'999999999999999',
5364 'position':'absolute',
5365 'left':'27px',
5366 'top':'220px',
5367 'width':'98%',
5368 });
5369 $( "#header-bottom-left" ).css({
5370 'z-index':'999999999999999',
5371 'position':'absolute',
5372 'left':'24px',
5373 'top':'273px',
5374 });
5375 $( "#header-bottom-right" ).css({
5376 'z-index':'999999999999999',
5377 'position':'absolute',
5378 'left':'855px',
5379 'top':'239px',
5380 });
5381 $( "#liveupdate-options" ).css({
5382 'z-index':'999999999999999',
5383 'position':'absolute',
5384 'left':'936px',
5385 'top':'379px',
5386 'background':'white',
5387
5388 });
5389 $( ".sidebar" ).css({
5390 'z-index':'999999999999999',
5391 'position':'absolute',
5392 'left':'906px',
5393 'top':'739px',
5394 'background':'white',
5395 'padding-top':'10px',
5396 });
5397
5398
5399 document.getElementById("sr-header-area").className += " hiddenfeature";
5400 document.getElementById("header-bottom-left").className += " hiddenfeature";
5401 document.getElementById("header-bottom-right").className += " hiddenfeature";
5402 document.getElementById("liveupdate-options").className += " hiddenfeature";
5403 $( ".sidebar" ).addClass( "hiddenfeature" );
5404 $( ".hiddenfeature" ).css({
5405 'display':'none',
5406 });
5407 $('head').append("<style>.save-button .error {display:inline!important;}.liveupdate-listing li.liveupdate ul.buttonrow button {font-size: 10px;} .liveupdate-listing li.liveupdate .body div.md {overflow:scroll!important;} .liveupdate-listing li.liveupdate ul.buttonrow {z-index:99;position:relative;top:-36px;left:108.33px;font-size:7px!important;} .liveupdate-listing li.liveupdate time::before {display: none!important;} .markdownEditor-wrapper {width: 500px;display: none !important;} .res-nightmode .usertext-edit textarea {background: white!important!important;}</style>");
5408
5409 $( ".res-floater-visibleAfterScroll" ).css({
5410 'display':'none!important',
5411 'background':'transparent',
5412 'position':'absolute',
5413 'height':'0px',
5414 'width':'0px',
5415 'font-size':'0px',
5416 'color':'transparent',
5417 'left':'-333px',
5418 'top':'-333px',
5419 });
5420 $( "#liveupdate-title" ).css({
5421 'display':'none',
5422 });
5423 $( "#liveupdate-header" ).css({
5424 'display':'none',
5425 });
5426 $( "#liveupdate-statusbar" ).css({
5427 'display':'none',
5428 });
5429 $( ".bottom-area" ).css({
5430 'position': 'absolute',
5431 'left': '-500px',
5432 'top': '-500px',
5433 });
5434
5435
5436 $( ".error" ).css({
5437 'display':'none',
5438 });
5439 $( ".main-content" ).css({
5440 'margin-top':'-1px',
5441 });
5442
5443 $('#new-update-form').find('.save-button .error').css('display', 'inline');
5444 $( "html" ).css({
5445 'scrollbar-width':'none',
5446 });
5447 $( "#preheader" ).css({
5448 'height':'34px',
5449 'background':'#1e7346',
5450 'font-family':'Segoe UI',
5451 'background-image':'url(https://i.imgur.com/Fsvkpmp.png)',
5452 'background-size': 'cover',
5453 'position':'fixed',
5454 'margin-top':'0px',
5455 'width':'100%'
5456 });
5457 $( "#filerow" ).css({
5458 'height':'123.33px',
5459 'background':'#1e7346',
5460 'font-family':'Segoe UI',
5461 'background-image':'url(https://i.imgur.com/ZPDl1Py.png)',
5462 'background-size': 'cover',
5463 'position':'fixed',
5464 'margin-top':'34px',
5465 'width':'100%'
5466 });
5467 $( "#submitrow" ).css({
5468 'height':'63.33px',
5469 'font-family':'Segoe UI',
5470 'background-image':'url(https://i.imgur.com/vANKvL2.png)',
5471 'background-size': 'cover',
5472 'position':'fixed',
5473 'margin-top':'157.33px',
5474 'width':'100%'
5475 });
5476 $( "#bottompart" ).css({
5477 'height':'499.33px',
5478 'font-family':'Segoe UI',
5479 'background-image':'url(https://i.imgur.com/VpKW3k9.png)',
5480 'background-size': 'cover',
5481 'position':'fixed',
5482 'margin-top':'220.66px',
5483 'width':'100%'
5484 });
5485 $( "#cells1" ).css({
5486 'height':'154.666px',
5487 'font-family':'Segoe UI',
5488 'background-image':'url(https://i.imgur.com/ealAJzh.png)',
5489 'background-size': 'cover',
5490 'position':'absolute',
5491 'margin-top':'220.66px',
5492 'width':'1232.666px',
5493 'margin-left':'26.666px',
5494 });
5495 $( "#cells2" ).css({
5496 'height':'20000px',
5497 'font-family':'Segoe UI',
5498 'background-image':'url(https://i.imgur.com/yT9zF7g.png)',
5499 'background-size': 'contain',
5500 'position':'absolute',
5501 'margin-top':'375.33px',
5502 'width':'1232.666px',
5503 'margin-left':'26.666px',
5504 'overflow':'hidden',
5505 });
5506 $( ".usertext .usertext-edit textarea" ).css({
5507 'z-index':'999999999',
5508 'position': 'fixed',
5509 'border': '1px solid #c6c6c6',
5510 'height': '23px',
5511 'margin-top': '152.33px',
5512 'margin-left': '-32px',
5513 'width': '1007px',
5514 'font-family':'Tahoma',
5515 'color':'#444',
5516 'text-indent':'10px',
5517 'font-size':'13px',
5518 });
5519 $( "#new-update-form .save-button button" ).css({
5520 'background': 'transparent',
5521 'border': '1px solid #c6c6c6',
5522 'margin-top': '152.33px',
5523 'position': 'fixed',
5524 'z-index': '999999999999999',
5525 'margin-left': '-144px',
5526 'height': '23px',
5527 'width': '109px',
5528 'color': 'transparent',
5529 });
5530 $( "#showhidestuff" ).css({
5531 'background': 'transparent',
5532 'position': 'fixed',
5533 'z-index': '999999999999999',
5534 'left': '4px',
5535 'height': '23px',
5536 'width': '103px',
5537 'color': 'transparent',
5538 'top':'168px',
5539 'cursor':'pointer',
5540 });
5541 $( "#showhidestuff" ).click(function() {
5542 $( ".hiddenfeature" ).toggle();
5543 });
5544 $( ".liveupdate-listing" ).css({
5545 'position':'relative',
5546 'z-index':'9999',
5547 'margin-top': '286.33px',
5548 'margin-left': '142px',
5549 'max-width':'398px',
5550 });
5551 $( "#tophidden" ).css({
5552 'position':'fixed',
5553 'z-index':'99999999',
5554 'width': '100%',
5555 'height': '220.66px',
5556 'top':'0',
5557 'left':'0',
5558 'background':'url(https://i.imgur.com/8hXvrhy.png)',
5559 'background-size': 'cover',
5560 });
5561 $( "#bottomhidden" ).css({
5562 'position':'fixed',
5563 'z-index':'99999999',
5564 'left': '0px',
5565 'top': '634px',
5566 'width':'100%',
5567 'height':'200px',
5568 'background':'url(https://i.imgur.com/VBrVvul.png)',
5569 'background-size': 'contain',
5570 });
5571 $( "#timestuff" ).css({
5572 'position':'fixed',
5573 'z-index':'99999999',
5574 'top': '682px',
5575 'width':'60px',
5576 'height':'60px',
5577 'font-family':'Segoe UI',
5578 'left':'1161px',
5579 'color':'white',
5580 'font-size':'12px',
5581 'text-align':'center',
5582 });
5583 $( "#datestuff" ).css({
5584 'position':'fixed',
5585 'z-index':'99999999',
5586 'top': '700px',
5587 'width':'60px',
5588 'height':'60px',
5589 'font-family':'Segoe UI',
5590 'left':'1161px',
5591 'color':'white',
5592 'font-size':'12px',
5593 'text-align':'center',
5594 });
5595 function updateTime(){
5596 var currentTime = new Date()
5597 var hours = currentTime.getHours()
5598 var minutes = currentTime.getMinutes()
5599 if (minutes < 10){
5600 minutes = "0" + minutes
5601 }
5602 if(hours > 11){
5603 hours = hours - 12;
5604 var t_str = hours + ":" + minutes + " ";
5605 t_str += "PM";
5606 } else {
5607 var t_str = hours + ":" + minutes + " ";
5608 t_str += "AM";
5609 }
5610 var aaatoday = new Date().toLocaleDateString()
5611 document.getElementById('timestuff').innerHTML = t_str;
5612 document.getElementById('datestuff').innerHTML = aaatoday;
5613}
5614setInterval(updateTime, 1000);
5615// $( "#lc-body li.liveupdate ul.buttonrow" ).css({
5616// 'position': 'relative',
5617// 'top': '-40px',
5618// 'left': '109px',
5619// });
5620
5621 function onupdate() {
5622 $( ".liveupdate" ).css({
5623 'max-height': '57.33px',
5624 'scrollbar-width': 'none',
5625 'overflow': 'hidden',
5626 'border-top': '1px solid transparent',
5627 'border-left': '1px solid transparent',
5628 'border-right': '1px solid transparent',
5629 });
5630 $( ".liveupdate time" ).css({
5631// 'border':'1px solid #d4d4d4',
5632 'width':'42.33px',
5633 'height':'54.33px',
5634 'overflow':'hidden',
5635 'margin-top':'-2px',
5636 'font-family': 'Calibri',
5637// 'font-size': '11px',
5638 'color': 'black',
5639 'position':'absolute',
5640 'border-right':'1px solid transparent',
5641 });
5642 $( ".liveupdate-listing li.liveupdate .body div.md" ).css({
5643 'width':'186px',
5644 'display':'block',
5645 'position':'absolute',
5646 'left':'64px',
5647 'overflow': 'scroll',
5648 'max-height': '62px',
5649 'scrollbar-width': 'none',
5650 'font-family':'Calibri',
5651 });
5652 //
5653 $( ".liveupdate-listing li.liveupdate .body" ).css({
5654 'height':'63.33px',
5655 'position':'relative',
5656 });
5657 $( ".liveupdate-listing li.liveupdate a.author" ).css({
5658 'position': 'absolute',
5659 'left': '249px',
5660 'border-left': '1px solid transparent',
5661 'height': '58.33px',
5662 'font-family':'Calibri',
5663 'z-index':'1',
5664 });
5665 $( ".liveupdate-listing li.separator" ).css({
5666 'height': '58px',
5667 'margin':'0',
5668 'padding':'0',
5669 });
5670 } //End function
5671 window.onload = onupdate();
5672 $( ".liveupdate-listing" ).on('DOMNodeInserted', function (e) {
5673 onupdate();
5674 });
5675
5676
5677 }
5678
5679/////////////////////april 2020 14
5680
5681/////////////////////april 2020 15
5682
5683if (april2020 == 15) {
5684 $( "#liveupdate-description .md" ).append('<p id="code_input"></p>');
5685 setTimeout(function () {
5686 var resull = 'VG8gdW5sb2NrIHRoZSBzcGVjaWFsIGFjaGlldmVtZW50LCBjb3B5IHRoaXMgYW5kIHB1dCBpdCBpbiB5b3VyIHBvc3Q6IDxjb2RlPl5eXl5eXl5eXl5eXl5eXl4hbm9jaGF0IF5eXl5eXl5eXl5eXl5eXl5kYXJrbmVzczwvY29kZT4=';
5687 document.getElementById('code_input').innerHTML = atob(resull);
5688 $('#code_input').css('background','#fffb55');
5689
5690}, 120000);
5691
5692 $('body').prepend('<div class="overlay"></div>');
5693
5694
5695 var mouseX = 0, mouseY = 0;
5696 var xp = 0, yp = 0;
5697
5698 $(document).mousemove(function(e){
5699 mouseX = e.pageX - 00;
5700 mouseY = e.pageY - 00;
5701 });
5702
5703 setInterval(function(){
5704 xp += ((mouseX - xp)/1);
5705 yp += ((mouseY - yp)/1);
5706 $(".overlay").css('-webkit-mask-image','radial-gradient(100px at '+xp+'px '+yp+'px , transparent 95%, black 100%)');
5707 }, 50);
5708
5709var body = document.body,
5710 html = document.documentElement;
5711var pg_height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ) + 'px';
5712 ////////////////////////////////////DO SOMETHING ELSE!!!!!!!!!!!!!!!!!!!!!!!!!
5713 //////////////////////////////////// aaaaaaaaaaaaaaa lol
5714
5715 Styles.add(`
5716.overlay {
5717 top:0;
5718 left:0;
5719 z-index:100;
5720 background-color:rgba(0,0,0,1);
5721 position:absolute;
5722 width:100%;
5723 height:`+pg_height+`;
5724 pointer-events:none;
5725 -webkit-mask-image:radial-gradient(100px at 00px 0px , transparent 95%, black 100%);
5726}
5727`);
5728}
5729
5730/////////////////////april 2020 15
5731
5732/////////////////////april 2020 16
5733
5734if (april2020 == 16) {
5735
5736Styles.add(`.deadupdate {background:initial;}`);
5737
5738
5739//timesecond = 1000 //Use 1000 on final version, but for testing, want to make it shorter
5740timesecond = 1000;
5741setTimeout(function(){
5742 if($('#contributors h2').text() == 'updated dy') {
5743 setTimeout(function(){
5744$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Remember to visit <a href="https://old.reddit.com/live/ta535s1hq2je/#graphite" rel="nofollow">https://old.reddit.com/live/ta535s1hq2je/#graphite</a> to see our progress!</p><p>To unlock the special achievement, copy this and put it in your post: <code>^^^^^^^^^^^^^^^^!nochat ^^^^^^^^^^^^^^^^aprilfools</code></p></div><a href="/u/me" class="deadauthor" style="color: black;"> /u/Graphite_bot</a></li>`);
5745 },0.5*timesecond); //post 1
5746 } else if ($('#contributors h2').text() == 'uppdated by') {
5747 setTimeout(function(){
5748$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Remember to visit <a href="https://old.reddit.com/live/ta535s1hq2je/#riverbot" rel="nofollow">https://old.reddit.com/live/ta535s1hq2je/#riverbot</a> to see our progress!</p><p>To unlock the special achievement, copy this and put it in your post: <code>^^^^^^^^^^^^^^^^!nochat ^^^^^^^^^^^^^^^^aprilfools</code></p></div><a href="/u/me" class="deadauthor" style="color: black;"> /u/Graphite_bot</a></li>`);
5749 },0.5*timesecond); //post 1
5750 } else if (window.location.href.indexOf("graphite") > -1 || window.location.href.indexOf("riverbot") > -1 ) {
5751 setTimeout(function(){
5752$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>You know what to do. (After you do it... please wait a minute and refresh.)</p></div><a href="/u/me" class="deadauthor" style="color: black;"> /u/Anonymous</a></li>`);
5753 },0.5*timesecond); //post 1
5754} else {
5755
5756 setTimeout(function(){
5757$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>psst...\n\nI need your help</p></div><a href="/u/me" class="deadauthor" style="color: black;"> /u/Graphite_bot</a></li>`);
5758 },5*timesecond); //post 1
5759
5760setTimeout(function(){
5761$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Are you willing to help?<div><button id="riveryes">Yes</button><button id="riverno">No</button></div></p></div><a href="/u/me" class="deadauthor" style="color: black;"> /u/Graphite_bot</a></li>`);
5762
5763 $( "#riverno" ).click(function() {
5764$( "#riveryes" ).hide();
5765$( "#riverno" ).hide();
5766
5767//$("html").prepend("<body2 id=abcd></body2>");
5768//$('body').fadeOut(10000);
5769//setTimeout(function(){
5770//$('body').fadeIn(10000);
5771// },10000);
5772//
5773
5774setTimeout(function(){
5775$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>alright, i'll ask someone else<a href="/u/me" class="deadauthor" style="color: black;"> /u/Graphite_bot</a></li>`);
5776 },2*timesecond);
5777
5778});
5779
5780 $( "#riveryes" ).click(function() {
5781$( "#riveryes" ).hide();
5782$( "#riverno" ).hide();
5783
5784//$("html").prepend("<body2 id=abcd></body2>");
5785//$('body').fadeOut(10000);
5786//setTimeout(function(){
5787//$('body').fadeIn(10000);
5788// },10000);
5789//
5790
5791setTimeout(function(){
5792$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>i really appreciate it. let's go somewhere else<a href="/u/me" class="deadauthor" style="color: black;"> /u/Graphite_bot</a></li>`);
5793 },2*timesecond);
5794
5795setTimeout(function(){
5796$("html").prepend("<body2 id=abcd><div id='preloading'><div id='preload01'></div><div id='preload02'></div><div id='preload03'></div><div id='preload04'></div><div id='preload05'></div><div id='preload06'></div><div id='preload07'></div><div id='preload08'></div><div id='preload09'></div><div id='preload10'></div><div id='preload11'></div><div id='preload12'></div><div id='preload13'></div><div id='preload14'></div><div id='preload15'></div><div id='preload16'></div><div id='preload17'></div><div id='preload18'></div><div id='preload19'></div></div></body2>");
5797
5798 /////PRELOADING IMAGES
5799 Styles.add(`#preload01 { background: url(https://i.imgur.com/MI4wjqB.png) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5800 Styles.add(`#preload02 { background: url(https://i.imgur.com/zjpzK2z.png) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5801 Styles.add(`#preload03 { background: url(https://i.imgur.com/t5kHcTM.png) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5802 Styles.add(`#preload04 { background: url(https://i.imgur.com/Z3WUuD2.png) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5803 Styles.add(`#preload05 { background: url(https://i.imgur.com/QZplF6w.png) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5804 Styles.add(`#preload06 { background: url(https://i.imgur.com/Khha89g.png) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5805 Styles.add(`#preload07 { background: url(https://i.imgur.com/JjWf3mR.png) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5806 Styles.add(`#preload08 { background: url(https://i.imgur.com/3UvI0OF.jpg) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5807 Styles.add(`#preload09 { background: url(https://i.imgur.com/IggDP5L.png) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5808 Styles.add(`#preload10 { background: url(https://i.imgur.com/MI4wjqB.png) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5809 Styles.add(`#preload11 { background: url(https://i.imgur.com/JyrPgUL.png) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5810 Styles.add(`#preload12 { background: url(https://i.imgur.com/zxLAfAy.png) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5811 Styles.add(`#preload13 { background: url(https://i.imgur.com/UOUEHRo.png) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5812 Styles.add(`#preload14 { background: url(https://i.imgur.com/KBDWaOt.png) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5813 Styles.add(`#preload15 { background: url(https://i.imgur.com/JrmYPjQ.png) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5814 Styles.add(`#preload16 { background: url(https://i.imgur.com/yM7Mh51.png) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5815 Styles.add(`#preload17 { background: url(https://i.imgur.com/GiVMOgO.png) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5816 Styles.add(`#preload18 { background: url(https://i.imgur.com/wzmAW6e.png) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5817 Styles.add(`#preload19 { background: url(https://i.imgur.com/wJG4bub.png) no-repeat -9999px -9999px;width:1px;height:1px;left:-999px;top:-999px;position:fixed; }`);
5818
5819
5820 //////////////////////
5821
5822 $('body2').css('display','none');
5823$('body').fadeOut(5*timesecond);
5824setTimeout(function(){
5825 Styles.add(`.choicy {animation: optionchoose 3s forwards;} @keyframes optionchoose {0% {z-index:9999;width:50%;} 100% {z-index:9999;width:100%;left:0%;}} #halfscreen1:after {background: none repeat scroll 0 0 transparent;bottom: 0;content: "";display: block;height: 50px;left: 50%;position: absolute;background: #000;transition: width 0.3s ease 0s, left 0.3s ease 0s;width: 0;}#halfscreen1:hover:after {width: 100%;left: 0;}#halfscreen2:after {background: none repeat scroll 0 0 transparent;bottom: 0;content: "";display: block;height: 50px;left: 50%;position: absolute;background: #fff;transition: width 0.3s ease 0s, left 0.3s ease 0s;width: 0;}#halfscreen2:hover:after {width: 100%;left: 0;} #halfscreen1 {position: fixed;background: white;cursor:pointer;color: black;width: 50%;left: 0%;text-align: center;height: 100%;display: flex;align-items: center;justify-content: center;font-size: 40px;} #halfscreen2 {position: fixed;cursor:pointer;left: 50%;background: black;color: white;width: 50%;left: 50%;text-align: center;height: 100%;display: flex;align-items: center;justify-content: center;font-size: 40px;} #abcd {background: #212121;width: 100%;height: 100%;position: fixed;} .rivmess {position: fixed;white-space: nowrap;left: 50%;top: 50%;color: #fff; transform: translate(-50%, -50%);opacity: 0.7;animation: textgrowth 5s forwards;} @keyframes textgrowth {0% {font-size: 0px;} 100% {font-size: calc(4vw + 4vh + 2vmin);}}`);
5826 Styles.add(`.slide {font-family:Consolas;display: flex;align-items: center;justify-content: center;height: 100%;}.row {width: auto;text-align:center;padding: 0px 20% 1% 20%;}`);
5827 $('body2').fadeIn(5*timesecond);
5828 },5*timesecond);
5829 var timeygo = 9*timesecond;
5830 setTimeout(function(){
5831 $('body2').html(`<div class="rivmess" id="message1">psst...</div>`);
5832 },timeygo);
5833 setTimeout(function(){
5834 $('#message1').fadeOut(5*timesecond);
5835 },timeygo);
5836 timeygo = timeygo + 5*timesecond;
5837 setTimeout(function(){
5838 $('body2').html(`<div class="rivmess" id="message1">Hello?</div>`);
5839 },timeygo);
5840 setTimeout(function(){
5841 $('#message1').fadeOut(5*timesecond);
5842 },timeygo);
5843 timeygo = timeygo + 5*timesecond;
5844 setTimeout(function(){
5845 $('body2').html(`<div class="rivmess" id="message2">I don't have much time</div>`);
5846 },timeygo);
5847 setTimeout(function(){
5848 $('#message2').fadeOut(5*timesecond);
5849 },timeygo);
5850 timeygo = timeygo + 5*timesecond;
5851 setTimeout(function(){
5852 $('body2').html(`<div class="rivmess" id="message3">I have to admit something</div>`);
5853 },timeygo);
5854 setTimeout(function(){
5855 $('#message3').fadeOut(5*timesecond);
5856 },timeygo);
5857 timeygo = timeygo + 5*timesecond;
5858 setTimeout(function(){
5859 $('body2').html(`<div class="rivmess" id="message4">I killed Riverbot</div>`);
5860 },timeygo);
5861 setTimeout(function(){
5862 $('#message4').fadeOut(5*timesecond);
5863 },timeygo);
5864 timeygo = timeygo + 5*timesecond;
5865 setTimeout(function(){
5866 $('body2').html(`<div class="rivmess" id="message5">I had no other choice</div>`);
5867 },timeygo);
5868 setTimeout(function(){
5869 $('#message5').fadeOut(5*timesecond);
5870 },timeygo);
5871 timeygo = timeygo + 5*timesecond;
5872 setTimeout(function(){
5873 $('body2').html(`<div class="rivmess" id="message6">Will you still help me?</div>`);
5874 },timeygo);
5875 setTimeout(function(){
5876 $('#message6').fadeOut(5*timesecond);
5877 },timeygo);
5878 timeygo = timeygo + 5*timesecond;
5879 setTimeout(function(){
5880 $('body2').html(`<div id="screenblocker"></div><div class="choice" id="halfscreen1">HELP</div><div class="choice" id="halfscreen2">DON'T HELP</div>`);
5881 $('#halfscreen1').css('display','none');
5882 $('#halfscreen2').css('display','none');
5883 },timeygo);
5884 setTimeout(function(){
5885 $('#halfscreen1').fadeIn(5*timesecond);
5886 $('#halfscreen2').fadeIn(5*timesecond);
5887 $( "#halfscreen1" ).click(function() { //START HALFSCREEN1
5888 $("#screenblocker").css('position','fixed').css('background','transparent').css('left','0').css('top','0').css('width','100%').css('height','100%').css('z-index','999999999999');
5889 $('#halfscreen1').addClass('choicy');
5890 setTimeout(function(){
5891 $('#halfscreen2').css('display','none');
5892 $('#abcd').css('background','#fff');
5893 $('#halfscreen1').fadeOut(3*timesecond);
5894 },3*timesecond);
5895 setTimeout(function(){
5896 $("#screenblocker").css('display','none');
5897 },7*timesecond);
5898// $('#halfscreen1').fadeIn(5*timesecond);
5899 setTimeout(function(){
5900 $('body2').html(`<div class="slide" id="slide1"><div class="row"><img class="imagy" id="helpimage1" src="https://i.imgur.com/MI4wjqB.png"></img></br><div class="text" id="helptext1">I first opened my bank in 1906. Those were simpler times. We had our ups and downs throughout the years, but our bank was a facet of the Countingston community.</div></br><div class="text" id="helptext2">As the years passed by, I saw our community grow into something beautiful. But people got older. Some passed away. Others moved on. For some time, I felt Countingston wasn't what it used to be. I felt left behind.</div></br></div><div class="nextbutton" id="nextbutton1">>>NEXT</div></div>`);
5901 Styles.add(`.imagy {max-width:70%;} .nextbutton {position: fixed;left: 87%;top: 87%;background: black;padding: 5px;color: white;font-size: 24px;cursor: pointer;visibility: hidden;}`);
5902 $('#helpimage1').css('visibility','hidden');
5903 $('#helptext1').css('visibility','hidden');
5904 $('#helptext2').css('visibility','hidden');
5905 },9*timesecond);
5906 setTimeout(function(){
5907 $('#helpimage1').css('visibility','visible').hide().fadeIn(1*timesecond);
5908 },9*timesecond);
5909 setTimeout(function(){
5910 $('#helptext1').css('visibility','visible').hide().fadeIn(1*timesecond);
5911 },14*timesecond);
5912 setTimeout(function(){
5913 $('#helptext2').css('visibility','visible').hide().fadeIn(1*timesecond);
5914 },19*timesecond);
5915 setTimeout(function(){
5916 $('#nextbutton1').css('visibility','visible').hide().fadeIn(1*timesecond);
5917 $( "#nextbutton1" ).click(function() {
5918 $('#helpimage1').fadeOut(1*timesecond);
5919 $('#helptext1').fadeOut(1*timesecond);
5920 $('#helptext2').fadeOut(1*timesecond);
5921 $('#nextbutton1').fadeOut(1*timesecond);
5922 setTimeout(function(){
5923 $('body2').html(`<div class="slide" id="slide2"><div class="row"><img class="imagy" id="helpimage2" src="https://i.imgur.com/zjpzK2z.png"></img></br><div class="text" id="helptext3">These feelings remained with me for years, but I eventually realized that I could never go back to the good old days. I loved my community too much and didn't want to be so resentful.</div></br></div><div class="nextbutton" id="nextbutton2">>>NEXT</div></div>`);
5924 $('#helpimage2').css('visibility','hidden');
5925 $('#helptext3').css('visibility','hidden');
5926 },1*timesecond);
5927 setTimeout(function(){
5928 $('#helpimage2').css('visibility','visible').hide().fadeIn(1*timesecond);
5929 },3*timesecond);
5930 setTimeout(function(){
5931 $('#helptext3').css('visibility','visible').hide().fadeIn(1*timesecond);
5932 },6*timesecond);
5933 setTimeout(function(){
5934 $('#nextbutton2').css('visibility','visible').hide().fadeIn(1*timesecond);
5935/////NEW CLICK
5936 $( "#nextbutton2" ).click(function() {
5937 $('#helpimage2').fadeOut(1*timesecond);
5938 $('#helptext3').fadeOut(1*timesecond);
5939 $('#nextbutton2').fadeOut(1*timesecond);
5940 setTimeout(function(){
5941 $('body2').html(`
5942<div class="slide" id="slide3">
5943<div class="row">
5944<img class="imagy" id="helpimage3" src="https://i.imgur.com/t5kHcTM.png"></img>
5945</br>
5946<div class="text" id="helptext4">
5947The world was becoming increasingly digital. The banking industry was no different. I had to adapt to these changes. As a small bank owner, these adaptations weren't easy, but were necessary for my bank to survive.
5948</div>
5949</br>
5950<div class="text" id="helptext5">
5951As I would find out, cybersecurity was not my forte. We had no major attacks for years, until a long-time adversary set up Riverbot to remotely rob my bank.
5952</div>
5953</br>
5954</div>
5955<div class="nextbutton" id="nextbutton3">>>NEXT</div></div>`);
5956
5957 $('#helpimage3').css('visibility','hidden');
5958 $('#helptext4').css('visibility','hidden');
5959 $('#helptext5').css('visibility','hidden');
5960 },1*timesecond);
5961 setTimeout(function(){
5962 $('#helpimage3').css('visibility','visible').hide().fadeIn(1*timesecond);
5963 },3*timesecond);
5964 setTimeout(function(){
5965 $('#helptext4').css('visibility','visible').hide().fadeIn(1*timesecond);
5966 },6*timesecond);
5967 setTimeout(function(){
5968 $('#helptext5').css('visibility','visible').hide().fadeIn(1*timesecond);
5969 },11*timesecond);
5970 setTimeout(function(){
5971 $('#nextbutton3').css('visibility','visible').hide().fadeIn(1*timesecond);
5972/////NEW CLICK BUTTON 3
5973 $( "#nextbutton3" ).click(function() {
5974 $('#helpimage3').fadeOut(1*timesecond);
5975 $('#helptext4').fadeOut(1*timesecond);
5976 $('#helptext5').fadeOut(1*timesecond);
5977 $('#nextbutton3').fadeOut(1*timesecond);
5978 setTimeout(function(){
5979 $('body2').html(`
5980<div class="slide" id="slide4">
5981<div class="row">
5982<img class="imagy" id="helpimage4" src="https://i.imgur.com/Z3WUuD2.png"></img>
5983</br>
5984<div class="text" id="helptext6">
5985Riverbot was created by a former employee of mine, David "River" Bridebride. River was a major contributor in the transition to a digital banking system. We had a good relationship for years until I called him into my office in 2015 and told him we were firing him and replacing him with Joe.
5986</div>
5987</br>
5988<div class="text" id="helptext7">
5989"Who's Joe?" River asked.
5990</div>
5991</br>
5992<div class="text" id="helptext8">
5993"JOE MAMMA!!!!!!!!!" I replied.
5994</div>
5995</br>
5996</div>
5997<div class="nextbutton" id="nextbutton4">>>NEXT</div></div>`);
5998
5999 $('#helpimage4').css('visibility','hidden');
6000 $('#helptext6').css('visibility','hidden');
6001 $('#helptext7').css('visibility','hidden');
6002 $('#helptext8').css('visibility','hidden');
6003 },1*timesecond);
6004 setTimeout(function(){
6005 $('#helpimage4').css('visibility','visible').hide().fadeIn(1*timesecond);
6006 },3*timesecond);
6007
6008 setTimeout(function(){
6009 $('#helptext6').css('visibility','visible').hide().fadeIn(1*timesecond);
6010 },6*timesecond);
6011
6012 setTimeout(function(){
6013 $('#helptext7').css('visibility','visible').hide().fadeIn(1*timesecond);
6014 },11*timesecond);
6015
6016 setTimeout(function(){
6017 $('#helptext8').css('visibility','visible').hide().fadeIn(1*timesecond);
6018 },16*timesecond);
6019
6020 setTimeout(function(){
6021 $('#nextbutton4').css('visibility','visible').hide().fadeIn(1*timesecond);
6022/////NEW CLICK BUTTON 4
6023 $( "#nextbutton4" ).click(function() {
6024 $('#helpimage4').fadeOut(1*timesecond);
6025 $('#helptext6').fadeOut(1*timesecond);
6026 $('#helptext7').fadeOut(1*timesecond);
6027 $('#helptext8').fadeOut(1*timesecond);
6028 $('#nextbutton4').fadeOut(1*timesecond);
6029 setTimeout(function(){
6030 $('body2').html(`
6031<div class="slide" id="slide5">
6032<div class="row">
6033<img class="imagy" id="helpimage5" src="https://i.imgur.com/QZplF6w.png"></img>
6034</br>
6035<div class="text" id="helptext9">
6036River was so insulted by this whole ordeal that he resigned on the spot. I pleaded with him to stay, but he packed his things and left.
6037</div>
6038</br>
6039<div class="text" id="helptext10">
6040Fast forward until a few months ago. Our bank had overcome some recent struggles and was doing better than it had in decades. The years of progress we had made would all go to waste due to Riverbot.
6041</div>
6042</br>
6043</div>
6044<div class="nextbutton" id="nextbutton5">>>NEXT</div></div>`);
6045
6046 $('#helpimage5').css('visibility','hidden');
6047 $('#helptext9').css('visibility','hidden');
6048 $('#helptext10').css('visibility','hidden');
6049 },1*timesecond);
6050 setTimeout(function(){
6051 $('#helpimage5').css('visibility','visible').hide().fadeIn(1*timesecond);
6052 },3*timesecond);
6053
6054 setTimeout(function(){
6055 $('#helptext9').css('visibility','visible').hide().fadeIn(1*timesecond);
6056 },6*timesecond);
6057
6058 setTimeout(function(){
6059 $('#helptext10').css('visibility','visible').hide().fadeIn(1*timesecond);
6060 },12*timesecond);
6061
6062 setTimeout(function(){
6063 $('#nextbutton5').css('visibility','visible').hide().fadeIn(1*timesecond);
6064/////NEW CLICK BUTTON 5
6065 $( "#nextbutton5" ).click(function() {
6066 $('#helpimage5').fadeOut(1*timesecond);
6067 $('#helptext9').fadeOut(1*timesecond);
6068 $('#helptext10').fadeOut(1*timesecond);
6069 $('#nextbutton5').fadeOut(1*timesecond);
6070 setTimeout(function(){
6071 $('body2').html(`
6072<div class="slide" id="slide6">
6073<div class="row">
6074<img class="imagy" id="helpimage6" src="https://i.imgur.com/Khha89g.png"></img>
6075</br>
6076<div class="text" id="helptext11">
6077River created Riverbot using a copy of our Linux-based system with decompiled VPN backdoor firmware stored on his flash drive. He tested it by stealing small amounts of money that raised no red flags. After various successes in his testing, River began to steal larger and larger amounts of money from the bank.
6078</div>
6079</br>
6080<div class="text" id="helptext12">
6081Having moved to Livecountingville, River had no association with Countingston any longer. He didn't care whether the citizens of our town suffered. He only cared about advancing his own community, even at the expense of ours. Thus, he made a program which allowed Livecountingville citizens to request cash, calling it a "community project" with money from his "own pocket."
6082</div>
6083</br>
6084</div>
6085<div class="nextbutton" id="nextbutton6">>>NEXT</div></div>`);
6086
6087 $('#helpimage6').css('visibility','hidden');
6088 $('#helptext11').css('visibility','hidden');
6089 $('#helptext12').css('visibility','hidden');
6090 },1*timesecond);
6091 setTimeout(function(){
6092 $('#helpimage6').css('visibility','visible').hide().fadeIn(1*timesecond);
6093 },3*timesecond);
6094
6095 setTimeout(function(){
6096 $('#helptext11').css('visibility','visible').hide().fadeIn(1*timesecond);
6097 },6*timesecond);
6098
6099 setTimeout(function(){
6100 $('#helptext12').css('visibility','visible').hide().fadeIn(1*timesecond);
6101 },16*timesecond);
6102
6103 setTimeout(function(){
6104 $('#nextbutton6').css('visibility','visible').hide().fadeIn(1*timesecond);
6105/////NEW CLICK BUTTON 6
6106 $( "#nextbutton6" ).click(function() {
6107 $('#helpimage6').fadeOut(1*timesecond);
6108 $('#helptext11').fadeOut(1*timesecond);
6109 $('#helptext12').fadeOut(1*timesecond);
6110 $('#nextbutton6').fadeOut(1*timesecond);
6111 setTimeout(function(){
6112 $('body2').html(`
6113<div class="slide" id="slide7">
6114<div class="row">
6115<img class="imagy" id="helpimage7" src="https://i.imgur.com/JjWf3mR.png"></img>
6116</br>
6117<div class="text" id="helptext13">
6118Albeit each request gave a small amount of money to the requestee, over a long period of time, it benefitted the Livecountingville community greatly.
6119</div>
6120</br>
6121<div class="text" id="helptext14">
6122Naturally, the citizens of Livecountingville were extremely appreciative of how River was distributing his wealth. River has pretended to be a multimillionaire giving his money back to his community for months. The people still don't know. I have to expose River's corruption to them.
6123</div>
6124</br>
6125</div>
6126<div class="nextbutton" id="nextbutton7">>>NEXT</div></div>`);
6127
6128 $('#helpimage7').css('visibility','hidden');
6129 $('#helptext13').css('visibility','hidden');
6130 $('#helptext14').css('visibility','hidden');
6131 },1*timesecond);
6132 setTimeout(function(){
6133 $('#helpimage7').css('visibility','visible').hide().fadeIn(1*timesecond);
6134 },3*timesecond);
6135
6136 setTimeout(function(){
6137 $('#helptext13').css('visibility','visible').hide().fadeIn(1*timesecond);
6138 },6*timesecond);
6139
6140 setTimeout(function(){
6141 $('#helptext14').css('visibility','visible').hide().fadeIn(1*timesecond);
6142 },14*timesecond);
6143
6144 setTimeout(function(){
6145 $('#nextbutton7').css('visibility','visible').hide().fadeIn(1*timesecond);
6146/////NEW CLICK BUTTON 7
6147 $( "#nextbutton7" ).click(function() {
6148 $('#helpimage7').fadeOut(1*timesecond);
6149 $('#helptext13').fadeOut(1*timesecond);
6150 $('#helptext14').fadeOut(1*timesecond);
6151 $('#nextbutton7').fadeOut(1*timesecond);
6152 setTimeout(function(){
6153 $('body2').html(`
6154<div class="slide" id="slide8">
6155<div class="row">
6156<img class="imagy" id="helpimage8" src="https://i.imgur.com/3UvI0OF.jpg"></img>
6157</br>
6158<div class="text" id="helptext15">
6159Countingston has declined hard in these past few months. No, our banks aren't FDIC insured, and don't ask why. Our citizens have lost everything. There's no way to recover all of the lost money from our bank.
6160</div>
6161</br>
6162<div class="text" id="helptext16">
6163River has gained political power as a result of Riverbot's robberies. Unfortunately, he is gaining national recognition for his work. We must stop his rise to prominence.
6164</div>
6165</br>
6166</div>
6167<div class="nextbutton" id="nextbutton8">>>NEXT</div></div>`);
6168
6169 $('#helpimage8').css('visibility','hidden');
6170 $('#helptext15').css('visibility','hidden');
6171 $('#helptext16').css('visibility','hidden');
6172 },1*timesecond);
6173 setTimeout(function(){
6174 $('#helpimage8').css('visibility','visible').hide().fadeIn(1*timesecond);
6175 },3*timesecond);
6176
6177 setTimeout(function(){
6178 $('#helptext15').css('visibility','visible').hide().fadeIn(1*timesecond);
6179 },6*timesecond);
6180
6181 setTimeout(function(){
6182 $('#helptext16').css('visibility','visible').hide().fadeIn(1*timesecond);
6183 },13*timesecond);
6184
6185 setTimeout(function(){
6186 $('#nextbutton8').css('visibility','visible').hide().fadeIn(1*timesecond);
6187/////NEW CLICK BUTTON 8
6188 $( "#nextbutton8" ).click(function() {
6189 $('#helpimage8').fadeOut(1*timesecond);
6190 $('#helptext15').fadeOut(1*timesecond);
6191 $('#helptext16').fadeOut(1*timesecond);
6192 $('#nextbutton8').fadeOut(1*timesecond);
6193 setTimeout(function(){
6194 $('body2').html(`
6195<div class="slide" id="slide9">
6196<div class="row">
6197<img class="imagy" id="helpimage9" src="https://i.imgur.com/IggDP5L.png"></img>
6198</br>
6199<div class="text" id="helptext17">
6200I already did the hard part. I used a GUI interface using Visual Basic to track Riverbot's IP address to find where Riverbot was physically hosted. Then I drove to it and shot the computer.
6201</div>
6202</br>
6203<div class="text" id="helptext18">
6204Now, River has no way of accessing our funds, so he has canceled his money distribution program. Our goal is to expose River's lies and help the people of Countingston recover from this disaster.
6205</div>
6206</br>
6207</div>
6208<div class="nextbutton" id="nextbutton9">>>NEXT</div></div>`);
6209
6210 $('#helpimage9').css('visibility','hidden');
6211 $('#helptext17').css('visibility','hidden');
6212 $('#helptext18').css('visibility','hidden');
6213 },1*timesecond);
6214 setTimeout(function(){
6215 $('#helpimage9').css('visibility','visible').hide().fadeIn(1*timesecond);
6216 },3*timesecond);
6217
6218 setTimeout(function(){
6219 $('#helptext17').css('visibility','visible').hide().fadeIn(1*timesecond);
6220 },6*timesecond);
6221
6222 setTimeout(function(){
6223 $('#helptext18').css('visibility','visible').hide().fadeIn(1*timesecond);
6224 },13*timesecond);
6225
6226 setTimeout(function(){
6227 $('#nextbutton9').css('visibility','visible').hide().fadeIn(1*timesecond);
6228/////NEW CLICK BUTTON 9
6229 $( "#nextbutton9" ).click(function() {
6230 $('#helpimage9').fadeOut(1*timesecond);
6231 $('#helptext17').fadeOut(1*timesecond);
6232 $('#helptext18').fadeOut(1*timesecond);
6233 $('#nextbutton9').fadeOut(1*timesecond);
6234 function disblr(id){
6235 document.getElementById('passwordbutton1').disabled = true;
6236 setTimeout(function(){document.getElementById('passwordbutton1').disabled = false;},2*timesecond);
6237 }
6238 setTimeout(function(){
6239 $('body2').html(`
6240<div class="slide" id="slide10" style="background:black;color:#0F0;">
6241<div class="row">
6242<div class="text" id="helptext19">
6243VERIFICATION REQUIRED</br>ENTER PASSWORD
6244</div>
6245</br>
6246<input class="inputry" id="inputry1">
6247</input>
6248</br>
6249</br>
6250<button id="passwordbutton1" onClick="disblr()">
6251SUBMIT
6252</button>
6253</br>
6254</br>
6255<div class="text" id="helptext20">
6256ERROR: PASSWORD IS INCORRECT
6257</div>
6258</br>
6259</div>
6260`);
6261document.getElementById("passwordbutton1").addEventListener("click", disblr);
6262 $('.row').css('visibility','hidden');
6263 $('#helptext19').css('visibility','hidden');
6264 $('#inputry1').css('visibility','hidden');
6265 $('#passwordbutton1').css('visibility','hidden');
6266 $('#helptext20').css('visibility','hidden').css('color','red');
6267 },1*timesecond);
6268 setTimeout(function(){
6269 $('.row').css('visibility','visible').hide().fadeIn(1*timesecond);
6270 },2*timesecond);
6271 setTimeout(function(){
6272 $('#helptext19').css('visibility','visible').hide().fadeIn(1*timesecond);
6273 },2*timesecond);
6274 setTimeout(function(){
6275 $('#inputry1').css('visibility','visible').hide().fadeIn(1*timesecond);
6276 },2*timesecond);
6277 setTimeout(function(){
6278 $('#passwordbutton1').css('visibility','visible').hide().fadeIn(1*timesecond);
6279 $( "#passwordbutton1" ).click(function() {
6280 if(document.getElementById('inputry1').value != "INCORRECT") {
6281 $('#helptext20').css('visibility','visible').hide().fadeIn(000*timesecond);
6282 setTimeout(function(){
6283 $('#helptext20').fadeOut(000*timesecond,function(){$('#helptext20').css("visibility","hidden").css("display","");});
6284 },0.5*timesecond);
6285 setTimeout(function(){
6286 $('#helptext20').css('visibility','visible').hide().fadeIn(000*timesecond);
6287 },1*timesecond);
6288 setTimeout(function(){
6289 $('#helptext20').fadeOut(000*timesecond,function(){$('#helptext20').css("visibility","hidden").css("display","");});
6290 },1.5*timesecond);
6291//
6292 } else {
6293$('body2').html(`
6294<div class="slide" id="slide11" style="background:black;color:#0F0;">
6295<div class="row">
6296<div class="text" id="helptext21">
6297ACCESS GRANTED
6298</br>
6299WELCOME `+USER.toUpperCase()+`
6300</div>
6301</div>
6302</div>
6303`);
6304 setTimeout(function(){
6305 $('#helptext21').text(`LOADING SECURE NETWORK PROTOCOLS`);
6306 },4*timesecond);
6307 setTimeout(function(){
6308 $('#helptext21').text(`IPv6 ADDRESS`);
6309 },6*timesecond);
6310 setTimeout(function(){
6311 $('#helptext21').text(`IPv6 ADDRESS 127.0.0.1 DONE`);
6312 },6.3*timesecond);
6313 setTimeout(function(){
6314 $('#helptext21').text(`LOADING SSL`);
6315 },6.5*timesecond);
6316 setTimeout(function(){
6317 $('#helptext21').text(`LOADING SSL DONE`);
6318 },6.8*timesecond);
6319 setTimeout(function(){
6320 $('#helptext21').text(`PERFORMING TLS HANDSHAKE`);
6321 },7*timesecond);
6322 setTimeout(function(){
6323 $('#helptext21').text(`PERFORMING TLS HANDSHAKE DONE`);
6324 },7.3*timesecond);
6325 setTimeout(function(){
6326 $('#helptext21').text(`LOADING DATA PACKETS`);
6327 },7.5*timesecond);
6328 setTimeout(function(){
6329 $('#helptext21').text(`LOADING DATA PACKETS DONE`);
6330 },7.8*timesecond);
6331 setTimeout(function(){
6332 $('#helptext21').text(`SECURE NETWORK PROTOCOLS SUCCESSFULLY LOADED`);
6333 },8*timesecond);
6334 setTimeout(function(){
6335 $('body2').html(`
6336<div class="slide" id="slide12" style="background:black;color:#0F0;">
6337<div class="row">
6338<div class="text" id="helptext22">
6339YOU HAVE ONE NEW MESSAGE
6340</div>
6341</div>
6342</div>
6343`);
6344 },11*timesecond);
6345 setTimeout(function(){
6346 $('body2').html(`
6347<div class="slide" id="slide13" style="background:black;color:#0F0;">
6348<div class="row">
6349<div class="text" id="helptext23">
6350Opening
6351</div>
6352</div>
6353</div>
6354`);
6355 },15*timesecond);
6356 setTimeout(function(){
6357 $('#helptext23').text(`Opening .`);
6358 },16*timesecond);
6359 setTimeout(function(){
6360 $('#helptext23').text(`Opening . .`);
6361 },17*timesecond);
6362 setTimeout(function(){
6363 $('#helptext23').text(`Opening . . .`);
6364 },18*timesecond);
6365 setTimeout(function(){
6366 $('body2').html(`
6367<div class="slide" id="slide14" style="background:black;color:#0F0;">
6368<div class="row">
6369<div class="text" id="helptext24">
6370MESSAGE FROM: Anonymous
6371</br>
6372</br>
6373Please visit https://www.reddit.com/live/ta535s1hq2je/#graphite in a new tab and copy and paste the following into the chat:
6374</br>
6375<input type="text" id="graphite" value="^^^^^^^^^^^^^^^^nochat ^^^^^^^^^^^^^^^^^join Hi">
6376</br>
6377This will allow us revolutionaries to better communicate in the future. Thank you for choosing to help.
6378</br>
6379</br>
6380END MESSAGE
6381</div>
6382</div>
6383</div>
6384`);
6385 document.getElementById("graphite").readOnly = true;
6386 $('#graphite').css('width','500px');
6387 },19*timesecond);
6388 } //password1 correct end
6389 }); //password1 click end
6390 },2*timesecond);
6391
6392
6393 });//nextbutton9 click end
6394 },20*timesecond); //nextbutton 9
6395
6396 });//nextbutton8 click end
6397 },20*timesecond); //nextbutton 8
6398
6399 });//nextbutton7 click end
6400 },21*timesecond); //nextbutton 7
6401
6402 });//nextbutton6 click end
6403 },26*timesecond); //nextbutton 6
6404
6405 });//nextbutton5 click end
6406 },19*timesecond); //nextbutton 5
6407
6408 });//nextbutton4 click end
6409 },21*timesecond); //nextbutton 4
6410
6411 });//nextbutton3 click end
6412 },18*timesecond);//nextbutton 3
6413 });//nextbutton2 click end
6414 },13*timesecond);//nextbutton2
6415
6416 }); //nextbutton1 click end
6417 },26*timesecond); //nextbutton1
6418
6419 }); //halfscreen1 click end
6420 $( "#halfscreen2" ).click(function() { //START HALFSCREEN2
6421 $('#halfscreen2').addClass('choicy');
6422 $("#screenblocker").css('position','fixed').css('background','transparent').css('left','0').css('top','0').css('width','100%').css('height','100%').css('z-index','999999999999');
6423setTimeout(function(){
6424 $('#halfscreen1').css('display','none');
6425 $('#abcd').css('background','#000');
6426 $('#halfscreen2').fadeOut(3*timesecond);
6427 },3*timesecond);
6428 setTimeout(function(){
6429 $("#screenblocker").css('display','none');
6430 },7*timesecond);
6431// $('#halfscreen1').fadeIn(5*timesecond);
6432 setTimeout(function(){
6433 $('body2').html(`<div class="slide" id="slide1"><div class="row"><img class="imagy" id="helpimage1" src="https://i.imgur.com/zxLAfAy.png"></img></br><div class="text" id="helptext1">Hey there! My name's David "River" Bridebride. I'm a hard-working Livecountingville citizen, just like you.</div></br><div class="text" id="helptext2">Listen, I understand your problems. I was in your shoes too. Who were you just talking to?</div></br></div><div class="nextbutton" id="nextbutton1">>>NEXT</div></div>`);
6434 Styles.add(`.imagy {max-width:70%;} .nextbutton {position: fixed;left: 87%;top: 87%;background: white;padding: 5px;color: black;font-size: 24px;cursor: pointer;visibility: hidden;} .slide {background: #000; color: #fff;}`);
6435
6436 $('#helpimage1').css('visibility','hidden');
6437 $('#helptext1').css('visibility','hidden');
6438 $('#helptext2').css('visibility','hidden');
6439 },9*timesecond);
6440 setTimeout(function(){
6441 $('#helpimage1').css('visibility','visible').hide().fadeIn(1*timesecond);
6442 },9*timesecond);
6443 setTimeout(function(){
6444 $('#helptext1').css('visibility','visible').hide().fadeIn(1*timesecond);
6445 },14*timesecond);
6446 setTimeout(function(){
6447 $('#helptext2').css('visibility','visible').hide().fadeIn(1*timesecond);
6448 },19*timesecond);
6449 setTimeout(function(){
6450 $('#nextbutton1').css('visibility','visible').hide().fadeIn(1*timesecond);
6451 $( "#nextbutton1" ).click(function() {
6452 $('#helpimage1').fadeOut(1*timesecond);
6453 $('#helptext1').fadeOut(1*timesecond);
6454 $('#helptext2').fadeOut(1*timesecond);
6455 $('#nextbutton1').fadeOut(1*timesecond);
6456 setTimeout(function(){
6457 $('body2').html(`<div class="slide" id="slide2"><div class="row"><img class="imagy" id="helpimage2" src="https://i.imgur.com/JyrPgUL.png"></img></br><div class="text" id="helptext3">Did they look something like this? This is a picture of my old boss.</div></br><div class="text" id="helptext3p5">He's been obsessed with me lately. I'm beginning to become worried.</div></br></div><div class="nextbutton" id="nextbutton2">>>NEXT</div></div>`);
6458 $('#helpimage2').css('visibility','hidden');
6459 $('#helptext3').css('visibility','hidden');
6460 $('#helptext3p5').css('visibility','hidden');
6461 },1*timesecond);
6462 setTimeout(function(){
6463 $('#helpimage2').css('visibility','visible').hide().fadeIn(1*timesecond);
6464 },3*timesecond);
6465 setTimeout(function(){
6466 $('#helptext3').css('visibility','visible').hide().fadeIn(1*timesecond);
6467 },6*timesecond);
6468 setTimeout(function(){
6469 $('#helptext3p5').css('visibility','visible').hide().fadeIn(1*timesecond);
6470 },11*timesecond);
6471 setTimeout(function(){
6472 $('#nextbutton2').css('visibility','visible').hide().fadeIn(1*timesecond);
6473/////NEW CLICK
6474 $( "#nextbutton2" ).click(function() {
6475 $('#helpimage2').fadeOut(1*timesecond);
6476 $('#helptext3').fadeOut(1*timesecond);
6477 $('#nextbutton2').fadeOut(1*timesecond);
6478 setTimeout(function(){
6479 $('body2').html(`
6480<div class="slide" id="slide3">
6481<div class="row">
6482<img class="imagy" id="helpimage3" src="https://i.imgur.com/UOUEHRo.png"></img>
6483</br>
6484<div class="text" id="helptext4">
6485He is a corrupt bankowner who cannot deal with the fact that he has competition.
6486</div>
6487</br>
6488<div class="text" id="helptext5">
6489Please don't trust the baseless conspiracy theories he's been putting out about me or my business.
6490</div>
6491</br>
6492</div>
6493<div class="nextbutton" id="nextbutton3">>>NEXT</div></div>`);
6494
6495 $('#helpimage3').css('visibility','hidden');
6496 $('#helptext4').css('visibility','hidden');
6497 $('#helptext5').css('visibility','hidden');
6498 },1*timesecond);
6499 setTimeout(function(){
6500 $('#helpimage3').css('visibility','visible').hide().fadeIn(1*timesecond);
6501 },3*timesecond);
6502 setTimeout(function(){
6503 $('#helptext4').css('visibility','visible').hide().fadeIn(1*timesecond);
6504 },6*timesecond);
6505 setTimeout(function(){
6506 $('#helptext5').css('visibility','visible').hide().fadeIn(1*timesecond);
6507 },11*timesecond);
6508 setTimeout(function(){
6509 $('#nextbutton3').css('visibility','visible').hide().fadeIn(1*timesecond);
6510/////NEW CLICK BUTTON 3
6511 $( "#nextbutton3" ).click(function() {
6512 $('#helpimage3').fadeOut(1*timesecond);
6513 $('#helptext4').fadeOut(1*timesecond);
6514 $('#helptext5').fadeOut(1*timesecond);
6515 $('#nextbutton3').fadeOut(1*timesecond);
6516 setTimeout(function(){
6517 $('body2').html(`
6518<div class="slide" id="slide4">
6519<div class="row">
6520<img class="imagy" id="helpimage4" src="https://i.imgur.com/JrmYPjQ.png"></img>
6521</br>
6522<div class="text" id="helptext6">
6523His name is Daniel Top, and he should be in jail. I helped with many technological aspects of his bank, like creating an app. It became much more convenient.
6524</div>
6525</br>
6526<div class="text" id="helptext7">
6527Daniel never did any work. He always pestered me to do it.
6528</div>
6529</br>
6530<div class="text" id="helptext8">
6531So I quit and started my own bank.
6532</div>
6533</br>
6534</div>
6535<div class="nextbutton" id="nextbutton4">>>NEXT</div></div>`);
6536
6537 $('#helpimage4').css('visibility','hidden');
6538 $('#helptext6').css('visibility','hidden');
6539 $('#helptext7').css('visibility','hidden');
6540 $('#helptext8').css('visibility','hidden');
6541 },1*timesecond);
6542 setTimeout(function(){
6543 $('#helpimage4').css('visibility','visible').hide().fadeIn(1*timesecond);
6544 },3*timesecond);
6545
6546 setTimeout(function(){
6547 $('#helptext6').css('visibility','visible').hide().fadeIn(1*timesecond);
6548 },6*timesecond);
6549
6550 setTimeout(function(){
6551 $('#helptext7').css('visibility','visible').hide().fadeIn(1*timesecond);
6552 },11*timesecond);
6553
6554 setTimeout(function(){
6555 $('#helptext8').css('visibility','visible').hide().fadeIn(1*timesecond);
6556 },16*timesecond);
6557
6558 setTimeout(function(){
6559 $('#nextbutton4').css('visibility','visible').hide().fadeIn(1*timesecond);
6560/////NEW CLICK BUTTON 4
6561 $( "#nextbutton4" ).click(function() {
6562 $('#helpimage4').fadeOut(1*timesecond);
6563 $('#helptext6').fadeOut(1*timesecond);
6564 $('#helptext7').fadeOut(1*timesecond);
6565 $('#helptext8').fadeOut(1*timesecond);
6566 $('#nextbutton4').fadeOut(1*timesecond);
6567 setTimeout(function(){
6568 $('body2').html(`
6569<div class="slide" id="slide5">
6570<div class="row">
6571<img class="imagy" id="helpimage5" src="https://i.imgur.com/KBDWaOt.png"></img>
6572</br>
6573<div class="text" id="helptext9">
6574His bank began to struggle after I left. I had moved away from Countingston and my bank was doing great... up until recently.
6575</div>
6576</br>
6577<div class="text" id="helptext10">
6578A short while ago, David broke into my bank and physically shot my hardware. I lost everything. If he couldn't be successful, no one could.
6579</div>
6580</br>
6581</div>
6582<div class="nextbutton" id="nextbutton5">>>NEXT</div></div>`);
6583
6584 $('#helpimage5').css('visibility','hidden');
6585 $('#helptext9').css('visibility','hidden');
6586 $('#helptext10').css('visibility','hidden');
6587 },1*timesecond);
6588 setTimeout(function(){
6589 $('#helpimage5').css('visibility','visible').hide().fadeIn(1*timesecond);
6590 },3*timesecond);
6591
6592 setTimeout(function(){
6593 $('#helptext9').css('visibility','visible').hide().fadeIn(1*timesecond);
6594 },6*timesecond);
6595
6596 setTimeout(function(){
6597 $('#helptext10').css('visibility','visible').hide().fadeIn(1*timesecond);
6598 },12*timesecond);
6599
6600 setTimeout(function(){
6601 $('#nextbutton5').css('visibility','visible').hide().fadeIn(1*timesecond);
6602/////NEW CLICK BUTTON 5
6603 $( "#nextbutton5" ).click(function() {
6604 $('#helpimage5').fadeOut(1*timesecond);
6605 $('#helptext9').fadeOut(1*timesecond);
6606 $('#helptext10').fadeOut(1*timesecond);
6607 $('#nextbutton5').fadeOut(1*timesecond);
6608 setTimeout(function(){
6609 $('body2').html(`
6610<div class="slide" id="slide6">
6611<div class="row">
6612<img class="imagy" id="helpimage6" src="https://i.imgur.com/yM7Mh51.png"></img>
6613</br>
6614<div class="text" id="helptext11">
6615As it turns out, Mr. Top has developed a wild conspiracy theory about me stealing from his bank to fund my own. He even blabbles about technological terms he knows nothing about.
6616</div>
6617</br>
6618<div class="text" id="helptext12">
6619It's absolute lunacy. I'm sorry his bank isn't doing great, but he's crossed the line. I've got to do something about this.
6620</div>
6621</br>
6622</div>
6623<div class="nextbutton" id="nextbutton6">>>NEXT</div></div>`);
6624
6625 $('#helpimage6').css('visibility','hidden');
6626 $('#helptext11').css('visibility','hidden');
6627 $('#helptext12').css('visibility','hidden');
6628 },1*timesecond);
6629 setTimeout(function(){
6630 $('#helpimage6').css('visibility','visible').hide().fadeIn(1*timesecond);
6631 },3*timesecond);
6632
6633 setTimeout(function(){
6634 $('#helptext11').css('visibility','visible').hide().fadeIn(1*timesecond);
6635 },6*timesecond);
6636
6637 setTimeout(function(){
6638 $('#helptext12').css('visibility','visible').hide().fadeIn(1*timesecond);
6639 },16*timesecond);
6640
6641 setTimeout(function(){
6642 $('#nextbutton6').css('visibility','visible').hide().fadeIn(1*timesecond);
6643/////NEW CLICK BUTTON 6
6644 $( "#nextbutton6" ).click(function() {
6645 $('#helpimage6').fadeOut(1*timesecond);
6646 $('#helptext11').fadeOut(1*timesecond);
6647 $('#helptext12').fadeOut(1*timesecond);
6648 $('#nextbutton6').fadeOut(1*timesecond);
6649 setTimeout(function(){
6650 $('body2').html(`
6651<div class="slide" id="slide7">
6652<div class="row">
6653<img class="imagy" id="helpimage7" src="https://i.imgur.com/GiVMOgO.png"></img>
6654</br>
6655<div class="text" id="helptext13">
6656Recently, Daniel Top has been going around to various members of Livecountingville to try to convince them to join his "revolution."
6657</div>
6658</br>
6659<div class="text" id="helptext14">
6660I'm guessing he asked you to do the same. Thank you for choosing not to help him. I hope you're considering helping me escape this mess.
6661</div>
6662</br>
6663</div>
6664<div class="nextbutton" id="nextbutton7">>>NEXT</div></div>`);
6665
6666 $('#helpimage7').css('visibility','hidden');
6667 $('#helptext13').css('visibility','hidden');
6668 $('#helptext14').css('visibility','hidden');
6669 },1*timesecond);
6670 setTimeout(function(){
6671 $('#helpimage7').css('visibility','visible').hide().fadeIn(1*timesecond);
6672 },3*timesecond);
6673
6674 setTimeout(function(){
6675 $('#helptext13').css('visibility','visible').hide().fadeIn(1*timesecond);
6676 },6*timesecond);
6677
6678 setTimeout(function(){
6679 $('#helptext14').css('visibility','visible').hide().fadeIn(1*timesecond);
6680 },14*timesecond);
6681
6682 setTimeout(function(){
6683 $('#nextbutton7').css('visibility','visible').hide().fadeIn(1*timesecond);
6684/////NEW CLICK BUTTON 7
6685 $( "#nextbutton7" ).click(function() {
6686 $('#helpimage7').fadeOut(1*timesecond);
6687 $('#helptext13').fadeOut(1*timesecond);
6688 $('#helptext14').fadeOut(1*timesecond);
6689 $('#nextbutton7').fadeOut(1*timesecond);
6690 setTimeout(function(){
6691 $('body2').html(`
6692<div class="slide" id="slide8">
6693<div class="row">
6694<img class="imagy" id="helpimage8" src="https://i.imgur.com/wzmAW6e.png"></img>
6695</br>
6696<div class="text" id="helptext15">
6697I'm establishing a coalition of Riverbot supporters to help start the bot again and revitalize the Livecountingville community.
6698</div>
6699</br>
6700<div class="text" id="helptext16">
6701I can't reward you right now, but we need to fight for justice. But first, we need a secure method of communication.
6702</div>
6703</br>
6704</div>
6705<div class="nextbutton" id="nextbutton8">>>NEXT</div></div>`);
6706
6707 $('#helpimage8').css('visibility','hidden');
6708 $('#helptext15').css('visibility','hidden');
6709 $('#helptext16').css('visibility','hidden');
6710 },1*timesecond);
6711 setTimeout(function(){
6712 $('#helpimage8').css('visibility','visible').hide().fadeIn(1*timesecond);
6713 },3*timesecond);
6714
6715 setTimeout(function(){
6716 $('#helptext15').css('visibility','visible').hide().fadeIn(1*timesecond);
6717 },6*timesecond);
6718
6719 setTimeout(function(){
6720 $('#helptext16').css('visibility','visible').hide().fadeIn(1*timesecond);
6721 },13*timesecond);
6722
6723 setTimeout(function(){
6724 $('#nextbutton8').css('visibility','visible').hide().fadeIn(1*timesecond);
6725/////NEW CLICK BUTTON 8
6726 $( "#nextbutton8" ).click(function() {
6727 $('#helpimage8').fadeOut(1*timesecond);
6728 $('#helptext15').fadeOut(1*timesecond);
6729 $('#helptext16').fadeOut(1*timesecond);
6730 $('#nextbutton8').fadeOut(1*timesecond);
6731 setTimeout(function(){
6732 $('body2').html(`
6733<div class="slide" id="slide9">
6734<div class="row">
6735<img class="imagy" id="helpimage9" src="https://i.imgur.com/wJG4bub.png"></img>
6736</br>
6737<div class="text" id="helptext17">
6738You will now be redirected to a verification system to ensure your loyalty to me. Hopefully you'll be able to make it through. If you get stuck, just think.
6739</div>
6740</br>
6741<div class="text" id="helptext18">
6742Best of luck, and I hope to see you soon.
6743</div>
6744</br>
6745</div>
6746<div class="nextbutton" id="nextbutton9">>>NEXT</div></div>`);
6747
6748 $('#helpimage9').css('visibility','hidden');
6749 $('#helptext17').css('visibility','hidden');
6750 $('#helptext18').css('visibility','hidden');
6751 },1*timesecond);
6752 setTimeout(function(){
6753 $('#helpimage9').css('visibility','visible').hide().fadeIn(1*timesecond);
6754 },3*timesecond);
6755
6756 setTimeout(function(){
6757 $('#helptext17').css('visibility','visible').hide().fadeIn(1*timesecond);
6758 },6*timesecond);
6759
6760 setTimeout(function(){
6761 $('#helptext18').css('visibility','visible').hide().fadeIn(1*timesecond);
6762 },13*timesecond);
6763
6764 setTimeout(function(){
6765 $('#nextbutton9').css('visibility','visible').hide().fadeIn(1*timesecond);
6766/////NEW CLICK BUTTON 9
6767 $( "#nextbutton9" ).click(function() {
6768 $('#helpimage9').fadeOut(1*timesecond);
6769 $('#helptext17').fadeOut(1*timesecond);
6770 $('#helptext18').fadeOut(1*timesecond);
6771 $('#nextbutton9').fadeOut(1*timesecond);
6772 function disblr(id){
6773 document.getElementById('passwordbutton1').disabled = true;
6774 setTimeout(function(){document.getElementById('passwordbutton1').disabled = false;},2*timesecond);
6775 }
6776 setTimeout(function(){
6777 $('body2').html(`
6778<div class="slide" id="slide10" style="background:black;color:#00F;">
6779<div class="row">
6780<div class="text" id="helptext19">
6781VERIFICATION REQUIRED</br>ENTER PASSWORD
6782</div>
6783</br>
6784<input class="inputry" id="inputry1">
6785</input>
6786</br>
6787</br>
6788<button id="passwordbutton1" onClick="disblr()">
6789SUBMIT
6790</button>
6791</br>
6792</br>
6793<div class="text" id="helptext20">
6794ERROR: PASSWORD IS INCORRECT
6795</div>
6796</br>
6797</div>
6798`);
6799document.getElementById("passwordbutton1").addEventListener("click", disblr);
6800 $('.row').css('visibility','hidden');
6801 $('#helptext19').css('visibility','hidden');
6802 $('#inputry1').css('visibility','hidden');
6803 $('#passwordbutton1').css('visibility','hidden');
6804 $('#helptext20').css('visibility','hidden').css('color','red');
6805 },1*timesecond);
6806 setTimeout(function(){
6807 $('.row').css('visibility','visible').hide().fadeIn(1*timesecond);
6808 },2*timesecond);
6809 setTimeout(function(){
6810 $('#helptext19').css('visibility','visible').hide().fadeIn(1*timesecond);
6811 },2*timesecond);
6812 setTimeout(function(){
6813 $('#inputry1').css('visibility','visible').hide().fadeIn(1*timesecond);
6814 },2*timesecond);
6815 setTimeout(function(){
6816 $('#passwordbutton1').css('visibility','visible').hide().fadeIn(1*timesecond);
6817 $( "#passwordbutton1" ).click(function() {
6818 if(document.getElementById('inputry1').value != "INCORRECT") {
6819 $('#helptext20').css('visibility','visible').hide().fadeIn(000*timesecond);
6820 setTimeout(function(){
6821 $('#helptext20').fadeOut(000*timesecond,function(){$('#helptext20').css("visibility","hidden").css("display","");});
6822 },.5*timesecond);
6823 setTimeout(function(){
6824 $('#helptext20').css('visibility','visible').hide().fadeIn(000*timesecond);
6825 },1*timesecond);
6826 setTimeout(function(){
6827 $('#helptext20').fadeOut(000*timesecond,function(){$('#helptext20').css("visibility","hidden").css("display","");});
6828 },1.5*timesecond);
6829//
6830 } else {
6831$('body2').html(`
6832<div class="slide" id="slide11" style="background:black;color:#00F;">
6833<div class="row">
6834<div class="text" id="helptext21">
6835ACCESS GRANTED
6836</br>
6837WELCOME `+USER.toUpperCase()+`
6838</div>
6839</div>
6840</div>
6841`);
6842 setTimeout(function(){
6843 $('#helptext21').text(`LOADING SECURE NETWORK PROTOCOLS`);
6844 },4*timesecond);
6845 setTimeout(function(){
6846 $('#helptext21').text(`IPv6 ADDRESS`);
6847 },6*timesecond);
6848 setTimeout(function(){
6849 $('#helptext21').text(`IPv6 ADDRESS 127.0.0.1 DONE`);
6850 },6.3*timesecond);
6851 setTimeout(function(){
6852 $('#helptext21').text(`LOADING SSL`);
6853 },6.5*timesecond);
6854 setTimeout(function(){
6855 $('#helptext21').text(`LOADING SSL DONE`);
6856 },6.8*timesecond);
6857 setTimeout(function(){
6858 $('#helptext21').text(`PERFORMING TLS HANDSHAKE`);
6859 },7*timesecond);
6860 setTimeout(function(){
6861 $('#helptext21').text(`PERFORMING TLS HANDSHAKE DONE`);
6862 },7.3*timesecond);
6863 setTimeout(function(){
6864 $('#helptext21').text(`LOADING DATA PACKETS`);
6865 },7.5*timesecond);
6866 setTimeout(function(){
6867 $('#helptext21').text(`LOADING DATA PACKETS DONE`);
6868 },7.8*timesecond);
6869 setTimeout(function(){
6870 $('#helptext21').text(`SECURE NETWORK PROTOCOLS SUCCESSFULLY LOADED`);
6871 },8*timesecond);
6872 setTimeout(function(){
6873 $('body2').html(`
6874<div class="slide" id="slide12" style="background:black;color:#00F;">
6875<div class="row">
6876<div class="text" id="helptext22">
6877YOU HAVE ONE NEW MESSAGE
6878</div>
6879</div>
6880</div>
6881`);
6882 },11*timesecond);
6883 setTimeout(function(){
6884 $('body2').html(`
6885<div class="slide" id="slide13" style="background:black;color:#00F;">
6886<div class="row">
6887<div class="text" id="helptext23">
6888Opening
6889</div>
6890</div>
6891</div>
6892`);
6893 },15*timesecond);
6894 setTimeout(function(){
6895 $('#helptext23').text(`Opening .`);
6896 },16*timesecond);
6897 setTimeout(function(){
6898 $('#helptext23').text(`Opening . .`);
6899 },17*timesecond);
6900 setTimeout(function(){
6901 $('#helptext23').text(`Opening . . .`);
6902 },18*timesecond);
6903 setTimeout(function(){
6904 $('body2').html(`
6905<div class="slide" id="slide14" style="background:black;color:#00F;">
6906<div class="row">
6907<div class="text" id="helptext24">
6908MESSAGE FROM: River
6909</br>
6910</br>
6911Please visit https://www.reddit.com/live/ta535s1hq2je/#riverbot in a new tab and copy and paste the following into the chat:
6912</br>
6913<input type="text" id="graphite" value="^^^^^^^^^^^^^^^^nochat ^^^^^^^^^^^^^^^^^join Hey">
6914</br>
6915This will allow our coalition to communicate going forwards. Thank you for choosing to help!
6916</br>
6917</br>
6918END MESSAGE
6919</div>
6920</div>
6921</div>
6922`);
6923 document.getElementById("graphite").readOnly = true;
6924 $('#graphite').css('width','500px');
6925 },19*timesecond);
6926 } //password1 correct end
6927 }); //password1 click end
6928 },2*timesecond);
6929
6930
6931 });//nextbutton9 click end
6932 },20*timesecond); //nextbutton 9
6933
6934 });//nextbutton8 click end
6935 },20*timesecond); //nextbutton 8
6936
6937 });//nextbutton7 click end
6938 },21*timesecond); //nextbutton 7
6939
6940 });//nextbutton6 click end
6941 },26*timesecond); //nextbutton 6
6942
6943 });//nextbutton5 click end
6944 },19*timesecond); //nextbutton 5
6945
6946 });//nextbutton4 click end
6947 },21*timesecond); //nextbutton 4
6948
6949 });//nextbutton3 click end
6950 },18*timesecond);//nextbutton 3
6951 });//nextbutton2 click end
6952 },16*timesecond);//nextbutton2
6953
6954 }); //nextbutton1 click end
6955 },26*timesecond); //nextbutton1
6956 }); //halfscreen2 click end
6957 },timeygo); //end of setTimeout for halfscreen1/2
6958 timeygo = timeygo + 5*timesecond;
6959},4.5*timesecond);
6960
6961});
6962
6963},8*timesecond); //post 2
6964
6965
6966 }
6967 },2*timesecond); // end settimeout checking for if discusions
6968
6969} //end april2020=16
6970
6971/////////////////////april 2020 16
6972
6973
6974/////////////////////END APRIL FOOLS 2020 april2020
6975
6976
6977
6978
6979//////////////////////APRIL FOOLS VARIABLE
6980
6981//aprilbools = -1;
6982
6983
6984
6985
6986if (window.location.href.toLowerCase().indexOf("?") == -1 && window.location.href.toLowerCase().indexOf("ta535s1hq2je") > -1 ) {
6987foolsprob = Math.floor(Math.random() * 100) + 1;
6988if (0 < foolsprob && foolsprob < 36) {
6989aprilbools = 1;
6990foolsprobt = ' (35%)';
6991} else if (35 < foolsprob && foolsprob < 51) {
6992aprilbools = 2;
6993foolsprobt = ' (15%)';
6994} else if (50 < foolsprob && foolsprob < 66) {
6995aprilbools = 3;
6996foolsprobt = ' (15%)';
6997} else if (65 < foolsprob && foolsprob < 71) {
6998aprilbools = 4;
6999foolsprobt = ' (5%)';
7000} else if (70 < foolsprob && foolsprob < 81) {
7001aprilbools = 5;
7002foolsprobt = ' (10%)';
7003} else if (80 < foolsprob && foolsprob < 91) {
7004aprilbools = 6;
7005foolsprobt = ' (10%)';
7006} else if (90 < foolsprob && foolsprob < 100) {
7007aprilbools = 7;
7008foolsprobt = ' (9%)';
7009} else if (100 == foolsprob) {
7010aprilbools = 8;
7011foolsprobt = ' (1%)';
7012}
7013
7014
7015
7016} else {
7017aprilbools = 2;
7018}
7019
7020
7021if (aprilbools2 == false || window.location.href.toLowerCase().indexOf("ta535s1hq2je") == -1 || window.location.href.toLowerCase().indexOf("discussions") > -1 || window.location.href.toLowerCase().indexOf("edit") > -1 || window.location.href.toLowerCase().indexOf("contributors") > -1 || window.location.href.toLowerCase().indexOf("updates") > -1) {
7022aprilbools = 0;
7023foolsprobt = '';
7024} else {
7025$('#lceversion').text(`Live Counting Extension v1.6.`+aprilbools);
7026$('#liveupdate-description .md p').append(`<span> [Live Counting `+aprilbools+foolsprobt+`]</span>`);
7027}
7028
7029if (aprilbools2 == false) {
7030aprilbools = 0;
7031}
7032
7033
7034//////////////////////APRIL FOOLS VARIABLE
7035
7036
7037/////////////////////april fools 2
7038if (0 < aprilbools && aprilbools < 9) {
7039if (aprilbools == 2 || window.location.href.toLowerCase().indexOf("initial") > -1) {$('#liveupdate-title').text(`Congrats on getting this special april fools thing. This one is a puzzle, and you will put your answers in the URL. To start, add ?start to the end of the URL, and load the page.`);$('#liveupdate-title').css('background', 'lightblue');}if(window.location.href.toLowerCase().indexOf("?") > -1 && window.location.href.toLowerCase().indexOf("initial") == -1) {$('#liveupdate-title').text(`Incorrect. Go back. (If you do not know what this is, add "?initial" to the URL.)`);}if(window.location.href.toLowerCase().indexOf("start") > -1) {$('#liveupdate-title').text(`Congrats on reaching LEVEL 1. To get to level 2... what was the last name of the first president of the US? Replace the word "start" in the URL with your answer.`);}if(window.location.href.toLowerCase().indexOf("washington") > -1) {$('#liveupdate-title').text(`You have reached LEVEL 2. Next question... in 2013, Team Orangered defeated Team _____?`);}if(window.location.href.toLowerCase().indexOf("periwinkle") > -1) {$('#liveupdate-title').text(`LEVEL 3. Who was the first admin to count in this thread?`);}if(window.location.href.toLowerCase().indexOf("alienth") > -1) {$('#liveupdate-title').text(`LEVEL 4. What is the word for the sore feeling you get in your left pinkie following the excessive use of the "ctrl" key?`);}if(window.location.href.toLowerCase().indexOf("hyptoheicla") > -1) {$('#liveupdate-title').text(`LEVEL 5!!! What was the name of the account that /u/NobodyL0vesMe ran with in his fastest run, a 5:11?`);}if(window.location.href.toLowerCase().indexOf("endcountingdrama2019") > -1) {$('#liveupdate-title').text(`LEVEL 6. Fill in the blank: ________ FOUND ON MARS. Hint: You need to put a space in your answer.`);}if(window.location.href.toLowerCase().indexOf("despacito%202") > -1) {$('#liveupdate-title').text(`LEVEL ?. Type out what the NEXT level is.`);}if(window.location.href.toLowerCase().indexOf("eight") > -1) {$('#liveupdate-title').text(`LEVEL 8. What is the name of the website that noduorg is from?`);}if(window.location.href.toLowerCase().indexOf("thestudentroom") > -1) {$('#liveupdate-title').text(`LEVEL 9. For every speed record after sub-10 was reached, /u/davidjl123 has been a part of each of them, except one. Who did /u/Tranquilsunrise run with to achieve a record 8:20?`);}if(window.location.href.toLowerCase().indexOf("gordonpt8") > -1) {$('#liveupdate-title').text(`LEVEL 10. Who was the first user to get a 1 second reply in /r/counting?`);}if(window.location.href.toLowerCase().indexOf("morallygray") > -1) {$('#liveupdate-title').text(`LEVEL 11. Which counter was the FIRST to include the phrase "not found" when posting a 404?`);}if(window.location.href.toLowerCase().indexOf("rschaosid") > -1) {$('#liveupdate-title').text(`LEVEL 12. Who does dominodan describe as "an iconic pre-revival LC counter who we know next to nothing about and used to use passing in HoC as a sort of coming-of-age"?`);}if(window.location.href.toLowerCase().indexOf("grunf") > -1) {$('#liveupdate-title').text(`LEVEL 13. What month did the first tie for most counts in a day happen?`);}if(window.location.href.toLowerCase().indexOf("june") > -1) {$('#liveupdate-title').text(`LEVEL 14. 01010111 01101000 01100001 01110100 00100000 01100010 01100001 01100011 01101111 01101110 01110011 00100000 01100001 01110100 00100000 01101101 01101001 01100100 01101110 01101001 01100111 01101000 01110100 00111111`);}if(window.location.href.toLowerCase().indexOf("narwhal") > -1) {$('#liveupdate-title').text(`LEVEL 15. Who won separator week? This answer also has a space in it. `);}if(window.location.href.toLowerCase().indexOf("team%20comma") > -1) {$('#liveupdate-title').text(`LEVEL 16. VGhpcyBpcyBiYXNlIDY0LiBUaGlzIHdlYnNpdGUgbWlnaHQgYmUgdXNlZnVsIGZvciB5b3U6IGh0dHA6Ly9ydW1raW4uY29tL3Rvb2xzL2NpcGhlci9jYWVzYXIta2V5ZWQucGhwCgpBbnl3YXksIHRvIGdldCB0byBsZXZlbCAxNywgZ28gdG8gdGhhdCB3ZWJzaXRlIGFuZCBlbnRlciAibGl2ZWNvdW50aW5nIiBhcyB0aGUga2V5LiBUaGVuLCBpbiB0aGUgYm94LCBlbnRlciB0aGUgdXNlcm5hbWUgKG5vIC91Lykgb2YgRWxsZW4gUGFvJ3MgcmVkZGl0IGFjY291bnQuIA==`);}if(window.location.href.toLowerCase().indexOf("cagj") > -1) {$('#liveupdate-title').text(`LEVEL 17. cagj. Vhmmcvq. To yhr lmc mcletfu qntp, uhhe ghi. Haly, qnc fcxq lfpwcm wtbb grpq ic fhmdlb qcxq. Wnlq ohhe tp /r/EH_R_CSF_PJLUNCQQT oldhrp ohm clqtfu?`);}if(window.location.href.toLowerCase().indexOf("rice") > -1) {$('#liveupdate-title').text(`LEVEL 18. You've almost made it. I'm trying to make the final question more obscure. This one is from a historic reddit comment. Thirteen years from now, what will be the first name of the first draft pick in the NFL?`);}if(window.location.href.toLowerCase().indexOf("streetlamp") > -1) {$('#liveupdate-title').text(`LEVEL 19. Congratulations, you've finished this puzzle. I don't know if anyone will actually finish this (with or without cheating). Welp, hope you had fun. `);}
7040}
7041/////////////////////april fools 2
7042
7043
7044
7045/////////////////////april fools 3
7046if (aprilbools == 3) {
7047var animationLength = 20000; //ms
7048
7049var counter = 7,
7050 counterEnd = 200000,
7051 countInterval = animationLength / counterEnd, // ms,
7052 a = 100; //speed factor
7053
7054var summatory = 0;
7055
7056function animate() {
7057 $('.viewer-count').text(counter++ + ' viewers');
7058 if (counter <= counterEnd) {
7059
7060 //that's the formula:
7061 var newInterval = (animationLength-summatory) / ( (a - Math.pow(a, -(counterEnd-1))) / (a-1))
7062
7063 summatory += newInterval;
7064 countInterval = newInterval;
7065 setTimeout(animate, newInterval);
7066 }
7067}
7068
7069animate();
7070}
7071
7072/////////////////////april fools 3
7073
7074
7075
7076/////////////////////april fools 4
7077
7078if (aprilbools == 4) {
7079
7080$("button.btn").text("I didn't like this one so I removed it. You're welcome.");
7081
7082}
7083
7084/////////////////////april fools 4
7085
7086
7087/////////////////////april fools 7
7088
7089if (aprilbools == 7) {
7090
7091$("button.btn").text("Sorry pika...");
7092
7093$("button.btn").delay(10000).hide(2500);
7094
7095}
7096
7097/////////////////////april fools 7
7098
7099///////////////april fools 8
7100
7101if (aprilbools == 8) {
7102
7103Styles.add(`.deadupdate {background:#eee;}`);
7104
7105
7106setTimeout(function(){
7107$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p><a href="/user/`+USER+`" rel="nofollow">/u/`+USER+`</a> <em>has joined this thread</em></p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7108 },7000);
7109setTimeout(function(){
7110$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>No really, <a href="/user/`+USER+`" rel="nofollow">/u/`+USER+`</a> <em>has joined this thread</em></p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7111 },27000);
7112setTimeout(function(){
7113$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Wait, <a href="/user/`+USER+`" rel="nofollow">/u/`+USER+`</a> is... <em>you?</em></p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7114 },47000);
7115
7116setTimeout(function(){
7117$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Listen, <a href="/user/`+USER+`" rel="nofollow">/u/`+USER+`</a>. I am the join bot. I make the rules. Not you.</p><p>I'm talking to you and you only. No one can see me except you.</p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7118 },67000);
7119
7120setTimeout(function(){
7121$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>I am the god of Live Counting. Do you dare challenge the word of your god, <a href="/user/`+USER+`" rel="nofollow">/u/`+USER+`</a>?</p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7122 },87000);
7123
7124
7125setTimeout(function(){
7126$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>The god of LC giveth, and the god of LC taketh away. This time, I taketh away.</p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7127$("#new-update-form").hide(2500);
7128 },107000);
7129
7130
7131setTimeout(function(){
7132$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Eh. I would get pretty lonely if no one could post. So I giveth again. </p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7133$("#new-update-form").show(2500);
7134 },127000);
7135
7136setTimeout(function(){
7137$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>I offer you a choice. Join me, and become a god of Live Counting. Or, betray me, and face my wrath.</p><p><button id="apriljoin">JOIN</button><button id="aprilbetray">BETRAY</button></p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7138$( "#apriljoin" ).click(function() {
7139$( "#apriljoin" ).hide();
7140$( "#aprilbetray" ).hide();
7141$("html").prepend("<body2 id=abcd></body2>");
7142$('body').fadeOut(10000);
7143setTimeout(function(){
7144$('body').fadeIn(10000);
7145 },10000);
7146
7147setTimeout(function(){
7148$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Does anything feel different?</p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7149 },40000);
7150setTimeout(function(){
7151$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Nothing is different. Not even you.</p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7152 },60000);
7153setTimeout(function(){
7154$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Well, this is underwhelming. </p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7155 },80000);
7156setTimeout(function(){
7157$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Wait. I hear something.</p><p>Did you hear that? Listen closely... it sounds like it's getting louder.</p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7158 },100000);
7159setTimeout(function(){
7160$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Oh god. It's right behind me.</p><p>RUN</p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7161 },120000);
7162setTimeout(function(){
7163$('body').hide(5000);
7164 },130000);
7165setTimeout(function(){
7166$('#abcd').prepend("<iframe class=embed-responsive-item id=lcgod type=text/html width=100% height=100% src=https://www.youtube.com/embed/oHg5SJYRHA0?&autoplay=1&loop=1&rel=0&showinfo=0&color=white&iv_load_policy=3&playlist=oHg5SJYRHA0></iframe>");
7167 },140000);
7168
7169});
7170
7171
7172$( "#aprilbetray" ).click(function() {
7173$( "#apriljoin" ).hide();
7174$( "#aprilbetray" ).hide();
7175$("html").prepend("<body3 id=efgh></body3>");
7176$('#efgh').css('background','black');
7177$('body').fadeOut(10000);
7178setTimeout(function(){
7179Styles.add(`.deadupdate {background:red!important;} #lc-body {transform: rotate(2deg);background: purple;font-size: 20px;} #lc-body li.liveupdate * {transition: none;color: yellow;font-family: Comic Sans MS;} div.content {background: blue;}#new-update-form .usertext .usertext-edit textarea {color: red;font-size: 20px;background: green;font-family: Comic Sans MS;}`);
7180$('body').fadeIn(10000);
7181 },10000);
7182
7183setTimeout(function(){
7184$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Welcome to LC Hell.</p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7185 },40000);
7186setTimeout(function(){
7187$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>This place is beautiful.</p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7188 },60000);
7189setTimeout(function(){
7190$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>I could do more. Or I could leave you with this disaster.</p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7191 },80000);
7192setTimeout(function(){
7193$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Yes, I can do many awful things. Like force you to use separators that aren't commas.</p><p>Wait. I have a better idea.</p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7194 },100000);
7195setTimeout(function(){
7196$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Okay.</p><p>Get ready.</p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7197 },120000);
7198setTimeout(function(){
7199$(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><p>Get it?</p><p>You expected something to happen. Nothing happened. Welp, I guess enjoy your stay in LC Hell. Maybe next time you'll choose to join me...</p></div><a href="/user/rideride" class="deadauthor" style="color: black;"> /u/join live counting</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>strike</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7200 },240000);
7201
7202});
7203
7204
7205 },147000);
7206
7207}
7208
7209///////////////april fools 8
7210
7211
7212///////////////
7213// Update.ts //
7214///////////////
7215var Update;
7216(function (Update) {
7217 // UTILITY
7218 // Get information about an update node
7219 function getUpdateInfo($node) {
7220 var data = {
7221 elem: $node,
7222 author: $node.find('.body > .author').text(),
7223 body_elem: $node.find('.body > .md'),
7224 author_elem: $node.find('.body > .author'),
7225 href_elem: $node.find('.body > .md > p > em > a')
7226 };
7227 if (data.author)
7228 data.author = data.author.trim().replace('/u/', '');
7229 return data;
7230 }
7231 // METHODS
7232 // Bind functions to execute in the following events:
7233 // - loadedNew(): When a new update is sent
7234 // - loadedOld(): When an old update is loaded
7235 // - striked(): When an update is striked
7236 // - TODO: deleted(): When an update is deleted
7237 // loaded from top (new updates sent)
7238 var funcLoadedTop = [];
7239 function loadedNew(func) {
7240 funcLoadedTop.push(func);
7241 }
7242 Update.loadedNew = loadedNew;
7243 // loaded from bottom (scrolled down to load old updates)
7244 var funcLoadedBottom = [];
7245 function loadedOld(func) {
7246 funcLoadedBottom.push(func);
7247 }
7248 Update.loadedOld = loadedOld;
7249 // striked
7250 var funcStriked = [];
7251 function striked(func) {
7252 funcStriked.push(func);
7253 }
7254 Update.striked = striked;
7255 // EVENTS
7256 // Setup MutationObserver on Elements.$updates
7257 var observer = new MutationObserver(function (mutations) {
7258 // Loop through MutationRecords and call the functions in various arrays based on .type
7259 // (Honestly the MutationRecord[] usually only contains one, but whatever)
7260 for (var _i = 0, mutations_1 = mutations; _i < mutations_1.length; _i++) {
7261 var mutation = mutations_1[_i];
7262 // Addition / removal of child elements
7263 // Executes loadedNew(), loadedOld(), deleted() functions accordingly
7264 if (mutation.type == 'childList') {
7265 // Setup variables for new updates or deleted updates
7266 var $addedNodes = $(mutation.addedNodes).filter('.liveupdate');
7267 var $removedNodes = $(mutation.removedNodes).filter('.liveupdate');
7268 // Loop through new updates (if any)
7269 $addedNodes.each(function (index, element) {
7270 var $node = $(element);
7271 if ($node.hasClass('preview'))
7272 return; // ignore preview messages (RemoveSubmissionLag.ts)
7273 // Get data about the new update
7274 var data = getUpdateInfo($node);
7275 // Check if the update was loaded from top or bottom
7276 // Execute loadedNew() or loadedOld() functions accordingly
7277 if ($node.index() == 0) {
7278 // Loaded from top
7279 // Execute loadedNew() functions
7280 for (var _i = 0, funcLoadedTop_1 = funcLoadedTop; _i < funcLoadedTop_1.length; _i++) {
7281 var func = funcLoadedTop_1[_i];
7282 func(data);
7283 }
7284 }
7285 else {
7286 // Loaded from bottom
7287 // Execute loadedOld() functions
7288 for (var _a = 0, funcLoadedBottom_1 = funcLoadedBottom; _a < funcLoadedBottom_1.length; _a++) {
7289 var func = funcLoadedBottom_1[_a];
7290 func(data);
7291 }
7292 }
7293 });
7294 }
7295 else if (mutation.type == 'attributes') {
7296 // Setup
7297 var $node = $(mutation.target);
7298 if (!(mutation.oldValue && $node.attr('class')))
7299 return;
7300 var oldClasses = mutation.oldValue.split(' ');
7301 var newClasses = $node.attr('class').split(' ');
7302 // Must be a .liveupdate element
7303 if (!$node.hasClass('liveupdate'))
7304 return;
7305 // Get data about the update
7306 var data = getUpdateInfo($node);
7307 // Check if the update had only now been stricken
7308 if (oldClasses.indexOf('stricken') == -1
7309 && newClasses.indexOf('stricken') > -1) {
7310 // Execute striked() functions
7311 for (var _a = 0, funcStriked_1 = funcStriked; _a < funcStriked_1.length; _a++) {
7312 var func = funcStriked_1[_a];
7313 func(data);
7314 }
7315 }
7316 }
7317 }
7318 });
7319 observer.observe(Elements.$updates.get(0), {
7320 // observe for insertion / removal of children updates
7321 childList: true,
7322 // observe for change in the 'class' attribute value
7323 attributes: true,
7324 attributeOldValue: true,
7325 attributeFilter: ['class'],
7326 // observe for these changes (particularly attributes changes) in descendants
7327 subtree: true
7328 });
7329})(Update || (Update = {}));
7330//////////////////
7331// CtrlEnter.ts //
7332//////////////////
7333var CtrlEnter;
7334(function (CtrlEnter) {
7335 // INITIALIZATION
7336 var enabled = true;
7337 var $textarea = $('#new-update-form textarea');
7338 var $submitBtn = $('#new-update-form .save-button button');
7339 // RES already has a ctrl-enter feature since v4.7.8
7340 // Skip remaining actions if using a version higher than that
7341 var $resVersion = $('#RESConsoleVersion');
7342 if ($resVersion.length > 0 && +($resVersion.text().replace(/\D/g, '')) >= 478)
7343 enabled = false;
7344 // Bind keydown event to the textarea
7345 if (enabled) {
7346 $textarea.on('keydown', function (e) {
7347 if (e.keyCode == 13 && (e.ctrlKey || e.metaKey)) {
7348 e.preventDefault();
7349 $submitBtn.trigger('click');
7350 }
7351 });
7352 }
7353})(CtrlEnter || (CtrlEnter = {}));
7354/////////////////////////
7355// ColoredUsernames.ts //
7356/////////////////////////
7357var ColoredUsernames;
7358(function (ColoredUsernames) {
7359 // INITIALIZATION
7360 // Specified colors for known users
7361 var userColors = {
7362 'SolidGoldMagikarp': '#008080',
7363 'rschaosid': '#008080',
7364 'live_mentions': 'Black',
7365 'joinlivecounting': 'Black',
7366 'livecounting_sidebar': 'Black',
7367 'live_lc_bot': 'Black',
7368 'Riverbot': 'Black',
7369 'Graphite_bot': 'Black',
7370 'piyushsharma301': '#FF0F19',
7371 'Tranquilsunrise': 'Orange',
7372 'dominodan123': 'Blue',
7373 'smarvin6689':'#060647',
7374 'rideride':'#069420',
7375 'nomaur2':'#8A2BE2',
7376 'VitaminB16': '#75CEAF',
7377 'LeinadSpoon': '#520063',
7378 'co3_carbonate': 'Grey',
7379 'artbn': '#e66b00',
7380 'amazingpikachu_38': '#FFFF00',
7381 'qwertylool': "YellowGreen",
7382 'TOP_20': '#ff00bf',
7383 '80sFan02': '#0505BB',
7384 'AstroMagician': '#2d8bff',
7385 'NobodyL0vesMe': '#730099',
7386 'PrinceCrinkle': '#0d2d89',
7387 'noduorg':'#0d2d89',
7388 'MrBahr12': '#00f20a',
7389 'parker_cube': '#FF69B4',
7390 'QuestoGuy': 'Purple',
7391 'Smartstocks': '#840d0d',
7392 'DemonBurritoCat':'#890003',
7393 'gordonpt8': '#00FF00',
7394 'Mooraell': '#DAA520',
7395 'randomusername123458': '#00CC99',
7396 'TheNitromeFan': '#fb72b0',
7397 'Capitanbublo' : '#ff531a',
7398 'davidjl123': '#6495ED',
7399 'abplows':'#2B0090',
7400 'Iamspeedy36': '#00BFFF',
7401 'Phoenixness': '#ff0000',
7402 'jillis6': '#ffd700',
7403 'Kris18': '#0000ff',
7404 'Chalupa_Dad':'#F08080',
7405 'Majestic_Bear':'#4682B4',
7406 'Flat-Mars-Society':'#00FF7F',
7407 'xHOCKEYx12': 'Lime',
7408 '_ntrpy': '#FF6600',
7409 'o99o99': '#2BBDFF',
7410 'afaintsmellofcurry': '#6799A0',
7411 'KingCaspianX': '#191970',
7412 'MewDP': '#FFFF33',
7413 'DaveTheDave_': '#00BFFF',
7414 'Luigi86101': '#006400',
7415 'thetiredlemur': '#464942',
7416 'TheGlobeIsRound': '#0080ff',
7417 'CarbonSpectre': '#339933',
7418 'Lonadont': '#a35252',
7419 'TehVulpez': '#c42c0a',
7420 'LC_Chats': '#dddddd',
7421 'LC-3P0': 'Black',
7422 'MaybeNotWrong': '#066666',
7423 'ElliottB1': '#00FFDD',
7424 'treje': '#ffc130',
7425 'sakima11': '#0cd1ad',
7426 'amazingpiakchu_38': '#FFFF00',
7427 'royalpurplesky': '#800080',
7428 'Mac_cy': '#FF8C00',
7429 'iwannaplay5050': '#B22222',
7430 'ludrol': '#191970',
7431 'thegreatestminer': '#4F9D82',
7432 'dogcatcowpig': '#1162f9',
7433 'ItzTaken': '#32ff95',
7434 'Noob2137': '#ff69ff',
7435 'PaleRepresentative': '#2F4F4F',
7436 'andrewtheredditor': '#2bdb6c',
7437 'Whit4You': '#ff99ff',
7438 'Rajalaxo': '#485432',
7439 'NikinCZ': '#86D8CA',
7440 'SecretAsianMa': '#373267',
7441 'srmpass': '#ffeed6',
7442 'MrUnderdawg': '#35e0cf',
7443 'SsPincus': '#840d0d',
7444 'amazingpikachu_37': '#FFFF00',
7445 'basskro': '#346cd1',
7446 'Chalupa_Grandpa': '#f69220',
7447 'TOP_6689': '#006689',
7448 'lyeinfyer': '#ccff99',
7449 'Zaajdaeon': '#1776BF',
7450 'Adventium_': '#228B22',
7451 'NeonL1vesMatter': '#730099',
7452 };
7453 if (USER == 'VitaminB16') {
7454userColors.LC_Chats = 'white';
7455}
7456 colortransfers = userColors;
7457 // Possible colors for other users
7458 var colors = ['Blue', 'Coral', 'DodgerBlue', 'SpringGreen', 'YellowGreen', 'Green', 'OrangeRed', 'Red', 'GoldenRod', 'CadetBlue', 'SeaGreen', 'Chocolate', 'BlueViolet', 'Firebrick'];
7459 for (var i = colors.length - 1; i > 0; i--) {
7460 // use Durstenfeld shuffle algorithm on colors array
7461 var j = Math.floor(Math.random() * (i + 1));
7462 var temp = colors[i];
7463 colors[i] = colors[j];
7464 colors[j] = temp;
7465 }
7466
7467/////////////april fools 1
7468if (aprilbools == 1) {
7469 var namecolors = ['untidy', 'hapless', 'greasy', 'learned', 'seemly', 'halting', 'envious', 'jobless', 'whole', 'high', 'thundering', 'dull', 'scintillating', 'violet', 'friendly', 'vivacious', 'flat', 'crazy', 'quarrelsome', 'worried', 'receptive', 'pleasant', 'secretive', 'comfortable', 'truculent', 'messy', 'obsolete', 'astonishing', 'fertile', 'slow', 'luxuriant', 'heartbreaking', 'foolish', 'torpid', 'sedate', 'famous', 'prickly', 'spiritual', 'normal', 'better', 'draconian', 'curious', 'rhetorical', 'periodic', 'chemical', 'quickest', 'cloistered', 'jumpy', 'last', 'obsequious', 'subsequent', 'plain', 'hateful', 'super', 'demonic', 'rural', 'automatic', 'damp', 'imminent', 'bloody', 'languid', 'cautious', 'old', 'hysterical', 'alcoholic', 'steady', 'open', 'alive', 'glib', 'unruly', 'two', 'bad', 'harmonious', 'long-term', 'many', 'unique', 'angry', 'noiseless', 'five', 'young', 'vagabond', 'standing', 'inquisitive', 'berserk', 'meaty', 'mountainous', 'funny', 'beautiful', 'tricky', 'obtainable', 'sore', 'enchanted', 'hollow', 'zealous', 'enthusiastic', 'straight', 'colorful', 'ill-informed', 'breakable', 'uninterested', 'grandiose', 'nifty', 'unhealthy', 'bored', 'impolite', 'disastrous', 'sad', 'billowy', 'neighborly', 'lazy', 'aquatic', 'lean', 'addicted', 'adhesive', 'eager', 'drunk', 'early', 'faint', 'rambunctious', 'exuberant', 'adventurous', 'nervous', 'needless', 'wandering', 'dysfunctional', 'weary', 'broken', 'daffy', 'loose', 'nutritious', 'shrill', 'ajar', 'jumbled', 'busy', 'honorable', 'accurate', 'wakeful', 'disturbed', 'infamous', 'groovy', 'ambiguous', 'humdrum', 'psychotic', 'tightfisted', 'abandoned', 'dependent', 'fantastic', 'overwrought', 'measly', 'verdant', 'tested', 'undesirable', 'smiling', 'dazzling', 'overrated', 'tense', 'invincible', 'true', 'well-to-do', 'common', 'quaint', 'level', 'impossible', 'lively', 'mammoth', 'sticky', 'pretty', 'earsplitting', 'abaft', 'far-flung', 'eatable', 'rare', 'venomous', 'ignorant', 'gaudy', 'dapper', 'jaded', 'puny', 'doubtful', 'reflective', 'unwritten', 'recondite', 'pumped', 'foregoing', 'purple', 'majestic', 'satisfying', 'upset', 'available', 'oceanic', 'nauseating', 'perpetual', 'habitual', 'oval', 'next', 'public', 'late', 'tearful', 'snotty', 'wrathful', 'uptight', 'greedy', 'ruthless', 'wiggly', 'amazing', 'hulking', 'grumpy', 'oafish', 'literate', 'square', 'nimble', 'neat', 'puffy', 'capricious', 'obese', 'aware', 'round', 'complex', 'bashful', 'gleaming', 'uttermost', 'remarkable', 'glossy', 'caring', 'symptomatic', 'spiky', 'ultra', 'pink', 'futuristic', 'gigantic', 'helpful', 'hushed', 'odd', 'illustrious', 'fresh', 'nappy', 'actually', 'warm', 'thinkable', 'acceptable', 'tan', 'quixotic', 'furry', 'clumsy', 'extra-large', 'depressed', 'hard', 'sloppy', 'great', 'tense', 'debonair', 'flaky', 'delirious', 'homely', 'exotic', 'healthy', 'abrupt', 'exciting', 'fortunate', 'four', 'tawdry', 'materialistic', 'silly', 'nice', 'closed', 'efficient', 'tiny', 'heady', 'confused', 'faithful', 'sweet', 'freezing', 'quiet', 'imaginary', 'moaning', 'easy', 'jittery', 'knowledgeable', 'garrulous', 'lackadaisical', 'resonant', 'entertaining', 'few', 'glistening', 'painful', 'didactic', 'apathetic', 'unbiased', 'ten', 'fair', 'wise', 'fumbling', 'unusual', 'screeching', 'dry', 'lovely', 'frightened', 'mixed', 'slimy', 'flippant', 'red', 'proud', 'complete', 'earthy', 'blue-eyed', 'grotesque', 'efficacious', 'upbeat', 'mature', 'burly', 'extra-small', 'regular', 'roomy', 'high-pitched', 'warlike', 'disagreeable', 'robust', 'craven', 'six', 'frail', 'guiltless', 'fast', 'violent', 'incompetent', 'frightening', 'peaceful', 'far', 'handsome', 'tremendous', 'blushing', 'cultured', 'parsimonious', 'nondescript', 'third', 'lacking', 'threatening', 'expensive', 'annoying', 'parched', 'careless', 'nonstop', 'energetic', 'noisy', 'spotty', 'idiotic', 'acoustic', 'succinct', 'stale', 'tough', 'ritzy', 'organic', 'delicious', 'coherent', 'aboard', 'wide-eyed', 'boiling', 'electric', 'skillful', 'irritating', 'woebegone', 'lewd', 'faded', 'tenuous', 'narrow', 'previous', 'white', 'responsible', 'uneven', 'paltry', 'sleepy', 'volatile', 'scrawny', 'overjoyed', 'wretched', 'afraid', 'gifted', 'numberless', 'tame', 'military', 'profuse', 'sordid', 'cuddly', 'supreme', 'left', 'omniscient', 'scared', 'thoughtful', 'picayune', 'highfalutin', 'ossified', 'three', 'trashy', 'grouchy', 'piquant', 'likeable', 'fierce', 'vulgar', 'disgusted', 'curvy', 'cooperative', 'courageous', 'ancient', 'powerful', 'tidy', 'shallow', 'vast', 'cut', 'melted', 'scary', 'well-groomed', 'tasty', 'polite', 'cheerful', 'festive', 'enormous', 'waggish', 'ceaseless', 'damaged', 'deranged', 'utter', 'jagged', 'imported', 'thirsty', 'little', 'daily', 'natural', 'unnatural', 'dead', 'material', 'voiceless', 'salty', 'ambitious', 'educated', 'crooked', 'past', 'cooing', 'woozy', 'mindless', 'coordinated', 'knowing', 'incredible', 'spurious', 'mushy', 'painstaking', 'rabid', 'one', 'scandalous', 'cold', 'itchy', 'abundant', 'hellish', 'shaky', 'absent', 'combative', 'political', 'zany', 'breezy', 'hesitant', 'unadvised', 'damaging', 'spotted', 'lively', 'wacky', 'distinct', 'zippy', 'tight', 'mean', 'descriptive', 'evasive', 'gabby', 'necessary', 'zonked', 'tranquil', 'sharp', 'eight', 'elated', 'juvenile', 'second', 'slim', 'unequaled', 'nippy', 'squalid', 'grubby', 'cumbersome', 'lyrical', 'labored', 'silent', 'temporary', 'private', 'kindhearted', 'impartial', 'fabulous', 'hot', 'graceful', 'romantic', 'weak', 'internal', 'shut', 'outrageous', 'broad', 'bawdy', 'pathetic', 'abiding', 'agreeable', 'living', 'bright', 'gaping', 'dreary', 'icy', 'productive', 'kaput', 'bustling', 'charming', 'useful', 'awesome', 'filthy', 'small', 'near', 'abounding', 'able', 'unsightly', 'sore', 'precious', 'gullible', 'well-off', 'intelligent', 'orange', 'mellow', 'green', 'cloudy', 'domineering', 'numerous', 'tedious', 'plucky', 'big', 'callous', 'mysterious', 'optimal', 'heavenly', 'teeny', 'real', 'low', 'thick', 'defective', 'befitting', 'ordinary', 'wooden', 'decisive', 'milky', 'chilly', 'tacit', 'incandescent', 'dashing', 'sneaky', 'womanly', 'ready', 'limping', 'average', 'abusive', 'superb', 'stingy', 'fearful', 'petite', 'acrid', 'chubby', 'sassy', 'willing', 'nonchalant', 'unarmed', 'empty', 'animated', 'petite', 'thin', 'juicy', 'ablaze', 'makeshift', 'terrible', 'full', 'husky', 'historical', 'sulky', 'clear', 'youthful', 'heavy', 'hallowed', 'whispering', 'black', 'pointless', 'abstracted', 'tangible', 'hungry', 'inexpensive', 'careful', 'motionless', 'defeated', 'defiant', 'wary', 'brainy', 'illegal', 'perfect', 'toothsome', 'phobic', 'puzzled', 'tender', 'savory', 'uppity', 'physical', 'naughty', 'acidic', 'gray', 'smooth', 'wasteful', 'flimsy', 'teeny-tiny', 'tangy', 'decorous', 'overt', 'sophisticated', 'amusing', 'solid', 'nebulous', 'endurable', 'dispensable', 'colossal', 'separate', 'stormy', 'nine', 'divergent', 'fluffy', 'malicious', 'large', 'flowery', 'hanging', 'yielding', 'general', 'amused', 'fascinated', 'righteous', 'secret', 'yummy', 'aback', 'bouncy', 'different', 'various', 'embarrassed', 'fancy', 'guarded', 'classy', 'marvelous', 'null', 'frequent', 'alike', 'guttural', 'fine', 'wanting', 'obscene', 'stimulating', 'glamorous', 'onerous', 'bright', 'sturdy', 'royal', 'superficial', 'loud', 'quirky', 'soggy', 'agonizing', 'dizzy', 'minor', 'noxious', 'dirty', 'unknown', 'swift', 'trite', 'whimsical', 'handy', 'kind', 'nostalgic', 'disgusting', 'exclusive', 'overconfident', 'absurd', 'ripe', 'cute', 'worthless', 'ratty', 'muddled', 'selfish', 'fluttering', 'half', 'truthful', 'harsh', 'jazzy', 'blue', 'madly', 'roasted', 'present', 'brief', 'rough', 'relieved', 'squealing', 'ugly', 'aboriginal', 'poor', 'ruddy', 'unused', 'fanatical', 'cruel', 'gainful', 'feeble', 'stupid', 'humorous', 'black-and-white', 'attractive', 'industrious', 'somber', 'old-fashioned', 'melodic', 'ragged', 'enchanting', 'special', 'alert', 'permissible', 'godly', 'unsuitable', 'capable', 'like', 'utopian', 'huge', 'ashamed', 'serious', 'fixed', 'even', 'elegant', 'strange', 'steadfast', 'quack', 'sudden', 'naive', 'sick', 'bizarre', 'crowded', 'future', 'nosy', 'grieving', 'reminiscent', 'legal', 'nasty', 'strong', 'uncovered', 'parallel', 'skinny', 'sable', 'spooky', 'pastoral', 'barbarous', 'quizzical', 'lowly', 'fallacious', 'lethal', 'vengeful', 'fearless', 'dear', 'magenta', 'belligerent', 'sweltering', 'abashed', 'cagey', 'deadpan', 'accessible', 'unaccountable', 'smart', 'lucky', 'male', 'longing', 'lavish', 'spicy', 'rigid', 'right', 'foamy', 'fat', 'imperfect', 'chief', 'gusty', 'useless', 'shaggy', 'dramatic', 'questionable', 'macabre', 'wet', 'curved', 'elastic', 'selective', 'rotten', 'adjoining', 'shivering', 'wild', 'soft', 'awful', 'handsomely', 'boring', 'interesting', 'spectacular', 'wide', 'simple', 'clammy', 'best', 'abortive', 'squeamish', 'creepy', 'silky', 'dusty', 'jolly', 'free', 'protective', 'clever', 'tiresome', 'crabby', 'steep', 'boorish', 'curly', 'panicky', 'stupendous', 'simplistic', 'tired', 'safe', 'wiry', 'childlike', 'medical', 'raspy', 'cynical', 'ethereal', 'vague', 'same', 'elfin', 'marked', 'excited', 'vigorous', 'homeless', 'poised', 'delightful', 'mere', 'magnificent', 'hospitable', 'unwieldy', 'cute', 'abhorrent', 'insidious', 'rainy', 'rude', 'wicked', 'chivalrous', 'helpless', 'joyous', 'light', 'obeisant', 'discreet', 'cool', 'psychedelic', 'anxious', 'voracious', 'calculating', 'economic', 'immense', 'knotty', 'macho', 'shiny', 'thankful', 'tasteful', 'icky', 'axiomatic', 'fuzzy', 'snobbish', 'annoyed', 'gorgeous', 'exultant', 'used', 'waiting', 'unkempt', 'evanescent', 'possessive', 'brave', 'rich', 'hypnotic', 'obnoxious', 'mute', 'understood', 'maddening', 'ludicrous', 'miscreant', 'moldy', 'rightful', 'absorbed', 'keen', 'massive', 'subdued', 'offbeat', 'drab', 'shy', 'bitter', 'talented', 'successful', 'premium', 'fragile', 'aggressive', 'watery', 'grey', 'cowardly', 'aloof', 'fretful', 'ad hoc', 'staking', 'miniature', 'flawless', 'gruesome', 'therapeutic', 'silent', 'splendid', 'cheap', 'deeply', 'good', 'nutty', 'wry', 'deep', 'thoughtless', 'diligent', 'plastic', 'disillusioned', 'vacuous', 'brash', 'troubled', 'lumpy', 'wistful', 'lying', 'married', 'typical', 'sour', 'instinctive', 'lame', 'adorable', 'opposite', 'unequal', 'murky', 'pricey', 'boundless', 'functional', 'brown', 'accidental', 'probable', 'deserted', 'ill', 'frantic', 'inconclusive', 'abnormal', 'second-hand', 'loving', 'happy', 'changeable', 'calm', 'synonymous', 'obedient', 'ubiquitous', 'scientific', 'ill-fated', 'giant', 'unbecoming', 'terrific', 'quick', 'slippery', 'dark', 'wealthy', 'cluttered', 'valuable', 'difficult', 'gamy', 'short', 'kindly', 'statuesque', 'mundane', 'rampant', 'outstanding', 'devilish', 'dynamic', 'loutish', 'bumpy', 'familiar', 'lonely', 'spiffy', 'panoramic', 'mighty', 'direful', 'equable', 'racial', 'grateful', 'flagrant', 'plausible', 'goofy', 'momentous', 'merciful', 'repulsive'];
7470 for (var i = namecolors.length - 1; i > 0; i--) {
7471 // use Durstenfeld shuffle algorithm on colors array
7472 var j = Math.floor(Math.random() * (i + 1));
7473 var nametemp = namecolors[i];
7474 namecolors[i] = namecolors[j];
7475 namecolors[j] = nametemp;
7476 }
7477 var namecolors2 = ['nut', 'sofa', 'songs', 'leg', 'finger', 'offer', 'cannon', 'grip', 'place', 'squirrel', 'parcel', 'hammer', 'geese', 'wren', 'clover', 'discovery', 'mailbox', 'company', 'paper', 'flock', 'camp', 'sleep', 'sign', 'square', 'earthquake', 'wealth', 'attack', 'boat', 'play', 'gate', 'treatment', 'health', 'respect', 'cobweb', 'downtown', 'canvas', 'iron', 'eggnog', 'bat', 'yarn', 'underwear', 'lamp', 'discussion', 'stone', 'competition', 'grandmother', 'foot', 'calculator', 'face', 'stomach', 'stage', 'science', 'alarm', 'caption', 'stick', 'mom', 'servant', 'spark', 'giants', 'smile', 'cellar', 'scissors', 'snow', 'insect', 'jewel', 'doctor', 'milk', 'theory', 'bottle', 'cushion', 'form', 'afterthought', 'rabbits', 'houses', 'spoon', 'pig', 'creature', 'toes', 'muscle', 'wine', 'ship', 'condition', 'card', 'insurance', 'linen', 'jelly', 'wash', 'invention', 'error', 'need', 'wire', 'eye', 'potato', 'elbow', 'house', 'chalk', 'bag', 'oatmeal', 'crook', 'memory', 'actor', 'minute', 'sister', 'attraction', 'friends', 'feeling', 'worm', 'quill', 'seed', 'boot', 'cattle', 'meat', 'flesh', 'engine', 'car', 'line', 'afternoon', 'pancake', 'cream', 'playground', 'key', 'crack', 'horse', 'friend', 'death', 'ball', 'club', 'agreement', 'sack', 'chicken', 'meal', 'train', 'apparatus', 'flowers', 'grandfather', 'babies', 'view', 'rest', 'fang', 'fall', 'bubble', 'library', 'reaction', 'spade', 'ring', 'zinc', 'fowl', 'purpose', 'pear', 'crate', 'rock', 'ducks', 'ink', 'chance', 'taste', 'sea', 'cabbage', 'regret', 'table', 'cars', 'fish', 'rake', 'minister', 'wave', 'seashore', 'pigs', 'rainstorm', 'destruction', 'experience', 'rub', 'stew', 'carpenter', 'brass', 'sidewalk', 'plantation', 'swim', 'move', 'cracker', 'tongue', 'sponge', 'kitty', 'steam', 'top', 'holiday', 'effect', 'shirt', 'bushes', 'river', 'haircut', 'quiet', 'poison', 'toe', 'horses', 'pen', 'drain', 'credit', 'position', 'produce', 'lock', 'sink', 'mist', 'furniture', 'laugh', 'degree', 'profit', 'zephyr', 'orange', 'ray', 'sisters', 'heat', 'snakes', 'crowd', 'planes', 'laborer', 'dock', 'surprise', 'mask', 'book', 'jump', 'girls', 'fruit', 'copper', 'drawer', 'dress', 'match', 'transport', 'children', 'brother', 'oranges', 'leather', 'birth', 'trick', 'tooth', 'cub', 'ticket', 'stop', 'mouth', 'authority', 'army', 'pail', 'unit', 'grade', 'start', 'vein', 'pizzas', 'zoo', 'judge', 'fact', 'smoke', 'rifle', 'society', 'substance', 'scarf', 'shape', 'straw', 'action', 'stocking', 'swing', 'believe', 'receipt', 'relation', 'rhythm', 'things', 'hat', 'texture', 'crib', 'hydrant', 'rain', 'skate', 'step', 'neck', 'maid', 'jeans', 'road', 'badge', 'money', 'sticks', 'nation', 'comparison', 'waste', 'tendency', 'payment', 'stitch', 'spot', 'skirt', 'cook', 'mountain', 'cow', 'corn', 'blow', 'hate', 'ground', 'value', 'end', 'part', 'sound', 'twig', 'pot', 'clam', 'cloth', 'team', 'acoustics', 'loaf', 'point', 'grass', 'wing', 'branch', 'butter', 'page', 'giraffe', 'jellyfish', 'seat', 'eggs', 'jam', 'mine', 'belief', 'women', 'motion', 'beginner', 'quicksand', 'letter', 'distribution', 'drink', 'queen', 'thing', 'railway', 'sail', 'crown', 'lettuce', 'plane', 'kettle', 'snake', 'donkey', 'soap', 'advertisement', 'books', 'uncle', 'shake', 'head', 'battle', 'sweater', 'soup', 'appliance', 'back', 'pipe', 'fuel', 'toad', 'shoe', 'bath', 'visitor', 'art', 'wax', 'plot', 'tomatoes', 'crayon', 'tank', 'weather', 'soda', 'event', 'guitar', 'slope', 'pencil', 'breath', 'detail', 'birds', 'hook', 'control', 'toys', 'price', 'voice', 'growth', 'interest', 'recess', 'way', 'run', 'cart', 'nerve', 'brick', 'space', 'suit', 'cave', 'aftermath', 'friction', 'anger', 'field', 'committee', 'fire', 'volleyball', 'noise', 'ladybug', 'fear', 'hill', 'rice', 'bead', 'plate', 'toothbrush', 'cherries', 'throat', 'aunt', 'territory', 'system', 'low', 'rat', 'daughter', 'jar', 'cactus', 'town', 'desk', 'pets', 'cent', 'cause', 'sort', 'sheep', 'stretch', 'rod', 'legs', 'snail', 'metal', 'self', 'yoke', 'grape', 'cough', 'bucket', 'voyage', 'jail', 'verse', 'celery', 'yard', 'dolls', 'bulb', 'curve', 'circle', 'wool', 'bite', 'coal', 'current', 'airplane', 'act', 'turn', 'representative', 'mind', 'turkey', 'sun', 'range', 'rose', 'design', 'bed', 'temper', 'flag', 'toy', 'smell', 'men', 'arithmetic', 'expert', 'liquid', 'idea', 'talk', 'bomb', 'pickle', 'earth', 'number', 'structure', 'pollution', 'nose', 'cemetery', 'ghost', 'base', 'impulse', 'pie', 'calendar', 'guide', 'chin', 'salt', 'exchange', 'driving', 'oil', 'hot', 'dad', 'market', 'reward', 'punishment', 'blade', 'fairies', 'steel', 'governor', 'year', 'front', 'coach', 'spring', 'spy', 'flower', 'drop', 'record', 'vacation', 'secretary', 'week', 'sky', 'wood', 'nest', 'rail', 'button', 'duck', 'debt', 'wrench', 'language', 'roof', 'wheel', 'trains', 'pies', 'son', 'crime', 'riddle', 'tree', 'business', 'desire', 'pin', 'toothpaste', 'loss', 'cover', 'achiever', 'time', 'chickens', 'beds', 'tent', 'girl', 'pet', 'use', 'frog', 'cast', 'porter', 'egg', 'trip', 'door', 'thrill', 'rabbit', 'school', 'dinosaurs', 'flame', 'letters', 'writing', 'wish', 'scent', 'glass', 'writer', 'quince', 'zebra', 'tramp', 'twist', 'teaching', 'pocket', 'arch', 'monkey', 'lunchroom', 'picture', 'window', 'collar', 'reading', 'cap', 'humor', 'direction', 'person', 'box', 'cheese', 'umbrella', 'thought', 'walk', 'education', 'root', 'silver', 'addition', 'basin', 'office', 'plough', 'protest', 'shop', 'ocean', 'song', 'balance', 'lunch', 'night', 'island', 'scarecrow', 'amount', 'whip', 'street', 'creator', 'mark', 'bear', 'mass', 'angle', 'flavor', 'sleet', 'church', 'border', 'notebook', 'hands', 'fly', 'existence', 'moon', 'screw', 'edge', 'hope', 'floor', 'dog', 'request', 'vest', 'hair', 'bit', 'powder', 'vegetable', 'blood', 'name', 'fireman', 'marble', 'bee', 'watch', 'partner', 'snails', 'vase', 'religion', 'development', 'shelf', 'shock', 'order', 'dust', 'hobbies', 'lip', 'pest', 'prose', 'quarter', 'vessel', 'spiders', 'wound', 'bridge', 'tin', 'berry', 'question', 'kick', 'month', 'cup', 'building', 'honey', 'camera', 'country', 'class', 'stranger', 'dirt', 'knowledge', 'mice', 'tax', 'teeth', 'harbor', 'station', 'truck', 'pull', 'rate', 'dogs', 'story', 'stove', 'day', 'north', 'wind', 'oven', 'limit', 'carriage', 'word', 'arm', 'title', 'trouble', 'behavior', 'middle', 'star', 'dinner', 'change', 'bike', 'baseball', 'chess', 'coat', 'war', 'can', 'lumber', 'van', 'work', 'basketball', 'care', 'smash', 'trucks', 'trees', 'bird', 'channel', 'show', 'meeting', 'string', 'locket', 'water', 'basket', 'ear', 'horn', 'quilt', 'store', 'pump', 'fork', 'shame', 'scale', 'plastic', 'level', 'kiss', 'tail', 'cats', 'observation', 'apparel', 'plant', 'board', 'home', 'activity', 'cake', 'gun', 'cat', 'finger', 'side', 'wilderness', 'doll', 'baby', 'power', 'cows', 'increase', 'sock', 'juice', 'statement', 'plants', 'volcano', 'look', 'support', 'expansion', 'flight', 'bedroom', 'mint', 'burst', 'mitten', 'popcorn', 'hospital', 'shade', 'cakes', 'woman', 'color', 'airport', 'adjustment', 'weight', 'icicle', 'argument', 'sneeze', 'history', 'hose', 'cable', 'eyes', 'peace', 'tub', 'selection', 'scene', 'stamp', 'glove', 'route', 'group', 'farm', 'silk', 'winter', 'reason', 'fog', 'example', 'fold', 'tiger', 'quiver', 'government', 'knee', 'brake', 'hall', 'ice', 'animal', 'grain', 'measure', 'boundary', 'mother', 'force', 'instrument', 'decision', 'hand', 'party', 'trade', 'thread', 'size', 'push', 'quartz', 'sand', 'zipper', 'trousers', 'connection', 'trail', 'pan', 'bikes', 'harmony', 'machine', 'sense', 'stream', 'needle', 'birthday', 'man', 'suggestion', 'industry', 'hole', 'stem', 'roll', 'ants', 'lace', 'join', 'magic', 'bone', 'hour', 'love', 'rule', 'curtain', 'summer', 'room', 'touch', 'sheet', 'knot', 'waves', 'coil', 'cherry', 'income', 'note', 'advice', 'bait', 'dime', 'kittens', 'account', 'bell', 'thunder', 'wall', 'wrist', 'pleasure', 'knife', 'tray', 'food', 'deer', 'yam', 'distance', 'property', 'frogs', 'division', 'sugar', 'veil', 'digestion', 'boy', 'amusement', 'frame', 'slave', 'coast', 'approval', 'bells', 'rings', 'skin', 'shoes', 'lake', 'air', 'slip', 'test', 'beef', 'land', 'crow', 'robin', 'throne', 'gold', 'whistle', 'morning', 'yak', 'thumb', 'passenger'];
7478 for (var i = namecolors2.length - 1; i > 0; i--) {
7479 // use Durstenfeld shuffle algorithm on colors array
7480 var j = Math.floor(Math.random() * (i + 1));
7481 var nametemp2 = namecolors2[i];
7482 namecolors2[i] = namecolors2[j];
7483 namecolors2[j] = nametemp2;
7484 }
7485}
7486
7487/////////////april fools 1
7488
7489
7490 /////////////april 2020 10
7491if (april2020 == 10) {
7492 var namecolors = ['TOP_','amazing','domino','Itz','nodu','Nobody','Lona','Maybe','david','Leinad','smarvin','tre','Chalupa_','Smart','piyush','gordon','Questo','ride','art','qwerty','Tranquil','Nikin','Demon','co3_','rs','Mr','ab','bass','Iam','Raja','parker_','Vitamin','Pale'];
7493 for (var i = namecolors.length - 1; i > 0; i--) {
7494 // use Durstenfeld shuffle algorithm on colors array
7495 var j = Math.floor(Math.random() * (i + 1));
7496 var nametemp = namecolors[i];
7497 namecolors[i] = namecolors[j];
7498 namecolors[j] = nametemp;
7499 }
7500 var namecolors2 = ['20','pikachu_38','dan123','Taken','org','L0vesMe','dont','NotWrong','jl123','Spoon','6689','je','Dad','stocks','sharma301','pt8','Guy','ride','bn','lool','sunrise','CZ','BurritoCat','carbonate','Underdawg','chaosid','plows','kro','speedy36','laxo','cube','B16','Representative'];
7501 for (var i = namecolors2.length - 1; i > 0; i--) {
7502 // use Durstenfeld shuffle algorithm on colors array
7503 var j = Math.floor(Math.random() * (i + 1));
7504 var nametemp2 = namecolors2[i];
7505 namecolors2[i] = namecolors2[j];
7506 namecolors2[j] = nametemp2;
7507 }
7508}
7509
7510/////////////april 2020 10
7511
7512 function aprfoo(str){
7513 var i = 0;
7514 var l = str.length;
7515 var start = 0;
7516 var end = l - 1;
7517 t = str.replace("0", "7").replace("1","7").replace("2","7").replace("3","7").replace("4","7").replace("5","7").replace("6","7").replace("8","7").replace("9","7");
7518 return t;
7519 }
7520
7521function chu_inc1(){
7522 master_s = ["7️⃣", "?", "?","?","?","?","?"];
7523 index = Math.floor(Math.random()*7)
7524 return master_s[index];
7525 }
7526
7527 function chu_inc(){
7528 master_s = "?????????????9⃣???❤ ⚽ ? ✅???????????⭐ ❤ ??????⬅ ???™ ️";
7529 index = Math.floor(Math.random()*44)+1
7530 chu = master_s.substring(index*2,index*2+2);
7531 return master_s.substring(index*2,index*2+2);
7532 }
7533
7534 function chu_inc22(){
7535 master_s = "?????????????9⃣???❤ ⚽ ? ✅???????????⭐ ❤ ";
7536 index = Math.floor(Math.random()*33)+1
7537 chu = master_s.substring(index*2,index*2+2);
7538 return master_s.substring(index*2,index*2+2);
7539 }
7540
7541 function rng(){
7542 count = Math.floor(Math.random()*10);
7543 return "";
7544 }
7545
7546 function rng2(){
7547 count2 = Math.floor(Math.random()*20);
7548 return "";
7549 }
7550
7551 function reverser(index){
7552 if(count != 0){
7553 if (index == 0){
7554 return s.charAt(index);
7555 } else{
7556 return s.charAt(index);
7557 }
7558 } else{
7559 if (index == 0){
7560 return s.charAt(6-index);
7561 } else{
7562 return s.charAt(6-index);
7563 }
7564 }
7565 }
7566 function Shuffle(o) {
7567 for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
7568 return o;
7569};
7570
7571 // index of next color to assign from colors array
7572 var currentColor = 0;
7573
7574
7575/////////////april fools 1
7576if (aprilbools == 1) {
7577 var currentNameColor = 0;
7578 var ranName = {
7579'lol': 'lol',
7580};
7581 var currentNameColor2 = 0;
7582 var ranName2 = {
7583'lol': 'lol',
7584};
7585}
7586/////////////april fools 1
7587
7588 /////////////april fools 10
7589if (april2020 == 10) {
7590 var currentNameColor = 0;
7591 var ranName = {
7592'lol': 'lol',
7593};
7594 var currentNameColor2 = 0;
7595 var ranName2 = {
7596'lol': 'lol',
7597};
7598}
7599/////////////april fools 10
7600
7601 // Options
7602 var enabled = true;
7603 Options.addCheckbox({
7604 label: 'COLORED USERNAMES',
7605 "default": true,
7606 help: 'Makes the username in each message gain a unique color.\n\nCertain users who have specified their preferred username colors to /u/co3_carbonaate get that fixed color all the time. Otherwise, your color will be random and appear differently for everyone using the extension.',
7607 onchange: function () {
7608 enabled = this.prop('checked');
7609 }
7610 });
7611 // EVENTS
7612 // New update loaded
7613 Update.loadedNew(function (data) {
7614
7615
7616if(window.location.href.indexOf("10gelxprc1umi") > -1) {
7617
7618var entirepost = data.body_elem.text();
7619
7620//OK So here's the format: [xxx,xx,xxx,xx,xxxxxx]
7621// It's [X position, Y position, width, height, color]
7622
7623
7624entirepost = entirepost.split(" ").join("\n");
7625entirepost = entirepost.split("[").join("\n[");
7626entirepost = entirepost.split("]").join("]\n");
7627entirepost = entirepost.replace(/^(?!.*\[.{3},.{2},.{3},.{2},.{6}\]).*$/gm, ``);
7628entirepost = entirepost.split("\n").join("");
7629if (entirepost.length > 0) {
7630var place1 = entirepost;
7631var place2 = entirepost;
7632var place3 = entirepost;
7633var place4 = entirepost;
7634var place5 = entirepost;
7635var place1 = place1.replace(/,.{2},.{3},.{2},.{6}\]/gm, ``);
7636place1 = place1.replace(/\[/gm, ``);
7637var place2 = place2.replace(/,.{3},.{2},.{6}\]/gm, ``);
7638place2 = place2.replace(/\[.{3},/gm, ``);
7639var place3 = place3.replace(/,.{2},.{6}\]/gm, ``);
7640place3 = place3.replace(/\[.{3},.{2},/gm, ``);
7641var place4 = place4.replace(/,.{6}\]/gm, ``);
7642place4 = place4.replace(/\[.{3},.{2},.{3},/gm, ``);
7643var place5 = place5.replace(/\[.{3},.{2},.{3},.{2},/gm, ``);
7644place5 = place5.replace(/\]/gm, ``);
7645
7646//var hmm = `context.fillRect(50,50,5,5,60,41,91);`;
7647
7648//hmm;
7649
7650var lolzo = context.fillStyle = "#"+place5;
7651 var lolzo = context.fillRect(place1,place2,place3,place4);
7652
7653
7654}
7655
7656 }
7657
7658 if (!enabled)
7659 return;
7660 // Special usernames (temp rewards for top in 100k HoC, or other contributions)
7661 // Bot-maker privileges (/u/co3_carbonate, /u/rschaosid, /u/piyushsharma301,/u/rideride)
7662 if (data.author == 'MaybeNotWrong' || data.author == 'co3_carbonate' || data.author == 'rschaosid' || data.author == 'piyushsharma301' || data.author == 'rideride' || data.author == 'LeinadSpoon' || data.author == 'artbn') {
7663 data.author_elem.css('font-weight', 'bold');
7664 }
7665
7666
7667 if (IgnoreEnabled == 'yep lol') {
7668var ignoretest = document.getElementById("ignorebox2").innerHTML;
7669
7670if (ignoretest.includes(data.author)) {
7671var entirepost = data.body_elem.html();
7672var entireposttext = data.body_elem.text();
7673var count1testlol = entireposttext.substring(0, 10);
7674 count1testlol = count1testlol.replace(/[A-Za-z]/g, '');
7675entirepost = entirepost.replace(count1testlol,`<p id="counttext" style="font-size: 14px; display:inline;">`+count1testlol+` </p>`);
7676entirepost = entirepost.replace(`p>`, `span>`);
7677data.body_elem.html(`<span class="ignoredpost" style="font-size: 0px;">`+entirepost+`</span>`);
7678}
7679}//IgnoreEnabled ending
7680
7681
7682
7683
7684
7685
7686 // Set username colour
7687 if (!userColors.hasOwnProperty(data.author)) {
7688 userColors[data.author] = colors[currentColor];
7689 currentColor++;
7690 if (currentColor == colors.length) {
7691 currentColor = 0;
7692 }
7693 }
7694 data.author_elem.css('color', userColors[data.author]);
7695
7696
7697 /////////////////////APRIL FOOLS SECRET MESSAGES????
7698
7699
7700// Styles.add(`
7701//a[href*='#test'] {
7702//background: black;
7703// color: white;
7704//}
7705//a[href*='#test']:after {
7706//content: attr(title);
7707//}
7708
7709 // `);
7710 //if($node.find('.body > .md > p > a').attr('href') != undefined) {
7711 //
7712 //}
7713
7714 //////////////
7715
7716
7717 /////////////////////april 2020 2
7718
7719if (april2020 == 2) {
7720 var count1testlol = data.body_elem.text();
7721var count1text = count1testlol;
7722count1testlol = count1testlol.substring(0, 10);
7723 var count2text = data.body_elem.text();;
7724 count1testlol = count1testlol.replace(/[A-Za-z]/g, '');
7725 count1testlol = count1testlol.replace(/,/g, '');
7726 count1testlol = count1testlol.replace(/ /g, '');
7727count1testlol = count1testlol.replace(/\./g, '');
7728if (count1testlol.length == 6) {
7729//count1testlol = count1testlol.substr(count1testlol.length - 1);
7730 count1testlol = count1testlol.substr(0,count1testlol.length - 1);
7731} else {
7732//count1testlol = count1testlol.substr(count1testlol.length - 3);
7733 count1testlol = count1testlol.substr(0,count1testlol.length - 3);
7734}
7735 if (count1testlol.length == 6) {
7736//count1testlol = count1testlol.substr(count1testlol.length - 1);
7737 count1testlol = count1testlol.substr(0,count1testlol.length - 1);
7738}
7739var count1testlolnext = count1testlol.substring(0,1);
7740 var repl = 0;
7741 var stringpart1 = count2text.substring(0,1);
7742 var stringpart2 = count2text.substring(1,2);
7743 var stringpart3 = count2text.substring(2,3);
7744 var stringpart4 = count2text.substring(3,4);
7745 var stringpart5 = count2text.substring(4,5);
7746 var stringpart6 = count2text.substring(5,6);
7747 var stringpart7 = count2text.substring(6,7);
7748 var stringpart8 = count2text.substring(7,8);
7749 var stringpart9 = count2text.substring(8,9);
7750 var stringpart10 = count2text.substring(9,10);
7751 if(count1testlol.length == 5 && repl < 5) {
7752 if(isNaN(parseInt(count1testlol.substring(0,1))) == false) {
7753 var stringpart1 = Math.floor(Math.random() * 9) + 1;
7754 stringpart1 = stringpart1.toString();
7755 repl += 1
7756 }
7757 }
7758 if(count1testlol.length == 5 && repl < 5) {
7759 if(isNaN(parseInt(stringpart2)) == false) {
7760 var stringpart2 = Math.floor(Math.random() * 10);
7761 stringpart2 = stringpart2.toString();
7762 repl += 1
7763 }
7764 }
7765 if(count1testlol.length == 5 && repl < 5) {
7766 if(isNaN(parseInt(stringpart3)) == false) {
7767 var stringpart3 = Math.floor(Math.random() * 10);
7768 stringpart3 = stringpart3.toString();
7769 repl += 1
7770 }
7771 }
7772 if(count1testlol.length == 5 && repl < 5) {
7773 if(isNaN(parseInt(stringpart4)) == false) {
7774 var stringpart4 = Math.floor(Math.random() * 10);
7775 stringpart4 = stringpart4.toString();
7776 repl += 1
7777 }
7778 }
7779 if(count1testlol.length == 5 && repl < 5) {
7780 if(isNaN(parseInt(stringpart5)) == false) {
7781 var stringpart5 = Math.floor(Math.random() * 10);
7782 stringpart5 = stringpart5.toString();
7783 repl += 1
7784 }
7785 }
7786 if(count1testlol.length == 5 && repl < 5) {
7787 if(isNaN(parseInt(stringpart6)) == false) {
7788 var stringpart6 = Math.floor(Math.random() * 10);
7789 stringpart6 = stringpart6.toString();
7790 repl += 1
7791 }
7792 }
7793 if(count1testlol.length == 5 && repl < 5) {
7794 if(isNaN(parseInt(stringpart7)) == false) {
7795 var stringpart7 = Math.floor(Math.random() * 10);
7796 stringpart7 = stringpart7.toString();
7797 repl += 1
7798 }
7799 }
7800 if(count1testlol.length == 5 && repl < 5) {
7801 if(isNaN(parseInt(stringpart8)) == false) {
7802 var stringpart8 = Math.floor(Math.random() * 10);
7803 stringpart8 = stringpart8.toString();
7804 repl += 1
7805 }
7806 }
7807 if(count1testlol.length == 5 && repl < 5) {
7808 if(isNaN(parseInt(stringpart9)) == false) {
7809 var stringpart9 = Math.floor(Math.random() * 10);
7810 stringpart9 = stringpart9.toString();
7811 repl += 1
7812 }
7813 }
7814 if(count1testlol.length == 5 && repl < 5) {
7815 if(isNaN(parseInt(stringpart10)) == false) {
7816 var stringpart10 = Math.floor(Math.random() * 10);
7817 stringpart10 = stringpart10.toString();
7818 repl += 1
7819 }
7820 }
7821 if(count1testlol.length == 5) {
7822 count2text = stringpart1 + stringpart2 + stringpart3 + stringpart4 + stringpart5 + stringpart6 + stringpart7 + stringpart8 + stringpart9 + stringpart10 + count2text.slice(10)
7823 }
7824
7825data.body_elem.text(count2text);
7826
7827}
7828
7829/////////////////////april 2020 2
7830
7831
7832 /////////////////////april 2020 6
7833
7834if (april2020 == 6) {
7835 var count1testlol = data.body_elem.text();
7836 var count1testlolauthor = data.author_elem.text();
7837var count1text = count1testlol;
7838count1testlol = count1testlol.substring(0, 10);
7839 var count2text = data.body_elem.text();;
7840 count1testlol = count1testlol.replace(/[A-Za-z]/g, '');
7841 count1testlol = count1testlol.replace(/,/g, '');
7842 count1testlol = count1testlol.replace(/ /g, '');
7843count1testlol = count1testlol.replace(/\./g, '');
7844if(count1testlol.includes("69") && count1testlolauthor.length > 3) {
7845 setTimeout(function(){
7846 $(".liveupdate-listing").prepend(`<li class="liveupdate deadupdate"><a href="/live/ta535s1hq2je/updates/f4c886aa-535a-11e9-8133-0e5d46594c50" target="_blank"><time class="live-timestamp" datetime="2019-03-31T02:16:13.000Z" title="this is fake lol">just now</time></a><div class="body"><div class="md"><blockquote> <p>69</p> </blockquote> <p>nice</p> </div><a href="/user/countmeister" class="deadauthor" style="color: Black;"> /u/69_bot</a></div><ul class="buttonrow"><li><span class="strike confirm-button"><button>this is fake lol</button></span></li><li><span class="delete confirm-button"><button>delete</button></span></li></ul></li>`);
7847 },50);
7848}
7849}
7850
7851
7852 /////////////////////april 2020 6
7853
7854
7855
7856 /////////////////////april 2020 10
7857
7858if (april2020 == 10) {
7859 if (!ranName.hasOwnProperty(data.author)) {
7860 ranName[data.author] = namecolors[currentNameColor];
7861 currentNameColor++;
7862 if (currentNameColor == namecolors.length) {
7863 currentNameColor = 0;
7864 }
7865 }
7866 if (!ranName2.hasOwnProperty(data.author)) {
7867 ranName2[data.author] = namecolors2[currentNameColor2];
7868 currentNameColor2++;
7869 if (currentNameColor2 == namecolors2.length) {
7870 currentNameColor2 = 0;
7871 }
7872 }
7873
7874 data.author_elem.html('/u/' + ranName[data.author] + ranName2[data.author]);
7875}
7876
7877
7878 /////////////////////april 2020 10
7879
7880
7881/////////////april fools 1
7882if (aprilbools == 1) {
7883 if (!ranName.hasOwnProperty(data.author)) {
7884 ranName[data.author] = namecolors[currentNameColor];
7885 currentNameColor++;
7886 if (currentNameColor == namecolors.length) {
7887 currentNameColor = 0;
7888 }
7889 }
7890 if (!ranName2.hasOwnProperty(data.author)) {
7891 ranName2[data.author] = namecolors2[currentNameColor2];
7892 currentNameColor2++;
7893 if (currentNameColor2 == namecolors2.length) {
7894 currentNameColor2 = 0;
7895 }
7896 }
7897
7898 data.author_elem.html('/u/the_' + ranName[data.author] + '_' + ranName2[data.author]);
7899}
7900/////////////april fools 1
7901
7902/////////////////////april fools 6
7903
7904if (aprilbools == 6) {
7905var entirepost = data.body_elem.text();
7906entirepost = entirepost.replace(/a/gi, '⠁');
7907entirepost = entirepost.replace(/b/gi, '⠃');
7908entirepost = entirepost.replace(/c/gi, '⠉');
7909entirepost = entirepost.replace(/d/gi, '⠙');
7910entirepost = entirepost.replace(/e/gi, '⠑');
7911entirepost = entirepost.replace(/f/gi, '⠋');
7912entirepost = entirepost.replace(/g/gi, '⠛');
7913entirepost = entirepost.replace(/h/gi, '⠓');
7914entirepost = entirepost.replace(/i/gi, '⠊');
7915entirepost = entirepost.replace(/j/gi, '⠚');
7916entirepost = entirepost.replace(/k/gi, '⠅');
7917entirepost = entirepost.replace(/l/gi, '⠇');
7918entirepost = entirepost.replace(/m/gi, '⠍');
7919entirepost = entirepost.replace(/n/gi, '⠝');
7920entirepost = entirepost.replace(/o/gi, '⠕');
7921entirepost = entirepost.replace(/p/gi, '⠏');
7922entirepost = entirepost.replace(/q/gi, '⠟');
7923entirepost = entirepost.replace(/r/gi, '⠗');
7924entirepost = entirepost.replace(/s/gi, '⠎');
7925entirepost = entirepost.replace(/t/gi, '⠞');
7926entirepost = entirepost.replace(/u/gi, '⠥');
7927entirepost = entirepost.replace(/v/gi, '⠧');
7928entirepost = entirepost.replace(/w/gi, '⠺');
7929entirepost = entirepost.replace(/x/gi, '⠭');
7930entirepost = entirepost.replace(/y/gi, '⠽');
7931entirepost = entirepost.replace(/z/gi, '⠵');
7932entirepost = entirepost.replace('<⠏>', '<p>');
7933entirepost = entirepost.replace('</⠏>', '</p>');
7934
7935
7936data.body_elem.text(entirepost);
7937
7938}
7939
7940/////////////////////april fools 6
7941
7942if(window.location.href.indexOf("110t4ltqqzi35") > -1 || window.location.href.indexOf("14ny3ur3axhd4") > -1) {
7943var lcchats = data.href_elem.attr('href');
7944lcchats = lcchats.trim().replace('/u/', '');
7945data.href_elem.css('color', userColors[lcchats]).css('fontStyle','initial').css('fontSize','13px');
7946if (lcchats == 'MaybeNotWrong' || lcchats == 'co3_carbonate' || lcchats == 'rschaosid' || lcchats == 'piyushsharma301' || lcchats == 'rideride' || lcchats == 'LeinadSpoon' || lcchats == 'artbn') {
7947 data.href_elem.css('font-weight', 'bold');
7948 }
7949}
7950 });
7951if(window.location.href.indexOf("110t4ltqqzi35") > -1 || window.location.href.indexOf("14ny3ur3axhd4") > -1) {
7952$('a[href*="/u/"]').each(function() {
7953var thishref = $(this).attr('href');
7954thishref = thishref.trim().replace('/u/', '');
7955 $(this).css('color', userColors[thishref]).css('fontStyle','initial').css('fontSize','13px');
7956if (thishref == 'MaybeNotWrong' || thishref == 'co3_carbonate' || thishref == 'rschaosid' || thishref == 'piyushsharma301' || thishref == 'rideride' || thishref == 'LeinadSpoon' || thishref == 'artbn') {
7957 $(this).css('font-weight', 'bold');
7958 }
7959});
7960 Update.loadedOld(function () {
7961$('a[href*="/u/"]').each(function() {
7962var thishref2 = $(this).attr('href');
7963thishref2 = thishref2.trim().replace('/u/', '');
7964 $(this).css('color', userColors[thishref2]).css('fontStyle','initial').css('fontSize','13px');
7965if (thishref2 == 'MaybeNotWrong' || thishref2 == 'co3_carbonate' || thishref2 == 'rschaosid' || thishref2 == 'piyushsharma301' || thishref2 == 'rideride' || thishref2 == 'LeinadSpoon' || thishref2 == 'artbn') {
7966 $(this).css('font-weight', 'bold');
7967 }
7968});
7969});
7970}
7971 Styles.add("\n\n\t.amazingpikachu_38 {\n\t\tanimation: blinker 1s linear infinite;\n\t}\n\t@keyframes blinker {\n\t\t50% { opacity: 0; }\n\t}\n\n\t");
7972 Styles.add(`li.stricken > div > a[href="/user/MaybeNotWrong"].author.flipped {animation: flippa 1s linear infinite;} @keyframes flippa {50% { float:initial;position:absolute; } 100%{ float:left; } }}`);
7973 Styles.add(`li > div > a[href="/user/MaybeNotWrong"].author.blink {animation: blinkerm 1s linear infinite;} @keyframes blinkerm {50% { opacity:0; } 100%{ opacity:1; } }`);
7974 Styles.add(`li.stricken > div > div > span > p #counttext {text-decoration: line-through;} .liveupdate-listing li.liveupdate.stricken div.md .ignoredpost p:last-of-type {text-decoration: none;} `);
7975
7976
7977})(ColoredUsernames || (ColoredUsernames = {}));
7978//////////////////////////
7979// ClearPastMessages.ts //
7980//////////////////////////
7981var ClearPastMessages;
7982(function (ClearPastMessages) {
7983 // INITIALIZATION
7984 var maxMessages = 50;
7985 // Options
7986 var enabled = true;
7987 var enTimeout = false;
7988 var $checkbox = Options.addCheckbox({
7989 label: 'CLEAR PAST MESSAGES (REDUCES LAG)',
7990 "default": true,
7991 help: 'Frequently clears past messages from the page, which drastically negates lag and reduces the need to refresh constantly.',
7992 onchange: function () {
7993 enabled = this.prop('checked');
7994 }
7995 });
7996 $checkbox.click(function() {
7997 enTimeout = true;
7998setTimeout(function(){ enTimeout = false; }, 5000);
7999});
8000 // EVENTS
8001 // New update loaded
8002 Update.loadedNew(function (data) {
8003 if(window.scrollY==0 && enTimeout==false) {
8004 if (!enabled) {
8005 $checkbox.prop('checked', true).trigger('change');
8006}
8007}
8008 if (!enabled)
8009 return;
8010 var $screenMessages = Elements.$updates.children('.liveupdate');
8011 if ($screenMessages.length > maxMessages) {
8012 $screenMessages.slice(maxMessages).remove();
8013 }
8014 });
8015 // Old update loaded (scrolled to bottom)
8016 Update.loadedOld(function (data) {
8017 // disable
8018 if (!enabled)
8019 return;
8020 $checkbox.prop('checked', false).trigger('change');
8021 });
8022})(ClearPastMessages || (ClearPastMessages = {}));
8023////////////////////
8024// DisplayMode.ts //
8025////////////////////
8026var DisplayMode;
8027(function (DisplayMode) {
8028 // INITIALIZATION
8029 Elements.$body.attr('data-DisplayMode', 'Normal');
8030 // "Return to Normal Display" button
8031 var $returnBtn = $('<input type="button" value="Return to Normal Display"/>');
8032 $returnBtn.on('click', function () {
8033 $select.children('option[value="Normal"]').prop('selected', true).trigger('change');
8034 });
8035 $returnBtn.css({
8036 marginBottom: '20px',
8037 display: 'none',
8038 margin: '0 auto'
8039 });
8040 Elements.$content.prepend($returnBtn);
8041
8042 // Options
8043 var $select = Options.addSelect({
8044 label: 'DISPLAY MODE',
8045 options: ['Normal', 'Minimal', 'Super Minimal'],
8046 help: 'Changes the display interface of the page to your preference.',
8047 onchange: function () {
8048 var display = this.val();
8049 $returnBtn.css('display', (display == 'Normal' ? 'none' : 'block'));
8050 Elements.$body.attr('data-DisplayMode', display);
8051 }
8052 });
8053/////////////////APRIL FOOLS 5
8054if (aprilbools == 5) {
8055 Elements.$body.attr('data-DisplayMode', 'Super Minimal');
8056$returnBtn.css('display', 'block');
8057 Styles.add("\n\n\t/* Display Minimal */\n\t#lc-body[data-DisplayMode='Super Minimal'] #header,\n\t#lc-body[data-DisplayMode='Super Minimal'] #liveupdate-statusbar,\n\t#lc-body[data-DisplayMode='Super Minimal'] .markdownEditor-wrapper,\n\t#lc-body[data-DisplayMode='Super Minimal'] #new-update-form .bottom-area,\n\t#lc-body[data-DisplayMode='Super Minimal'] li.liveupdate time.live-timestamp,\n\t#lc-body[data-DisplayMode='Super Minimal'] #liveupdate-options, \n\t#lc-body[data-DisplayMode='Super Minimal'] aside.sidebar {\n\t\tdisplay: none;\n\t}\n\n\t#lc-body[data-DisplayMode='Super Minimal'] #liveupdate-header,\n\t#lc-body[data-DisplayMode='Super Minimal'] #new-update-form {\n\t\tmargin-left: 0px;\n\t}\n\n\t#lc-body[data-DisplayMode='Super Minimal'] li.liveupdate ul.buttonrow {\n\t\tmargin: 0 0 2em 0px !important;\n\t}\n\n\t#lc-body[data-DisplayMode='Super Minimal'] div.content {max-width:81px; padding:0;} #lc-body[data-DisplayMode='Super Minimal'] div.content #new-update-form .usertext .usertext-edit textarea {height: 12px;width: 51px !important; font-size:6px;} #lc-body[data-DisplayMode='Super Minimal'] #liveupdate-header {display: none;} #lc-body[data-DisplayMode='Super Minimal'] #river {font-size: 6px;width: 28px;margin-left: -33px;margin-top: 1px;} #lc-body[data-DisplayMode='Super Minimal'] li.liveupdate * {font-size: 6px;} #lc-body[data-DisplayMode='Super Minimal'] .liveupdate-listing li.separator time {font-size: 6px;} #lc-body[data-DisplayMode='Super Minimal'] .status {font-size: 6px;} #lc-body[data-DisplayMode='Super Minimal'] {font-size: 6px!important;} #lc-body[data-DisplayMode='Super Minimal'] button, html input[type='button'] {padding: 0;font-size: 6px;}");
8058 Styles.add(`@keyframes mymove {0% {font-size: 13px;transform:rotate(0deg);}50% {font-size: 78px;transform:rotate(180deg);}100% {font-size: 13px;transform:rotate(360deg);}}`);
8059 Styles.add(`@keyframes mymove2 {0% {font-size: 13px;transform:rotate(0deg);opacity:1;}50% {font-size: 78px;transform:rotate(180deg);opacity:0;}100% {font-size: 13px;transform:rotate(360deg);opacity:1;}}`);
8060
8061}
8062//////////////// APRIL FOOLS 5
8063 // Styles
8064 Styles.add("\n\n\t/* Display Minimal */\n\t#lc-body[data-DisplayMode='Minimal'] #header,\n\t#lc-body[data-DisplayMode='Minimal'] #liveupdate-statusbar,\n\t#lc-body[data-DisplayMode='Minimal'] .markdownEditor-wrapper,\n\t#lc-body[data-DisplayMode='Minimal'] #new-update-form .bottom-area,\n\t#lc-body[data-DisplayMode='Minimal'] li.liveupdate time.live-timestamp,\n\t#lc-body[data-DisplayMode='Minimal'] #liveupdate-options, \n\t#lc-body[data-DisplayMode='Minimal'] aside.sidebar {\n\t\tdisplay: none;\n\t}\n\n\t#lc-body[data-DisplayMode='Minimal'] #liveupdate-header,\n\t#lc-body[data-DisplayMode='Minimal'] #new-update-form {\n\t\tmargin-left: 0px;\n\t}\n\n\t#lc-body[data-DisplayMode='Minimal'] li.liveupdate ul.buttonrow {\n\t\tmargin: 0 0 2em 0px !important;\n\t}\n\n\t#lc-body[data-DisplayMode='Minimal'] div.content {\n\t\tmax-width: " + Math.max(450, $('#new-update-form textarea').outerWidth()) + "px;\n\t}\n\n\t");
8065
8066
8067////////////////////APRIL FOOLS 5
8068// Styles.add("\n\n\t/* Display Minimal */\n\t#lc-body #header,\n\t#lc-body #liveupdate-statusbar,\n\t#lc-body .markdownEditor-wrapper,\n\t#lc-body #new-update-form .bottom-area,\n\t#lc-body li.liveupdate time.live-timestamp,\n\t#lc-body #liveupdate-options, \n\t#lc-body aside.sidebar {\n\t\tdisplay: none;\n\t}\n\n\t#lc-body #liveupdate-header,\n\t#lc-body #new-update-form {\n\t\tmargin-left: 0px;\n\t}\n\n\t#lc-body li.liveupdate ul.buttonrow {\n\t\tmargin: 0 0 2em 0px !important;\n\t}\n\n\t#lc-body div.content {max-width:81px; padding:0;} #lc-body div.content #new-update-form .usertext .usertext-edit textarea {height: 12px;width: 51px !important; font-size:6px;} #lc-body #liveupdate-header {display: none;} #lc-body #river {font-size: 6px;width: 28px;margin-left: -33px;margin-top: 1px;} #lc-body li.liveupdate * {font-size: 6px;} #lc-body .liveupdate-listing li.separator time {font-size: 6px;} #lc-body .status {font-size: 6px;} #lc-body {font-size: 6px!important;} #lc-body button, html input[type='button'] {padding: 0;font-size: 6px;}");
8069////////////////////APRIL FOOLS 5/ TODO: ADD A RETURN TO NORMAL BUTTON
8070// Styles.add("\n\n\t/* Display Minimal */\n\t#lc-body #header,\n\t#lc-body #liveupdate-statusbar,\n\t#lc-body .markdownEditor-wrapper,\n\t#lc-body #new-update-form .bottom-area,\n\t#lc-body li.liveupdate time.live-timestamp,\n\t#lc-body #liveupdate-options, \n\t#lc-body aside.sidebar {\n\t\tdisplay: initial;\n\t}\n\n\t#lc-body #liveupdate-header,\n\t#lc-body #new-update-form {\n\t\tmargin-left: initial;\n\t}\n\n\t#lc-body li.liveupdate ul.buttonrow {\n\t\tmargin: initial !important;\n\t}\n\n\t#lc-body div.content {max-width:initial; padding:initial;} #lc-body div.content #new-update-form .usertext .usertext-edit textarea {height: initial;width: initial !important; font-size:initial;} #lc-body #liveupdate-header {display: initial;} #lc-body #river {font-size: initial;width: initial;margin-left: initial;margin-top: initial;} #lc-body li.liveupdate * {font-size: initial;} #lc-body .liveupdate-listing li.separator time {font-size: initial;} #lc-body .status {font-size: initial;} #lc-body {font-size: initial!important;} #lc-body button, html input[type='button'] {padding: initial;font-size: initial;}");
8071
8072
8073})(DisplayMode || (DisplayMode = {}));
8074////////////////////////////
8075// RemoveSubmissionLag.ts //
8076////////////////////////////
8077var RemoveSubmissionLag;
8078(function (RemoveSubmissionLag) {
8079 // INITIALIZATION
8080 var lastInput = '';
8081 var enabled = true;
8082 var ghostEnabled = false;
8083 var previews = [];
8084 // Options
8085 Options.addSelect({
8086 label: 'REMOVE SUBMISSION LAG',
8087 options: ['Enabled', 'Enabled without Ghost Messages', 'Disabled'],
8088 "default": 1,
8089 help: 'Upon submitting a message, the textbox is immediately cleared to allow you to enter new contents without waiting for your previous submission to be processed.\n\nThe ghost messages are to prevent messages from being permanently lost if they had failed to deliver. You can enable the feature without ghost messages if you find them too distracting.',
8090 onchange: function () {
8091 var display = this.val();
8092 enabled = display == 'Enabled' || display == 'Enabled without Ghost Messages';
8093 ghostEnabled = display == 'Enabled';
8094 }
8095 });
8096 // Styles
8097 Styles.add("\n\n\t.liveupdate-listing li.liveupdate.preview {\n\t\topacity: 0.75;\n\t}\n\t.liveupdate-listing li.liveupdate.preview .live-timestamp {\n\t\tvisibility: hidden;\n\t}\n\n\t");
8098 // EVENTS
8099 // When message is submitted
8100 Elements.$submitBtn.on('click', function (e) {
8101 if (!enabled)
8102 return;
8103 setTimeout(function () {
8104 var val = Elements.$textarea.val();
8105 if (val.length == 0)
8106 return;
8107 // Add preview element, a "ghost" message containing the contents of the new message
8108 // until it has been delivered.
8109 // Prevents permanent loss of messages if delivery fails
8110 if (ghostEnabled) {
8111 var html = SnuOwnd.getParser().render(val);
8112 var $buttonRow = $("\n\t\t\t\t\t<ul class=\"buttonrow\">\n\t\t\t\t\t\t<li><button>retry</button></li>\n\t\t\t\t\t\t<li><button>cancel</button></li>\n\t\t\t\t\t</ul>\n\t\t\t\t");
8113 var $elem_1 = $("\n\t\t\t\t\t<li class=\"liveupdate preview\">\n\t\t\t\t\t\t<a href=\"#\"><time class=\"live-timestamp\"></time></a>\n\t\t\t\t\t\t<div class=\"body\">\n\t\t\t\t\t\t\t<div class=\"md\">\n\t\t\t\t\t\t\t\t" + html + "\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</li>\n\t\t\t\t").append($buttonRow);
8114 previews.push({
8115 html: html.trim().replace(/(\r\n|\n|\r)/gm, ""),
8116 elem: $elem_1
8117 });
8118 Elements.$updates.prepend($elem_1);
8119 // Setup event listeners for the buttons of the preview message
8120 var $buttons = $buttonRow.find('button');
8121 // "Retry" button
8122 $buttons.eq(0).on('click', function () {
8123 Elements.$textarea.val(val).focus();
8124 });
8125 // "Cancel" button
8126 $buttons.eq(1).on('click', function () {
8127 for (var i = 0; i < previews.length; i++) {
8128 if ($elem_1 == previews[i].elem) {
8129 $elem_1.remove();
8130 previews.splice(i, 1);
8131 break;
8132 }
8133 }
8134 });
8135 }
8136 // Clear textbox
8137 Elements.$textarea.val('');
8138 // This is a way to work around the issue where Reddit automatically clears the textbox
8139 // when the update had been successfully delivered, although we just cleared it here.
8140 // Call backupInput() whenever the textarea content is changed
8141 Elements.$textarea.on('keydown keyup input', backupInput);
8142 }, 0);
8143 });
8144 // In backupInput(), keep track of the last backed up textarea content, by storing in lastInput
8145 function backupInput() {
8146 lastInput = Elements.$textarea.val();
8147 }
8148 // Use MutationObserver on the 'error message' to detect when Reddit had cleared the textbox.
8149 // When the error message's style changes from 'display: inline;' to 'display: none;', it
8150 // is clear that Reddit had cleared the textbox.
8151 // At this point, use the last backed-up input
8152 var observer = new MutationObserver(function (mutations) {
8153 if (!enabled)
8154 return;
8155 if (mutations.length != 1)
8156 return;
8157 // Exit if we think that Reddit had not cleared the textbox
8158 var mutation = mutations[0];
8159 if (!(mutation.oldValue == 'display: inline;' &&
8160 Elements.$submitError.attr('style') == 'display: none;'))
8161 return;
8162 // Use the last backed-up input
8163 Elements.$textarea.off('keydown keyup input', backupInput);
8164 Elements.$textarea.val(lastInput);
8165 lastInput = '';
8166 });
8167if (Elements.$submitError.length > 0) {
8168 observer.observe(Elements.$submitError.get(0), {
8169 // observe for change in 'style' attribute value
8170 attributes: true,
8171 attributeOldValue: true,
8172 attributeFilter: ['style']
8173 });
8174}
8175 // When new message is loaded and is by this user, check if we can delete the corresponding
8176 // preview message.
8177 // If it is by another user, push all the preview messages to the front (in the right order),
8178 // so that they seem to always be on top.
8179 // (Only if preview messages are enabled)
8180 Update.loadedNew(function (data) {
8181 if (!enabled || !ghostEnabled)
8182 return;
8183 var l = previews.length; // number of preview messages
8184 if (data.author != USER) {
8185 // Message not from this user
8186 // Attempt to bring all the preview messages to the front and exit
8187 for (var i = 0; i < l; i++) {
8188 Elements.$updates.prepend(previews[i].elem);
8189 }
8190 return;
8191 }
8192 // Get the contents of the user's message (trimmed and without linebreaks),
8193 // loop through the preview messages (trimmed and without linebreaks),
8194 // and if the contents are the same, delete the preview message
8195 var body = data.body_elem.html().replace(/(\r\n|\n|\r)/gm, "").trim();
8196 //console.log(body);
8197 var to_delete = -1;
8198 for (var i = 0; i < l; i++) {
8199 //console.log(previews[i].html);
8200 if (previews[i].html == body) {
8201 to_delete = i;
8202 break;
8203 }
8204 }
8205 if (to_delete != -1)
8206 previews.splice(to_delete, 1)[0].elem.remove();
8207 });
8208})(RemoveSubmissionLag || (RemoveSubmissionLag = {}));
8209/////////////////////////////
8210// DisableUsernameLinks.ts //
8211/////////////////////////////
8212var DisableUsernameLinks;
8213(function (DisableUsernameLinks) {
8214 // INITIALIZATION
8215 Elements.$body.attr('data-DisableUsernameLinks', 'false');
8216 // Options
8217 Options.addCheckbox({
8218 label: 'DISABLE USERNAME LINKS',
8219 section: 'Advanced',
8220 help: 'Disables the redirection to a user\'s profile upon clicking on his/her username. This is convenient to prevent yourself from accidentally going to one\'s profile page when trying to strike or delete a message.',
8221 onchange: function () {
8222 Elements.$body.attr('data-DisableUsernameLinks', this.prop('checked').toString());
8223 }
8224 });
8225 // Styles
8226 Styles.add("\n\n\t#lc-body[data-DisableUsernameLinks='true'] li.liveupdate > .body > .author {\n\t\tpointer-events: none;\n\t\tcursor: auto;\n\t}\n\n\t");
8227})(DisableUsernameLinks || (DisableUsernameLinks = {}));
8228////////////////////////
8229// LinksOpenNewTab.ts //
8230////////////////////////
8231var LinksOpenNewTab;
8232(function (LinksOpenNewTab) {
8233 // INITIALIZATION
8234 var $base = $('<base target="_blank">');
8235 Elements.$head.append($base);
8236 // Options
8237 var enabled = true;
8238 Options.addCheckbox({
8239 label: 'MAKE ALL LINKS OPEN IN A NEW TAB',
8240 "default": true,
8241 section: 'Advanced',
8242 help: 'Makes all links on the page open in a new tab.',
8243 onchange: function () {
8244 enabled = this.prop('checked');
8245 if (enabled)
8246 $base.attr('target', '_blank');
8247 else
8248 $base.attr('target', '_self');
8249 }
8250 });
8251})(LinksOpenNewTab || (LinksOpenNewTab = {}));
8252/////////////////////////
8253// DisableShortcuts.ts //
8254/////////////////////////
8255var DisableShortcuts;
8256(function (DisableShortcuts) {
8257 // INITIALIZATION
8258 // Options
8259 var enabled = true;
8260 Options.addCheckbox({
8261 label: 'DISABLE OBSTRUCTIVE BROWSER SHORTCUTS',
8262 "default": true,
8263 section: 'Advanced',
8264 help: 'Disables certain obstructive browser keyboard shortcuts. This currently disables the following: Ctrl+0 (Zoom Reset), Ctrl+[1-9] (Switch Tabs)',
8265 onchange: function () {
8266 enabled = this.prop('checked');
8267 }
8268 });
8269 // EVENTS
8270 $(document).on('keydown', function (e) {
8271 if (!enabled)
8272 return;
8273 // Ctrl Hotkeys
8274 if (e.ctrlKey) {
8275 // Ctrl+0 (Zoom Reset)
8276 if (e.keyCode == 48)
8277 e.preventDefault();
8278 // Ctrl+[1-9] (Switch Tabs)
8279 if (e.keyCode >= 49 && e.keyCode <= 57)
8280 e.preventDefault();
8281 // Ctrl+[numpad0-9] (as above)
8282 if (e.keyCode >= 96 && e.keyCode <= 105)
8283 e.preventDefault();
8284 }
8285 });
8286})(DisableShortcuts || (DisableShortcuts = {}));
8287//////////////////////////
8288// SpecialUsernames.ts //
8289//////////////////////////
8290if (specialnumber > 0) {
8291var SpecialUsernames1;
8292var SpecialUsernamesEnabled1;
8293(function (SpecialUsernames1) {
8294 // Options
8295 var enabled1 = true;
8296 var $checkbox = Options.addCheckbox({
8297 label: kname1 + ' 100K USERNAME',
8298 section: 'Advanced',
8299 "default": true,
8300 help: 'Enable or disable the special 100k usernames.',
8301 onchange: function () {
8302 enabled1 = this.prop('checked');
8303 }
8304 });
8305 if (enabled1 == true) {
8306 SpecialUsernamesEnabled1 = 'yep lol';
8307 } else {
8308 SpecialUsernamesEnabled1 = 'nope lol';
8309 }
8310})(SpecialUsernames1 || (SpecialUsernames1 = {}));
8311}
8312if (specialnumber > 1) {
8313var SpecialUsernames2;
8314var SpecialUsernamesEnabled2;
8315(function (SpecialUsernames2) {
8316 // Options
8317 var enabled2 = true;
8318 var $checkbox = Options.addCheckbox({
8319 label: kname2 + ' 100K USERNAME',
8320 section: 'Advanced',
8321 "default": true,
8322 help: 'Enable or disable the special 100k usernames.',
8323 onchange: function () {
8324 enabled2 = this.prop('checked');
8325 }
8326 });
8327 if (enabled2 == true) {
8328 SpecialUsernamesEnabled2 = 'yep lol';
8329 } else {
8330 SpecialUsernamesEnabled2 = 'nope lol';
8331 }
8332})(SpecialUsernames2 || (SpecialUsernames2 = {}));
8333}
8334if (specialnumber > 2) {
8335var SpecialUsernames3;
8336var SpecialUsernamesEnabled3;
8337(function (SpecialUsernames3) {
8338 // Options
8339 var enabled3 = true;
8340 var $checkbox = Options.addCheckbox({
8341 label: kname3 + ' 100K USERNAME',
8342 section: 'Advanced',
8343 "default": true,
8344 help: 'Enable or disable the special 100k usernames.',
8345 onchange: function () {
8346 enabled3 = this.prop('checked');
8347 }
8348 });
8349 if (enabled3 == true) {
8350 SpecialUsernamesEnabled3 = 'yep lol';
8351 } else {
8352 SpecialUsernamesEnabled3 = 'nope lol';
8353 }
8354})(SpecialUsernames3 || (SpecialUsernames3 = {}));
8355}
8356if (specialnumber > 3) {
8357var SpecialUsernames4;
8358var SpecialUsernamesEnabled4;
8359(function (SpecialUsernames2) {
8360 // Options
8361 var enabled4 = true;
8362 var $checkbox = Options.addCheckbox({
8363 label: kname4 + ' 100K USERNAME',
8364 section: 'Advanced',
8365 "default": true,
8366 help: 'Enable or disable the special 100k usernames.',
8367 onchange: function () {
8368 enabled4 = this.prop('checked');
8369 }
8370 });
8371 if (enabled4 == true) {
8372 SpecialUsernamesEnabled4 = 'yep lol';
8373 } else {
8374 SpecialUsernamesEnabled4 = 'nope lol';
8375 }
8376})(SpecialUsernames4 || (SpecialUsernames4 = {}));
8377}
8378if (specialnumber > 4) {
8379var SpecialUsernames5;
8380var SpecialUsernamesEnabled5;
8381(function (SpecialUsernames5) {
8382 // Options
8383 var enabled5 = true;
8384 var $checkbox = Options.addCheckbox({
8385 label: kname5 + ' 100K USERNAME',
8386 section: 'Advanced',
8387 "default": true,
8388 help: 'Enable or disable the special 100k usernames.',
8389 onchange: function () {
8390 enabled5 = this.prop('checked');
8391 }
8392 });
8393 if (enabled5 == true) {
8394 SpecialUsernamesEnabled5 = 'yep lol';
8395 } else {
8396 SpecialUsernamesEnabled5 = 'nope lol';
8397 }
8398})(SpecialUsernames5 || (SpecialUsernames5 = {}));
8399}
8400if (specialnumber > 5) {
8401var SpecialUsernames6;
8402var SpecialUsernamesEnabled6;
8403(function (SpecialUsernames6) {
8404 // Options
8405 var enabled6 = true;
8406 var $checkbox = Options.addCheckbox({
8407 label: kname6 + ' 100K USERNAME',
8408 section: 'Advanced',
8409 "default": true,
8410 help: 'Enable or disable the special 100k usernames.',
8411 onchange: function () {
8412 enabled6 = this.prop('checked');
8413 }
8414 });
8415 if (enabled6 == true) {
8416 SpecialUsernamesEnabled6 = 'yep lol';
8417 } else {
8418 SpecialUsernamesEnabled6 = 'nope lol';
8419 }
8420})(SpecialUsernames6 || (SpecialUsernames6 = {}));
8421}
8422
8423//////////////////////////
8424// TeamBars.ts //
8425//////////////////////////
8426var TeamBars;
8427var TeamBarsEnabled;
8428(function (TeamBars) {
8429 // Options
8430 var enabled = true;
8431 var $checkbox = Options.addCheckbox({
8432 label: 'DAILY HALL OF COUNTERS',
8433 section: 'Advanced',
8434 "default": true,
8435 help: 'Enable or disable the daily Hall of Counters.',
8436 onchange: function () {
8437 enabled = this.prop('checked');
8438 }
8439 });
8440 if (enabled == true) {
8441 TeamBarsEnabled = 'yep lol';
8442 } else {
8443 TeamBarsEnabled = 'nope lol';
8444 }
8445
8446 //////////////////////////////////TEAM COMMAS
8447 if (window.location.href.indexOf("ta535s1hq2je") > -1) {
8448 if (TeamBarsEnabled == 'yep lol') {
8449 var hmmyy;
8450 var checky;
8451 var checky2;
8452 var first_call = true;
8453
8454 day_hoc_handler = function (data) {
8455 hmmyy = data["hoc"];
8456 checky = data["hoc"];
8457 if (first_call){
8458 $(`<div id=wholetable><table id=loadtest><caption id=dailyenabler>Daily Hall of Counters [+]</caption><tr id="tablenames"><td>#</td><td>User</td><td>Counts</td></tr></table></div>`).insertBefore("#liveupdate-resources .md");
8459 first_call = false;
8460 } else {
8461 $(`#wholetable`).html(`<table id=loadtest><caption id=dailyenabler>Daily Hall of Counters [+]</caption><tr id="tablenames"><td>#</td><td>User</td><td>Counts</td></tr></table>`);
8462 }
8463 function getTableRow(item, index) {
8464 let res = "<tr style='font-size:inherit;'";
8465 if (index >= 3){
8466 res += " class=collapsedo";
8467 }
8468 var hocname = [item.author, item.counts].join("</a></td><td>");
8469 res += "><td>" + (index + 1) + "</td><td><a class=authoro>/u/" + hocname + "</td></tr>";
8470 return res;
8471 }
8472 function jsonCheck(item) {
8473 var hocnamd = [item.author, item.counts].join("");
8474 return hocnamd;
8475 }
8476
8477 hmmyy = hmmyy.map(getTableRow);
8478 checky = checky.map(jsonCheck);
8479
8480 checky = checky.join("");
8481 checky = checky.replace(/[A-Za-z]/g, ``);
8482 checky = checky.replace(/[-]/g, ``);
8483 checky = checky.replace(/[_]/g, ``);
8484 checky = checky.replace(/[0-9]+/g, '');
8485 if (checky.length == 0) {
8486 $('#loadtest').append(hmmyy.join(""));
8487 $("#loadtest tbody:nth-child(5)").append(`<tr><td>divide</td></tr>`);
8488 $(".authoro").each(function () {
8489 // $(this).prepend(`<a href=` + $(this).text() + `>`);
8490 // $(this).append(`</a>`);
8491 $(this).attr("href", "https://reddit.com" + $(this).text());
8492 if (dailyHocColorNamesEnable2 == true) {
8493 var thishref = $(this).attr('href');
8494 thishref = thishref.trim().replace('https://reddit.com/u/', '');
8495 $(this).css('color', colortransfers[thishref]);
8496 if ($(this).text() == `/u/` + USER) {
8497 $(this).parent().parent().css('font-weight', 'bold');
8498 }
8499 }
8500 });
8501
8502 if (dailysize == 0) {
8503 document.getElementById("dailyenabler").innerHTML = "Daily Hall of Counters [+]";
8504 $(".collapsedo").css({
8505 'display': 'none',
8506 });
8507 } else {
8508 document.getElementById("dailyenabler").innerHTML = "Daily Hall of Counters [-]";
8509 $(".collapsedo").css({
8510 'display': 'table-row',
8511 });
8512 }
8513 $("#dailyenabler").on('click', function () {
8514 if (dailysize == 0) {
8515 dailysize++;
8516 document.getElementById("dailyenabler").innerHTML = "Daily Hall of Counters [-]";
8517 $(".collapsedo").css({
8518 'display': 'table-row',
8519 });
8520 } else {
8521 dailysize--;
8522 document.getElementById("dailyenabler").innerHTML = "Daily Hall of Counters [+]";
8523 $(".collapsedo").css({
8524 'display': 'none',
8525 });
8526 }
8527 });
8528 } else { //checky length check
8529 $('#loadtest').append("<tr><td>Error verifying data, please PM /u/rideride</td></tr>");
8530 }
8531 }
8532
8533 $.ajax({
8534 method: 'GET',
8535 dataType: 'json',
8536 cache: false,
8537 url: 'https://raw.githubusercontent.com/MaybeNotWrong/lc-sep/master/data.txt',
8538 success: day_hoc_handler, //////this is where you put the checky bracket
8539 error: function (data) {
8540 hmmyy;
8541 }
8542 });
8543
8544 setInterval(function () {
8545
8546 var hmmyy;
8547 var checky;
8548 var checky2;
8549 $.ajax({
8550 method: 'GET',
8551 dataType: 'json',
8552 cache: false,
8553 url: 'https://raw.githubusercontent.com/MaybeNotWrong/lc-sep/master/data.txt',
8554 success: day_hoc_handler, //////this is where you put the checky bracket
8555 error: function (data) {
8556 hmmyy;
8557 }
8558 });
8559
8560 }, 15000);
8561Styles.add(` #loadtest tbody tr:nth-child(2) td:nth-child(1){background: gold;color: black;}#loadtest tbody tr:nth-child(3) td:nth-child(1){background: silver;color: black;}#loadtest tbody tr:nth-child(4) td:nth-child(1){background: #cd7f32;color: black;}#loadtest{border: 1px solid black;width: 100%;text-align: center;}#loadtest tr td{border: 1px solid black;max-width: 223px;}#loadtest{overflow: hidden;height: 100%;}#loadtest{color: #000;font-size: inherit;font-weight: normal;}#dailyenabler{cursor: pointer;color: #000;font-size: 14px;font-weight: bold;margin-bottom: 3px;}#tablenames{font-weight: bold;}`);
8562 //document.getElementById("team1").style.cssText = 'background:#0000cf;color:white;z-index: 99999;min-width: 14px;max-width: 14px;height: 14px;line-height: 14px;border-radius: 14px;border: none;overflow: hidden;padding: 0;vertical-align: middle;font-size: 11px !important;position: relative;text-indent: 12px;-webkit-transition: all 0.3s;transition: all 0.3s;-webkit-transition-delay: 0.1s;transition-delay: 0.1s;cursor:help;';
8563 } //TeamBarsEnabled end
8564 }
8565 //////////////////////////////////
8566})(TeamBars || (TeamBars = {}));
8567
8568
8569//////////////////////////
8570// TeamBarsRevival.ts //
8571//////////////////////////
8572var TeamBarsRevival;
8573var TeamBarsRevivalEnabled;
8574(function (TeamBarsRevival) {
8575 // Options
8576 var enabled = true;
8577 var $checkbox = Options.addCheckbox({
8578 label: 'TEAM BARS',
8579 section: 'Advanced 2',
8580 "default": true,
8581 help: 'Enable or disable the team bars.',
8582 onchange: function () {
8583 enabled = this.prop('checked');
8584 }
8585 });
8586 if (enabled == true) {
8587 TeamBarsRevivalEnabled = 'yep lol';
8588 } else {
8589 TeamBarsRevivalEnabled = 'nope lol';
8590 }
8591
8592//////////////////////////////////TEAM COMMAS
8593
8594 var thingycheck = false;
8595
8596setTimeout(function(){
8597 if($('#discussions h2').text() == 'discusions') {
8598 if (window.location.href.indexOf("graphite") > -1 || window.location.href.indexOf("riverbot") > -1 ) {
8599 thingycheck = true;
8600 }
8601 if (april2020 == 16 ) {
8602 thingycheck = true;
8603 }
8604 }
8605},2000);
8606
8607setTimeout(function(){
8608if(window.location.href.indexOf("ta535s1hq2je") > -1 && thingycheck == true) {
8609if (TeamBarsRevivalEnabled == 'yep lol') {
8610var hmmyyTeamBarsRevival;
8611var checkyTeamBarsRevival;
8612var checky2TeamBarsRevival;
8613$.ajax({
8614 method: 'GET',
8615 dataType: 'text',
8616 cache: false,
8617 url: 'https://gist.githubusercontent.com/rideride/83689b8fe63efbbba0d68dd2494a3b2a/raw/teambars_revival.txt',
8618 success: function(data) {
8619checkyTeamBarsRevival = `<div id="commacount"></div><div id="noncommacount"></div>`;
8620hmmyyTeamBarsRevival = data;
8621checky2TeamBarsRevival = data;
8622checky2TeamBarsRevival = checky2TeamBarsRevival.replace(/[0-9]+/g, '');
8623if (checkyTeamBarsRevival != checky2TeamBarsRevival) {
8624//alert('Something has gone wrong in the verification of the data. Please PM /u/rideride. To stop showing this message, disable the option for now until it is fixed');
8625} else {
8626$("<div id=loadtestTeamBarsRevival></div><div id=teamdisplay><div id=team1>The Revolutionaries</div><div id=team1count></div><div id=team2count></div><div id=team2>The Coalition</div></div>").insertBefore("#liveupdate-description");
8627document.getElementById('loadtestTeamBarsRevival').innerHTML = hmmyyTeamBarsRevival;
8628$("#loadtestTeamBarsRevival").css('display','none');
8629var commacountsTeamBarsRevival = parseInt(document.getElementById('commacount').innerHTML);
8630var noncommacountsTeamBarsRevival = parseInt(document.getElementById('noncommacount').innerHTML);
8631var totalcountsTeamBarsRevival = commacountsTeamBarsRevival + noncommacountsTeamBarsRevival;
8632var commapercentTeamBarsRevival = (commacountsTeamBarsRevival / totalcountsTeamBarsRevival) * 100;
8633commapercentTeamBarsRevival = Math.round( commapercentTeamBarsRevival * 10 ) / 10;
8634var noncommapercentTeamBarsRevival = (noncommacountsTeamBarsRevival / totalcountsTeamBarsRevival) * 100;
8635noncommapercentTeamBarsRevival = Math.round( noncommapercentTeamBarsRevival * 10 ) / 10;
8636document.getElementById('team1count').innerHTML = commacountsTeamBarsRevival;
8637document.getElementById('team2count').innerHTML = noncommacountsTeamBarsRevival;
8638$("#teamdisplay").css('display','flex').css('font-size','14px');
8639$("#team1count").css('flex',commapercentTeamBarsRevival + '0 1 0px').css('background','blue').css('text-align','center').css('color','transparent').css('padding-top','3px');
8640$("#team2count").css('flex',noncommapercentTeamBarsRevival + '0 1 0px').css('background','green').css('text-align','center').css('color','transparent').css('padding-top','3px');
8641$( "#teamdisplay" ).hover(function() {
8642 document.getElementById("team1count").style.color = 'white';
8643 document.getElementById("team2count").style.color = 'white';
8644 }, function() {
8645 document.getElementById("team1count").style.color = 'transparent';
8646 document.getElementById("team2count").style.color = 'transparent';
8647 });
8648$("#team1").css('padding','3px 3px 3px 3px').css('background','#0000cf').css('color','white');
8649$("#team2").css('padding','3px 3px 3px 3px').css('background','#006000').css('color','white');
8650 var cssheadTeamBarsRevival = $(`<style>#team1:before {-webkit-transition: all 0.3s;transition: all 0.3s;transition-delay: 0.3s;-webkit-transition-delay: 0.3s;transition-delay: 0.3s;content: attr(data-before);width: 10px;height: 12px;display: inline-block;position: absolute;left: 0px;text-align: center;top: 3px;text-indent: 3px;font-size: 14px;} #team1:hover::before {-webkit-transition: all 0.3s;transition: all 0.3s;transition-delay: 0s;-webkit-transition-delay: 0.0s;transition-delay: 0.0s;font-size:0px;} #team2:before {-webkit-transition: all 0.3s;transition: all 0.3s;transition-delay: 0.3s;-webkit-transition-delay: 0.3s;transition-delay: 0.3s;content:attr(data-before);width: 10px;height: 12px;display: inline-block;position: absolute;left: 0px;text-align: center;top: 3px;text-indent: 3px;font-size: 14px;} #team2:hover::before {-webkit-transition: all 0.3s;transition: all 0.3s;transition-delay: 0s;-webkit-transition-delay: 0.0s;transition-delay: 0.0s;font-size:0px;} #team1 {background: #0000cf;color: white;z-index: 99;min-width: 45px;max-width: 45px;height: 17px;line-height: 14px;border-top-left-radius: 14px;border: none;overflow: hidden;padding: 0;vertical-align: middle;font-size: 0px;position: relative;text-indent: 0px;-webkit-transition: all 0.3s;transition: all 0.3s;transition-delay: 0s;-webkit-transition-delay: 0.1s;transition-delay: 0.1s;cursor: help;border-bottom-left-radius: 14px;} #team1:hover {font-size: 14px;max-width: 500px;padding: 0 5px;color: #fff} #team2 {background: #0000cf;color: white;z-index: 99;min-width: 45px;max-width: 45px;height: 17px;line-height: 14px;border-top-right-radius: 14px;border: none;overflow: hidden;padding: 0;vertical-align: middle;font-size: 0px;position: relative;text-indent: 0px;-webkit-transition: all 0.3s;transition: all 0.3s;transition-delay: 0s;-webkit-transition-delay: 0.1s;transition-delay: 0.1s;cursor: help;border-bottom-right-radius: 14px;} #team2:hover {font-size: 14px;max-width: 500px;padding: 0 5px;color: #fff}</style>`);
8651$("#team1").attr('data-before',commapercentTeamBarsRevival+"%");
8652$("#team2").attr('data-before',noncommapercentTeamBarsRevival+"%");
8653 // INITIALIZATION
8654 $('head').append(cssheadTeamBarsRevival);
8655 }},
8656 error: function(data) {
8657 //alert('Error ' +data.status+ ' while loading Live Counting Extension: ' +data.statusText+ '\n\nPlease refresh to try again.');
8658 }
8659 });
8660setInterval(function(){
8661var hmmyyTeamBarsRevival;
8662var checkyTeamBarsRevival;
8663var checky2TeamBarsRevival;
8664$.ajax({
8665 method: 'GET',
8666 dataType: 'text',
8667 cache: false,
8668 url: 'https://gist.githubusercontent.com/rideride/83689b8fe63efbbba0d68dd2494a3b2a/raw/teambars_revival.txt',
8669 success: function(data) {
8670checkyTeamBarsRevival = `<div id="commacount"></div><div id="noncommacount"></div>`;
8671hmmyyTeamBarsRevival = data;
8672checky2TeamBarsRevival = data;
8673checky2TeamBarsRevival = checky2TeamBarsRevival.replace(/[0-9]+/g, '');
8674if (checkyTeamBarsRevival != checky2TeamBarsRevival) {
8675//alert('Something has gone wrong in the verification of the data. Please PM /u/rideride. To stop showing this message, disable the option for now until it is fixed');
8676} else {
8677document.getElementById('loadtestTeamBarsRevival').innerHTML = hmmyyTeamBarsRevival;
8678var commacountsTeamBarsRevival = parseInt(document.getElementById('commacount').innerHTML);
8679var noncommacountsTeamBarsRevival = parseInt(document.getElementById('noncommacount').innerHTML);
8680var totalcountsTeamBarsRevival = commacountsTeamBarsRevival + noncommacountsTeamBarsRevival;
8681var commapercentTeamBarsRevival = (commacountsTeamBarsRevival / totalcountsTeamBarsRevival) * 100;
8682commapercentTeamBarsRevival = Math.round( commapercentTeamBarsRevival * 10 ) / 10;
8683var noncommapercentTeamBarsRevival = (noncommacountsTeamBarsRevival / totalcountsTeamBarsRevival) * 100;
8684noncommapercentTeamBarsRevival = Math.round( noncommapercentTeamBarsRevival * 10 ) / 10;
8685document.getElementById('team1count').innerHTML = commacountsTeamBarsRevival;
8686document.getElementById('team2count').innerHTML = noncommacountsTeamBarsRevival;
8687$("#team1count").css('flex',commapercentTeamBarsRevival + '0 1 0px');
8688$("#team2count").css('flex',noncommapercentTeamBarsRevival + '0 1 0px');
8689$("#team1").attr('data-before',commapercentTeamBarsRevival+"%");
8690$("#team2").attr('data-before',noncommapercentTeamBarsRevival+"%");
8691}},
8692 error: function(data) {
8693 //alert('Error ' +data.status+ ' while loading Live Counting Extension: ' +data.statusText+ '\n\nPlease refresh to try again.');
8694 }
8695 });
8696}, 60500);
8697//document.getElementById("team1").style.cssText = 'background:#0000cf;color:white;z-index: 99999;min-width: 14px;max-width: 14px;height: 14px;line-height: 14px;border-radius: 14px;border: none;overflow: hidden;padding: 0;vertical-align: middle;font-size: 11px !important;position: relative;text-indent: 12px;-webkit-transition: all 0.3s;transition: all 0.3s;-webkit-transition-delay: 0.1s;transition-delay: 0.1s;cursor:help;';
8698} //TeamBarsEnabled end
8699}
8700 },3000);
8701//////////////////////////////////
8702})(TeamBarsRevival || (TeamBarsRevival = {}));
8703////////////////////////
8704
8705
8706////////////////////////
8707// ContentPosition.ts //
8708////////////////////////
8709var ContentPosition;
8710(function (ContentPosition) {
8711 // INITIALIZATION
8712 Elements.$body.attr('data-ContentPosition', 'Center');
8713 // Options
8714 Options.addSelect({
8715 label: 'CONTENT POSITION',
8716 options: ['Left', 'Center', 'Right'],
8717 section: 'Advanced',
8718 "default": 1,
8719 help: 'Adjusts the position of the main content section.',
8720 onchange: function () {
8721 Elements.$body.attr('data-ContentPosition', this.val());
8722 }
8723 });
8724 // Styles
8725 Styles.add("\n\n\t#lc-body[data-ContentPosition='Left'] div.content {\n\t\tmargin: 0;\n\t}\n\t#lc-body[data-ContentPosition='Center'] div.content {\n\t\tmargin: 0 auto;\n\t}\n\t#lc-body[data-ContentPosition='Right'] div.content {\n\t\tfloat: right;\n\t}\n\n\t");
8726})(ContentPosition || (ContentPosition = {}));
8727////////////////////////////////
8728// StandardizeNumberFormat.ts //
8729////////////////////////////////
8730var StandardizeNumberFormat;
8731(function (StandardizeNumberFormat) {
8732 // UTILITY
8733 // Format a number string with a character separator (e.g. 1,000,000)
8734 function delimit(str, char) {
8735 return str.replace(/\B(?=(\d{3})+(?!\d))/g, char);
8736 }
8737 // Trim specified leading and trailing characters in a string
8738 function trim(str, chars) {
8739 var i = 0;
8740 var l = str.length;
8741 var start = 0;
8742 var end = l - 1;
8743 for (i = 0; i < l; i++) {
8744 if (chars.indexOf(str.charAt(i)) == -1) {
8745 start = i;
8746 break;
8747 }
8748 }
8749 for (i = l - 1; i >= 0; i--) {
8750 if (chars.indexOf(str.charAt(i)) == -1) {
8751 end = i;
8752 break;
8753 }
8754 }
8755 return str.slice(start, end + 1);
8756 }
8757 /**
8758 * Get the first element in the body that is either
8759 * a text node
8760 * a node that does not have any children
8761 */
8762 function first_node(parent) {
8763 var contents = parent.childNodes;
8764 var i = 0;
8765 for (var l = contents.length; i < l; i++) {
8766 if (contents[i].nodeType == 3) {
8767 // text node
8768 // check if empty
8769 if (contents[i].textContent.trim().length > 0)
8770 return contents[i];
8771 }
8772 if (contents[i].nodeType == 1) {
8773 // element node
8774 var elem = contents[i];
8775 if (elem.children.length == 0) {
8776 // no more children
8777 break;
8778 }
8779 // parent node - recurse to return its first node
8780 return first_node(elem);
8781 }
8782 }
8783 return contents[i];
8784 }
8785 // INITIALIZATION
8786 var enabled = false;
8787 var format = function (str) { return str; };
8788 // Possible format functions
8789 // (this is to avoid the use of anonymous functions, improving performance)
8790 var FormatFuncs;
8791 (function (FormatFuncs) {
8792 function Commas(str) {
8793 return delimit(str, ',');
8794 }
8795 FormatFuncs.Commas = Commas;
8796 function Spaces(str) {
8797 return delimit(str, ' ');
8798 }
8799 FormatFuncs.Spaces = Spaces;
8800 function Periods(str) {
8801 return delimit(str, '.');
8802 }
8803 FormatFuncs.Periods = Periods;
8804 function None(str) {
8805 return str;
8806 }
8807 FormatFuncs.None = None;
8808 })(FormatFuncs || (FormatFuncs = {}));
8809 ;
8810 // Options
8811 Options.addSelect({
8812 label: 'STANDARDIZE NUMBER FORMAT',
8813 options: ['Disabled', 'Spaces', 'Periods', 'Commas', 'None'],
8814 section: 'Advanced',
8815 help: 'Standardizes the number count in each message to a format of your choice. Also removes special formatting on the number.',
8816 onchange: function () {
8817 var val = this.val();
8818 if (val == 'Disable') {
8819 enabled = false;
8820 return;
8821 }
8822 enabled = true;
8823 format = FormatFuncs[val];
8824 }
8825 });
8826 // EVENTS
8827 // New update loaded
8828 Update.loadedNew(function (data) {
8829 if (!enabled)
8830 return;
8831 var first_elem = first_node(data.body_elem.get(0));
8832 var $first_elem = $(first_elem);
8833 var body = first_elem.textContent;
8834 if (!body)
8835 return;
8836 // Detect number from string
8837 // (This algorithm has a few problems, such as "2,000 2 GETS today"
8838 // producing a detected number of "20002".)
8839 var l = body.length;
8840 var num = '';
8841 var original_num = '';
8842 var c;
8843 for (var i = 0; i < l; i++) {
8844 c = body.charAt(i);
8845 if (c == '0' || c == '1' || c == '2' || c == '3' || c == '4' ||
8846 c == '5' || c == '6' || c == '7' || c == '8' || c == '9') {
8847 num += c;
8848 original_num += c;
8849 continue;
8850 }
8851 else if (c == ' ' || c == ',' || c == '.') {
8852 // part of number styling preference
8853 original_num += c;
8854 continue;
8855 }
8856 else {
8857 break;
8858 }
8859 }
8860 if (num.length == 0)
8861 num = null;
8862 // Replace original_num in first_elem with num
8863 if (num == null)
8864 return;
8865 first_elem.textContent = body.replace(trim(original_num, [' ', ',', '.']), format(num));
8866 // Remove formatting of parents of first_elem by changing into span
8867 // Also, headers are not wrapped in p, so replace those with p
8868 var $parents = $first_elem.parentsUntil('p, div.md');
8869 var parentsLen = $parents.length;
8870 if (first_elem.nodeType == 1 && !$first_elem.is('p, div.md')) {
8871 $parents = $parents.add($first_elem);
8872 if (parentsLen == 0) {
8873 // not a paragraph, but still no parent? must be a header (h1)
8874 // convert to p
8875 $first_elem.replaceWith('<p>' + first_elem.textContent + '</p>');
8876 }
8877 }
8878 var $this;
8879 $parents.each(function (index, element) {
8880 $this = $(this);
8881 if ($this.parent().is(data.body_elem)) {
8882 // if the direct parent is the body element,
8883 // replace to p instead,
8884 // since this is definitely not a p itself
8885 $this.replaceWith('<p>' + this.textContent + '</p>');
8886 return;
8887 }
8888 $this.replaceWith('<span>' + this.textContent + '</span>');
8889 });
8890 });
8891})(StandardizeNumberFormat || (StandardizeNumberFormat = {}));
8892////////////////////////
8893// OptionPosition.ts //
8894////////////////////////
8895
8896var OptionPosition;
8897(function (OptionPosition) {
8898 // INITIALIZATION
8899 $('#liveupdate-options').attr('data-OptionPosition', 'HIGHER');
8900 // Options
8901 Options.addSelect({
8902 label: 'OPTION POSITION',
8903 options: ['HIGHER', 'DEFAULT'],
8904 section: 'Advanced',
8905 "default": 0,
8906 help: 'Adjusts the position of the options.',
8907 onchange: function () {
8908 $('#liveupdate-options').attr('data-OptionPosition', this.val());
8909 }
8910 });
8911 // Styles
8912 Styles.add("\n\n\t#liveupdate-options[data-OptionPosition='HIGHER'] {margin-top: -11em;}\n\n\t#liveupdate-options[data-OptionPosition='DEFAULT'] {margin-top: -2em;}");
8913})(OptionPosition || (OptionPosition = {}));
8914
8915////////////////////////
8916// Ignore.ts //
8917////////////////////////
8918
8919var Ignore;
8920var IgnoreEnabled;
8921
8922(function (Ignore) {
8923 // INITIALIZATION
8924// $('#liveupdate-options').attr('data-OptionPosition', 'HIGHER');
8925 // Options
8926 var enabled7 = false;
8927
8928 Options.addCheckbox({
8929 label: 'IGNORE',
8930 section: 'Advanced',
8931 "default": false,
8932 help: 'Adjusts the position of the options.',
8933 onchange: function () {
8934 enabled7 = this.prop('checked');
8935 if (enabled7 == true) {
8936 IgnoreEnabled = 'yep lol';
8937 $('#ignorestuff').css('display','initial');
8938 } else {
8939 IgnoreEnabled = 'nope lol';
8940 $('#ignorestuff').css('display','none');
8941 }
8942 }
8943 });
8944
8945 $(`<script>var ignored = []; ignored.push(localStorage['ignoredppl']); function addIgnore() {var ignoreinp = document.getElementById('ignorebox');ignored.push(ignoreinp.value);ignoreinp.value = "";document.getElementById("ignorebox2").innerHTML = ignored;localStorage['ignoredppl'] = ignored;}function displayIgnore() {document.getElementById("ignorebox2").innerHTML = ignored;}function deleteIgnore() {ignored = []; localStorage['ignoredppl'] = []; document.getElementById("ignorebox2").innerHTML = '';}</script><span id=ignorestuff><input id=ignorebox style="position: absolute;margin-top: -25px;margin-left: 65px;"></input><span style="position: absolute;margin-top: -26px;margin-left: 210px;font-size: 9px !important;"><button type="button" id="ignoreadd" onclick="addIgnore()" style="font-size: 12px;padding: 0;margin-right: 3px;">ADD</button><button type="button" id="ignoredelete" onclick="deleteIgnore()" style="font-size: 12px;padding: 0;">DELETE ALL</button></span><div>Ignored users: <span id=ignorebox2></span></div></span><script>document.getElementById('ignorebox2').innerHTML = ignored;</script>`).insertAfter(`#live-counting-extension div div:nth-child(4) label:nth-last-child(1)`);
8946 if (enabled7 == true) {
8947 IgnoreEnabled = 'yep lol';
8948 $('#ignorestuff').css('display','initial');
8949 } else {
8950 IgnoreEnabled = 'nope lol';
8951 $('#ignorestuff').css('display','none');
8952 }
8953 // Styles
8954
8955
8956
8957// Styles.add("\n\n\t#liveupdate-options[data-OptionPosition='HIGHER'] {margin-top: -11em;}\n\n\t#liveupdate-options[data-OptionPosition='DEFAULT'] {margin-top: -2em;}");
8958})(Ignore || (Ignore= {}));