diff --git a/4chan_x.user.js b/4chan_x.user.js
index a39a247b9..229e8a443 100644
--- a/4chan_x.user.js
+++ b/4chan_x.user.js
@@ -958,7 +958,7 @@
var arr, checked, description, dialog, hiddenNum, hiddenThreads, html, input, key, li, main, obj, ul, _i, _len, _ref, _ref2;
hiddenThreads = $.getValue("hiddenThreads/" + g.BOARD + "/", {});
hiddenNum = Object.keys(g.hiddenReplies).length + Object.keys(hiddenThreads).length;
- html = "
";
+ html = "
";
dialog = ui.dialog('options', {
top: '25%',
left: '25%'
@@ -990,7 +990,9 @@
$.bind($('a[name=flavors]', dialog), 'click', options.flavors);
$.bind($('a[name=time]', dialog), 'click', options.time);
$.bind($('textarea[name=flavors]', dialog), 'change', $.cb.value);
- return $.append(d.body, dialog);
+ $.bind($('input[name=time]', dialog), 'keyup', options.cb.time);
+ $.append(d.body, dialog);
+ return options.cb.time.call($('input[name=time]', dialog));
},
flavors: function() {
var ta;
@@ -1016,6 +1018,12 @@
$.deleteValue("hiddenThreads/" + g.BOARD + "/");
this.value = "hidden: 0";
return g.hiddenReplies = {};
+ },
+ time: function(e) {
+ $.setValue('time', this.value);
+ time.foo();
+ time.date = new Date();
+ return $('#timePreview').textContent = time.funk(time);
}
}
};
@@ -1670,6 +1678,25 @@
};
time = {
init: function() {
+ time.foo();
+ return g.callbacks.push(function(root) {
+ var day, hour, min, month, s, timeEl, year, _, _ref;
+ if (root.className === 'inline') {
+ return;
+ }
+ s = $('span[id^=no]', root).previousSibling;
+ _ref = s.textContent.match(/(\d+)\/(\d+)\/(\d+)\(\w+\)(\d+):(\d+)/), _ = _ref[0], month = _ref[1], day = _ref[2], year = _ref[3], hour = _ref[4], min = _ref[5];
+ year = "20" + year;
+ month -= 1;
+ hour = g.chanOffset + Number(hour);
+ time.date = new Date(year, month, day, hour, min);
+ timeEl = $.el('time', {
+ textContent: ' ' + time.funk(time) + ' '
+ });
+ return $.replace(s, timeEl);
+ });
+ },
+ foo: function() {
var code;
code = $.config('time').replace(/%(.)/g, function(s, c) {
switch (c) {
@@ -1689,23 +1716,7 @@
return s;
}
});
- time.funk = Function('time', "return '" + code + "'");
- return g.callbacks.push(function(root) {
- var day, hour, min, month, s, timeEl, year, _, _ref;
- if (root.className === 'inline') {
- return;
- }
- s = $('span[id^=no]', root).previousSibling;
- _ref = s.textContent.match(/(\d+)\/(\d+)\/(\d+)\(\w+\)(\d+):(\d+)/), _ = _ref[0], month = _ref[1], day = _ref[2], year = _ref[3], hour = _ref[4], min = _ref[5];
- year = "20" + year;
- month -= 1;
- hour = g.chanOffset + Number(hour);
- time.date = new Date(year, month, day, hour, min);
- timeEl = $.el('time', {
- textContent: ' ' + time.funk(time) + ' '
- });
- return $.replace(s, timeEl);
- });
+ return time.funk = Function('time', "return '" + code + "'");
},
zeroPad: function(n) {
if (n < 10) {
diff --git a/script.coffee b/script.coffee
index 215331c17..ec56073f6 100644
--- a/script.coffee
+++ b/script.coffee
@@ -738,7 +738,7 @@ options =
-
+
Format specifiers (source)
@@ -772,7 +772,9 @@ options =
$.bind $('a[name=flavors]', dialog), 'click', options.flavors
$.bind $('a[name=time]', dialog), 'click', options.time
$.bind $('textarea[name=flavors]', dialog), 'change', $.cb.value
+ $.bind $('input[name=time]', dialog), 'keyup', options.cb.time
$.append d.body, dialog
+ options.cb.time.call $('input[name=time]', dialog)
flavors: ->
ta = $ '#options textarea[name=flavors]'
@@ -790,6 +792,11 @@ options =
$.deleteValue "hiddenThreads/#{g.BOARD}/"
@value = "hidden: 0"
g.hiddenReplies = {}
+ time: (e) ->
+ $.setValue 'time', @value
+ time.foo()
+ time.date = new Date()
+ $('#timePreview').textContent = time.funk time
cooldown =
init: ->
@@ -1329,13 +1336,7 @@ sauce =
time =
init: ->
- code = $.config('time').replace /%(.)/g, (s, c) ->
- switch c
- when '%' then '%'
- when 'a', 'd', 'H', 'm', 'M', 'p', 'P', 'y' then "' + time.#{c}() + '"
- else s
- time.funk = Function 'time', "return '#{code}'"
-
+ time.foo()
g.callbacks.push (root) ->
return if root.className is 'inline'
s = $('span[id^=no]', root).previousSibling
@@ -1351,6 +1352,14 @@ time =
textContent: ' ' + time.funk(time) + ' '
$.replace s, timeEl
+ foo: ->
+ code = $.config('time').replace /%(.)/g, (s, c) ->
+ switch c
+ when '%' then '%'
+ when 'a', 'd', 'H', 'm', 'M', 'p', 'P', 'y' then "' + time.#{c}() + '"
+ else s
+ time.funk = Function 'time', "return '#{code}'"
+
zeroPad: (n) -> if n < 10 then '0' + n else n
a: -> [
'Sun'