actually delete old file
[KiwiIRC.git] / index.php
index 4e29af1841f7733305e86475248bb14c5806b583..1c42acd86443e82ef05b8220c4e9562b6c8e7c81 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,34 +1,36 @@
 <?php\r
 \r
-       switch(true){\r
-               case stripos($_SERVER['HTTP_USER_AGENT'], 'android') > 0:\r
-                       $agent = "android"; $touchscreen = true;\r
-                       break;\r
-                       \r
-               case stripos($_SERVER['HTTP_USER_AGENT'], 'iphone') > 0:\r
-                       $agent = "iphone"; $touchscreen = true;\r
-                       break;\r
-                       \r
-               case stripos($_SERVER['HTTP_USER_AGENT'], 'ipod') > 0:\r
-                       $agent = "ipod"; $touchscreen = true;\r
-                       break;\r
-                       \r
-               case stripos($_SERVER['HTTP_USER_AGENT'], 'ipad') > 0:\r
-                       $agent = "ipad"; $touchscreen = true;\r
-                       break;\r
-                       \r
-               default:\r
-                       $agent = "normal";\r
-                       $touchscreen = false;\r
-       }\r
-       \r
-       define("SERVER_SET", isset($_GET['server']));\r
-       $server = isset($_GET['server']) ? $_GET['server'] : "irc.anonnet.org";\r
-       $nick = isset($_GET['nick']) ? $_GET['nick'] : "";\r
-       // Channel is set via javascript using location.hash\r
-\r
-       $node_server = $_SERVER['HTTP_HOST'];\r
-       \r
+    $node_config = json_decode(file_get_contents("node/config.json"), true);\r
+\r
+    switch(true){\r
+        case stripos($_SERVER['HTTP_USER_AGENT'], 'android') > 0:\r
+            $agent = "android"; $touchscreen = true;\r
+            break;\r
+            \r
+        case stripos($_SERVER['HTTP_USER_AGENT'], 'iphone') > 0:\r
+            $agent = "iphone"; $touchscreen = true;\r
+            break;\r
+            \r
+        case stripos($_SERVER['HTTP_USER_AGENT'], 'ipod') > 0:\r
+            $agent = "ipod"; $touchscreen = true;\r
+            break;\r
+            \r
+        case stripos($_SERVER['HTTP_USER_AGENT'], 'ipad') > 0:\r
+            $agent = "ipad"; $touchscreen = true;\r
+            break;\r
+            \r
+        default:\r
+            $agent = "normal";\r
+            $touchscreen = false;\r
+    }\r
+    \r
+    define("SERVER_SET", isset($_GET['server']));\r
+    $server = isset($_GET['server']) ? $_GET['server'] : "irc.anonnet.org";\r
+    $nick = isset($_GET['nick']) ? $_GET['nick'] : "";\r
+    // Channel is set via javascript using location.hash\r
+\r
+    $node_server = $_SERVER['HTTP_HOST'];\r
+    \r
 ?>\r
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
 <html xmlns="http://www.w3.org/1999/xhtml">\r
 <?php } ?>\r
 \r
 <script src="http://<?php echo $node_server; ?>:7777/socket.io/socket.io.js"></script>\r
-<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>\r
+<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>\r
 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>\r
 <script type="text/javascript" src="js/jquery.json-2.2.min.js"></script>\r
 <script type="text/javascript" src="js/util.js"></script>\r
 <script type="text/javascript" src="js/gateway.js"></script>\r
 <script type="text/javascript" src="js/front.js"></script>\r
+<script type="text/javascript" src="js/iscroll.js"></script>\r
 \r
 <?php if(in_array($agent, array("android", "ipad", "iphone", "ipad"))){ ?>\r
 <script type="text/javascript" src="js/touchscreen_tweaks.js"></script>\r
 <?php } ?>\r
 \r
 <script type="text/javascript">\r
-       var agent = '<?php echo $agent; ?>';\r
-       var touchscreen = <?php echo ($touchscreen) ? 'true' : 'false'; ?>;\r
-       var init_data = {};\r
-       var kiwi_addr = 'wss://<?php echo $node_server; ?>:7777/';\r
-       \r
-       $(document).ready(function(){\r
-               if(touchscreen) $('#kiwi').addClass('touchscreen');\r
-               \r
-               //#nick@irc.anonnet.org:6679+/#channel,##channel,&channel\r
-               var chans = document.location.hash.match(/[#&]+[^ ,\007]+/g);\r
-               if(chans != null && chans.length > 0) {\r
-                       init_data.channel = chans.join(',');\r
-                       $('#channel').val(init_data.channel);\r
-               }\r
-               \r
-               front.init();\r
-               addEvents();\r
-               gateway.start(kiwi_addr);\r
-               \r
-               $('.nick').focus();\r
-       });\r
-       \r
-       \r
-       function addEvents(){\r
-               $('.more_link').click(function(){ $('.content.bottom').slideDown('fast'); $('.network').focus(); return false; });\r
-               $('.formconnectwindow').submit(function(){\r
-                       init_data.channel = $('#channel').val();\r
-                       return false;\r
-               });\r
-               $('a.connect').click(function(){ $('.formconnectwindow').submit(); return false; });\r
-       }\r
+    var agent = '<?php echo $agent; ?>';\r
+    var touchscreen = <?php echo ($touchscreen) ? 'true' : 'false'; ?>;\r
+    var init_data = {};\r
+    var kiwi_server = '<?php echo ($node_config['listen_ssl'] ? "https" : "http")."://".$node_server; ?>:7777/';\r
+    var touch_scroll;\r
+    \r
+    $(document).ready(function(){\r
+        manageDebug(false);\r
+\r
+        //#channel,##channel,&channel\r
+        var chans = document.location.hash.match(/[#&]+[^ ,\007]+/g);\r
+        if(chans != null && chans.length > 0) {\r
+            init_data.channel = chans.join(',');\r
+            $('#channel').val(init_data.channel);\r
+        }\r
+        \r
+        front.init();\r
+        gateway.start(kiwi_server);\r
+        \r
+        addEvents();\r
+        $('.nick').focus();\r
+    });\r
+    \r
+    \r
+    function addEvents(){\r
+        $('.more_link').click(function(){ $('.content.bottom').slideDown('fast'); $('.network').focus(); return false; });\r
+        $('.formconnectwindow').submit(function(){\r
+            init_data.channel = $('#channel').val();\r
+            return false;\r
+        });\r
+        $('a.connect').click(function(){ $('.formconnectwindow').submit(); return false; });\r
+    }\r
+</script>\r
+\r
+\r
+<script id="tmpl_about_box" type="text/x-jquery-tmpl">\r
+    <h2>Kiwi IRC</h2>\r
+    <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
+    <button class="about_close">Close</button>\r
+    <p class="info">${about}</p>\r
+    <p class="revisions">Front: ${front_revision}<br />Gateway: ${gateway_revision}</p>\r
+</script>\r
+\r
+<script id="tmpl_change_nick" type="text/x-jquery-tmpl">\r
+    <div class="newnick box">\r
+        Your new nick:<br />\r
+        <form class="form_newnick">\r
+            <input type="text" class="txtnewnick" /><br />\r
+            <button class="butnewnick" type="submit">Change</button> <a class="link cancelnewnick">Cancel</a>\r
+        </form>\r
+    </div>\r
+</script>\r
+\r
+\r
+<script id="tmpl_plugins" type="text/x-jquery-tmpl">\r
+    <div class="list">\r
+        <h2>Kiwi plugins</h2>\r
+        <p>\r
+            <select multiple="multiple" id="plugin_list">\r
+            </select>\r
+            <button id="plugins_list_unload">Unload</button>\r
+        </p>\r
+    </div>\r
+    <div class="load">\r
+        Plugin file URL:<br />\r
+        <form>\r
+            <input type="text" class="txtpluginfile" /><br />\r
+            <button class="butnewnick" type="submit">Load..</button> <a class="link cancelpluginfile">Cancel</a>\r
+        </form>\r
+    </div>\r
+</script>\r
+\r
+<script id="tmpl_user_box" type="text/x-jquery-tmpl">\r
+    <div class="userbox">\r
+        <input type="hidden" class="userbox_nick" value="${nick}" />\r
+        <a href="#" class="userbox_query">Message</a>\r
+        <a href="#" class="userbox_whois">Info</a>\r
+    </div>\r
 </script>\r
 \r
 </head>\r
 <body>\r
 \r
 <div id="kiwi">\r
-       <div class="connectwindow">\r
-               <h1 class="logo">Kiwi IRC</h1>\r
-               <div id="login">\r
-                       <form class="formconnectwindow">\r
-                               <div class="content top">\r
-                                       <ul>\r
-                                               <li><label for="nick">Your nickname:</label>\r
-                                                       <input type="text" id="nick" name="nick" class="nick" value="<?php echo htmlentities($nick); ?>" /></li>\r
-                                       </ul>\r
-                                       <a class="connect" href="">Connect..</a>\r
-                               </div>\r
-                               \r
-                               <div class="more" style="<?php if(SERVER_SET) echo "display:none;"; ?>">\r
-                                       <a href="" class="more_link">More</a>\r
-                                       <div class="content bottom">\r
-                                               <ul>\r
-                                                       <li><label for="network">Server:</label>\r
-                                                               <input type="text" id="network" name="network" class="network" value="<?php echo htmlentities($server); ?>" /></li>\r
-                                                       <li><label for="channel">Channel:</label>\r
-                                                               <input type="text" id="channel" name="channel" class="channel" value="#kiwiirc" /></li>\r
-                                               </ul>\r
-                                               <a class="connect" href="">Connect..</a>\r
-                                       </div>\r
-                               </div>\r
-                       </form>\r
-               </div>\r
-       </div>\r
-       \r
-       \r
-       \r
-       <div class="windowlist">\r
-               <div class="poweredby">Powered by Kiwi IRC</div>\r
-               <ul></ul>\r
-       </div>\r
-       \r
-       <div class="cur_topic"></div>\r
-       \r
-       <div class="userlist">\r
-               <ul></ul>\r
-       </div>\r
-       \r
-       <div class="control">\r
-               <div class="msginput">\r
-                       <div class="nick"><a href="#"></a>:</div>\r
-                       <input type="text" name="kiwi_msginput" id="kiwi_msginput" />\r
-               </div>\r
-               <div class="plugins">\r
-                       <ul>\r
-                               <!-- <li><a class="load_plugin_file">Plugins</a></li> -->\r
-                               <?php if(isset($_GET['debug'])){ ?>\r
-                               <li><a class="reload_css">Reload CSS</a></li>\r
-                               <?php } ?>\r
-                       </ul>\r
-               </div>\r
-       </div>\r
+    <div class="connectwindow">\r
+        <h1 class="logo">Kiwi IRC</h1>\r
+        <div id="login">\r
+            <form class="formconnectwindow">\r
+                <div class="content top">\r
+                    <ul>\r
+                        <li><label for="nick">Your nickname:</label>\r
+                            <input type="text" id="nick" name="nick" class="nick" placeholder="Your nick.." /></li>\r
+                    </ul>\r
+                    <a class="connect" href="">Connect..</a>\r
+                </div>\r
+                \r
+                <div class="more" style="<?php if(SERVER_SET) echo "display:none;"; ?>">\r
+                    <a href="" class="more_link">More</a>\r
+                    <div class="content bottom">\r
+                        <ul>\r
+                            <li><label for="network">Server:</label>\r
+                                <input type="text" id="network" name="network" class="network" value="<?php echo htmlentities($server); ?>" /></li>\r
+                            <li><label for="channel">Channel:</label>\r
+                                <input type="text" id="channel" name="channel" class="channel" value="#kiwiirc" /></li>\r
+                        </ul>\r
+                        <a class="connect" href="">Connect..</a>\r
+                    </div>\r
+                </div>\r
+            </form>\r
+        </div>\r
+    </div>\r
+    \r
+    \r
+    \r
+    <div class="windowlist">\r
+        <div class="poweredby">Powered by Kiwi IRC</div>\r
+        <ul></ul>\r
+    </div>\r
+    \r
+    <div class="cur_topic"></div>\r
+    \r
+    <div class="userlist">\r
+        <ul></ul>\r
+    </div>\r
+    \r
+    <div id="windows" class="windows"><div class="scroller" style="width:100%;"></div></div>\r
+\r
+    <div class="control">\r
+        <div class="msginput">\r
+            <div class="nick"><a href="#"></a>:</div>\r
+            <input type="text" name="kiwi_msginput" id="kiwi_msginput" />\r
+        </div>\r
+        <div class="plugins">\r
+            <ul>\r
+                <li><a class="load_plugin_file">Plugins</a></li>\r
+                <?php if(isset($_GET['debug'])){ ?>\r
+                <li><a class="reload_css">Reload CSS</a></li>\r
+                <?php } ?>\r
+            </ul>\r
+        </div>\r
+    </div>\r
 </div>\r
 \r
 </body>\r