Loading text theme tidy up
[KiwiIRC.git] / client / src / index.html.tmpl
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
5 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
6 <base target="_blank">
7
8 <title> Kiwi IRC </title>
9
10 <link rel="shortcut icon" href="<%base_path%>/assets/img/favicon.ico">
11
12 <link rel="stylesheet" type="text/css" href="<%base_path%>/assets/css/style.css" />
13 <link rel="stylesheet" type="text/css" href="<%base_path%>/assets/css/font-awesome.min.css" />
14 <!--[if IE 7]>
15 <link rel="stylesheet" type="text/css" href="/kiwi/assets/css/font-awesome-ie7.css" />
16 <![endif]-->
17 </head>
18 <body>
19
20 <script type="text/html" id="tmpl_application">
21 <div id="kiwi" class="theme_relaxed">
22 <div class="toolbar">
23 <div class="app_tools">
24 <ul class="main">
25 <li class="settings"><i class="icon-cogs" title="Settings"></i></li>
26 <li class="startup"><i class="icon-home" title="Home"></i></li>
27 <li><a href="https://kiwiirc.com/" target="_blank"><img src="<%base_path%>/assets/img/ico.png" alt="KiwiIRC" title="KiwiIRC" /></a></li>
28 </ul>
29 </div>
30
31 <div class="tabs"></div>
32
33 <div class="topic">
34 <div contenteditable="true"></div>
35 </div>
36
37 <div class="status_message"></div>
38 </div>
39
40 <div class="memberlists_resize_handle"></div>
41
42 <div class="panels">
43 <div class="panel_container container1"></div>
44 </div>
45
46 <div class="right_bar disabled">
47 <div class="right-bar-toggle"><i class=""></i></div>
48 <div class="right-bar-content">
49 <div class="channel_tools">
50 <i class="icon-info-sign channel_info" title="Channel Info"></i>
51 <i class="icon-signout channel_part" title="Leave Channel"></i>
52 <i class="icon-double-angle-right right-bar-toggle-inner" title="Hide"></i>
53 </div>
54 <div class="memberlists"></div>
55 </div>
56 </div>
57
58 <div class="controlbox">
59 <div class="input">
60 <span class="nick"> </span>
61 <div class="input_wrap"><textarea class="inp"></textarea></div>
62 <div class="input_tools"></div>
63 </div>
64 </div>
65 </div>
66 </script>
67
68
69 <script type="text/html" id="tmpl_channel_info">
70 <div class="channel_info">
71 <b class="channel_url"><a href=""></a></b>
72
73 <form>
74 <div class="control-group channel_info_modes">
75 <label>
76 <input type="checkbox" name="channel_mute" class="channel-mode" data-mode="m" />
77 Moderated chat
78 </label>
79 <label>
80 <input type="checkbox" name="channel_invite" class="channel-mode" data-mode="i" />
81 Invite only
82 </label>
83 <label>
84 <input type="checkbox" name="channel_topic" class="channel-mode" data-mode="t" />
85 Only operators can change the topic
86 </label>
87 <label>
88 <input type="checkbox" name="channel_external_messages" class="channel-mode" data-mode="n" />
89 Block messages from outside this channel
90 </label>
91 </div>
92
93 <div class="control-group">
94 <label>
95 Password
96 <input type="text" name="channel_key" class="channel-mode" data-mode="k" />
97 </label>
98 </div>
99
100
101 <div class="control-group channel-banlist">
102 <button class="toggle_banlist">Toggle banlist</button> <span class="banlist-status"></span>
103 <table>
104 <thead>
105 <tr>
106 <td>Ban Mask</td>
107 <td>Added By</td>
108 <td>Date Added</td>
109 <td></td>
110 </tr>
111 </thead>
112 <tbody>
113 </tbody>
114 </table>
115 </div>
116 </form>
117 </div>
118 </script>
119
120
121 <script type="text/html" id="tmpl_userbox">
122 <div class="userbox">
123 <a class="close_menu if_op op"><i class="icon-star"></i><%= op %></a>
124 <a class="close_menu if_op deop"><i class="icon-star-empty"></i><%= de_op %></a>
125 <a class="close_menu if_op voice"><i class="icon-volume-up"></i><%= voice %></a>
126 <a class="close_menu if_op devoice"><i class="icon-volume-off"></i><%= de_voice %></a>
127 <a class="close_menu if_op kick"><i class="icon-remove"></i><%= kick %></a>
128 <a class="close_menu if_op ban"><i class="icon-ban-circle"></i><%= ban %></a>
129
130 <a class="close_menu query"><i class="icon-comment"></i><%= message %></a>
131 <a class="close_menu info"><i class="icon-info-sign"></i><%= info %></a>
132 <a class="close_menu ignore"><label><i><input type="checkbox" /></i><%= ignore %></label></a>
133 </div>
134 </script>
135
136 <script type="text/html" id="tmpl_nickchange">
137 <form class="nickchange">
138 <label for="nickchange"><%= new_nick %>:</label> <input type="text" mozactionhint="done" autocomplete="off" spellcheck="false"/> <button><%= change %></button> <a class="cancel"><%= cancel %></a>
139 </form>
140 </script>
141
142 <script type="text/html" id="tmpl_new_connection_info">
143 <div style="margin:1em 20px;">
144 <img src="<%base_path%>/assets/img/ico.png" alt="KiwiIRC Logo" title="Kiwi IRC" style="display:block; margin:0 auto;"/> <br />
145 <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>
146
147 <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>
148 </div>
149 </script>
150
151 <script type="text/html" id="tmpl_server_select">
152 <div class="server_select">
153
154 <div class="side_panel" style="position:absolute;top:0px;left:320px;">
155 <div class="content" style="position:relative;width:300px;">
156 </div>
157 </div>
158
159 <div class="server_details" style="position:relative;width:320px;">
160 <div class="status"><%= think_nick %></div>
161
162 <form>
163 <div class="basic">
164 <table>
165 <tr class="nick">
166 <td><label for="server_select_nick"><%= nickname %></label></td>
167 <td><input type="text" class="nick" id="server_select_nick"></td>
168 </tr>
169
170 <tr class="have_pass">
171 <td colspan="2">
172 <label for="server_select_show_pass"><%= have_password %></label> <input type="checkbox" id="server_select_show_pass" style="width:auto;" />
173 </td>
174 </tr>
175
176 <tr class="pass">
177 <td><label for="server_select_password"><%= password %></label></td>
178 <td><input type="password" class="password" id="server_select_password"></td>
179 </tr>
180
181 <tr class="channel">
182 <td><label for="server_select_channel"><%= channel %></label></td>
183 <td>
184 <div style="position:relative;">
185 <input type="text" class="channel" id="server_select_channel">
186 <i class="icon-key" title="<%= channel_key %>"></i>
187 </div>
188 </td>
189 </tr>
190
191 <tr class="have_key">
192 <td colspan="2">
193 <label for="server_select_show_channel_key"><%= require_key %></label> <input type="checkbox" id="server_select_show_channel_key" style="width:auto;" />
194 </td>
195 </tr>
196
197 <tr class="key">
198 <td><label for="server_select_channel_key"><%= key %></label></td>
199 <td><input type="password" class="channel_key" id="server_select_channel_key"></td>
200 </tr>
201
202 <tr class="start">
203 <td></td>
204 <td><button type="submit"><%= start %></button></td>
205 </tr>
206 </table>
207
208 <a href="" onclick="return false;" class="show_more"><%= server_network %> <i class="icon-caret-down"></i></a>
209 </div>
210
211
212 <div class="more">
213 <table>
214 <tr class="server">
215 <td><label for="server_select_server"><%= server %></label></td>
216 <td><input type="text" class="server" id="server_select_server"></td>
217 <tr>
218
219 <tr class="port">
220 <td><label for="server_select_port"><%= port %></label></td>
221 <td><input type="text" class="port" id="server_select_port"></td>
222 </tr>
223
224 <tr class="ssl">
225 <td><label for="server_select_ssl">SSL</label></td>
226 <td><input type="checkbox" class="ssl" id="server_select_ssl"></td>
227 </tr>
228 </table>
229 </div>
230 </form>
231
232 <a class="kiwi_logo" href="https://kiwiirc.com/" target="_blank">
233 <h1><span><%= powered_by %></span> <img src="<%base_path%>/assets/img/ico.png" alt="KiwiIRC Logo" title="Kiwi IRC" /></h1>
234 </a>
235 </div>
236 </div>
237 </script>
238
239 <script type="text/html" id="tmpl_theme_thumbnail">
240 <a class="thumbnail" data-setting="theme" data-value="<%= name.toLowerCase() %>" href="#">
241 <div class="thumbnail_wrapper"><div class="theme_color" style="background-color: <%= thumbnail_colour %>;"></div></div>
242 <div class="caption"><u><%= name %></u></div>
243 </a>
244 </script>
245
246 <script type="text/html" id="tmpl_applet_settings">
247 <div class="settings_container">
248 <form>
249 <section>
250 <h6>Theme</h6>
251 <div class="control-group">
252 <div class="thumbnails">
253 <% _.forEach(theme_thumbnails, function(thumbnail) { %>
254 <%= thumbnail %>
255 <% }); %>
256 </div>
257 </div>
258 </section>
259
260 <section>
261 <h6>Channels</h6>
262 <div class="control-group">
263 <div class="radio">
264 <label>
265 <input type="radio" name="channel_list_style" data-setting="channel_list_style" value="tabs">
266 <%= tabs %>
267 </label>
268 </div>
269 <div class="radio">
270 <label>
271 <input type="radio" name="channel_list_style" data-setting="channel_list_style" value="list">
272 <%= list %><small class="text-muted">(<%= large_amounts_of_chans %>)</small>
273 </label>
274 </div>
275 </div>
276 </section>
277
278 <section>
279 <h6>Chat window</h6>
280 <div class="control-group">
281 <div class="checkbox">
282 <label>
283 <input data-setting="show_joins_parts" type="checkbox">
284 <%= join_part %>
285 </label>
286 </div>
287 <div class="checkbox">
288 <label>
289 <input data-setting="count_all_activity" type="checkbox">
290 <%= count_all_activity %>
291 </label>
292 </div>
293 <div class="checkbox">
294 <label>
295 <input data-setting="show_timestamps" type="checkbox">
296 <%= timestamps %>
297 </label>
298 </div>
299 <div class="checkbox">
300 <label>
301 <input data-setting="use_24_hour_timestamps" type="checkbox">
302 <%= timestamp_24 %>
303 </label>
304 </div>
305 <div class="checkbox">
306 <label>
307 <input data-setting="mute_sounds" type="checkbox">
308 <%= mute %>
309 </label>
310 </div>
311 <div class="checkbox">
312 <label>
313 <input data-setting="show_emoticons" type="checkbox">
314 <%= emoticons %>
315 </label>
316 </div>
317 <label>
318 <input data-setting="scrollback" class="input-small" type="text" size="4" pattern="\d*">
319 <span><%= scroll_history %></span>
320 </label>
321 </div>
322 </section>
323
324 <section class="language">
325 <h6>Language</h6>
326 <div class="control-group">
327 <select data-setting="locale">
328 <option value=""></li>
329 <% _.forEach(languages, function(lang) { %>
330 <option value="<%= lang.tag %>"><%= lang.language %></li>
331 <% }); %>
332 </select>
333 <br>
334 <small><%= locale_restart_needed %></small>
335 </div>
336 </section>
337
338 <section class="protocol_handler">
339 <h6><%= default_client %></h6>
340 <div class="control-group">
341 <button class="register_protocol"><%= make_default %></button>
342 <br>
343 <small><%= default_note %></small>
344 </div>
345 </section>
346
347 <section class="notification_enabler">
348 <h6><%= html5_notifications %></h6>
349 <div class="control-group">
350 <button class="enable_notifications"><%= enable_notifications %></button>
351 </div>
352 </section>
353 </form>
354 </div>
355 </script>
356
357
358 <script type="text/html" id="tmpl_channel_list">
359 <div class="applet_chanlist">
360 <table>
361 <thead style="font-weight: bold;">
362 <tr>
363 <td><a class="channel_name_title"><%= channel_name %></a></td>
364 <td><a class="users_title"><%= users %></a></td>
365 <td style="padding-left: 2em;"><%= topic %></td>
366 </tr>
367 </thead>
368 <tbody style="vertical-align: top;">
369 </tbody>
370 </table>
371 </div>
372 </script>
373
374
375 <script type="text/html" id="tmpl_script_editor">
376 <div style="height:100%;">
377 <style>
378 #kiwi .script_editor .se_toolbar { padding: 10px 20px; }
379 #kiwi .script_editor .se_toolbar span.status { margin-left:2em; font-style:italic; }
380 #kiwi .script_editor .se_toolbar button { height:30px; padding:0 1em; }
381 #kiwi .script_editor .se_toolbar button i { font-size:1.2em; margin-left:3px; }
382 </style>
383 <div class="script_editor" style="height:100%; position:relative;">
384 <div class="se_toolbar"><button class="btn_save"><%= save %><i class="icon-save"></i></button><span class="status"></span></div>
385 <div class="editor" style="position:absolute;top:50px;bottom:0px;left:0px;right:0px;"></div>
386 </div>
387 </div>
388 </script>
389
390
391 <script src="<%base_path%>/assets/libs/jquery-1.11.0.min.js"></script>
392 <script>
393 /* Script loader (https://github.com/ded/script.js) */
394 (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)
395
396
397 // Avoid `console` errors in browsers that lack a console. (https://github.com/h5bp/html5-boilerplate)
398 function normalizeConsole() {
399 var method;
400 var noop = function () {};
401 var methods = [
402 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
403 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
404 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
405 'timeStamp', 'trace', 'warn'
406 ];
407 var length = methods.length;
408 var console = (window.console = window.console || {});
409
410 while (length--) {
411 method = methods[length];
412
413 // Only stub undefined methods.
414 if (!console[method]) {
415 console[method] = noop;
416 }
417 }
418 };
419
420 function getQueryVariable(variable) {
421 var query = window.location.search.substring(1);
422 var vars = query.split('&');
423 for (var i = 0; i < vars.length; i++) {
424 var pair = vars[i].replace(/\+/g, '%20').split('=');
425 if (decodeURIComponent(pair[0]) == variable) {
426 return decodeURIComponent(pair[1]);
427 }
428 }
429 }
430
431 /**
432 * Get alerted when a group of jobs have been completed.
433 * Eg. .registerJob('job1'); .registerJob('job2');
434 * .onFinish(function(){ alert('Jobs finished!'); });
435 * .finishJob('job1');
436 * .finishJob('job2');
437 */
438 function JobManager() {
439 var completed_jobs = { };
440
441 // Functions to call once all jobs have completed
442 var completed_callbacks = [];
443
444
445 function callCompletedFunctions(fn) {
446 $.each(completed_callbacks, function(idx, fn) {
447 fn();
448 });
449
450 completed_callbacks = [];
451 };
452
453
454 this.finishJob = function(job_name) {
455 if (typeof completed_jobs[job_name] === 'undefined') {
456 return;
457 }
458
459 completed_jobs[job_name] = true;
460
461 // Check if all our jobs have completed
462 var all_jobs_completed = true;
463 $.each(completed_jobs, function(idx, completed) {
464 if (!completed) {
465 all_jobs_completed = false;
466 return false;
467 }
468 });
469
470 if (all_jobs_completed) {
471 callCompletedFunctions();
472 }
473 };
474
475
476 this.onFinish = function(fn) {
477 completed_callbacks.push(fn);
478 };
479
480
481 this.registerJob = function(job_name) {
482 completed_jobs[job_name] = false;
483 };
484 }
485
486 (function () {
487 var base_path = '<%base_path%>', // Entry path for the kiwi application
488 scripts = [],
489 opts = {
490 container: $('body'),
491 base_path: base_path,
492 settings_path: base_path + '/assets/settings.json'
493 };
494
495 normalizeConsole();
496
497 /**
498 * Job bootup manager
499 * Once all jobs have completed, call any registered completed functions
500 */
501 var jobs = new JobManager();
502
503
504 // Run after all dependancies have been loaded
505 jobs.onFinish(function startApp() {
506 // Kiwi IRC version this is built from
507 kiwi.build_version = '<%build_version%>';
508
509 // Start the app after loading plugins
510 kiwi.init(opts, function() {
511 if (opts.client_plugins && opts.client_plugins.length > 0) {
512
513 // Wait until all plugins are loaded before starting the app
514 kiwi.plugins.once('loaded', function() {
515 kiwi.start();
516 });
517
518 _.each(opts.client_plugins, function (plugin_url) {
519 kiwi.plugins.load(plugin_url);
520 });
521
522 } else {
523
524 // No plugins were needed so start the app
525 kiwi.start();
526 }
527 });
528 });
529
530
531 // Load each script
532 jobs.registerJob('load_scripts');
533 var cur_script = 0;
534 function loadNextScript () {
535 var to_load,
536 base = base_path + '/';
537
538 // Start the kiwi app if all scripts have been loaded
539 if (cur_script === scripts.length) {
540 jobs.finishJob('load_scripts');
541 return;
542 }
543
544 if (typeof scripts[cur_script] === 'string') {
545 to_load = base + scripts[cur_script];
546 } else {
547 to_load = [];
548 for(var idx in scripts[cur_script]) {
549 to_load.push(base + scripts[cur_script][idx]);
550 }
551 }
552
553 $script(to_load, loadNextScript);
554
555 cur_script++;
556 }
557
558 // If we're not interested in debug libs, start loading production files
559 if (!getQueryVariable('debug')) {
560 scripts.push(['assets/libs/lodash.min.js']);
561 scripts.push([
562 'assets/libs/backbone.min.js',
563 'assets/libs/jed.js'
564 ]);
565 scripts.push([
566 'assets/kiwi.min.js',
567 'assets/libs/engine.io.bundle.min.js'
568 ]);
569
570 loadNextScript();
571 }
572
573 // Load application settings
574 jobs.registerJob('load_settings');
575 $.getJSON(opts.settings_path, function (data) {
576 opts.server_settings = data.server_settings;
577 opts.client_plugins = data.client_plugins;
578 opts.translations = data.translations;
579 opts.locale = data.locale;
580 opts.themes = data.themes;
581
582 if (typeof data.kiwi_server !== 'undefined')
583 opts.kiwi_server = data.kiwi_server;
584
585 jobs.finishJob('load_settings');
586
587 // If debugging, grab the debug scripts and load them
588 if (getQueryVariable('debug')) {
589 scripts = scripts.concat(data.scripts);
590 loadNextScript();
591 }
592
593 // Load themes
594 if (opts.themes) {
595 $.each(opts.themes, function (theme_idx, theme) {
596 var disabled = (opts.server_settings.client.settings.theme.toLowerCase() !== theme.name.toLowerCase()),
597 rel = (disabled?'alternate ':'') + 'stylesheet' /*+ (disabled?' prefetch':'')*/;
598
599 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':'') + '/>');
600 link.disabled = disabled;
601
602 $(link).appendTo($('head'));
603 });
604 }
605 });
606
607 jobs.registerJob('window_load');
608 window.onload = function() {
609 jobs.finishJob('window_load');
610 };
611 })();
612 </script>
613 </body>
614 </html>