Initial node code.
[KiwiIRC.git] / index.php
1 <?php
2
3 switch(true){
4 case stripos($_SERVER['HTTP_USER_AGENT'], 'android') > 0:
5 $agent = "android"; $touchscreen = true;
6 break;
7
8 case stripos($_SERVER['HTTP_USER_AGENT'], 'iphone') > 0:
9 $agent = "iphone"; $touchscreen = true;
10 break;
11
12 case stripos($_SERVER['HTTP_USER_AGENT'], 'ipod') > 0:
13 $agent = "ipod"; $touchscreen = true;
14 break;
15
16 case stripos($_SERVER['HTTP_USER_AGENT'], 'ipad') > 0:
17 $agent = "ipad"; $touchscreen = true;
18 break;
19
20 default:
21 $agent = "normal";
22 $touchscreen = false;
23 }
24
25 define("SERVER_SET", isset($_GET['server']));
26 $server = isset($_GET['server']) ? $_GET['server'] : "irc.anonnet.org";
27 $nick = isset($_GET['nick']) ? $_GET['nick'] : "";
28 // Channel is set via javascript using location.hash
29
30 ?>
31 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
32 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head>
34 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
35
36 <?php if(in_array($agent, array("android", "ipad", "iphone", "ipad"))){ ?>
37 <meta name="viewport" content="width=device-width,user-scalable=no" />
38 <?php } ?>
39
40 <title>Kiwi IRC</title>
41 <link rel="stylesheet" type="text/css" href="css/default.css">
42 <link rel="stylesheet" type="text/css" href="css/ui.css">
43
44 <?php if($touchscreen){ ?>
45 <link rel="stylesheet" type="text/css" href="css/touchscreen_tweaks.css">
46 <?php } ?>
47
48
49 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
50 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
51 <script type="text/javascript" src="js/jquery.json-2.2.min.js"></script>
52 <script type="text/javascript" src="js/util.js"></script>
53 <script type="text/javascript" src="js/gateway.js"></script>
54 <script type="text/javascript" src="js/front.js"></script>
55
56 <?php if(in_array($agent, array("android", "ipad", "iphone", "ipad"))){ ?>
57 <script type="text/javascript" src="js/touchscreen_tweaks.js"></script>
58 <?php } ?>
59
60 <script type="text/javascript">
61 var agent = '<?= $agent ?>';
62 var touchscreen = <?= ($touchscreen) ? 'true' : 'false' ?>;
63 var init_data = {};
64
65 $(document).ready(function(){
66 if(touchscreen) $('#kiwi').addClass('touchscreen');
67
68 //#nick@irc.anonnet.org:6679+/#channel,##channel,&channel
69 var chans = document.location.hash.match(/[#&]+[^ ,\007]+/g);
70 if(chans != null && chans.length > 0) {
71 init_data.channel = chans.join(',');
72 $('#channel').val(init_data.channel);
73 }
74
75 front.init();
76
77 addEvents();
78 $('.nick').focus();
79 });
80
81
82 function addEvents(){
83 $('.more_link').click(function(){ $('.content.bottom').slideDown('fast'); $('.network').focus(); return false; });
84 $('.formconnectwindow').submit(function(){
85 init_data.channel = $('#channel').val();
86 return false;
87 });
88 $('a.connect').click(function(){ $('.formconnectwindow').submit(); return false; });
89 }
90 </script>
91
92 </head>
93
94 <body>
95
96 <div id="kiwi">
97 <div class="connectwindow">
98 <h1 class="logo">Kiwi IRC</h1>
99 <div id="login">
100 <form class="formconnectwindow">
101 <div class="content top">
102 <ul>
103 <li><label for="nick">Your nickname:</label>
104 <input type="text" id="nick" name="nick" class="nick" value="<?php echo htmlentities($nick); ?>" /></li>
105 </ul>
106 <a class="connect" href="">Connect..</a>
107 </div>
108
109 <div class="more" style="<?php if(SERVER_SET) echo "display:none;"; ?>">
110 <a href="" class="more_link">More</a>
111 <div class="content bottom">
112 <ul>
113 <li><label for="network">Server:</label>
114 <input type="text" id="network" name="network" class="network" value="<?php echo htmlentities($server); ?>" /></li>
115 <li><label for="channel">Channel:</label>
116 <input type="text" id="channel" name="channel" class="channel" value="#kiwiirc" /></li>
117 </ul>
118 <a class="connect" href="">Connect..</a>
119 </div>
120 </div>
121 </form>
122 </div>
123 </div>
124
125
126
127 <div class="windowlist">
128 <div class="poweredby">Powered by Kiwi IRC</div>
129 <ul></ul>
130 </div>
131
132 <div class="cur_topic"></div>
133
134 <div class="userlist">
135 <ul></ul>
136 </div>
137
138 <div class="control">
139 <div class="msginput">
140 <div class="nick"><a href="#"></a>:</div>
141 <input type="text" name="kiwi_msginput" id="kiwi_msginput" />
142 </div>
143 <div class="plugins">
144 <ul>
145 <!-- <li><a class="load_plugin_file">Plugins</a></li> -->
146 <?php if(isset($_GET['debug'])){ ?>
147 <li><a class="reload_css">Reload CSS</a></li>
148 <?php } ?>
149 </ul>
150 </div>
151 </div>
152 </div>
153
154 </body>
155 </html>