Skip to content

Commit

Permalink
Restructured repo file layout. Added build script with Javascript min…
Browse files Browse the repository at this point in the history
…ification.

Minification reduces Chatmore js files from 147KiB to 57KiB.  Gzip brings it to 13KiB.
Build script located in scripts dir.
  • Loading branch information
Shawn Poulson committed Mar 14, 2012
1 parent aa07ea8 commit 3e11aab
Show file tree
Hide file tree
Showing 49 changed files with 63 additions and 35 deletions.
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
tmp/*.db
tmp/*.log
tmp/*.sock
build/*
src/obj/*
src/tmp/*.db
src/tmp/*.log
src/tmp/*.sock
39 changes: 11 additions & 28 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
Chatmore web-based IRC client
=============================

Release 2012-02-21
Release 2012-03-14
Github repo: https://github.com/spoulson/Chatmore
Shawn Poulson, http://explodingcoder.com

INTRODUCTION
------------

### What does Chatmore do?
- Chatmore implements the IRC client protocol (RFC 2812) in order to chat in realtime on IRC chat networks.
- Enables web-based IRC access where installation of a native client is prohibited or inconvenient.
- User interface is focused on simplistic and functional for ease of use.

### What *doesn't* Chatmore do?
- Chatmore doesn't make IRC connections from the browser PC. It only talks over HTTP(S) to the hosting web server. The web server maintains the IRC connection.
- There are no tabs or multiple chat windows. All activity is in one view.
- Chatmore doesn't do everything because it's not finished. It is under heavy development, so is currently considered alpha grade software.

### Why use Chatmore?
- No end-user client installation.
- No end-user client installation. Minimal server requirements.
- Chatmore aims to be a better web IRC client. At the time of writing, there are few alternatives for self-hosting web-based IRC clients.
- You want to access IRC networks from anywhere there's a web browser, such as an Internet cafe, while using a computer that you don't own, etc.

Expand All @@ -26,64 +27,46 @@ INTRODUCTION

SYSTEM REQUIREMENTS
-------------------

### Server
- PHP 5.2+.
- Linux/Unix OS. Windows is not supported.
- Tested on Debian Linux 3.1, Apache 2.2, PHP 5.2.17

### Client
- Browser supporting HTML5.
- Tested on browsers on Windows: Chrome 13+, Firefox 5+, IE9, Safari 5.1.
- Tested on browsers on Mac OS X Lion: Chrome 17, Firefox 9, Safari 5.1.
- Tested browsers on Windows: Chrome 13+, Firefox 5+, IE9, Safari 5.1.
- Tested browsers on Mac OS X: Chrome 17+, Firefox 9+, Safari 5.1.

INSTALLATION
------------

- Copy all files to a web hosted directory.
- Customize settings in config.php.
- In a browser, access the directory's associated URL.

USER ACCESS
-----------
### In a browser, access the directory's associated URL.
### In a browser, access the hosted URL.
Assuming the installed virtual directory is /chatmore.

Chatmore accepts access URLs in formats:

http://server/chatmore/
Startup with defaults.
View landing page, prompting for connection details.

http://server/chatmore/client.php?server=irc.example.com
http://server/chatmore/client.php?server=irc.example.com&nick=yournick
http://server/chatmore/client.php?server=irc.example.com&nick=yournick#channel
http://server/chatmore/client.php?server=irc.example.com&nick=yournick#channel,#channel2
http://server/chatmore/client.php?server=irc.example.com&nick=yournick#channel,#channel2
http://server/chatmore/client.php?server=irc.example.com&port=6667&nick=yournick&realname=yourname#channel

Connect to IRC server name.
If nick is omitted, use randomly generated nick.
If #channel is provided, join the channel(s) automatically.

### Alternatively, user friendly URLs:
http://server/irc.example.com
http://server/irc.example.com/yournick
http://server/irc.example.com/yournick#channel

To implement, update .htaccess in parent directory:
Assuming /chatmore is the chat client virtual directory, append /.htaccess with:

RewriteEngine On
# Do not rewrite legit URLs to files.
RewriteRule \.(html|php|js|css)$ - [L]
# http://server/<IRC server>
RewriteRule ^/?([^/]*\.[^/]*)/?(#.+)?$ /chatmore/client.php?server=$1$2
# http://server/<IRC server>/<nick>
RewriteRule ^/?([^/]*\.[^/]*)/([^/]+)[^#]*(#.+)?$ /chatmore/client.php?server=$1&nick=$2$3

KNOWN ISSUES
------------
- UI not compatible with Mobile Safari on iOS.

LICENSING
---------

Unless otherwise attributed, these works are licensed under the Creative Commons Attribution license:
http://creativecommons.org/licenses/by/3.0/legalcode.
22 changes: 22 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

pushd `dirname $0`

BUILD_DIR=../build
SRC_DIR=../src
OBJ_DIR=$SRC_DIR/obj

# Clean build dir.
if [ ! -d $BUILD_DIR ]; then mkdir $BUILD_DIR; fi
rm -rf $BUILD_DIR/*

# Minify javascript.
./minify.sh

# Copy src files.
rsync -av $SRC_DIR/* $BUILD_DIR --exclude=chatmore*.js --exclude=obj

# Copy minified output.
cp -a $OBJ_DIR/chatmoreAll.min.js $BUILD_DIR

popd
20 changes: 20 additions & 0 deletions scripts/minify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

pushd `dirname $0`

TOOLS_DIR=../tools
SRC_DIR=../src
OBJ_DIR=$SRC_DIR/obj

if [ ! -f $OBJ_DIR ]; then mkdir $OBJ_DIR; fi

# Minify each Chatmore component.
java -jar $TOOLS_DIR/yuicompressor-2.4.7.jar --type js --charset UTF-8 -v $SRC_DIR/chatmoreState.js > $OBJ_DIR/chatmoreState.min.js
java -jar $TOOLS_DIR/yuicompressor-2.4.7.jar --type js --charset UTF-8 -v $SRC_DIR/chatmore.js > $OBJ_DIR/chatmore.min.js
java -jar $TOOLS_DIR/yuicompressor-2.4.7.jar --type js --charset UTF-8 -v $SRC_DIR/chatmoreUI.js > $OBJ_DIR/chatmoreUI.min.js
java -jar $TOOLS_DIR/yuicompressor-2.4.7.jar --type js --charset UTF-8 -v $SRC_DIR/chatmoreUI.fullpage.js > $OBJ_DIR/chatmoreUI.fullpage.min.js

# Combine all Chatmore scripts into chatmoreAll.min.js.
cat $OBJ_DIR/chatmoreState.min.js $OBJ_DIR/chatmore.min.js $OBJ_DIR/chatmoreUI.min.js $OBJ_DIR/chatmoreUI.fullpage.min.js > $OBJ_DIR/chatmoreAll.min.js

popd
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion chatmoreUI.fullpage.js → src/chatmoreUI.fullpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,5 +784,5 @@
};

// Register layout.
$.chatmore('layouts').default = layout;
$.chatmore('layouts')['default'] = layout;
})();
2 changes: 1 addition & 1 deletion chatmoreUI.js → src/chatmoreUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
var getLayoutPlugin = function () {
if (options.layout === undefined) {
if ('default' in layouts) {
return layouts.default;
return layouts['default'];
}
else {
for (var name in layouts) {
Expand Down
5 changes: 3 additions & 2 deletions client.php → src/client.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ function redirectNewViewKey() {
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.16.min.js"></script>
<script type="text/javascript" src="jquery.tmpl.min.js"></script>
<script type="text/javascript" src="chatmoreState.js"></script>
<!--<script type="text/javascript" src="chatmoreState.js"></script>
<script type="text/javascript" src="chatmore.js"></script>
<script type="text/javascript" src="chatmoreUI.js"></script>
<script type="text/javascript" src="chatmoreUI.fullpage.js"></script>
<script type="text/javascript" src="chatmoreUI.fullpage.js"></script>-->
<script type="text/javascript" src="chatmoreAll.min.js"></script>
<script type="text/javascript" src="config.js"></script>
<script type="text/javascript">
$(function () {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added tools/yuicompressor-2.4.7.jar
Binary file not shown.

0 comments on commit 3e11aab

Please sign in to comment.