+++ /dev/null
-<?php\r
-\r
- function auto_load($class){\r
- try {\r
- $file = str_replace('_', '/', strtolower($class));\r
- $path = 'libs/'.$file.'.php';\r
-\r
- if (file_exists($path)){\r
- require $path;\r
- return true;\r
- }\r
-\r
- return false;\r
- }catch (Exception $e){\r
- // Err...\r
- }\r
- }\r
- spl_autoload_register('auto_load');\r
-\r
-\r
-\r
- define('CACHE_DIR', './cache/');\r
-\r
- function cacheReadfile($file){\r
- if(file_exists(CACHE_DIR.$file)){\r
- readfile(CACHE_DIR.$file);\r
- exit;\r
- }\r
- }\r
-\r
- function writeToCache($file, $data){\r
- file_put_contents(CACHE_DIR.$file, $data);\r
- }\r
-\r
-\r
-\r
- if(isset($_GET['js'])){\r
- $files = explode(',', $_GET['js']);\r
- arsort($files);\r
-\r
- $cache_filename = 'js';\r
- foreach($files as $file) $cache_filename .= '_'.$file;\r
- cacheReadfile($cache_filename);\r
-\r
- $js = '';\r
- foreach($files as $file){\r
- $js .= JSMin::minify(file_get_contents("js/$file.js"));\r
- }\r
- //writeToCache($cache_filename, $js);\r
- echo $js;\r
- }\r
-\r
-
\ No newline at end of file
+++ /dev/null
-<?php\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>\r
-<html xmlns="http://www.w3.org/1999/xhtml">\r
-<head>\r
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\r
-\r
-<?php if(in_array($agent, array("android", "ipad", "iphone", "ipad"))){ ?>\r
-<meta name="viewport" content="width=device-width,user-scalable=no" />\r
-<?php } ?>\r
-\r
-<title>Kiwi IRC</title>\r
-<link rel="stylesheet" type="text/css" href="css/default.css">\r
-<link rel="stylesheet" type="text/css" href="css/ui.css">\r
-\r
-<?php if($touchscreen){ ?>\r
-<link rel="stylesheet" type="text/css" href="css/touchscreen_tweaks.css">\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.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_server = '<?php echo ($node_config['listen_ssl'] ? "https" : "http")."://".$node_server; ?>:7777/kiwi';\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
- $('#kiwi .more_link').click(function(){ $('.content.bottom').slideDown('fast'); $('.network').focus(); return false; });\r
- $('#kiwi .formconnectwindow').submit(function(){\r
- init_data.channel = $('#channel').val();\r
- return false;\r
- });\r
- $('#kiwi a.connect').click(function(){ $('.formconnectwindow').submit(); return false; });\r
- $('#kiwi .messages a.chan').live('click', function() {\r
- front.joinChannel($(this).text());\r
- return false;\r
- });\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
-\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" 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">\r
- <!--\r
- <ul class="edit" style="float:right;">\r
- <li>\r
- <img src="img/more.png" />\r
- <ul id="kiwi_menu">\r
- <li>Item 1</li>\r
- <li>Item 2</li>\r
- <li>Item 3</li>\r
- </ul>\r
- </li>\r
- </ul>\r
- -->\r
- <div class="topic" style="margin-right:5em; overflow:hidden; white-space: pre-wrap; word-wrap: break-word;"></div>\r
- </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
-</html>\r
+++ /dev/null
-<?php
-/**
- * jsmin.php - PHP implementation of Douglas Crockford's JSMin.
- *
- * This is pretty much a direct port of jsmin.c to PHP with just a few
- * PHP-specific performance tweaks. Also, whereas jsmin.c reads from stdin and
- * outputs to stdout, this library accepts a string as input and returns another
- * string as output.
- *
- * PHP 5 or higher is required.
- *
- * Permission is hereby granted to use this version of the library under the
- * same terms as jsmin.c, which has the following license:
- *
- * --
- * Copyright (c) 2002 Douglas Crockford (www.crockford.com)
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is furnished to do
- * so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * The Software shall be used for Good, not Evil.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- * --
- *
- * @package JSMin
- * @author Ryan Grove <ryan@wonko.com>
- * @copyright 2002 Douglas Crockford <douglas@crockford.com> (jsmin.c)
- * @copyright 2008 Ryan Grove <ryan@wonko.com> (PHP port)
- * @license http://opensource.org/licenses/mit-license.php MIT License
- * @version 1.1.1 (2008-03-02)
- * @link https://github.com/rgrove/jsmin-php/
- */
-
-class JSMin {
- const ORD_LF = 10;
- const ORD_SPACE = 32;
- const ACTION_KEEP_A = 1;
- const ACTION_DELETE_A = 2;
- const ACTION_DELETE_A_B = 3;
-
- protected $a = '';
- protected $b = '';
- protected $input = '';
- protected $inputIndex = 0;
- protected $inputLength = 0;
- protected $lookAhead = null;
- protected $output = '';
-
- // -- Public Static Methods --------------------------------------------------
-
- /**
- * Minify Javascript
- *
- * @uses __construct()
- * @uses min()
- * @param string $js Javascript to be minified
- * @return string
- */
- public static function minify($js) {
- $jsmin = new JSMin($js);
- return $jsmin->min();
- }
-
- // -- Public Instance Methods ------------------------------------------------
-
- /**
- * Constructor
- *
- * @param string $input Javascript to be minified
- */
- public function __construct($input) {
- $this->input = str_replace("\r\n", "\n", $input);
- $this->inputLength = strlen($this->input);
- }
-
- // -- Protected Instance Methods ---------------------------------------------
-
- /**
- * Action -- do something! What to do is determined by the $command argument.
- *
- * action treats a string as a single character. Wow!
- * action recognizes a regular expression if it is preceded by ( or , or =.
- *
- * @uses next()
- * @uses get()
- * @throws JSMinException If parser errors are found:
- * - Unterminated string literal
- * - Unterminated regular expression set in regex literal
- * - Unterminated regular expression literal
- * @param int $command One of class constants:
- * ACTION_KEEP_A Output A. Copy B to A. Get the next B.
- * ACTION_DELETE_A Copy B to A. Get the next B. (Delete A).
- * ACTION_DELETE_A_B Get the next B. (Delete B).
- */
- protected function action($command) {
- switch($command) {
- case self::ACTION_KEEP_A:
- $this->output .= $this->a;
-
- case self::ACTION_DELETE_A:
- $this->a = $this->b;
-
- if ($this->a === "'" || $this->a === '"') {
- for (;;) {
- $this->output .= $this->a;
- $this->a = $this->get();
-
- if ($this->a === $this->b) {
- break;
- }
-
- if (ord($this->a) <= self::ORD_LF) {
- throw new JSMinException('Unterminated string literal.');
- }
-
- if ($this->a === '\\') {
- $this->output .= $this->a;
- $this->a = $this->get();
- }
- }
- }
-
- case self::ACTION_DELETE_A_B:
- $this->b = $this->next();
-
- if ($this->b === '/' && (
- $this->a === '(' || $this->a === ',' || $this->a === '=' ||
- $this->a === ':' || $this->a === '[' || $this->a === '!' ||
- $this->a === '&' || $this->a === '|' || $this->a === '?' ||
- $this->a === '{' || $this->a === '}' || $this->a === ';' ||
- $this->a === "\n" )) {
-
- $this->output .= $this->a . $this->b;
-
- for (;;) {
- $this->a = $this->get();
-
- if ($this->a === '[') {
- /*
- inside a regex [...] set, which MAY contain a '/' itself. Example: mootools Form.Validator near line 460:
- return Form.Validator.getValidator('IsEmpty').test(element) || (/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]\.?){0,63}[a-z0-9!#$%&'*+/=?^_`{|}~-]@(?:(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])$/i).test(element.get('value'));
- */
- for (;;) {
- $this->output .= $this->a;
- $this->a = $this->get();
-
- if ($this->a === ']') {
- break;
- } elseif ($this->a === '\\') {
- $this->output .= $this->a;
- $this->a = $this->get();
- } elseif (ord($this->a) <= self::ORD_LF) {
- throw new JSMinException('Unterminated regular expression set in regex literal.');
- }
- }
- } elseif ($this->a === '/') {
- break;
- } elseif ($this->a === '\\') {
- $this->output .= $this->a;
- $this->a = $this->get();
- } elseif (ord($this->a) <= self::ORD_LF) {
- throw new JSMinException('Unterminated regular expression literal.');
- }
-
- $this->output .= $this->a;
- }
-
- $this->b = $this->next();
- }
- }
- }
-
- /**
- * Get next char. Convert ctrl char to space.
- *
- * @return string|null
- */
- protected function get() {
- $c = $this->lookAhead;
- $this->lookAhead = null;
-
- if ($c === null) {
- if ($this->inputIndex < $this->inputLength) {
- $c = substr($this->input, $this->inputIndex, 1);
- $this->inputIndex += 1;
- } else {
- $c = null;
- }
- }
-
- if ($c === "\r") {
- return "\n";
- }
-
- if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) {
- return $c;
- }
-
- return ' ';
- }
-
- /**
- * Is $c a letter, digit, underscore, dollar sign, or non-ASCII character.
- *
- * @return bool
- */
- protected function isAlphaNum($c) {
- return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1;
- }
-
- /**
- * Perform minification, return result
- *
- * @uses action()
- * @uses isAlphaNum()
- * @return string
- */
- protected function min() {
- $this->a = "\n";
- $this->action(self::ACTION_DELETE_A_B);
-
- while ($this->a !== null) {
- switch ($this->a) {
- case ' ':
- if ($this->isAlphaNum($this->b)) {
- $this->action(self::ACTION_KEEP_A);
- } else {
- $this->action(self::ACTION_DELETE_A);
- }
- break;
-
- case "\n":
- switch ($this->b) {
- case '{':
- case '[':
- case '(':
- case '+':
- case '-':
- $this->action(self::ACTION_KEEP_A);
- break;
-
- case ' ':
- $this->action(self::ACTION_DELETE_A_B);
- break;
-
- default:
- if ($this->isAlphaNum($this->b)) {
- $this->action(self::ACTION_KEEP_A);
- }
- else {
- $this->action(self::ACTION_DELETE_A);
- }
- }
- break;
-
- default:
- switch ($this->b) {
- case ' ':
- if ($this->isAlphaNum($this->a)) {
- $this->action(self::ACTION_KEEP_A);
- break;
- }
-
- $this->action(self::ACTION_DELETE_A_B);
- break;
-
- case "\n":
- switch ($this->a) {
- case '}':
- case ']':
- case ')':
- case '+':
- case '-':
- case '"':
- case "'":
- $this->action(self::ACTION_KEEP_A);
- break;
-
- default:
- if ($this->isAlphaNum($this->a)) {
- $this->action(self::ACTION_KEEP_A);
- }
- else {
- $this->action(self::ACTION_DELETE_A_B);
- }
- }
- break;
-
- default:
- $this->action(self::ACTION_KEEP_A);
- break;
- }
- }
- }
-
- return $this->output;
- }
-
- /**
- * Get the next character, skipping over comments. peek() is used to see
- * if a '/' is followed by a '/' or '*'.
- *
- * @uses get()
- * @uses peek()
- * @throws JSMinException On unterminated comment.
- * @return string
- */
- protected function next() {
- $c = $this->get();
-
- if ($c === '/') {
- switch($this->peek()) {
- case '/':
- for (;;) {
- $c = $this->get();
-
- if (ord($c) <= self::ORD_LF) {
- return $c;
- }
- }
-
- case '*':
- $this->get();
-
- for (;;) {
- switch($this->get()) {
- case '*':
- if ($this->peek() === '/') {
- $this->get();
- return ' ';
- }
- break;
-
- case null:
- throw new JSMinException('Unterminated comment.');
- }
- }
-
- default:
- return $c;
- }
- }
-
- return $c;
- }
-
- /**
- * Get next char. If is ctrl character, translate to a space or newline.
- *
- * @uses get()
- * @return string|null
- */
- protected function peek() {
- $this->lookAhead = $this->get();
- return $this->lookAhead;
- }
-}
-
-// -- Exceptions ---------------------------------------------------------------
-class JSMinException extends Exception {}
-?>
\ No newline at end of file
+++ /dev/null
-<?php\r
- \r
- require("plugin.php");\r
- $p = new Plugin();\r
- $p->name = "Console Logger";\r
-\r
- $p->onprivmsg = <<<JS\r
-function(inp, tabview){\r
- console.log("> "+tabview+": "+inp);\r
-}\r
-JS;\r
-\r
- echo $p->export();
\ No newline at end of file
+++ /dev/null
-<?php\r
-\r
- require("plugin.php");\r
- $p = new Plugin();\r
- $p->name = "Dev Tools";\r
- \r
- $p->onload = <<<JS\r
-function(){\r
- $('#kiwi .plugins ul').append('<li><a id="dev_tools_open">Dev Tools</a></li>');\r
- $('#dev_tools_open').click(function(){ alert("Opening Dev Tools window"); });\r
-}\r
-JS;\r
-\r
- $p->onunload = <<<JS\r
-function(){ alert('unloading dev tools'); $('#dev_tools_open').remove(); }\r
-JS;\r
-\r
- echo $p->export();
\ No newline at end of file
+++ /dev/null
-<?php\r
- \r
- class Plugin {\r
- var $name = "Kiwi Plugin";\r
- var $onload = "function(){}";\r
- var $onunload = "function(){}";\r
- var $onprivmsg = "function(inp, tabview){}";\r
- \r
- public function export(){\r
- //header("Content-Type: application/json");\r
- return json_encode(array(\r
- 'name'=>$this->name,\r
- 'onprivmsg'=>$this->onprivmsg,\r
- 'onload'=>$this->onload,\r
- 'onunload'=>$this->onunload\r
- ));\r
- }\r
- }
\ No newline at end of file