Kiwi globals; Built kiwi within closure
[KiwiIRC.git] / client_backbone / index.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
5
6 <title> KiwiIRC </title>
7
8 <link rel="stylesheet" type="text/css" href="style.css" />
9
10 </head>
11 <body>
12 <div id="kiwi">
13 <div id="toolbar">
14 <ul class="panellist channels"></ul>
15
16 <div id="topic">
17 <input type="text" />
18 </div>
19
20 <div id="status_message"></div>
21 </div>
22
23 <div id="panels">
24 <div class="panel_container container1"></div>
25 </div>
26
27 <div id="memberlists"></div>
28
29 <div id="controlbox">
30 <div class="input">
31 <span class="nick"> </span>
32 <div class="input_wrap"><input type="text" class="inp" /></div>
33 </div>
34 </div>
35 </div>
36
37 <script type="text/x-jquery-tmpl" id="tmpl_userbox">
38 <div class="userbox">
39 <a class="query">Message</a>
40 <a class="info">Info</a>
41 </div>
42 </script>
43
44 <script type="text/x-jquery-tmpl" id="tmpl_server_select">
45 <div class="server_select">
46 <div class="status"></div>
47
48 <form>
49 <div class="basic">
50 <label for="server_select_nick">Nickname</label>
51 <input type="text" class="nick" id="server_select_nick"> <br />
52
53 <button type="submit">Connect..</button> <br />
54 <a class="show_more">More</a>
55 </div>
56
57 <div class="more">
58 <label for="server_select_server">Server</label>
59 <input type="text" class="server" id="server_select_server"> <br />
60 <label for="server_select_channel">Channel</label>
61 <input type="text" class="channel" id="server_select_channel"> <br />
62 <br />
63 <label for="server_select_port">Port</label>
64 <input type="text" class="port" id="server_select_port"> <br />
65 <label for="server_select_password">Password</label>
66 <input type="text" class="password" id="server_select_password"> <br />
67 <label for="server_select_ssl">SSL</label>
68 <input type="checkbox" class="ssl" id="server_select_ssl">
69 </div>
70 </form>
71 </div>
72 </script>
73
74
75 <script>
76 /* Script loader (https://github.com/ded/script.js) */
77 (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)
78
79
80
81
82 function getQueryVariable(variable) {
83 var query = window.location.search.substring(1);
84 var vars = query.split('&');
85 for (var i = 0; i < vars.length; i++) {
86 var pair = vars[i].split('=');
87 if (decodeURIComponent(pair[0]) == variable) {
88 return decodeURIComponent(pair[1]);
89 }
90 }
91 }
92
93 window.onload = function () {
94
95 // Common dependancies that are required at all times
96 var scripts = [
97 ['jquery-1.7.1.min.js', 'underscore-min.js'],
98 'backbone-git.js'
99 ];
100
101 // If in debug mode, load each development script
102 if (getQueryVariable('debug')) {
103 console.log('Loading debugging scripts');
104 scripts = scripts.concat([
105 'dev/app.js',
106 [
107 'dev/model_application.js',
108 'dev/model_gateway.js'
109 ],
110 [
111 'dev/model_panellist.js',
112 'dev/model_panel.js',
113 'dev/model_member.js',
114 'dev/model_memberlist.js'
115 ],
116
117 [
118 'dev/model_channel.js',
119 'dev/model_server.js'
120 ],
121
122 [
123 'dev/utils.js',
124 'dev/view.js'
125 ]
126 ]);
127 } else {
128 scripts.push('kiwi.min.js');
129 }
130
131
132 // Run after all dependancies have been loaded
133 function startApp () {
134 var opts = {
135 container: $('#kiwi'),
136
137 // Override the kiwi_server to use. (Think: running on standalone client..)
138 kiwi_server: 'http://192.168.1.13:7778'
139 };
140
141 // Start the app by either the dev or closed environment
142 (kiwi && kiwi.global && kiwi.global.start(opts)) || (kiwi && kiwi.start(opts));
143 }
144
145
146 // Load each script
147 var cur_script = 0;
148 function loadNextScript () {
149 // Start the kiwi app if all scripts have been loaded
150 if (cur_script === scripts.length) {
151 startApp();
152 return;
153 }
154
155 $script(scripts[cur_script], loadNextScript);
156
157 cur_script++;
158 }
159
160 // Start loading scripts
161 loadNextScript();
162 };
163 </script>
164 </body>
165 </html>