license added to build.js
[KiwiIRC.git] / client / src / index.html.tmpl
CommitLineData
8eb39b80
D
1<!DOCTYPE html>\r
2<html>\r
3<head>\r
2b3eb5b9 4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>\r
ecc47600 5<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">\r
8eb39b80
D
6<base target="_blank">\r
7\r
d26a40c6 8<title> Kiwi IRC </title>\r
8eb39b80 9\r
aa92fb91 10<link rel="shortcut icon" href="<%base_path%>/assets/img/favicon.ico">\r
2b3eb5b9 11\r
ac823215 12<link rel="stylesheet" type="text/css" href="<%base_path%>/assets/css/style.css?t=<%build_time%>" />\r
b20715f9 13<link rel="stylesheet" type="text/css" href="<%base_path%>/assets/css/font-awesome.min.css" />\r
8eb39b80
D
14</head>\r
15<body>\r
8eb39b80 16\r
9aa4b87d
D
17 <script type="text/html" id="tmpl_application">\r
18 <div id="kiwi" class="theme_relaxed">\r
19 <div class="toolbar">\r
20 <div class="app_tools">\r
21 <ul class="main">\r
880239e8
JA
22 <li class="settings"><i class="fa fa-cogs" title="Settings"></i></li>\r
23 <li class="startup"><i class="fa fa-home" title="Home"></i></li>\r
9aa4b87d
D
24 <li><a href="https://kiwiirc.com/" target="_blank"><img src="<%base_path%>/assets/img/ico.png" alt="KiwiIRC" title="KiwiIRC" /></a></li>\r
25 </ul>\r
26 </div>\r
8eb39b80 27\r
9aa4b87d 28 <div class="tabs"></div>\r
8eb39b80 29\r
9aa4b87d
D
30 <div class="topic">\r
31 <div contenteditable="true"></div>\r
32 </div>\r
8eb39b80 33\r
9aa4b87d 34 <div class="status_message"></div>\r
8eb39b80 35 </div>\r
8eb39b80 36\r
9aa4b87d 37 <div class="memberlists_resize_handle"></div>\r
8eb39b80 38\r
9aa4b87d
D
39 <div class="panels">\r
40 <div class="panel_container container1"></div>\r
41 </div>\r
8eb39b80 42\r
9936359c 43 <div class="right_bar disabled">\r
0c760966
D
44 <div class="right-bar-toggle"><i class=""></i></div>\r
45 <div class="right-bar-content">\r
46 <div class="channel_tools">\r
880239e8
JA
47 <i class="fa fa-info-circle channel_info" title="Channel Info"></i>\r
48 <i class="fa fa-sign-out channel_part" title="Leave Channel"></i>\r
49 <i class="fa fa-angle-double-right right-bar-toggle-inner" title="Hide"></i>\r
0c760966
D
50 </div>\r
51 <div class="memberlists"></div>\r
9936359c 52 </div>\r
9936359c 53 </div>\r
8eb39b80 54\r
9aa4b87d
D
55 <div class="controlbox">\r
56 <div class="input">\r
57 <span class="nick"> </span>\r
58 <div class="input_wrap"><textarea class="inp"></textarea></div>\r
59 <div class="input_tools"></div>\r
60 </div>\r
61 </div>\r
62 </div>\r
63 </script>\r
8eb39b80 64\r
64bdb2ff 65\r
72db27e4
D
66 <script type="text/html" id="tmpl_channel_info">\r
67 <div class="channel_info">\r
72db27e4
D
68 <b class="channel_url"><a href=""></a></b>\r
69\r
19c15434
D
70 <form>\r
71 <div class="control-group channel_info_modes">\r
72db27e4
D
72 <label>\r
73 <input type="checkbox" name="channel_mute" class="channel-mode" data-mode="m" />\r
74 Moderated chat\r
75 </label>\r
76 <label>\r
77 <input type="checkbox" name="channel_invite" class="channel-mode" data-mode="i" />\r
78 Invite only\r
79 </label>\r
80 <label>\r
81 <input type="checkbox" name="channel_topic" class="channel-mode" data-mode="t" />\r
82 Only operators can change the topic\r
83 </label>\r
84 <label>\r
85 <input type="checkbox" name="channel_external_messages" class="channel-mode" data-mode="n" />\r
86 Block messages from outside this channel\r
87 </label>\r
19c15434
D
88 </div>\r
89\r
90 <div class="control-group">\r
72db27e4
D
91 <label>\r
92 Password\r
93 <input type="text" name="channel_key" class="channel-mode" data-mode="k" />\r
94 </label>\r
19c15434 95 </div>\r
72db27e4 96\r
19c15434
D
97\r
98 <div class="control-group channel-banlist">\r
099a0764 99 <button class="toggle_banlist">Toggle banlist</button> <span class="banlist-status"></span>\r
72db27e4
D
100 <table>\r
101 <thead>\r
102 <tr>\r
099a0764 103 <td>Ban Mask</td>\r
72db27e4
D
104 <td>Added By</td>\r
105 <td>Date Added</td>\r
106 <td></td>\r
107 </tr>\r
108 </thead>\r
109 <tbody>\r
110 </tbody>\r
111 </table>\r
19c15434
D
112 </div>\r
113 </form>\r
72db27e4
D
114 </div>\r
115 </script>\r
116\r
117\r
8eb39b80
D
118 <script type="text/html" id="tmpl_userbox">\r
119 <div class="userbox">\r
880239e8
JA
120 <a class="close_menu if_op op"><i class="fa fa-star"></i><%= op %></a>\r
121 <a class="close_menu if_op deop"><i class="fa fa-star-o"></i><%= de_op %></a>\r
122 <a class="close_menu if_op voice"><i class="fa fa-volume-up"></i><%= voice %></a>\r
123 <a class="close_menu if_op devoice"><i class="fa fa-volume-off"></i><%= de_voice %></a>\r
124 <a class="close_menu if_op kick"><i class="fa fa-times"></i><%= kick %></a>\r
125 <a class="close_menu if_op ban"><i class="fa fa-ban"></i><%= ban %></a>\r
126\r
127 <a class="close_menu query"><i class="fa fa-comment"></i><%= message %></a>\r
128 <a class="close_menu info"><i class="fa fa-info-circle"></i><%= info %></a>\r
721febea 129 <a class="close_menu ignore"><label><i><input type="checkbox" /></i><%= ignore %></label></a>\r
8eb39b80
D
130 </div>\r
131 </script>\r
64bdb2ff 132\r
8eb39b80
D
133 <script type="text/html" id="tmpl_nickchange">\r
134 <form class="nickchange">\r
0d29c21f 135 <label for="nickchange"><%= new_nick %>:</label> <input type="text" mozactionhint="done" autocomplete="off" spellcheck="false"/> <button><%= change %></button> <a class="cancel"><%= cancel %></a>\r
8eb39b80
D
136 </form>\r
137 </script>\r
138\r
21e3d147
D
139 <script type="text/html" id="tmpl_new_connection_info">\r
140 <div style="margin:1em 20px;">\r
2c110a31 141 <img src="<%base_path%>/assets/img/ico.png" alt="KiwiIRC Logo" title="Kiwi IRC" style="display:block; margin:0 auto;"/> <br />\r
21e3d147
D
142 <p style="font-style:italic;">A <strong>hand-crafted IRC client</strong> that you can enjoy. Designed to be used <strong>easily</strong> and <strong>freely</strong>.</p>\r
143\r
144 <p style="font-size:0.9em;margin-top:2em;">Peek at the <a href="https://www.kiwiirc.com/">Kiwi IRC homepage</a> for more information or to find out how to embed it on your own website. Looking for source code? Try the <a href="http://github.com/prawnsalad/KiwiIRC/">GitHub</a> page. This network of people may not be associated with Kiwi IRC itself.</p>\r
145 </div>\r
146 </script>\r
147\r
8eb39b80
D
148 <script type="text/html" id="tmpl_server_select">\r
149 <div class="server_select">\r
150\r
21e3d147
D
151 <div class="side_panel" style="position:absolute;top:0px;left:320px;">\r
152 <div class="content" style="position:relative;width:300px;">\r
153 </div>\r
154 </div>\r
155\r
3735e390 156 <div class="server_details" style="position:relative;width:320px;">\r
0d29c21f 157 <div class="status"><%= think_nick %></div>\r
8eb39b80
D
158\r
159 <form>\r
160 <div class="basic">\r
bac3c32e
D
161 <table>\r
162 <tr class="nick">\r
0d29c21f 163 <td><label for="server_select_nick"><%= nickname %></label></td>\r
bac3c32e
D
164 <td><input type="text" class="nick" id="server_select_nick"></td>\r
165 </tr>\r
166\r
167 <tr class="have_pass">\r
168 <td colspan="2">\r
0d29c21f 169 <label for="server_select_show_pass"><%= have_password %></label> <input type="checkbox" id="server_select_show_pass" style="width:auto;" />\r
bac3c32e
D
170 </td>\r
171 </tr>\r
172\r
173 <tr class="pass">\r
0d29c21f 174 <td><label for="server_select_password"><%= password %></label></td>\r
bac3c32e
D
175 <td><input type="password" class="password" id="server_select_password"></td>\r
176 </tr>\r
177\r
178 <tr class="channel">\r
0d29c21f 179 <td><label for="server_select_channel"><%= channel %></label></td>\r
700ef8ba
D
180 <td>\r
181 <div style="position:relative;">\r
182 <input type="text" class="channel" id="server_select_channel">\r
880239e8 183 <i class="fa fa-key" title="<%= channel_key %>"></i>\r
700ef8ba
D
184 </div>\r
185 </td>\r
9f67f0f2
JA
186 </tr>\r
187\r
188 <tr class="have_key">\r
189 <td colspan="2">\r
0d29c21f 190 <label for="server_select_show_channel_key"><%= require_key %></label> <input type="checkbox" id="server_select_show_channel_key" style="width:auto;" />\r
9f67f0f2
JA
191 </td>\r
192 </tr>\r
193\r
194 <tr class="key">\r
0d29c21f 195 <td><label for="server_select_channel_key"><%= key %></label></td>\r
b1e93bfa 196 <td><input type="password" class="channel_key" id="server_select_channel_key"></td>\r
bac3c32e
D
197 </tr>\r
198\r
199 <tr class="start">\r
6c800c47
D
200 <td></td>\r
201 <td><button type="submit"><%= start %></button></td>\r
bac3c32e
D
202 </tr>\r
203 </table>\r
204\r
880239e8 205 <a href="" onclick="return false;" class="show_more"><%= server_network %> <i class="fa fa-caret-down"></i></a>\r
8eb39b80
D
206 </div>\r
207\r
bf3d49ee 208\r
bac3c32e
D
209 <div class="more">\r
210 <table>\r
211 <tr class="server">\r
0d29c21f 212 <td><label for="server_select_server"><%= server %></label></td>\r
bac3c32e
D
213 <td><input type="text" class="server" id="server_select_server"></td>\r
214 <tr>\r
215\r
216 <tr class="port">\r
0d29c21f 217 <td><label for="server_select_port"><%= port %></label></td>\r
bac3c32e
D
218 <td><input type="text" class="port" id="server_select_port"></td>\r
219 </tr>\r
220\r
221 <tr class="ssl">\r
222 <td><label for="server_select_ssl">SSL</label></td>\r
223 <td><input type="checkbox" class="ssl" id="server_select_ssl"></td>\r
224 </tr>\r
225 </table>\r
8eb39b80
D
226 </div>\r
227 </form>\r
228\r
155d9f1d 229 <a class="kiwi_logo" href="https://kiwiirc.com/" target="_blank">\r
0d29c21f 230 <h1><span><%= powered_by %></span> <img src="<%base_path%>/assets/img/ico.png" alt="KiwiIRC Logo" title="Kiwi IRC" /></h1>\r
8eb39b80 231 </a>\r
8eb39b80
D
232 </div>\r
233 </div>\r
234 </script>\r
235\r
5664b269
JA
236 <script type="text/html" id="tmpl_theme_thumbnail">\r
237 <a class="thumbnail" data-setting="theme" data-value="<%= name.toLowerCase() %>" href="#">\r
238 <div class="thumbnail_wrapper"><div class="theme_color" style="background-color: <%= thumbnail_colour %>;"></div></div>\r
239 <div class="caption"><u><%= name %></u></div>\r
240 </a>\r
241 </script>\r
242\r
8eb39b80 243 <script type="text/html" id="tmpl_applet_settings">\r
5720c80a 244 <div class="settings_container">\r
72db27e4
D
245 <form>\r
246 <section>\r
247 <h6>Theme</h6>\r
248 <div class="control-group">\r
249 <div class="thumbnails">\r
83dc56c5
D
250 <% _.forEach(theme_thumbnails, function(thumbnail) { %>\r
251 <%= thumbnail %>\r
252 <% }); %>\r
72db27e4 253 </div>\r
41e7e25b 254 </div>\r
72db27e4
D
255 </section>\r
256\r
257 <section>\r
258 <h6>Channels</h6>\r
259 <div class="control-group">\r
260 <div class="radio">\r
261 <label>\r
262 <input type="radio" name="channel_list_style" data-setting="channel_list_style" value="tabs">\r
263 <%= tabs %>\r
264 </label>\r
265 </div>\r
266 <div class="radio">\r
267 <label>\r
268 <input type="radio" name="channel_list_style" data-setting="channel_list_style" value="list">\r
269 <%= list %><small class="text-muted">(<%= large_amounts_of_chans %>)</small>\r
270 </label>\r
271 </div>\r
41e7e25b 272 </div>\r
72db27e4
D
273 </section>\r
274\r
275 <section>\r
276 <h6>Chat window</h6>\r
277 <div class="control-group">\r
278 <div class="checkbox">\r
279 <label>\r
280 <input data-setting="show_joins_parts" type="checkbox">\r
281 <%= join_part %>\r
282 </label>\r
283 </div>\r
e7bc26f9
D
284 <div class="checkbox">\r
285 <label>\r
286 <input data-setting="count_all_activity" type="checkbox">\r
287 <%= count_all_activity %>\r
288 </label>\r
289 </div>\r
72db27e4
D
290 <div class="checkbox">\r
291 <label>\r
292 <input data-setting="show_timestamps" type="checkbox">\r
293 <%= timestamps %>\r
294 </label>\r
295 </div>\r
62d1e896
JA
296 <div class="checkbox">\r
297 <label>\r
298 <input data-setting="use_24_hour_timestamps" type="checkbox">\r
299 <%= timestamp_24 %>\r
300 </label>\r
301 </div>\r
72db27e4
D
302 <div class="checkbox">\r
303 <label>\r
304 <input data-setting="mute_sounds" type="checkbox">\r
305 <%= mute %>\r
306 </label>\r
307 </div>\r
308 <div class="checkbox">\r
309 <label>\r
310 <input data-setting="show_emoticons" type="checkbox">\r
311 <%= emoticons %>\r
312 </label>\r
313 </div>\r
41e7e25b 314 <label>\r
72db27e4
D
315 <input data-setting="scrollback" class="input-small" type="text" size="4" pattern="\d*">\r
316 <span><%= scroll_history %></span>\r
41e7e25b
VC
317 </label>\r
318 </div>\r
72db27e4
D
319 </section>\r
320\r
321 <section class="language">\r
322 <h6>Language</h6>\r
323 <div class="control-group">\r
324 <select data-setting="locale">\r
d31dea2c 325 <option value=""></li>\r
72db27e4
D
326 <% _.forEach(languages, function(lang) { %>\r
327 <option value="<%= lang.tag %>"><%= lang.language %></li>\r
328 <% }); %>\r
329 </select>\r
330 <br>\r
331 <small><%= locale_restart_needed %></small>\r
41e7e25b 332 </div>\r
72db27e4
D
333 </section>\r
334\r
335 <section class="protocol_handler">\r
336 <h6><%= default_client %></h6>\r
337 <div class="control-group">\r
338 <button class="register_protocol"><%= make_default %></button>\r
339 <br>\r
340 <small><%= default_note %></small>\r
41e7e25b 341 </div>\r
72db27e4 342 </section>\r
d70c63d4 343\r
72db27e4
D
344 <section class="notification_enabler">\r
345 <h6><%= html5_notifications %></h6>\r
346 <div class="control-group">\r
347 <button class="enable_notifications"><%= enable_notifications %></button>\r
348 </div>\r
349 </section>\r
350 </form>\r
8eb39b80
D
351 </div>\r
352 </script>\r
353\r
354\r
355 <script type="text/html" id="tmpl_channel_list">\r
42ff337a 356 <div class="applet_chanlist">\r
73ddddf0 357 <table>\r
8eb39b80
D
358 <thead style="font-weight: bold;">\r
359 <tr>\r
df0aee09
CC
360 <td><a class="channel_name_title"><%= channel_name %></a></td>\r
361 <td><a class="users_title"><%= users %></a></td>\r
0d29c21f 362 <td style="padding-left: 2em;"><%= topic %></td>\r
8eb39b80
D
363 </tr>\r
364 </thead>\r
365 <tbody style="vertical-align: top;">\r
366 </tbody>\r
367 </table>\r
368 </div>\r
369 </script>\r
370\r
371\r
22373da6
D
372 <script type="text/html" id="tmpl_script_editor">\r
373 <div style="height:100%;">\r
374 <style>\r
8c3b8ed2
D
375 #kiwi .script_editor .se_toolbar { padding: 10px 20px; }\r
376 #kiwi .script_editor .se_toolbar span.status { margin-left:2em; font-style:italic; }\r
377 #kiwi .script_editor .se_toolbar button { height:30px; padding:0 1em; }\r
378 #kiwi .script_editor .se_toolbar button i { font-size:1.2em; margin-left:3px; }\r
22373da6
D
379 </style>\r
380 <div class="script_editor" style="height:100%; position:relative;">\r
880239e8 381 <div class="se_toolbar"><button class="btn_save"><%= save %><i class="fa fa-floppy-o"></i></button><span class="status"></span></div>\r
22373da6
D
382 <div class="editor" style="position:absolute;top:50px;bottom:0px;left:0px;right:0px;"></div>\r
383 </div>\r
384 </div>\r
385 </script>\r
386\r
387\r
93c54616
D
388 <script type="text/html" id="tmpl_notifications">\r
389 <div class="notification-inner">\r
390 <i class="fa fa-times close"></i>\r
391 <h6></h6>\r
392 <div class="content"></div>\r
393 </div>\r
394 </script>\r
395\r
396\r
8080d5ca 397<script src="<%base_path%>/assets/libs/jquery-1.11.1.min.js"></script>\r
8eb39b80 398<script>\r
0cb15315 399/** @licstart The following is the entire license notice for the\r
400 * JavaScript code in this page.\r
401 *\r
402 *\r
403 * The JavaScript code in this page is free software: you can\r
404 * redistribute it and/or modify it under the terms of the GNU\r
405 * Affero General Public License as published by the Free Software\r
406 * Foundation, either version 3 of the License, or (at your option)\r
407 * any later version. The code is distributed WITHOUT ANY WARRANTY;\r
408 * without even the implied warranty of MERCHANTABILITY or FITNESS\r
409 * FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.\r
410 *\r
411 * As additional permission under GNU AGPL version 3 section 7, you\r
412 * may distribute non-source (e.g., minimized or compacted) forms of\r
413 * that code without the copy of the GNU AGPL normally required by\r
414 * section 4, provided you include this license notice and a URL\r
415 * through which recipients can access the Corresponding Source.\r
416 *\r
417 * @licend The above is the entire license notice\r
418 * for the JavaScript code in this page.\r
419*/\r
8eb39b80
D
420/* Script loader (https://github.com/ded/script.js) */\r
421(function(a,b,c){typeof c["module"]!="undefined"&&c.module.exports?c.module.exports=b():typeof c["define"]!="undefined"&&c["define"]=="function"&&c.define.amd?define(a,b):c[a]=b()})("$script",function(){function p(a,b){for(var c=0,d=a.length;c<d;++c)if(!b(a[c]))return j;return 1}function q(a,b){p(a,function(a){return!b(a)})}function r(a,b,i){function o(a){return a.call?a():d[a]}function t(){if(!--n){d[m]=1,l&&l();for(var a in f)p(a.split("|"),o)&&!q(f[a],o)&&(f[a]=[])}}a=a[k]?a:[a];var j=b&&b.call,l=j?b:i,m=j?a.join(""):b,n=a.length;return setTimeout(function(){q(a,function(a){if(h[a])return m&&(e[m]=1),h[a]==2&&t();h[a]=1,m&&(e[m]=1),s(!c.test(a)&&g?g+a+".js":a,t)})},0),r}function s(c,d){var e=a.createElement("script"),f=j;e.onload=e.onerror=e[o]=function(){if(e[m]&&!/^c|loade/.test(e[m])||f)return;e.onload=e[o]=null,f=1,h[c]=2,d()},e.async=1,e.src=c,b.insertBefore(e,b.firstChild)}var a=document,b=a.getElementsByTagName("head")[0],c=/^https?:\/\//,d={},e={},f={},g,h={},i="string",j=!1,k="push",l="DOMContentLoaded",m="readyState",n="addEventListener",o="onreadystatechange";return!a[m]&&a[n]&&(a[n](l,function t(){a.removeEventListener(l,t,j),a[m]="complete"},j),a[m]="loading"),r.get=s,r.order=function(a,b,c){(function d(e){e=a.shift(),a.length?r(e,d):r(e,b,c)})()},r.path=function(a){g=a},r.ready=function(a,b,c){a=a[k]?a:[a];var e=[];return!q(a,function(a){d[a]||e[k](a)})&&p(a,function(a){return d[a]})?b():!function(a){f[a]=f[a]||[],f[a][k](b),c&&c(e)}(a.join("|")),r},r},this)\r
422\r
423\r
64bdb2ff
D
424 // Avoid `console` errors in browsers that lack a console. (https://github.com/h5bp/html5-boilerplate)\r
425 function normalizeConsole() {\r
426 var method;\r
427 var noop = function () {};\r
428 var methods = [\r
429 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',\r
430 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',\r
431 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',\r
432 'timeStamp', 'trace', 'warn'\r
433 ];\r
434 var length = methods.length;\r
435 var console = (window.console = window.console || {});\r
436\r
437 while (length--) {\r
438 method = methods[length];\r
439\r
440 // Only stub undefined methods.\r
441 if (!console[method]) {\r
442 console[method] = noop;\r
443 }\r
444 }\r
ae007e1e
JA
445 }\r
446\r
447 normalizeConsole();\r
64bdb2ff 448\r
8eb39b80
D
449 function getQueryVariable(variable) {\r
450 var query = window.location.search.substring(1);\r
451 var vars = query.split('&');\r
452 for (var i = 0; i < vars.length; i++) {\r
440c7738 453 var pair = vars[i].replace(/\+/g, '%20').split('=');\r
8eb39b80
D
454 if (decodeURIComponent(pair[0]) == variable) {\r
455 return decodeURIComponent(pair[1]);\r
456 }\r
457 }\r
458 }\r
459\r
ae007e1e
JA
460 (function afterPromiseAvailable() {\r
461 var base_path = '<%base_path%>', // Entry path for the kiwi application\r
462 scripts = [],\r
463 opts = {\r
464 container: $('body'),\r
465 base_path: base_path,\r
466 settings_path: base_path + '/assets/settings.json'\r
467 },\r
468 script_promise, script_promise_resolve,\r
469 onload_promise,\r
470 settings_promise;\r
471\r
472 // If the browser doesn't natively support promises load up the polyfill and try again.\r
473 if (!window.Promise) {\r
474 $script(base_path + "/assets/libs/promise.min.js", afterPromiseAvailable);\r
475 return;\r
476 }\r
28990b2a 477\r
ae007e1e
JA
478 function loadScripts(scripts) {\r
479 return new Promise(function (resolve, reject) {\r
480 var to_load, idx,\r
481 base = base_path + '/';\r
482 if (typeof scripts === 'string') {\r
483 to_load = base + scripts;\r
484 } else {\r
485 to_load = [];\r
486 for (idx in scripts) {\r
487 to_load.push(base + scripts[idx]);\r
488 }\r
489 }\r
490 $script(to_load, resolve, reject);\r
28990b2a 491 });\r
ae007e1e 492 }\r
28990b2a 493\r
ae007e1e 494 onload_promise = new Promise(function (resolve) {\r
89ae7bbf
D
495 // Document may already be loaded if we had to load the Promise shim seperately\r
496 if (document.readyState === 'complete') {\r
497 resolve();\r
498 return;\r
499 }\r
500\r
ae007e1e
JA
501 window.onload = resolve;\r
502 });\r
28990b2a 503\r
bc2bf2eb 504 // Get a resolve function for the script loading promises\r
ae007e1e
JA
505 script_promise = new Promise(function (resolve) {\r
506 script_promise_resolve = resolve;\r
507 });\r
bc2bf2eb
D
508\r
509 // Chain each script loading promise\r
ae007e1e
JA
510 script_promise = script_promise.then(function () {\r
511 var idx;\r
512 for (idx = 0; idx < scripts.length; idx++) {\r
513 (function (idx) {\r
514 script_promise = script_promise.then(function () {\r
515 return loadScripts(scripts[idx]);\r
516 });\r
517 })(idx);\r
28990b2a 518 }\r
ae007e1e 519 });\r
28990b2a 520\r
bc2bf2eb 521 // Debugging will get a list of debugging scripts from settings.json (below)\r
ae007e1e
JA
522 if (!getQueryVariable('debug')) {\r
523 scripts.push(['assets/libs/lodash.min.js?t=<%build_time%>']);\r
524 scripts.push([\r
525 'assets/libs/backbone.min.js?t=<%build_time%>',\r
526 'assets/libs/jed.js?t=<%build_time%>'\r
527 ]);\r
528 scripts.push([\r
529 'assets/kiwi.min.js?t=<%build_time%>',\r
530 'assets/libs/engine.io.bundle.min.js?t=<%build_time%>'\r
531 ]);\r
28990b2a 532\r
ae007e1e
JA
533 script_promise_resolve();\r
534 }\r
28990b2a 535\r
ae007e1e
JA
536 settings_promise = new Promise(function (resolve) {\r
537 $.getJSON(opts.settings_path, function (data) {\r
538 opts.server_settings = data.server_settings;\r
539 opts.client_plugins = data.client_plugins;\r
540 opts.translations = data.translations;\r
541 opts.locale = data.locale;\r
542 opts.themes = data.themes;\r
28990b2a 543\r
ae007e1e
JA
544 if (typeof data.kiwi_server !== 'undefined') {\r
545 opts.kiwi_server = data.kiwi_server;\r
546 }\r
28990b2a 547\r
ae007e1e 548 resolve();\r
28990b2a 549\r
ae007e1e
JA
550 // If debugging, grab the debug scripts and load them\r
551 if (getQueryVariable('debug')) {\r
552 scripts = scripts.concat(data.scripts);\r
553 script_promise_resolve();\r
554 }\r
8eb39b80 555\r
ae007e1e
JA
556 // Load themes\r
557 if (opts.themes) {\r
558 $.each(opts.themes, function (theme_idx, theme) {\r
559 var disabled = (opts.server_settings.client.settings.theme.toLowerCase() !== theme.name.toLowerCase()),\r
560 rel = (disabled?'alternate ':'') + 'stylesheet';\r
64bdb2ff 561\r
ae007e1e
JA
562 var link = $.parseHTML('<link rel="' + rel + '" type="text/css" data-theme href="'+ opts.base_path + '/assets/themes/' + theme.name.toLowerCase() + '/style.css" title="' + theme.name.toLowerCase() + '" ' + (disabled?'disabled':'') + '/>');\r
563 link.disabled = disabled;\r
040d9360 564\r
ae007e1e
JA
565 $(link).appendTo($('head'));\r
566 });\r
567 }\r
568 });\r
569 });\r
040d9360 570\r
bc2bf2eb
D
571 // prawnsalad: Why is the below script_promise in its own .then()?\r
572 // M2Ys4U: prawnsalad: either of the first two promises can resolve the\r
573 // third one, but the third one has a then() on it already, so the\r
574 // then() on the all() makes it wait for the then() on the script promise\r
575 // to resolve.\r
576 //\r
577 // Promises - simple.\r
578 Promise.all([onload_promise, settings_promise])\r
579 .then(function(){return script_promise})\r
580 .then(function startApp() {\r
4c424593
D
581 // Kiwi IRC version this is built from\r
582 kiwi.build_version = '<%build_version%>';\r
583\r
6b8fbed0
D
584 // Start the app after loading plugins\r
585 kiwi.init(opts, function() {\r
62c18d2d 586 if (opts.client_plugins && opts.client_plugins.length > 0) {\r
6b8fbed0
D
587\r
588 // Wait until all plugins are loaded before starting the app\r
589 kiwi.plugins.once('loaded', function() {\r
590 kiwi.start();\r
591 });\r
592\r
62c18d2d
D
593 _.each(opts.client_plugins, function (plugin_url) {\r
594 kiwi.plugins.load(plugin_url);\r
595 });\r
6b8fbed0
D
596\r
597 } else {\r
598\r
599 // No plugins were needed so start the app\r
600 kiwi.start();\r
62c18d2d
D
601 }\r
602 });\r
040d9360 603 });\r
9aa4b87d 604 })();\r
8eb39b80
D
605</script>\r
606</body>\r
b1e93bfa 607</html>\r