1tbfree commited on
Commit
459fca2
·
verified ·
1 Parent(s): a2cfcfa

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +1225 -59
index.html CHANGED
@@ -1,71 +1,1237 @@
 
1
  <!DOCTYPE html>
2
- <html lang="en">
3
  <head>
4
- <meta charset="UTF-8">
5
- <title>Trollbox Lite</title>
6
- <script src="https://cdn.socket.io/2.3.0/socket.io.min.js"></script>
7
- </head>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  <body>
9
- <input id="username" type="text" placeholder="Enter your username">
10
- <input id="message" type="text" placeholder="Type a message">
11
- <button id="join">Join</button>
12
- <button id="send">Send</button>
13
- <ul id="messages"></ul>
14
-
15
- <script>
16
- const socket = io("https://www.windows93.net:8086", {
17
- forceNew: true,
18
- transportOptions: {
19
- polling: {
20
- extraHeaders: {
21
- "Accept": "*/*",
22
- "Accept-Encoding": "identity",
23
- "Accept-Language": "*",
24
- "Cache-Control": "no-cache",
25
- "Connection": "keep-alive",
26
- "Host": "www.windows93.net",
27
- "Origin": "http://www.windows93.net",
28
- "Pragma": "no-cache",
29
- "Referer": 'http://www.windows93.net/trollbox/index.php',
30
- "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"
31
- }
32
- }
33
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  });
 
 
35
 
36
- // Join event
37
- document.getElementById('join').onclick = function() {
38
- const username = document.getElementById('username').value;
39
- if (username) {
40
- socket.emit("user joined", username, "lime", "", "");
41
- alert(`Welcome ${username}!`);
42
- document.getElementById('username').disabled = true; // Disable username input after joining
43
- } else {
44
- alert("Please enter a username.");
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
- // Send message event
49
- document.getElementById('send').onclick = function() {
50
- const message = document.getElementById('message').value;
51
- if (message) {
52
- socket.send(message); // Send message directly
53
- document.getElementById('message').value = ''; // Clear input
54
- } else {
55
- alert("Please enter a message.");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  }
57
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
- // Receive messages
60
- socket.on("message", function(data) {
61
- if (data.msg === "t!hello") {
62
- socket.send("Hello, " + data.nick + "!"); // Respond to specific command
63
- } else {
64
- const item = document.createElement('li');
65
- item.textContent = `${data.nick}: ${data.msg}`; // Display messages with sender's nickname
66
- document.getElementById('messages').appendChild(item);
67
  }
68
- });
69
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  </body>
71
  </html>
 
1
+
2
  <!DOCTYPE html>
3
+ <html lang="en" class="no-js">
4
  <head>
5
+ <meta charset="utf-8">
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
7
+ <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1" />
8
+ <title>trollbox</title>
9
+
10
+ <meta name="description" content="hug + hack = infinity">
11
+ <meta name="author" content="jankenpopp, zombectro">
12
+ <meta http-equiv="Content-Language" content="en_US" />
13
+ <meta name="google" content="notranslate" />
14
+ <link href="/rss" rel="alternate" type="application/rss+xml" title="windows93" />
15
+ <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=2.4.8" />
16
+
17
+ <link rel="stylesheet" href="/c/sys42.css?v=2.4.8">
18
+ <link rel="stylesheet" href="/c/sys/skins/w93.css?v=2.4.8" id="w93_skin">
19
+ <link rel="stylesheet" href="/sys/hotfix.css?v=2.4.8"></head>
20
+ <script>
21
+ //if (location.protocol != 'https:'){ window.location='https://windows93.net/trollbox/' }
22
+ </script>
23
+ <link rel="stylesheet" href="https://windows93.net/trollbox/trollbox.css?v=3">
24
+ <script src="https://windows93.net/c/libs/jquery.min.js"></script>
25
+ <script type="text/javascript" src="https://windows93.net/suncalc.js"></script>
26
+ <script type="text/javascript" src="https://windows93.net/he.js"></script>
27
+ <script type="text/javascript" src="https://windows93.net/zalgo.js"></script>
28
  <body>
29
+ <div id="trollbox" class="skin_base ui_layout _ui_unselectable">
30
+ <section class="_mb5 ui_layout">
31
+ <article>
32
+ <section id="trollbox_scroll" class="skin_inset _mr5"></section>
33
+ <aside id="trollbox_infos" class="skin_inset w150p"></aside>
34
+ </article>
35
+ </section>
36
+ <footer>
37
+ <form action="" id="trollbox_form" class="ui_group">
38
+ <button id="trollbox_nick_btn" type="button">Nick</button><textarea id="trollbox_input" autocomplete="off"></textarea><button>Send</button>
39
+ </form>
40
+ </footer>
41
+ <script>
42
+ var messageStyle="normal";
43
+ alphabets = {
44
+ a: "4",
45
+ b: "8",
46
+ e: "3",
47
+ g: "6",
48
+ i: "1",
49
+ o: "0",
50
+ p: "9",
51
+ s: "5",
52
+ t: "7",
53
+ z: "2"
54
+ },
55
+ words = {
56
+ "c00l": "kewl",
57
+ "dud3": "d00d",
58
+ "h4ck3r": "h4x0r",
59
+ "n3w813": "n00b",
60
+ "5uck5": "sux0r"
61
+ };
62
+
63
+ // dynamic title
64
+ var noFocusMsg = 0;
65
+ $(document).focus(function() {
66
+ //document.title = 'trollbox';
67
+ //noFocusMsg = 0;
68
+ });
69
+ $(document).click(function() {
70
+ document.title = 'trollbox';
71
+ noFocusMsg = 0;
72
+ });
73
+
74
+ function changeLetters(text) { // change all letters
75
+ //text = elite.value.toLowerCase();
76
+ text = text.toLowerCase();
77
+ for (var i = 0; i < text.length; i++) {
78
+ if (alphabets[text[i]]) {
79
+ text = text.replace(text[i], alphabets[text[i]]);
80
+ }
81
+ }
82
+ // leet.value = text;
83
+ return text;
84
+ }
85
+ function changeWords(text) { // change special words
86
+ wordsArr = text.split(" ");
87
+ for (var i = 0; i < wordsArr.length; i++) {
88
+ if (words[wordsArr[i]]) {
89
+ wordsArr[i] = words[wordsArr[i]];
90
+ }
91
+ }
92
+ return wordsArr.join(" ");
93
+ }
94
+ function tol33t(text) {
95
+ x =changeLetters(text);
96
+ x = changeWords(x);
97
+ return x;
98
+ }
99
+ //sin
100
+ function toRad(deg) {
101
+ return deg * (Math.PI / 180);
102
+ }
103
+ function toDeg(rad) {
104
+ return rad * (180 / Math.PI);
105
+ }
106
+ function sinFlood(s,max,snick,scolor,sstyle){
107
+ var counter = 0;
108
+ var increase = Math.PI * 2 / max;
109
+ for (var i = 0; i <= 1; i += 0.01) {
110
+ x = i;
111
+ y = Math.abs(Math.sin(counter));
112
+ counter += increase;
113
+ val = parseInt(y*30);
114
+ string = "";
115
+ for (var j = 0; j < val; j++) {
116
+ string = string+s; //"█"
117
+ };
118
+ dada = { date: Date.now(), nick: snick, color: scolor, style: sstyle, home: 'local', msg: string };
119
+ printMsg(dada);
120
+ }
121
+ }
122
+ var synth = window.speechSynthesis;
123
+ var voices = synth.getVoices();
124
+ var helpMsg =""+
125
+ "___________ .__ .__ __________ \n"+
126
+ "\\__ ___/______ ____ | | | |\\______ \\ _______ ___ \n"+
127
+ " | | \\_ __ \\/ _ \\| | | | | | _// _ \\ \\/ / \n"+
128
+ " | | | | \\( <_> ) |_| |_| | ( <_> > < \n"+
129
+ " |____| |__| \\____/|____/____/______ /\\____/__/\\_ \\ (v2.1) \n"+
130
+ " \\/ \\/ \n"+
131
+ "––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––--–\n"+
132
+ "| COMMANDS: |\n"+
133
+ "| /color htmlColor eg: /color #C3FF00 |\n"+
134
+ "| /sin text period eg: /sin # 50 |\n"+
135
+ "| /sin off disable /sin |\n"+
136
+ "| /lorem numberOfWords eg: /lorem 10 |\n"+
137
+ "| /b string eg: /b hello world |\n"+
138
+ "| /font 2 set teh /b font (from 0 to 10) |\n"+
139
+ "| /reverse upside down mode |\n"+
140
+ "| /l337 leet speak mode |\n"+
141
+ "| /normal normal mode |\n"+
142
+ "| /img on/off activate image embedding (do this at your own risk) |\n"+
143
+ "| /yt on/off activate youtube embedding |\n"+
144
+ "| /k&zwnj;ao random kaomoji |\n"+
145
+ "| /emo on/off activate/desactivate ugly emoticons |\n"+
146
+ "| /say something make browser say something |\n"+
147
+ "| /say off mute speech synthesizer |\n"+
148
+ "| /pitch 1.5 set speech pitch (from 0.0 to 2.0) (FF) |\n"+
149
+ "| /rate 5.0 set speech rate (from 0.1 to 10.0) (FF) |\n";
150
+
151
+ if (voices.length>0) {
152
+ helpMsg=helpMsg+"| /voice 3 set speech voice (from 0 to "+voices.length+", may bypass pitch and rate) |\n";
153
+ };
154
+ helpMsg=helpMsg+"| /zalgo [text] he comes |\n"+
155
+ "| /vapor [text] aesthetics |\n"+
156
+ "| /wrap [text] wrap in flourish |\n"+
157
+ "| /mess [text] useless |\n"+
158
+ "| /ascii imageUrl ascii art converter |\n"+
159
+ "| /who list users by [home] |\n"+
160
+ "| /o shortcut for /who |\n"+
161
+ "| /block [home] block user (or right click user's name, on the right) |\n"+
162
+ "| /unblock [home] unblock user (or click user's name, on the right) |\n"+
163
+ "| /unblock unblock every users |\n"+
164
+ "| /room display room infos |\n"+
165
+ "| /room [room name] enter [room name] |\n"+
166
+ "| /a shortcut for /room atrium |\n"+
167
+ "| /r shortcut for /room |\n"+
168
+ "| /scroll toggle auto scroll |\n"+
169
+ "| /clear clear teh chat |\n"+
170
+ "| Suggestions? [email protected] |\n"+
171
+ "–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n";
172
+ </script>
173
+ <!--<script src="/socket.io/socket.io.js"></script>-->
174
+ <script src="//www.windows93.net:8086/socket.io/socket.io.js"></script>
175
+ <script src="https://windows93.net/c/sys42.js?v=2.3.6"></script>
176
+ <script>
177
+
178
+ var trollbox_scroll = document.getElementById('trollbox_scroll');
179
+ var trollbox_form = document.getElementById('trollbox_form');
180
+ var trollbox_infos = document.getElementById('trollbox_infos');
181
+ var trollbox_nick_btn = document.getElementById('trollbox_nick_btn');
182
+ var trollbox_input = document.getElementById('trollbox_input');
183
+
184
+ //var socket = io();
185
+ var socket = io('//www.windows93.net:8086');
186
+
187
+ var pseudo = $store.get('.config/trollbox/nick') || '';
188
+ var color = $store.get('.config/trollbox/color') || '';
189
+ var style = $store.get('.config/trollbox/style') || '';
190
+ var pass = $store.get('.config/trollbox/pass') || '';
191
+ var imgShow = JSON.parse($store.get('.config/trollbox/img')) || false;
192
+ var ytShow = JSON.parse($store.get('.config/trollbox/yt')) || false;
193
+ var emoticons = JSON.parse($store.get('.config/trollbox/emoticons')) || false;
194
+ var sin = JSON.parse($store.get('.config/trollbox/sin')) || false;
195
+ var speech = JSON.parse($store.get('.config/trollbox/speech')) || false;
196
+ var pitch = $store.get('.config/trollbox/pitch') || 0.1;
197
+ var rate = $store.get('.config/trollbox/rate') || 1.0;
198
+ var voice = $store.get('.config/trollbox/voice') || 0;
199
+ var blocked = $store.get('.config/trollbox/blocked') || [];
200
+ var fontName = $store.get('.config/trollbox/font') || "Graffiti";
201
+
202
+ var scroll = true;
203
+ var say;
204
+
205
+ var users=[];
206
+
207
+ if (pseudo) {
208
+ setPseudo(pseudo);
209
+ } else {
210
+ getPseudo()
211
+ }
212
+
213
+ trollbox_nick_btn.onclick = getPseudo;
214
+
215
+ function chatKing(){
216
+ king = $("#trollbox_infos div span").first().html();
217
+ $("#trollbox_infos div span").first().before("<span style='float: left;margin-right: 4px;'>👑 </span>");
218
+
219
+ $( "#trollbox_infos div" ).contextmenu(function() {
220
+ sendMsg('/block '+$(this).children('span:last-child').text())
221
+ return false
222
+ });
223
+ $( "#trollbox_infos div" ).click(function() {
224
+ sendMsg('/unblock '+$(this).children('span:last-child').text())
225
+ return false
226
+ });
227
+ }
228
+
229
+ function getPseudo () {
230
+ if (window.top === window) {
231
+ pseudo = prompt('nickname ?');
232
+
233
+ if (pseudo==null) {pseudo="anonymous"};
234
+ if (pseudo) {}else{pseudo="anonymous"};
235
+
236
+ setPseudo(pseudo);
237
+
238
+ } else {
239
+ window.top.$prompt('nickname ?', '', function (ok, txt) {
240
+ setPseudo(txt);
241
  });
242
+ }
243
+ }
244
 
245
+ function setPseudo (txt) {
246
+ pseudo = txt;
247
+ trollbox_nick_btn.textContent = pseudo;
248
+ $store.set('.config/trollbox/nick', pseudo);
249
+ socket.emit('user joined', pseudo, color, style, pass);
250
+ }
251
+
252
+ function h(dt) {
253
+ var dt = new Date(dt);
254
+ var h = dt.getHours()+'';
255
+ h = h.length > 1 ? h : '0' + h
256
+ var m = dt.getMinutes()+'';
257
+ m = m.length > 1 ? m : '0' + m
258
+ return h+':'+m
259
+ }
260
+
261
+ function RegExpEscape(text) {
262
+ return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
263
+ }
264
+
265
+ function uniq(a) {
266
+ var prims = {"boolean":{}, "number":{}, "string":{}}, objs = [];
267
+
268
+ return a.filter(function(item) {
269
+ var type = typeof item;
270
+ if(type in prims)
271
+ return prims[type].hasOwnProperty(item) ? false : (prims[type][item] = true);
272
+ else
273
+ return objs.indexOf(item) >= 0 ? false : objs.push(item);
274
+ });
275
+ }
276
+
277
+ function replaceEmoticons(text,set) {
278
+ var emots = {
279
+ ";)": "wink",
280
+ ":)": "smile",
281
+ ":(": "sad",
282
+ ":d": "grin",
283
+ ":o": "suprised",
284
+ ":p": "tongue",
285
+ ":-|": "disappointed",
286
+ ":'(": "cry",
287
+ ":$": "shy",
288
+ "(H)": "cool",
289
+ "(bob)": "bob",
290
+ ":@": "angry",
291
+ ":s": "confused",
292
+ "<:o)": "party"
293
+ };
294
+ for(var key in emots){
295
+ if(emots.hasOwnProperty(key)){
296
+ text = text.replace(new RegExp(escapeRegExp(key), 'g'), '<img src="/trollbox/pix/emoticons/'+set+'/' + emots[key] + '.gif"/>');
297
+ }
298
+ }
299
+ return text;
300
+ }
301
+
302
+ function escapeRegExp(str) {
303
+ return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
304
+ }
305
+
306
+ function printNick (data) {
307
+
308
+ if (data.nick==undefined) {data.nick='●'};
309
+ if (data.color==undefined) {data.color='white'};
310
+ if (data.style==undefined) {data.style=''};
311
+ if (decodeHtmlEntity(data.nick)==""){data.nick='●'};
312
+ if (typeof data.nick != "string") {return};
313
+ str="";
314
+ if (data.home) {
315
+ for (var i = 0; i < blocked.length; i++) {
316
+ if (data.home==blocked[i]) {
317
+ str="<span style='float: left;margin-right: 4px;margin-top: 1px;'>❌</span>";
318
+ };
319
+ };
320
  };
321
+ name = "";
322
+ var test = (/image/).test(data.style);
323
+
324
+ if (test) {
325
+ name= str+'<span class="trollbox_nick" style="color:wthite;">❌' + data.nick + '</span>';
326
+ if (data.nick==pseudo) {
327
+ name = str+'<span class="trollbox_nick" style="color:' + data.color.split(";")[0]+';">' + data.nick + '</span>';
328
+ };
329
+ }else{
330
+ name = str+'<span class="trollbox_nick" style="color:' + data.color.split(";")[0]+';">' + data.nick + '</span>';
331
+ }
332
+ return name;
333
+ }
334
+
335
+ var warnTxt = '/!\\ Be careful, commands will not affect your computer but can mess with your windows93 desktop and saved files...';
336
+ function getCmd (txt) {
337
+ var m = txt.match(/^\/([a-z]+) (.*)/)
338
+ if (m) return { cmd: m[1], val: m[2] }
339
+ }
340
+
341
+ function sendMsg (msg) {
342
+
343
+ if (typeof msg !== 'string') return;
344
+
345
+ if (color == undefined) {color='white'};
346
+ if (style == undefined) {style=''};
347
+
348
+ var cmd = getCmd(msg);
349
+
350
+ if (typeof msg === 'string') {
351
+
352
+ if (msg.startsWith('/sin')) {
353
+ sin=true;
354
+ $store.set('.config/trollbox/sin', sin);
355
+ }
356
+
357
+ if (cmd) {
358
+
359
+ if (cmd.cmd === 'color') {
360
+ color = cmd.val;
361
+ $store.set('.config/trollbox/color', color);
362
+ socket.emit('user joined', pseudo, color, style, pass);
363
+ return;
364
+ }
365
 
366
+ if (cmd.cmd === 'say') {
367
+ msg = '/say '+pitch+':'+rate+':'+voice+' '+cmd.val;
368
+ }
369
+
370
+ if (cmd.cmd === 'pitch') {
371
+ pitch = parseFloat(cmd.val);
372
+ if (pitch<0) {pitch=0}; if (pitch>=2) {pitch=2.0};
373
+ $store.set('.config/trollbox/pitch', pitch);
374
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: "Pitch set to: "+pitch };
375
+ printMsg(dada);
376
+ return;
377
+ }
378
+
379
+ if (cmd.cmd === 'rate') {
380
+ rate = parseFloat(cmd.val);
381
+ if (rate<0.1) {rate=0.1}; if (rate>=10) {rate=10.0};
382
+ $store.set('.config/trollbox/rate', rate);
383
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: "Rate set to: "+rate };
384
+ printMsg(dada);
385
+ return;
386
+ }
387
+
388
+ if (cmd.cmd === 'voice'&&voices.length>0) {
389
+ voice = parseInt(cmd.val)%voices.length;
390
+ $store.set('.config/trollbox/voice', voice);
391
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: "Voice set to: "+voices[voice].name };
392
+ printMsg(dada);
393
+ return;
394
+ }
395
+
396
+ /*
397
+ if (cmd.cmd === 'style') {
398
+ style = cmd.val;
399
+ $store.set('.config/trollbox/style', style);
400
+ socket.emit('user joined', pseudo, color, style, pass);
401
+ return;
402
+ }
403
+ */
404
+ if (cmd.cmd === 'img') {
405
+ if (cmd.val=='on') {
406
+ imgShow=true;
407
+ $store.set('.config/trollbox/img', imgShow);
408
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: "Show images: ON" };
409
+ printMsg(dada);
410
  }
411
+ if (cmd.val=='off') {
412
+ imgShow=false;
413
+ $store.set('.config/trollbox/img', imgShow);
414
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: "Show images: OFF" };
415
+ printMsg(dada);
416
+ }
417
+ return;
418
+ }
419
+ if (cmd.cmd === 'yt') {
420
+ if (cmd.val=='on') {
421
+ ytShow=true;
422
+ $store.set('.config/trollbox/yt', ytShow);
423
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: "Youtube player: ON" };
424
+ printMsg(dada);
425
+ }
426
+ if (cmd.val=='off') {
427
+ ytShow=false;
428
+ $store.set('.config/trollbox/yt', ytShow);
429
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: "Youtube player: OFF" };
430
+ printMsg(dada);
431
+ }
432
+ return;
433
+ }
434
+ if (cmd.cmd === 'emo') {
435
+ if (cmd.val=='on') {
436
+ emoticons=true;
437
+ $store.set('.config/trollbox/emoticons', emoticons);
438
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: "Emoticon: ON" };
439
+ printMsg(dada);
440
+ }
441
+ if (cmd.val=='off') {
442
+ emoticons=false;
443
+ $store.set('.config/trollbox/emoticons', emoticons);
444
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: "Emoticon: OFF" };
445
+ printMsg(dada);
446
+ }
447
+ return;
448
+ }
449
+ if (cmd.cmd === 'sin') {
450
+ if (cmd.val=='off') {
451
+ sin=false;
452
+ $store.set('.config/trollbox/sin', sin);
453
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: "Sin: OFF" };
454
+ printMsg(dada);
455
+ return;
456
+ }
457
+ }
458
+ if (cmd.cmd === 'say') {
459
+ speech = true;
460
+ $store.set('.config/trollbox/speech', speech);
461
+ if (cmd.val=='on') {
462
+ speech=true;
463
+ $store.set('.config/trollbox/speech', speech);
464
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: "Speech: ON" };
465
+ printMsg(dada);
466
+ return;
467
+ }
468
+ if (cmd.val=='off') {
469
+ speech=false;
470
+ $store.set('.config/trollbox/speech', speech);
471
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: "Speech: OFF" };
472
+ printMsg(dada);
473
+ return;
474
+ }
475
+ }
476
+ if (cmd.cmd === 'mlg') {
477
+ if (cmd.val=='on') {
478
+ imgShow=true;
479
+ ytShow=true;
480
+ emoticons=true;
481
+ $store.set('.config/trollbox/yt', ytShow);
482
+ $store.set('.config/trollbox/img', imgShow);
483
+ $store.set('.config/trollbox/speech', speech);
484
+ $store.set('.config/trollbox/emoticons', emoticons);
485
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: "Major League Gaming: ON" };
486
+ printMsg(dada);
487
+ }
488
+ if (cmd.val=='off') {
489
+ imgShow=false;
490
+ ytShow=false;
491
+ emoticons=false;
492
+ $store.set('.config/trollbox/yt', ytShow);
493
+ $store.set('.config/trollbox/img', imgShow);
494
+ $store.set('.config/trollbox/speech', speech);
495
+ $store.set('.config/trollbox/emoticons', emoticons);
496
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: "Major League Gaming: OFF" };
497
+ printMsg(dada);
498
+ }
499
+ return;
500
+ }
501
+ if (cmd.cmd == 'shrug') {
502
+ temp=''
503
+ if (cmd.val) {temp = cmd.val+' '}
504
+ msg = temp+'¯\\_(ツ)_/¯'
505
+ }
506
+ if (msg.startsWith('/ascii ')) {
507
+ var doge = msg.slice(7).trim();
508
+ doge = doge.substring(doge.indexOf("\n") + 1);
509
+ dogescii(doge);
510
+ return;
511
+ }
512
+ if (msg.startsWith('/block ')) {
513
+ var user = msg.slice(7).trim();
514
+ for (var key in users) {
515
+ for (var i = 0; i < users[key].length; i++) {
516
+ if (users[key][i]==user) {
517
+ blocked.push(key);
518
+ };
519
+ };
520
+ }
521
+ blocked=uniq(blocked);
522
+ $store.set('.config/trollbox/blocked', blocked);
523
+ userMsg = 'User is now blocked.';
524
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: userMsg };
525
+ printMsg(dada);
526
+ return;
527
+ }
528
 
529
+ if (msg.startsWith('/unblock ')) {
530
+ var user = msg.slice(9).trim();
531
+ for (var key in users) {
532
+ for (var i = 0; i < users[key].length; i++) {
533
+ if (users[key][i]==user) {
534
+ blocked.splice( blocked.indexOf(key), 1 );
535
+ };
536
+ };
537
  }
538
+ blocked=uniq(blocked);
539
+ $store.set('.config/trollbox/blocked', blocked);
540
+ userMsg = 'User is now unblocked';
541
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: userMsg };
542
+ printMsg(dada);
543
+ return;
544
+ }
545
+
546
+ if (msg.startsWith('/b ')) {
547
+ var temp = msg.slice(3).trim();
548
+ temp = temp.substring(temp.indexOf("\n") + 1);
549
+ banner(temp);
550
+ return;
551
+ }
552
+
553
+ if (msg.startsWith('/font ')) {
554
+ var myfont = parseInt(msg.slice(6).trim());
555
+ if (fontNames[(myfont%fontNames.length)]) {
556
+ fontName=fontNames[(myfont%fontNames.length)];
557
+ $store.set('.config/trollbox/font', fontName);
558
+ temp = 'Font selected: '+fontName;
559
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: temp };
560
+ printMsg(dada);
561
+ return;
562
+ }
563
+ };
564
+
565
+ if (msg.startsWith('/lorem ')) {
566
+ var numb = msg.slice(7).trim();
567
+ numb = numb.substring(numb.indexOf("\n") + 1);
568
+ lorem(numb);
569
+ return;
570
+ }
571
+
572
+ }
573
+ if ( (msg=='/normal')||(msg=='lɐɯɹou/')||(msg=='/n0rm4l') ) {
574
+ messageStyle = "normal";
575
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: "back to normal mode" };
576
+ printMsg(dada);
577
+ $('#trollbox').css('transform','rotate(0deg)');
578
+ return;
579
+ }
580
+ if ((msg=='/reverse')||(msg=='ǝsɹǝʌǝɹ/')||(msg=='/r3v3r53')) {
581
+ if (messageStyle!="upDown") {
582
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: "reverse mode: ON" };
583
+ printMsg(dada);
584
+ };
585
+ messageStyle = "upDown";
586
+ $('#trollbox').css('transform','rotate(180deg)');
587
+ return;
588
+ }
589
+ if ((msg=='/l337')||(msg=='ㄥƐƐl/')) {
590
+ messageStyle = "l337";
591
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: "leet mode: ON" };
592
+ printMsg(dada);
593
+ $('#trollbox').css('transform','rotate(0deg)');
594
+ return;
595
+ }
596
+
597
+ if (msg=='/help') {
598
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: helpMsg };
599
+ printMsg(dada);
600
+ return;
601
+ }
602
+
603
+ if (msg=='/scroll') {
604
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: 'Auto Scroll: '+!scroll };
605
+ scrollDown ()
606
+ scroll=!scroll;
607
+ printMsg(dada);
608
+ return;
609
+ }
610
+
611
+ if (msg=='/clear') {
612
+ $('#trollbox_scroll').html("");
613
+ messageStyle="normal";
614
+ return;
615
+ }
616
+
617
+ if (msg=='/unblock') {
618
+ blocked=[];
619
+ $store.set('.config/trollbox/blocked', blocked);
620
+ userMsg = 'Block list cleared.';
621
+ dada = { date: Date.now(), nick: "~", color: "white", style: "opacity: 0.7;", home: 'local', msg: userMsg };
622
+ printMsg(dada);
623
+ return;
624
+ }
625
+
626
+ if(msg=='/shrug'){msg = '¯\\_(ツ)_/¯'}
627
+
628
+ if (msg.length > 10000) msg = msg.slice(0, 10000);
629
+ if (msg.trim() !== '') socket.emit('message', msg);
630
+ }
631
+ }
632
+
633
+ function matchYoutubeUrl(url){
634
+ var p = /www\.youtube\.com/;
635
+ return (url.match(p)) ? true : false ;
636
+ }
637
+
638
+ var faces = ["( .-. )","( .o.)","( `·´ )","( ° ͜ ʖ °)","( ͡° ͜ʖ ͡°)","( ⚆ _ ⚆ )","( ︶︿︶)","( ゚ヮ゚)","(\\/)(°,,,°)(\\/)","(¬_¬)","(¬º-°)¬","(¬‿¬)","(°ロ°)☝","(´・ω・)っ","(ó ì_í)","(ʘᗩʘ')","(ʘ‿ʘ)","(̿▀̿ ̿Ĺ̯̿̿▀̿ ̿)̄","(͡° ͜ʖ ͡°)","(ಠ_ಠ)","(ಠ‿ಠ)","(ಠ⌣ಠ)","(ಥ_ಥ)","(ಥ﹏ಥ)","(ง ͠° ͟ل͜ ͡°)ง","(ง ͡ʘ ͜ʖ ͡ʘ)ง","(ง •̀_•́)ง","(ง'̀-'́)ง","(ง°ل͜°)ง","(ง⌐□ل͜□)ง","(ღ˘⌣˘ღ)","(ᵔᴥᵔ)","(•ω•)","(•◡•)/","(⊙ω⊙)","(⌐■_■)","(─‿‿─)","(╯°□°)╯","(◕‿◕)","(☞゚∀゚)☞","(❍ᴥ❍ʋ)","(っ◕‿◕)っ","(づ。◕‿‿◕。)づ","(ノಠ益ಠ)ノ","(ノ・∀・)ノ","(;一_一)","(`◔ ω ◔´)","(。◕‿‿◕。)","(ノ◕ヮ◕)ノ","*<{:¬{D}}}","=^.^=","t(-.-t)","| (• ◡•)|","~(˘▾˘~)","¬_¬","¯(°_o)/¯","¯\_(ツ)_/¯","°Д°","ɳ༼ຈل͜ຈ༽ɲ","ʅʕ•ᴥ•ʔʃ","ʕ´•ᴥ•`ʔ","ʕ•ᴥ•ʔ","ʕ◉.◉ʔ","ʕㅇ호ㅇʔ","ʕ;•`ᴥ•´ʔ","ʘ‿ʘ","͡° ͜ʖ ͡°","ζ༼Ɵ͆ل͜Ɵ͆༽ᶘ","Ѱζ༼ᴼل͜ᴼ༽ᶘѰ","ب_ب","٩◔̯◔۶","ಠ_ಠ","ಠoಠ","ಠ~ಠ","ಠ‿ಠ","ಠ⌣ಠ","ಠ╭╮ಠ","ರ_ರ","ง ͠° ل͜ °)ง","๏̯͡๏﴿","༼ ºººººل͟ººººº ༽","༼ ºل͟º ༽","༼ ºل͟º༼","༼ ºل͟º༽","༼ ͡■ل͜ ͡■༽","༼ つ ◕_◕ ༽つ","༼ʘ̚ل͜ʘ̚༽","ლ(´ڡ`ლ)","ლ(́◉◞౪◟◉‵ლ)","ლ(ಠ益ಠლ)","ᄽὁȍ ̪őὀᄿ","ᔑ•ﺪ͟͠•ᔐ","ᕕ( ᐛ )ᕗ","ᕙ(⇀‸↼‶)ᕗ","ᕙ༼ຈل͜ຈ༽ᕗ","ᶘ ᵒᴥᵒᶅ","‎‎(ノಥ益ಥ)ノ","≧☉_☉≦","⊙▃⊙","⊙﹏⊙","┌( ಠ_ಠ)┘","╚(ಠ_ಠ)=┐","◉_◉","◔ ⌣ ◔","◔̯◔","◕‿↼","◕‿◕","☉_☉","☜(⌒▽⌒)☞","☼.☼","♥‿♥","⚆ _ ⚆","✌(-‿-)✌","〆(・∀・@)","ノ( º _ ºノ)","ノ( ゜-゜ノ)","ヽ( ͝° ͜ʖ͡°)ノ","ヽ(`Д´)ノ","ヽ༼° ͟ل͜ ͡°༽ノ","ヽ༼ʘ̚ل͜ʘ̚༽ノ","ヽ༼ຈل͜ຈ༽ง","ヽ༼ຈل͜ຈ༽ノ","ヽ༼Ὸل͜ຈ༽ノ","ヾ(⌐■_■)ノ","꒰・◡・๑꒱","﴾͡๏̯͡๏﴿","。◕‿◕。","ʕノ◔ϖ◔ʔノ","꒰•̥̥̥̥̥̥̥ ﹏ •̥̥̥̥̥̥̥̥๑꒱","ಠ_ರೃ","(ू˃̣̣̣̣̣̣︿˂̣̣̣̣̣̣ ू)","(ꈨຶꎁꈨຶ)۶”","(ꐦ°᷄д°᷅)","(۶ૈ ۜ ᵒ̌▱๋ᵒ̌ )۶ૈ=͟͟͞͞ ⌨","₍˄·͈༝·͈˄₎◞ ̑̑ෆ⃛","(*゚⚙͠ ∀ ⚙͠)ノ❣","٩꒰・ัε・ั ꒱۶","ヘ(。□°)ヘ","˓˓(ृ  ु ॑꒳’)ु(ृ’꒳ ॑ ृ )ु˒˒˒","꒰✘Д✘◍꒱","૮( ᵒ̌ૢཪᵒ̌ૢ )ა","“ψ(`∇´)ψ","ಠﭛಠ","(๑>ᴗ<๑)","(۶ꈨຶꎁꈨຶ )۶ʸᵉᵃʰᵎ","٩(•̤̀ᵕ•̤́๑)ᵒᵏᵎᵎᵎᵎ","(oT-T)尸","(✌゚∀゚)☞","ಥ‿ಥ","ॱ॰⋆(˶ॢ‾᷄﹃‾᷅˵ॢ)","┬┴┬┴┤ (ಠ├┬┴┬┴","( ˘ ³˘)♥","Σ (੭ु ຶਊ ຶ)੭ु⁾⁾","(⑅ ॣ•͈ᴗ•͈ ॣ)","ヾ(´¬`)ノ","(•̀o•́)ง","(๑•॒̀ ູ॒•́๑)","⚈้̤͡ ˌ̫̮ ⚈้̤͡","=͟͟͞͞ =͟͟͞͞ ヘ( ´Д`)ノ","(((╹д╹;)))","•̀.̫•́✧","(ᵒ̤̑ ₀̑ ᵒ̤̑)","\_(ʘ_ʘ)_/"]
639
+
640
+ function printMsg (data) {
641
+ if (!data || typeof data.msg !== 'string' || data.msg.trim()=='') return;
642
+ if (data.nick==undefined) {return};
643
+ if (data.nick==null) {return};
644
+ if (data.home==undefined||data.home==null||!data.home) {return;};
645
+ for (var i = 0; i < blocked.length; i++) { if (data.home==blocked[i]) {return} };
646
+ if (typeof data.nick != "string") {return};
647
+
648
+ // /kaomoji
649
+ while (data.msg.includes("/kao")) {
650
+ data.msg = data.msg.replace('/kao', faces[parseInt(Math.random()*faces.length)])
651
+ }
652
+
653
+ if ((data.msg)&&(data.msg.startsWith('data:image/'))) {
654
+ if ( imgShow ) {
655
+ if(data.msg.indexOf("&#62")!=-1){return};
656
+ if(data.msg.indexOf("&#39")!=-1){return};
657
+ data.msg = "<img style='max-width: 98%;' src='"+data.msg+"'>";
658
+ }else{
659
+ data.msg = "You need to type '/img on' to see this."
660
+ }
661
+ }
662
+ var cmd = getCmd(data.msg);
663
+ var ytplayer = false;
664
+ if (ytShow) {
665
+ if (matchYoutubeUrl(data.msg)) {
666
+ if (data.msg.startsWith('https://www.youtube.com/watch?v=')) {
667
+ var id = data.msg.slice(32).trim();
668
+ data.msg='<iframe width="560" height="315" src="https://www.youtube.com/embed/'+id+'" frameborder="0" allowfullscreen></iframe>';
669
+ ytplayer=true;
670
+ }
671
+ };
672
+ };
673
+
674
+ if (ytplayer!=true) {
675
+ if ( imgShow ) {
676
+ var test = (/\.(gif|jpg|jpeg|tiff|png|webp)/i).test(data.msg);
677
+ if (test) {
678
+ message = data.msg.split(" ");
679
+ data.msg = "";
680
+ for (var i = 0; i < message.length; i++) {
681
+ var testa = (/\.(gif|jpg|jpeg|tiff|png|webp)/i).test(message[i]);
682
+ if (testa) {
683
+ //img
684
+ if ((/\.(php)/i).test(message[i])) {
685
+ data.msg = data.msg + " <img style='max-width: 98%;' src=''> "
686
+ }else{
687
+ data.msg = data.msg + " <img style='max-width: 98%;' src='"+ message[i] +"'> "
688
+ }
689
+ }else{
690
+ //txt
691
+ data.msg = data.msg + " " + $io.str.autolink(message[i]);
692
+ }
693
+ };
694
+ }else{data.msg = $io.str.autolink(data.msg);}
695
+
696
+ }else{
697
+ data.msg = $io.str.autolink(data.msg);
698
+ }
699
+ };
700
+
701
+ words = data.msg.split(" ");
702
+ if (words[0]=="/sin"){
703
+ if (words[1]) {
704
+ string = words[1];
705
+ string = string.substring(0, 50);
706
+
707
+ }else{
708
+ string="█";
709
+ }
710
+ if (words[2]) {
711
+ amplitude = words[2];
712
+ }else{
713
+ amplitude = parseInt(Math.random()*100);
714
+ }
715
+ if (data.nick==undefined) {data.nick="anonymous"};
716
+ if (data.color==undefined) {data.color="white"};
717
+ if (data.style==undefined) {data.style=""};
718
+ if (sin) {
719
+ sinFlood(string, amplitude,data.nick,data.color,data.style)
720
+ return
721
+ };
722
+ };
723
+ //
724
+ if (words[0]=="/say"){
725
+
726
+ settings = words[1].split(":")
727
+ words.shift();
728
+ words.shift();
729
+ var temp = words.join(" ").trim();
730
+ say = new SpeechSynthesisUtterance();
731
+ say.volume = 0.5;
732
+ say.text = temp;
733
+ if (settings[0]<0) {settings[0]=0}; if (settings[0]>=2) {settings[0]=2.0};
734
+ say.pitch = settings[0];
735
+ if (settings[1]<0.1) {settings[1]=0.1}; if (settings[1]>=10) {settings[1]=10.0};
736
+ say.rate=settings[1];
737
+ if (voices.length>0) { say.voice=voices[parseInt(settings[2])%voices.length] };
738
+ if (speech&&temp.length>0) {
739
+ speechSynthesis.speak(say);
740
+ data.msg = "🔈 "+temp;
741
+ }else{
742
+ data.msg = "🔇 "+temp;
743
+ }
744
+ //return;
745
+ }
746
+ // vintage emoticons, will add moar sets later.
747
+ if (emoticons) {
748
+ substring = "&#175;\\_(&#12484;)_/&#175;";
749
+ if(data.msg.indexOf(substring) == -1){
750
+ emoSet='msn';
751
+ data.msg = replaceEmoticons(data.msg,emoSet);
752
+ }
753
+ };
754
+ //
755
+ if (words[0]=="/zalgo"){
756
+ var temp = data.msg.slice(6).trim().substring(0, 1000);
757
+ data.msg = zalgo(temp);
758
+ }
759
+ if (cmd) {
760
+ if (cmd.cmd === 'exe') {
761
+ data.msg = '<div class="trollbox_exe"><button title="'+warnTxt+'" data-exe="'+cmd.val.replace(/"/g, '\\"')+'">/exe</button>' + cmd.val + '</div>';
762
+ }
763
+ }
764
+
765
+ if (data.msg.startsWith('/exe ')) {
766
+ var ex = data.msg.slice(5).trim()
767
+ data.msg = '<div class="trollbox_exe"><button title="'+warnTxt+'" data-exe="'+ex.replace(/"/g, '\\"')+'">/exe</button>' + ex + '</div>';
768
+ }
769
+
770
+ var div = document.createElement('div');
771
+ data.nick = data.nick || '●';
772
+ if (data.nick=='●') {pseudo=='●'};
773
+ div.className = 'trollbox_line ui_group';
774
+ div.innerHTML = '<span class="trollbox_h">' + h(data.date) + '</span>'
775
+ + (printNick(data))
776
+ + '<span class="trollbox_msg">' + data.msg + '</span>'
777
+ // + '<span class="trollbox_msg" style="color:'+data.color+'">' + data.msg + '</span>'
778
+ ;
779
+ trollbox_scroll.appendChild(div);
780
+ if (getScrollPos()>90) {scrollDown();};
781
+
782
+ }
783
+
784
+ socket.on('_connected', function (data) {
785
+ //console.log('_connected')
786
+ });
787
+
788
+ socket.on('update history', function (data) {
789
+ data.forEach(function (item) {
790
+ printMsg(item)
791
+ })
792
+ });
793
+
794
+ socket.on('update users', function (data) {
795
+ users=[];
796
+ for (var key in data) {
797
+ if (!users[data[key].home]) {
798
+ users[data[key].home]=[he.decode(data[key].nick)]
799
+
800
+ }else{
801
+ users[data[key].home].push(he.decode(data[key].nick));
802
+ }
803
+ }
804
+ trollbox_infos.innerHTML = ''
805
+ var frag = document.createDocumentFragment()
806
+ for (var key in data) {
807
+ if (data.hasOwnProperty(key)) {
808
+ var div = document.createElement('div');
809
+ div.innerHTML = printNick(data[key]);
810
+ frag.appendChild(div);
811
+ }
812
+ }
813
+ trollbox_infos.appendChild(frag);
814
+ chatKing();
815
+ });
816
+
817
+ socket.on('user joined', function (data) {
818
+ if (data.nick){}else{return}
819
+ if( typeof data.nick === 'undefined' || data.nick === null || data.nick == undefined){
820
+ data.nick="anonymous"
821
+ }
822
+ if (data.nick==undefined) {data.nick="anonymous"};
823
+ if (typeof data.nick != "string") {return};
824
+ for (var i = 0; i < blocked.length; i++) { if (data.home==blocked[i]) {return} };
825
+ if (data.nick) printMsg({date: Date.now(), color: '#0f0', nick: '→', home: data.home, msg: printNick(data) + ' <em>has entered teh trollbox</em>'});
826
+ });
827
+
828
+ socket.on('user left', function (data) {
829
+ for (var i = 0; i < blocked.length; i++) { if (data.home==blocked[i]) {return} };
830
+ if (data.nick) printMsg({date: Date.now(), color: '#f00', nick: '←', home: data.home, msg: printNick(data) + ' <em>has left teh trollbox</em>'});
831
+ });
832
+
833
+ socket.on('user change nick', function (data) {
834
+ if (data[0].nick==data[1].nick) {return};
835
+ for (var i = 0; i < blocked.length; i++) { if (data[1].home==blocked[i]) {return} };
836
+ if (data[1].nick) printMsg({date: Date.now(), color: '#af519b', nick: '~', home: data[1].home, msg: printNick(data[0]) + ' <em>is now known as</em> ' + printNick(data[1])});
837
+ });
838
+
839
+ socket.on('message', function (data) {
840
+ if (!data || typeof data.msg !== 'string') return;
841
+ if (data.nick==undefined) {return};
842
+ if (data.nick==null) {return};
843
+ printMsg(data);
844
+ // dynamic title
845
+ if(document.hasFocus()==false){
846
+ noFocusMsg = noFocusMsg + 1;
847
+ if(noFocusMsg>0){
848
+ document.title = 'trollbox ('+noFocusMsg+')';
849
+ }
850
+ }else{
851
+ noFocusMsg=0;
852
+ document.title = 'trollbox';
853
+ }
854
+ //
855
+ });
856
+
857
+ socket.on('cmd', function (data) {
858
+ // console.log(data);
859
+ });
860
+
861
+ function scrollDown () {
862
+ if (scroll){
863
+ setTimeout(function () {
864
+ trollbox_scroll.scrollTop = trollbox_scroll.scrollHeight;
865
+ }, 2)
866
+ }
867
+ }
868
+
869
+ $el(trollbox_scroll)
870
+ .on('click', 'button', function () {
871
+ if (window.top.$exe) {
872
+ var res = window.top.$exe(this.getAttribute('data-exe'))
873
+ if (res === false && window.top.$notif) window.top.$notif('Invalid command...')
874
+ }
875
+ })
876
+ ;
877
+
878
+ trollbox_input.onkeydown = function (e) {
879
+ if (e.keyCode === 13 && !e.shiftKey) send(e)
880
+ };
881
+ trollbox_form.onsubmit = send
882
+
883
+ function send (e) {
884
+ e.preventDefault();
885
+
886
+ if (pseudo == 'undefined') { setPseudo("anonymous") };
887
+ if (pseudo == null) { setPseudo("anonymous") };
888
+
889
+ // damn u SONIC
890
+ some = trollbox_input.value;
891
+ if (some.match(/sonic/i)) {
892
+ document.body.innerHTML = '<html></html>';
893
+ parent.$exe('shutdown');
894
+ };
895
+
896
+ if (some.match(/fortnite/i)) {
897
+ if(parent.$explorer){
898
+ document.body.innerHTML = '<html></html>';
899
+ parent.$window.current.close();
900
+ }else{
901
+ document.body.innerHTML = '<html></html>';
902
+ }
903
+ };
904
+ // Discord, sonic, among us, etcblock removed
905
+
906
+ if (messageStyle=="normal") {sendMsg(trollbox_input.value)};
907
+ if (messageStyle=="l337") {sendMsg(tol33t(trollbox_input.value))};
908
+ if (messageStyle=="upDown") {sendMsg(flipText(trollbox_input.value))};
909
+
910
+ trollbox_input.value = '';
911
+ scrollDown();
912
+ return false;
913
+ }
914
+
915
+ //auto scroll
916
+ function getScrollPos() {
917
+ var startDistance = 0;
918
+ var scrollTop = $('#trollbox_scroll').scrollTop()+$('#trollbox_scroll').height();
919
+ var documentHeight = document.getElementById("trollbox_scroll").scrollHeight;
920
+ var scrollPercent = parseInt((scrollTop / documentHeight) * 100);
921
+ return scrollPercent;
922
+ }
923
+
924
+ var defaultDiacriticsRemovalMap = [
925
+ {'base':'A', 'letters':/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},
926
+ {'base':'AA','letters':/[\uA732]/g},
927
+ {'base':'AE','letters':/[\u00C6\u01FC\u01E2]/g},
928
+ {'base':'AO','letters':/[\uA734]/g},
929
+ {'base':'AU','letters':/[\uA736]/g},
930
+ {'base':'AV','letters':/[\uA738\uA73A]/g},
931
+ {'base':'AY','letters':/[\uA73C]/g},
932
+ {'base':'B', 'letters':/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},
933
+ {'base':'C', 'letters':/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},
934
+ {'base':'D', 'letters':/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},
935
+ {'base':'DZ','letters':/[\u01F1\u01C4]/g},
936
+ {'base':'Dz','letters':/[\u01F2\u01C5]/g},
937
+ {'base':'E', 'letters':/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},
938
+ {'base':'F', 'letters':/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},
939
+ {'base':'G', 'letters':/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},
940
+ {'base':'H', 'letters':/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},
941
+ {'base':'I', 'letters':/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},
942
+ {'base':'J', 'letters':/[\u004A\u24BF\uFF2A\u0134\u0248]/g},
943
+ {'base':'K', 'letters':/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},
944
+ {'base':'L', 'letters':/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},
945
+ {'base':'LJ','letters':/[\u01C7]/g},
946
+ {'base':'Lj','letters':/[\u01C8]/g},
947
+ {'base':'M', 'letters':/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},
948
+ {'base':'N', 'letters':/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},
949
+ {'base':'NJ','letters':/[\u01CA]/g},
950
+ {'base':'Nj','letters':/[\u01CB]/g},
951
+ {'base':'O', 'letters':/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},
952
+ {'base':'OI','letters':/[\u01A2]/g},
953
+ {'base':'OO','letters':/[\uA74E]/g},
954
+ {'base':'OU','letters':/[\u0222]/g},
955
+ {'base':'P', 'letters':/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},
956
+ {'base':'Q', 'letters':/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},
957
+ {'base':'R', 'letters':/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},
958
+ {'base':'S', 'letters':/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},
959
+ {'base':'T', 'letters':/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},
960
+ {'base':'TZ','letters':/[\uA728]/g},
961
+ {'base':'U', 'letters':/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},
962
+ {'base':'V', 'letters':/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},
963
+ {'base':'VY','letters':/[\uA760]/g},
964
+ {'base':'W', 'letters':/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},
965
+ {'base':'X', 'letters':/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},
966
+ {'base':'Y', 'letters':/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},
967
+ {'base':'Z', 'letters':/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},
968
+ {'base':'a', 'letters':/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},
969
+ {'base':'aa','letters':/[\uA733]/g},
970
+ {'base':'ae','letters':/[\u00E6\u01FD\u01E3]/g},
971
+ {'base':'ao','letters':/[\uA735]/g},
972
+ {'base':'au','letters':/[\uA737]/g},
973
+ {'base':'av','letters':/[\uA739\uA73B]/g},
974
+ {'base':'ay','letters':/[\uA73D]/g},
975
+ {'base':'b', 'letters':/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},
976
+ {'base':'c', 'letters':/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},
977
+ {'base':'d', 'letters':/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},
978
+ {'base':'dz','letters':/[\u01F3\u01C6]/g},
979
+ {'base':'e', 'letters':/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},
980
+ {'base':'f', 'letters':/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},
981
+ {'base':'g', 'letters':/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},
982
+ {'base':'h', 'letters':/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},
983
+ {'base':'hv','letters':/[\u0195]/g},
984
+ {'base':'i', 'letters':/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},
985
+ {'base':'j', 'letters':/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},
986
+ {'base':'k', 'letters':/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},
987
+ {'base':'l', 'letters':/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},
988
+ {'base':'lj','letters':/[\u01C9]/g},
989
+ {'base':'m', 'letters':/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},
990
+ {'base':'n', 'letters':/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},
991
+ {'base':'nj','letters':/[\u01CC]/g},
992
+ {'base':'o', 'letters':/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},
993
+ {'base':'oi','letters':/[\u01A3]/g},
994
+ {'base':'ou','letters':/[\u0223]/g},
995
+ {'base':'oo','letters':/[\uA74F]/g},
996
+ {'base':'p','letters':/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},
997
+ {'base':'q','letters':/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},
998
+ {'base':'r','letters':/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},
999
+ {'base':'s','letters':/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},
1000
+ {'base':'t','letters':/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},
1001
+ {'base':'tz','letters':/[\uA729]/g},
1002
+ {'base':'u','letters':/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},
1003
+ {'base':'v','letters':/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},
1004
+ {'base':'vy','letters':/[\uA761]/g},
1005
+ {'base':'w','letters':/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},
1006
+ {'base':'x','letters':/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},
1007
+ {'base':'y','letters':/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},
1008
+ {'base':'z','letters':/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}
1009
+ ];
1010
+ var diacriticChange;
1011
+ function removeDiacritics(str) {
1012
+ if(!diacriticChange) {
1013
+ diacriticChange = defaultDiacriticsRemovalMap;
1014
+ }
1015
+ for(var i=0; i<diacriticChange.length; i++) {
1016
+ str = str.replace(diacriticChange[i].letters, diacriticChange[i].base);
1017
+ }
1018
+ return str;
1019
+ }
1020
+ var flipTable = {
1021
+ "a":"\u0250",
1022
+ "b":"q",
1023
+ "c":"\u0254",
1024
+ "ç":"\u0254",
1025
+ "d":"p",
1026
+ "e":"\u01DD",
1027
+ "f":"\u025F",
1028
+ "g":"\u0183",
1029
+ "h":"\u0265",
1030
+ "i":"\u1D09",
1031
+ "j":"\u027E",
1032
+ "k":"\u029E",
1033
+ "m":"\u026F",
1034
+ "n":"u",
1035
+ "p":"d",
1036
+ "q":"b",
1037
+ "r":"\u0279",
1038
+ "t":"\u0287",
1039
+ "u":"n",
1040
+ "v":"\u028C",
1041
+ "w":"\u028D",
1042
+ "y":"\u028E",
1043
+ "A":"\u2200",
1044
+ "B":"q",
1045
+ "C":"\u0186",
1046
+ "E":"\u018E",
1047
+ "F":"\u2132",
1048
+ "G":"\u05E4",
1049
+ "H":"H",
1050
+ "I":"I",
1051
+ "J":"\u017F",
1052
+ "L":"\u02E5",
1053
+ "M":"W",
1054
+ "N":"N",
1055
+ "P":"\u0500",
1056
+ "T":"\u2534",
1057
+ "Q":"b",
1058
+ "U":"\u2229",
1059
+ "V":"\u039B",
1060
+ "Y":"\u2144",
1061
+ "1":"\u0196",
1062
+ "2":"\u1105",
1063
+ "3":"\u0190",
1064
+ "4":"\u3123",
1065
+ "5":"\u03DB",
1066
+ "6":"9",
1067
+ "7":"\u3125",
1068
+ "8":"8",
1069
+ "9":"6",
1070
+ "0":"0",
1071
+ ".":"\u02D9",
1072
+ ",":"'",
1073
+ "'":",",
1074
+ '"':",,",
1075
+ "`":",",
1076
+ "?":"\u00BF",
1077
+ "!":"\u00A1",
1078
+ "[":"]",
1079
+ "]":"[",
1080
+ "(":")",
1081
+ ")":"(",
1082
+ "{":"}",
1083
+ "}":"{",
1084
+ "<":">",
1085
+ ">":"<",
1086
+ "&":"\u214B",
1087
+ "_":"\u203E",
1088
+ "\u2234":"\u2235",
1089
+ "\u2045":"\u2046"
1090
+ };
1091
+ function flipText(txt) {
1092
+ txt = removeDiacritics(txt);
1093
+ convTxt = "";
1094
+ for (var c = (txt.length - 1); c >= 0; c--) {
1095
+ if (flipTable[txt.charAt(c)]!=undefined) {
1096
+ convTxt = convTxt + flipTable[txt.charAt(c)];
1097
+ }else{
1098
+ convTxt = convTxt + txt.charAt(c);
1099
+ }
1100
+ }
1101
+ return convTxt;
1102
+ }
1103
+
1104
+ function isItNight(){
1105
+ hour = new Date().getHours();
1106
+ if ((hour>=22)||(hour<=6)||(imgShow==true)) {
1107
+ return true;
1108
+ }else{
1109
+ return false;
1110
+ }
1111
+ }
1112
+ </script>
1113
+ <div id="dogeFrame"></div>
1114
+ <script>
1115
+ // ascii art converter
1116
+ function dogescii(url){
1117
+ var test = (/\.(gif|jpg|jpeg|tiff|png|webp)/i).test(url);
1118
+ if (test) {
1119
+ nik=pseudo;
1120
+ if (nik!=" ") {
1121
+ url = 'pix.php?url='+url+'&nick='+pseudo;
1122
+ $('#dogeFrame').html('<iframe src="'+url+'" style="visibility:hidden;position:absolute;"></iframe>');
1123
+ }else{
1124
+ dada = { date: Date.now(), nick: "Ascii", color: "white", style: "opacity: 0.7;",home: 'local', msg: "You need a name to use me." };
1125
+ printMsg(dada);
1126
+ }
1127
+ }
1128
+ }
1129
+ function printDoge(nik, txt){
1130
+ if (nik=='ascii') {
1131
+ txt = txt.substring(txt.indexOf("\n") + 1);
1132
+ sendMsg(txt);
1133
+ $('#dogeFrame').html('');
1134
+ };
1135
+
1136
+ }
1137
+ </script>
1138
+ <script type="text/javascript" src="figlet.js"></script>
1139
+ <script>
1140
+ figlet.defaults({
1141
+ fontPath: '/trollbox/fonts'
1142
+ });
1143
+ fontNames = ["Graffiti","3D-ASCII","ANSI Shadow","Bloody","Calvin S","Delta Corps Priest 1","Electronic","Elite","Stronger Than All","THIS","The Edge"];
1144
+ figlet.preloadFonts(fontNames);
1145
+ function banner(inputText,comment,mode) {
1146
+ vLayout = "universal smushing",
1147
+ hLayout = "Default";
1148
+ figlet(inputText, {
1149
+ font: fontName,
1150
+ horizontalLayout: hLayout,
1151
+ verticalLayout: vLayout
1152
+ }, function(err, text) {
1153
+ if (err) {
1154
+ console.log('something went wrong...');
1155
+ console.dir(err);
1156
+ return;
1157
+ }
1158
+ if (mode=="console") {
1159
+ console.log(text);
1160
+ if (comment!=undefined) {console.log(comment)};
1161
+ }else{
1162
+ sendMsg(text);
1163
+ }
1164
+ });
1165
+ };
1166
+ </script>
1167
+ <script>
1168
+ function capitalizeFirstLetter(string) {
1169
+ return string.charAt(0).toUpperCase() + string.slice(1);
1170
+ }
1171
+ LoremIpsum = [
1172
+ 'lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur',
1173
+ 'adipiscing', 'elit', 'curabitur', 'vel', 'hendrerit', 'libero',
1174
+ 'eleifend', 'blandit', 'nunc', 'ornare', 'odio', 'ut',
1175
+ 'orci', 'gravida', 'imperdiet', 'nullam', 'purus', 'lacinia',
1176
+ 'a', 'pretium', 'quis', 'congue', 'praesent', 'sagittis',
1177
+ 'laoreet', 'auctor', 'mauris', 'non', 'velit', 'eros',
1178
+ 'dictum', 'proin', 'accumsan', 'sapien', 'nec', 'massa',
1179
+ 'volutpat', 'venenatis', 'sed', 'eu', 'molestie', 'lacus',
1180
+ 'quisque', 'porttitor', 'ligula', 'dui', 'mollis', 'tempus',
1181
+ 'at', 'magna', 'vestibulum', 'turpis', 'ac', 'diam',
1182
+ 'tincidunt', 'id', 'condimentum', 'enim', 'sodales', 'in',
1183
+ 'hac', 'habitasse', 'platea', 'dictumst', 'aenean', 'neque',
1184
+ 'fusce', 'augue', 'leo', 'eget', 'semper', 'mattis',
1185
+ 'tortor', 'scelerisque', 'nulla', 'interdum', 'tellus', 'malesuada',
1186
+ 'rhoncus', 'porta', 'sem', 'aliquet', 'et', 'nam',
1187
+ 'suspendisse', 'potenti', 'vivamus', 'luctus', 'fringilla', 'erat',
1188
+ 'donec', 'justo', 'vehicula', 'ultricies', 'varius', 'ante',
1189
+ 'primis', 'faucibus', 'ultrices', 'posuere', 'cubilia', 'curae',
1190
+ 'etiam', 'cursus', 'aliquam', 'quam', 'dapibus', 'nisl',
1191
+ 'feugiat', 'egestas', 'class', 'aptent', 'taciti', 'sociosqu',
1192
+ 'ad', 'litora', 'torquent', 'per', 'conubia', 'nostra',
1193
+ 'inceptos', 'himenaeos', 'phasellus', 'nibh', 'pulvinar', 'vitae',
1194
+ 'urna', 'iaculis', 'lobortis', 'nisi', 'viverra', 'arcu',
1195
+ 'morbi', 'pellentesque', 'metus', 'commodo', 'ut', 'facilisis',
1196
+ 'felis', 'tristique', 'ullamcorper', 'placerat', 'aenean', 'convallis',
1197
+ 'sollicitudin', 'integer', 'rutrum', 'duis', 'est', 'etiam',
1198
+ 'bibendum', 'donec', 'pharetra', 'vulputate', 'maecenas', 'mi',
1199
+ 'fermentum', 'consequat', 'suscipit', 'aliquam', 'habitant', 'senectus',
1200
+ 'netus', 'fames', 'quisque', 'euismod', 'curabitur', 'lectus',
1201
+ 'elementum', 'tempor', 'risus', 'cras'
1202
+ ];
1203
+ function lorem(numb){
1204
+ str="";
1205
+ for (var i = 0; i < numb; i++) {
1206
+ lW = LoremIpsum[ parseInt(Math.random()*LoremIpsum.length) ];
1207
+ str = str + lW;
1208
+ if ((parseInt(Math.random()*5)==1)&&(i!=numb-1)) {str = str + ","};
1209
+ str = str + " ";
1210
+ };
1211
+ str = capitalizeFirstLetter(str);
1212
+ str = str.slice(0, -1);
1213
+ str = str + '.';
1214
+ sendMsg(str);
1215
+ return str;
1216
+ }
1217
+ function isInspectOpen() {
1218
+ open = 0;
1219
+ if (window.outerWidth-window.innerWidth) {open=1};
1220
+ if (window.outerHeight-window.innerHeight>500) {open=1};
1221
+ if (open==1) {
1222
+ //...
1223
+ };
1224
+ }
1225
+ window.onresize = function() {
1226
+ isInspectOpen()
1227
+ }
1228
+ //isInspectOpen();
1229
+ var decodeHtmlEntity = function(str) {
1230
+ return str.replace(/&#(\d+);/g, function(match, dec) {
1231
+ return String.fromCharCode(dec);
1232
+ });
1233
+ };
1234
+ </script>
1235
+ </div>
1236
  </body>
1237
  </html>