Merge git://github.com/prawnsalad/KiwiIRC
[KiwiIRC.git] / index.php
CommitLineData
54f4a22e
D
1<?php\r
2\r
12a3d773
D
3 $node_config = json_decode(file_get_contents("node/config.json"), true);\r
4\r
54f4a22e
D
5 switch(true){\r
6 case stripos($_SERVER['HTTP_USER_AGENT'], 'android') > 0:\r
7 $agent = "android"; $touchscreen = true;\r
8 break;\r
9 \r
10 case stripos($_SERVER['HTTP_USER_AGENT'], 'iphone') > 0:\r
11 $agent = "iphone"; $touchscreen = true;\r
12 break;\r
13 \r
14 case stripos($_SERVER['HTTP_USER_AGENT'], 'ipod') > 0:\r
15 $agent = "ipod"; $touchscreen = true;\r
16 break;\r
17 \r
18 case stripos($_SERVER['HTTP_USER_AGENT'], 'ipad') > 0:\r
19 $agent = "ipad"; $touchscreen = true;\r
20 break;\r
21 \r
22 default:\r
23 $agent = "normal";\r
24 $touchscreen = false;\r
25 }\r
26 \r
27 define("SERVER_SET", isset($_GET['server']));\r
28 $server = isset($_GET['server']) ? $_GET['server'] : "irc.anonnet.org";\r
29 $nick = isset($_GET['nick']) ? $_GET['nick'] : "";\r
30 // Channel is set via javascript using location.hash\r
1614c0f9
D
31\r
32 $node_server = $_SERVER['HTTP_HOST'];\r
54f4a22e
D
33 \r
34?>\r
35<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
36<html xmlns="http://www.w3.org/1999/xhtml">\r
37<head>\r
38<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\r
39\r
40<?php if(in_array($agent, array("android", "ipad", "iphone", "ipad"))){ ?>\r
41<meta name="viewport" content="width=device-width,user-scalable=no" />\r
42<?php } ?>\r
43\r
44<title>Kiwi IRC</title>\r
45<link rel="stylesheet" type="text/css" href="css/default.css">\r
46<link rel="stylesheet" type="text/css" href="css/ui.css">\r
47\r
48<?php if($touchscreen){ ?>\r
49<link rel="stylesheet" type="text/css" href="css/touchscreen_tweaks.css">\r
50<?php } ?>\r
51\r
1614c0f9 52<script src="http://<?php echo $node_server; ?>:7777/socket.io/socket.io.js"></script>\r
6cd647f7 53<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>\r
54f4a22e
D
54<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>\r
55<script type="text/javascript" src="js/jquery.json-2.2.min.js"></script>\r
56<script type="text/javascript" src="js/util.js"></script>\r
57<script type="text/javascript" src="js/gateway.js"></script>\r
58<script type="text/javascript" src="js/front.js"></script>\r
784ae106 59<script type="text/javascript" src="js/iscroll.js"></script>\r
54f4a22e
D
60\r
61<?php if(in_array($agent, array("android", "ipad", "iphone", "ipad"))){ ?>\r
62<script type="text/javascript" src="js/touchscreen_tweaks.js"></script>\r
63<?php } ?>\r
64\r
65<script type="text/javascript">\r
1614c0f9
D
66 var agent = '<?php echo $agent; ?>';\r
67 var touchscreen = <?php echo ($touchscreen) ? 'true' : 'false'; ?>;\r
54f4a22e 68 var init_data = {};\r
12a3d773 69 var kiwi_server = '<?php echo ($node_config['listen_ssl'] ? "https" : "http")."://".$node_server; ?>:7777/';\r
784ae106 70 var touch_scroll;\r
54f4a22e
D
71 \r
72 $(document).ready(function(){\r
7cc2e5bd
D
73 manageDebug(false);\r
74\r
75 //#channel,##channel,&channel\r
54f4a22e
D
76 var chans = document.location.hash.match(/[#&]+[^ ,\007]+/g);\r
77 if(chans != null && chans.length > 0) {\r
78 init_data.channel = chans.join(',');\r
79 $('#channel').val(init_data.channel);\r
80 }\r
81 \r
82 front.init();\r
1614c0f9 83 gateway.start(kiwi_server);\r
54f4a22e
D
84 \r
85 addEvents();\r
86 $('.nick').focus();\r
87 });\r
88 \r
89 \r
90 function addEvents(){\r
91 $('.more_link').click(function(){ $('.content.bottom').slideDown('fast'); $('.network').focus(); return false; });\r
92 $('.formconnectwindow').submit(function(){\r
93 init_data.channel = $('#channel').val();\r
94 return false;\r
95 });\r
96 $('a.connect').click(function(){ $('.formconnectwindow').submit(); return false; });\r
97 }\r
98</script>\r
99\r
6cd647f7
D
100\r
101<script id="tmpl_about_box" type="text/x-jquery-tmpl">\r
102 <h2>Kiwi IRC</h2>\r
103 <p>An alternative to downloading an irc client. Kiwi IRC is the best web app you'll use for the next couple years.</p>\r
104 <button class="about_close">Close</button>\r
105 <p class="info">${about}</p>\r
106 <p class="revisions">Front: ${front_revision}<br />Gateway: ${gateway_revision}</p>\r
107</script>\r
108\r
109<script id="tmpl_change_nick" type="text/x-jquery-tmpl">\r
110 <div class="newnick box">\r
111 Your new nick:<br />\r
112 <form class="form_newnick">\r
113 <input type="text" class="txtnewnick" /><br />\r
114 <button class="butnewnick" type="submit">Change</button> <a class="link cancelnewnick">Cancel</a>\r
115 </form>\r
116 </div>\r
117</script>\r
118\r
119\r
120<script id="tmpl_plugins" type="text/x-jquery-tmpl">\r
121 <div class="list">\r
122 <h2>Kiwi plugins</h2>\r
123 <p>\r
124 <select multiple="multiple" id="plugin_list">\r
125 </select>\r
126 <button id="plugins_list_unload">Unload</button>\r
127 </p>\r
128 </div>\r
129 <div class="load">\r
130 Plugin file URL:<br />\r
131 <form>\r
132 <input type="text" class="txtpluginfile" /><br />\r
133 <button class="butnewnick" type="submit">Load..</button> <a class="link cancelpluginfile">Cancel</a>\r
134 </form>\r
135 </div>\r
136</script>\r
137\r
138<script id="tmpl_user_box" type="text/x-jquery-tmpl">\r
139 <div class="userbox">\r
140 <input type="hidden" class="userbox_nick" value="${nick}" />\r
141 <a href="#" class="userbox_query">Message</a>\r
142 <a href="#" class="userbox_whois">Info</a>\r
143 </div>\r
144</script>\r
145\r
54f4a22e
D
146</head>\r
147\r
148<body>\r
149\r
150<div id="kiwi">\r
151 <div class="connectwindow">\r
152 <h1 class="logo">Kiwi IRC</h1>\r
153 <div id="login">\r
154 <form class="formconnectwindow">\r
155 <div class="content top">\r
156 <ul>\r
157 <li><label for="nick">Your nickname:</label>\r
6cd647f7 158 <input type="text" id="nick" name="nick" class="nick" placeholder="Your nick.." /></li>\r
54f4a22e
D
159 </ul>\r
160 <a class="connect" href="">Connect..</a>\r
161 </div>\r
162 \r
163 <div class="more" style="<?php if(SERVER_SET) echo "display:none;"; ?>">\r
164 <a href="" class="more_link">More</a>\r
165 <div class="content bottom">\r
166 <ul>\r
167 <li><label for="network">Server:</label>\r
168 <input type="text" id="network" name="network" class="network" value="<?php echo htmlentities($server); ?>" /></li>\r
169 <li><label for="channel">Channel:</label>\r
170 <input type="text" id="channel" name="channel" class="channel" value="#kiwiirc" /></li>\r
171 </ul>\r
172 <a class="connect" href="">Connect..</a>\r
173 </div>\r
174 </div>\r
175 </form>\r
176 </div>\r
177 </div>\r
178 \r
179 \r
180 \r
181 <div class="windowlist">\r
182 <div class="poweredby">Powered by Kiwi IRC</div>\r
183 <ul></ul>\r
184 </div>\r
185 \r
186 <div class="cur_topic"></div>\r
187 \r
188 <div class="userlist">\r
189 <ul></ul>\r
190 </div>\r
191 \r
784ae106
D
192 <div id="windows" class="windows"><div class="scroller" style="width:100%;"></div></div>\r
193\r
54f4a22e
D
194 <div class="control">\r
195 <div class="msginput">\r
196 <div class="nick"><a href="#"></a>:</div>\r
197 <input type="text" name="kiwi_msginput" id="kiwi_msginput" />\r
198 </div>\r
199 <div class="plugins">\r
200 <ul>\r
6cd647f7 201 <li><a class="load_plugin_file">Plugins</a></li>\r
54f4a22e
D
202 <?php if(isset($_GET['debug'])){ ?>\r
203 <li><a class="reload_css">Reload CSS</a></li>\r
204 <?php } ?>\r
205 </ul>\r
206 </div>\r
207 </div>\r
208</div>\r
209\r
210</body>\r
c984ba1b 211</html>\r