From fd8abd174e9323db57303510a2877af285283273 Mon Sep 17 00:00:00 2001 From: Evan Paul Fletcher Date: Thu, 7 Feb 2013 12:50:46 -0700 Subject: [PATCH 1/3] add build.py --- README.md | 2 +- build.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 build.py diff --git a/README.md b/README.md index fae2f704..10c1d23d 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ Please do! Hacking ------- -Execute `./build.rb` to effectively concatenate `main.js` with all the files in `code/`. It generates the user script which may be installed into your browser. +Execute `./build.rb` or `./build.py` to effectively concatenate `main.js` with all the files in `code/`. It generates the user script which may be installed into your browser. `style.css` contains most styles required for the user-script. The extra ones can be found in `code/boot.js#window.setupStyles`. Only CSS rules that depend on config variables should be defined there. diff --git a/build.py b/build.py new file mode 100644 index 00000000..2341eff2 --- /dev/null +++ b/build.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +import glob +import time + +def readfile(fn): + with open(fn, 'rb') as f: + return f.read() + +c = '\r\n\r\n'.join(map(readfile, glob.glob('code/*'))) +n = time.strftime('%Y-%m-%d-%H%M%S') +m = readfile('main.js').replace('@@BUILDDATE@@', n) +m = m.split('@@INJECTHERE@@') +m.insert(1, c) +t = '\r\n\r\n'.join(m) + +with open('total-conversion-build.user.js', 'wb') as f: + f.write(t) + +# vim: ai si ts=4 sw=4 sts=4 et From d73eebdd3265b139e0bff666eb277ba09a657fd0 Mon Sep 17 00:00:00 2001 From: Evan Paul Fletcher Date: Thu, 7 Feb 2013 20:17:13 -0700 Subject: [PATCH 2/3] fix for line endings --- build.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.py b/build.py index 2341eff2..b690a2ed 100644 --- a/build.py +++ b/build.py @@ -4,17 +4,17 @@ import glob import time def readfile(fn): - with open(fn, 'rb') as f: + with open(fn, 'Ur') as f: return f.read() -c = '\r\n\r\n'.join(map(readfile, glob.glob('code/*'))) +c = '\n\n'.join(map(readfile, glob.glob('code/*'))) n = time.strftime('%Y-%m-%d-%H%M%S') m = readfile('main.js').replace('@@BUILDDATE@@', n) m = m.split('@@INJECTHERE@@') m.insert(1, c) -t = '\r\n\r\n'.join(m) +t = '\n\n'.join(m) -with open('total-conversion-build.user.js', 'wb') as f: +with open('total-conversion-build.user.js', 'w') as f: f.write(t) # vim: ai si ts=4 sw=4 sts=4 et From d4a781d4dcc8d9d769d1ebc3b7fa22164febc8e1 Mon Sep 17 00:00:00 2001 From: Xelio Date: Fri, 8 Feb 2013 13:50:06 +0800 Subject: [PATCH 3/3] Fixing bug in window.chat.setupTime Problem: "#chatinput time" use "toLocaleTimeString().slice(0, 5)" to get time, but hh:mm not always at 0-5 in all locale Fix: Use "toISOString().slice(11, 16)" to get time for "#chatinput time" --- code/chat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/chat.js b/code/chat.js index e1c52da5..46b4db11 100644 --- a/code/chat.js +++ b/code/chat.js @@ -616,7 +616,7 @@ window.chat.setupTime = function() { var updateTime = function() { if(window.isIdle()) return; var d = new Date(); - inputTime.text(d.toLocaleTimeString().slice(0, 5)); + inputTime.text(d.toISOString().slice(11, 16)); // update ON the minute (1ms after) setTimeout(updateTime, (60 - d.getSeconds()) * 1000 + 1); };