diff --git a/Makefile b/Makefile
index 9072250..a14c98b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,14 @@
-all:
+ISSO = "isso/js"
+
+all: js
init:
- cd isso/js
- ender build jeesh
-
- git clone https://github.com/posativ/promisejs.git
- ender add promisejs
+ git clone https://github.com/posativ/promisejs.git $(ISSO)/promise.js
+ (cd $(ISSO) && ender build jeesh)
+ (cd $(ISSO) && ender add promise.js)
+ rm -rf $(ISSO)/promise.js
js:
- cat isso/js/ender.js isso/js/isso.js > _.js
- yuicompressor --type js --charset utf-8 _.js -o isso/js/embed.js
- rm _.js
+ cat $(ISSO)/ender.js $(ISSO)/isso.js $(ISSO)/utils.js > $(ISSO)/_.js
+ yuicompressor --type js --charset utf-8 $(ISSO)/_.js -o $(ISSO)/embed.js
+ rm $(ISSO)/_.js
diff --git a/isso/js/isso.js b/isso/js/isso.js
index d0e9bdb..87267c4 100644
--- a/isso/js/isso.js
+++ b/isso/js/isso.js
@@ -9,75 +9,10 @@
* with `isso`.
*/
-
-/* utility functions -- JS Y U SO STUPID?
- *
- * read(cookie): return `cookie` string if set
- * format(date): human-readable date formatting
- * brew(array): similar to DOMinate essentials
- */
-
// var prefix = "/comments";
var prefix = "";
-function read(cookie) {
- return (document.cookie.match('(^|; )' + cookie + '=([^;]*)') || 0)[2]
-};
-
-
-function format(date) {
- /*!
- * JavaScript Pretty Date
- * Copyright (c) 2011 John Resig (ejohn.org)
- * Licensed under the MIT and GPL licenses.
- */
- var diff = (((new Date()).getTime() - date.getTime()) / 1000),
- day_diff = Math.floor(diff / 86400);
-
- 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 < 7200 && "1 hour 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";
-}
-
-
-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'], ...])
- * --> Hello World Foo BarHello World
- */
-
- var rv = document.createElement(arr[0]);
-
- for (var i = 1; i < arr.length; i++) {
-
- if (arr[i] instanceof Array) {
- rv.appendChild(brew(arr[i]));
- } else if (typeof(arr[i]) == "string") {
- rv.appendChild(document.createTextNode(arr[i]));
- } else {
- attrs = arr[i] || {};
- for (var k in attrs) {
- if (!attrs.hasOwnProperty(k)) continue;
- rv.setAttribute(k, attrs[k]);
- }
- }
- };
-
- return rv;
-}
-
-
/*
* isso specific helpers to create, modify, delete and receive comments
*/
diff --git a/isso/js/utils.js b/isso/js/utils.js
new file mode 100644
index 0000000..b6cd21d
--- /dev/null
+++ b/isso/js/utils.js
@@ -0,0 +1,65 @@
+/* Copyright 2012, Martin Zimmermann . All rights reserved.
+ * License: BSD Style, 2 clauses. See isso/__init__.py.
+ *
+ * utility functions -- JS Y U SO STUPID?
+ *
+ * read(cookie): return `cookie` string if set
+ * format(date): human-readable date formatting
+ * brew(array): similar to DOMinate essentials
+ */
+
+ function read(cookie) {
+ return (document.cookie.match('(^|; )' + cookie + '=([^;]*)') || 0)[2]
+};
+
+
+function format(date) {
+ /*!
+ * JavaScript Pretty Date
+ * Copyright (c) 2011 John Resig (ejohn.org)
+ * Licensed under the MIT and GPL licenses.
+ */
+ var diff = (((new Date()).getTime() - date.getTime()) / 1000),
+ day_diff = Math.floor(diff / 86400);
+
+ 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 < 7200 && "1 hour 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";
+}
+
+
+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'], ...])
+ * --> Hello World Foo BarHello World
+ */
+
+ var rv = document.createElement(arr[0]);
+
+ for (var i = 1; i < arr.length; i++) {
+
+ if (arr[i] instanceof Array) {
+ rv.appendChild(brew(arr[i]));
+ } else if (typeof(arr[i]) == "string") {
+ rv.appendChild(document.createTextNode(arr[i]));
+ } else {
+ attrs = arr[i] || {};
+ for (var k in attrs) {
+ if (!attrs.hasOwnProperty(k)) continue;
+ rv.setAttribute(k, attrs[k]);
+ }
+ }
+ };
+
+ return rv;
+}
diff --git a/isso/static/post.html b/isso/static/post.html
index 27da167..612ce56 100644
--- a/isso/static/post.html
+++ b/isso/static/post.html
@@ -6,6 +6,7 @@
+