diff --git a/Makefile b/Makefile
index 3c6fb5c..45797f2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
all:
init:
- (cd isso/js && ender build jeesh reqwest)
+ (cd isso/js && ender build jeesh)
js:
cat isso/js/ender.js isso/js/isso.js > _.js
diff --git a/isso/__init__.py b/isso/__init__.py
index 1dafd73..ba64e07 100644
--- a/isso/__init__.py
+++ b/isso/__init__.py
@@ -26,10 +26,10 @@ import sys; reload(sys)
sys.setdefaultencoding('utf-8') # we only support UTF-8 and python 2.X :-)
import io
+import os
import json
import traceback
-from os.path import dirname
from optparse import OptionParser, make_option, SUPPRESS_HELP
from itsdangerous import URLSafeTimedSerializer
@@ -117,9 +117,13 @@ class Isso(object):
if code == 404:
try:
- code, body, headers = wsgi.sendfile(environ['PATH_INFO'], dirname(__file__))
+ code, body, headers = wsgi.sendfile(environ['PATH_INFO'], os.getcwd())
except (IOError, OSError):
- pass
+ try:
+ path = environ['PATH_INFO'].rstrip('/') + '/index.html'
+ code, body, headers = wsgi.sendfile(path, os.getcwd())
+ except (IOError, OSError):
+ pass
if request == 'HEAD':
body = ''
diff --git a/isso/js/isso.js b/isso/js/isso.js
index cfea3ae..d0e9bdb 100644
--- a/isso/js/isso.js
+++ b/isso/js/isso.js
@@ -12,20 +12,21 @@
/* utility functions -- JS Y U SO STUPID?
*
- * read(cookie): return `cookie` string if set
- * zfill(argument, i): zero fill `argument` with `i` zeros
+ * read(cookie): return `cookie` string if set
+ * format(date): human-readable date formatting
+ * brew(array): similar to DOMinate essentials
*/
- // var prefix = "/comments";
- var prefix = "";
+// var prefix = "/comments";
+var prefix = "";
-function read(cookie){
- return(document.cookie.match('(^|; )' + cookie + '=([^;]*)') || 0)[2]
+function read(cookie) {
+ return (document.cookie.match('(^|; )' + cookie + '=([^;]*)') || 0)[2]
};
-function format(date){
+function format(date) {
/*!
* JavaScript Pretty Date
* Copyright (c) 2011 John Resig (ejohn.org)
@@ -34,20 +35,49 @@ function format(date){
var diff = (((new Date()).getTime() - date.getTime()) / 1000),
day_diff = Math.floor(diff / 86400);
- if ( isNaN(day_diff) || day_diff < 0 || day_diff >= 31 )
+ if (isNaN(day_diff) || day_diff < 0 || day_diff >= 31)
return;
return day_diff == 0 && (
diff < 60 && "just now" ||
diff < 120 && "1 minute ago" ||
- diff < 3600 && Math.floor( diff / 60 ) + " minutes ago" ||
+ diff < 3600 && Math.floor(diff / 60) + " minutes ago" ||
diff < 7200 && "1 hour ago" ||
- diff < 86400 && Math.floor( diff / 3600 ) + " hours ago") ||
+ diff < 86400 && Math.floor(diff / 3600) + " hours ago") ||
day_diff == 1 && "Yesterday" ||
day_diff < 7 && day_diff + " days ago" ||
- day_diff < 31 && Math.ceil( day_diff / 7 ) + " weeks ago";
+ day_diff < 31 && Math.ceil(day_diff / 7) + " weeks ago";
}
+
+function brew(arr) {
+ /*
+ * Element creation utility. Similar to DOMinate, but with a slightly different syntax:
+ * brew([TAG, {any: attribute, ...}, 'Hello World', ' Foo Bar', ['TAG', 'Hello World'], ...])
+ * -->