diff --git a/4chan_x.user.js b/4chan_x.user.js index 3a2f5184f..812494e55 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -114,7 +114,7 @@ 'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes'] } }, - flavors: ['http://regex.info/exif.cgi?url=', 'http://iqdb.org/?url=', 'http://google.com/searchbyimage?image_url=', '#http://tineye.com/search?url=', '#http://saucenao.com/search.php?db=999&url=', '#http://imgur.com/upload?url='].join('\n'), + flavors: ['http://iqdb.org/?url=', 'http://google.com/searchbyimage?image_url=', '#http://regex.info/exif.cgi?url=', '#http://tineye.com/search?url=', '#http://saucenao.com/search.php?db=999&url=', '#http://imgur.com/upload?url='].join('\n'), time: '%m/%d/%y(%a)%H:%M', backlink: '>>%id', hotkeys: { @@ -2036,12 +2036,17 @@ return g.callbacks.push(Time.node); }, node: function(root) { - var day, hour, min, month, s, time, year, _, _ref; + var day, hour, min, month, node, tc, time, 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]; + node = $('span[id]', root).previousSibling; + tc = node.textContent; + if (tc === ' ') { + node = node.previousSibling; + tc = node.textContent; + } + _ref = tc.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); @@ -2049,7 +2054,7 @@ time = $.el('time', { textContent: ' ' + Time.funk(Time) + ' ' }); - return $.replace(s, time); + return $.replace(node, time); }, foo: function() { var code; diff --git a/changelog b/changelog index 541894964..8b80cbe0a 100644 --- a/changelog +++ b/changelog @@ -1,7 +1,11 @@ master + +2.19.3 - mayhem quote inlining default styling (by xat) add up/down/right/left keybinding support +- aeosynth + fixed bug that caused script to fail when time formatting enabled 2.19.2 - mayhem diff --git a/script.coffee b/script.coffee index 6ed95a70d..6f83a26c7 100644 --- a/script.coffee +++ b/script.coffee @@ -44,9 +44,9 @@ config = 'Quote Preview': [true, 'Show quote content on hover'] 'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes'] flavors: [ - 'http://regex.info/exif.cgi?url=' 'http://iqdb.org/?url=' 'http://google.com/searchbyimage?image_url=' + '#http://regex.info/exif.cgi?url=' '#http://tineye.com/search?url=' '#http://saucenao.com/search.php?db=999&url=' '#http://imgur.com/upload?url=' @@ -1569,9 +1569,13 @@ Time = g.callbacks.push Time.node node: (root) -> return if root.className is 'inline' - s = $('span[id^=no]', root).previousSibling + node = $('span[id]', root).previousSibling + tc = node.textContent + if tc is ' ' + node = node.previousSibling + tc = node.textContent [_, month, day, year, hour, min] = - s.textContent.match /(\d+)\/(\d+)\/(\d+)\(\w+\)(\d+):(\d+)/ + tc.match /(\d+)\/(\d+)\/(\d+)\(\w+\)(\d+):(\d+)/ year = "20#{year}" month -= 1 #months start at 0 hour = g.chanOffset + Number hour @@ -1580,7 +1584,7 @@ Time = time = $.el 'time', textContent: ' ' + Time.funk(Time) + ' ' - $.replace s, time + $.replace node, time foo: -> code = conf['time'].replace /%([A-Za-z])/g, (s, c) -> if c of Time.formatters