From be9c5785be2aca96b0b57db9d811d68e4da6e319 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 24 Sep 2011 14:06:40 -0700 Subject: [PATCH 1/3] prevent vertical scrollbar in chrom thumbnails imgs w/o src have 0 width / height, floating / absolutely positioned elements don't fill up the parent, so the parent thinks it has 0 width / height, and chrom doesn't reposition when the img does get a src. the file input always has a width / height, so don't float / position it so it fills up the parent. --- 4chan_x.user.js | 4 ++-- script.coffee | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index b77c3c370..d5d42026e 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3169,11 +3169,11 @@ http://code.google.com/p/chromium/issues/detail?id=78961\ */\ font-size: 100px;\ - position: absolute;\ - left: 0;\ opacity: 0;\ }\ #qr #files img {\ + position: absolute;\ + left: 0;\ max-height: 100px;\ max-width: 100px;\ }\ diff --git a/script.coffee b/script.coffee index 6802230f7..9df150983 100644 --- a/script.coffee +++ b/script.coffee @@ -2501,11 +2501,11 @@ Main = http://code.google.com/p/chromium/issues/detail?id=78961 */ font-size: 100px; - position: absolute; - left: 0; opacity: 0; } #qr #files img { + position: absolute; + left: 0; max-height: 100px; max-width: 100px; } From d955ef0e0ededf9b3a7aad173388d1e9a86c1c43 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 25 Sep 2011 01:32:43 +0200 Subject: [PATCH 2/3] Opera will always retry unless the thread died. --- 4chan_x.user.js | 16 ++++++++++------ script.coffee | 7 +++++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index c33e9a5a9..8b629b8f2 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2737,12 +2737,16 @@ var req, thumb; thumb = this.previousSibling; imgExpand.contract(thumb); - req = $.ajax(this.src, null, 'head'); - return req.onreadystatechange = function(e) { - if (this.status !== 404) { - return setTimeout(imgExpand.retry, 10000, thumb); - } - }; + if (navigator.appName !== 'Opera') { + req = $.ajax(this.src, null, 'head'); + return req.onreadystatechange = function(e) { + if (this.status !== 404) { + return setTimeout(imgExpand.retry, 10000, thumb); + } + }; + } else if (!g.dead) { + return setTimeout(imgExpand.retry, 10000, thumb); + } }, retry: function(thumb) { if (!thumb.hidden) { diff --git a/script.coffee b/script.coffee index fd975629e..bba83ab60 100644 --- a/script.coffee +++ b/script.coffee @@ -2026,8 +2026,11 @@ imgExpand = thumb = @previousSibling imgExpand.contract thumb #navigator.online is not x-browser/os yet - req = $.ajax @src, null, 'head' - req.onreadystatechange = (e) -> setTimeout imgExpand.retry, 10000, thumb if @status isnt 404 + if navigator.appName isnt 'Opera' + req = $.ajax @src, null, 'head' + req.onreadystatechange = (e) -> setTimeout imgExpand.retry, 10000, thumb if @status isnt 404 + else unless g.dead + setTimeout imgExpand.retry, 10000, thumb retry: (thumb) -> imgExpand.expand thumb unless thumb.hidden From 5c635badd240f3ad3cfd462bc443f9e562632b2a Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 25 Sep 2011 02:48:58 +0200 Subject: [PATCH 3/3] Clean options, keep it readable and organized. --- 4chan_x.user.js | 99 +++++++++++++++++++++++----- script.coffee | 169 +++++++++++++++++++++++++----------------------- 2 files changed, 172 insertions(+), 96 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 01e44fa2e..d407e9d91 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1117,15 +1117,78 @@ return $.replace(home, a); }, dialog: function() { - var arr, checked, description, dialog, hiddenNum, hiddenThreads, html, input, key, li, main, obj, overlay, ul, _i, _len, _ref, _ref2; - hiddenThreads = $.get("hiddenThreads/" + g.BOARD + "/", {}); - hiddenNum = Object.keys(g.hiddenReplies).length + Object.keys(hiddenThreads).length; - html = "
| | |

    Backlink formatting
  • :
    Time formatting
  • :
  • Supported format specifiers:
  • Day: %a, %A, %d, %e
  • Month: %m, %b, %B
  • Year: %y
  • Hour: %k, %H, %l (lowercase L), %I (uppercase i), %p, %P
  • Minutes: %M
ActionsKeybinds
Close Options or QR
Quick spoiler
Open QR with post number inserted
Open QR without post number inserted
Submit post
Select next reply
Select previous reply
See next thread
See previous thread
Jump to the next page
Jump to the previous page
Jump to page 0
Open thread in current tab
Open thread in new tab
Expand thread
Watch thread
Hide thread
Expand selected image
Expand all images
Update now
Reset the unread count to 0
"; + var arr, back, checked, description, dialog, flavors, hiddenNum, hiddenThreads, input, key, li, obj, overlay, time, ul, _i, _len, _ref, _ref2; dialog = $.el('div', { id: 'options', - innerHTML: html + innerHTML: '\ +
\ +
\ +
\ + \ + | \ + | \ + | \ +
\ +
\ + 4chan X\ + | Support Throd\ + | GitHub\ + | Donate\ +
\ +
\ +
\ +
\ + \ +
\ + \ + \ + \ +
\ +
    \ + Backlink formatting\ +
  • :
  • \ +
\ +
    \ + Time formatting\ +
  • :
  • \ +
  • Supported format specifiers:
  • \ +
  • Day: %a, %A, %d, %e
  • \ +
  • Month: %m, %b, %B
  • \ +
  • Year: %y
  • \ +
  • Hour: %k, %H, %l (lowercase L), %I (uppercase i), %p, %P
  • \ +
  • Minutes: %M
  • \ +
\ +
\ + \ +
\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
ActionsKeybinds
Close Options or QR
Quick spoiler
Open QR with post number inserted
Open QR without post number inserted
Submit post
Select next reply
Select previous reply
See next thread
See previous thread
Jump to the next page
Jump to the previous page
Jump to page 0
Open thread in current tab
Open thread in new tab
Expand thread
Watch thread
Hide thread
Expand selected image
Expand all images
Update now
Reset the unread count to 0
\ +
\ +
\ +
' }); - main = $('#main', dialog); _ref = config.main; for (key in _ref) { obj = _ref[key]; @@ -1142,19 +1205,25 @@ $.bind($('input', li), 'click', $.cb.checked); $.add(ul, li); } - $.add(main, ul); + $.add($('#main', dialog), ul); } + hiddenThreads = $.get("hiddenThreads/" + g.BOARD + "/", {}); + hiddenNum = Object.keys(g.hiddenReplies).length + Object.keys(hiddenThreads).length; li = $.el('li', { innerHTML: " : Forget all hidden posts. Useful if you accidentally hide a post and have `show stubs` disabled." }); $.bind($('button', li), 'click', options.clearHidden); $.add($('ul:nth-child(2)', dialog), li); - $.bind($('#flavors', dialog), 'change', $.cb.value); - $.bind($('input[name=time]', dialog), 'keyup', options.time); - $.bind($('input[name=backlink]', dialog), 'keyup', options.backlink); + (flavors = $('#flavors', dialog)).textContent = conf['flavors']; + $.bind(flavors, 'change', $.cb.value); + (back = $('[name=backlink]', dialog)).value = conf['backlink']; + (time = $('[name=time]', dialog)).value = conf['time']; + $.bind(back, 'keyup', options.backlink); + $.bind(time, 'keyup', options.time); _ref2 = $$('#keybinds input', dialog); for (_i = 0, _len = _ref2.length; _i < _len; _i++) { input = _ref2[_i]; + input.type = 'text'; input.value = conf[input.name]; $.bind(input, 'keydown', options.keybind); } @@ -1167,16 +1236,16 @@ overlay = $.el('div', { id: 'overlay' }); - $.add(overlay, dialog); - $.add(d.body, overlay); - options.time.call($('input[name=time]', dialog)); - options.backlink.call($('input[name=backlink]', dialog)); $.bind(overlay, 'click', function() { return $.rm(overlay); }); - return $.bind(dialog.firstElementChild, 'click', function(e) { + $.bind(dialog.firstElementChild, 'click', function(e) { return e.stopPropagation(); }); + $.add(overlay, dialog); + $.add(d.body, overlay); + options.time.call(time); + return options.backlink.call(back); }, clearHidden: function(e) { $["delete"]("hiddenReplies/" + g.BOARD + "/"); diff --git a/script.coffee b/script.coffee index dbdde85c1..e923f819d 100644 --- a/script.coffee +++ b/script.coffee @@ -796,79 +796,76 @@ options = $.replace home, a dialog: -> - hiddenThreads = $.get "hiddenThreads/#{g.BOARD}/", {} - hiddenNum = Object.keys(g.hiddenReplies).length + Object.keys(hiddenThreads).length - html = " -
-
-
- | | | -
- -
-
-
- -
- - - -
-
    - Backlink formatting -
  • :
  • -
-
    - Time formatting -
  • :
  • -
  • Supported format specifiers:
  • -
  • Day: %a, %A, %d, %e
  • -
  • Month: %m, %b, %B
  • -
  • Year: %y
  • -
  • Hour: %k, %H, %l (lowercase L), %I (uppercase i), %p, %P
  • -
  • Minutes: %M
  • -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - -
ActionsKeybinds
Close Options or QR
Quick spoiler
Open QR with post number inserted
Open QR without post number inserted
Submit post
Select next reply
Select previous reply
See next thread
See previous thread
Jump to the next page
Jump to the previous page
Jump to page 0
Open thread in current tab
Open thread in new tab
Expand thread
Watch thread
Hide thread
Expand selected image
Expand all images
Update now
Reset the unread count to 0
-
-
-
- " + dialog = $.el 'div', id: 'options', innerHTML: ' +
+
+
+ + | + | + | +
+ +
+
+
+ +
+ + + +
+
    + Backlink formatting +
  • :
  • +
+
    + Time formatting +
  • :
  • +
  • Supported format specifiers:
  • +
  • Day: %a, %A, %d, %e
  • +
  • Month: %m, %b, %B
  • +
  • Year: %y
  • +
  • Hour: %k, %H, %l (lowercase L), %I (uppercase i), %p, %P
  • +
  • Minutes: %M
  • +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
ActionsKeybinds
Close Options or QR
Quick spoiler
Open QR with post number inserted
Open QR without post number inserted
Submit post
Select next reply
Select previous reply
See next thread
See previous thread
Jump to the next page
Jump to the previous page
Jump to page 0
Open thread in current tab
Open thread in new tab
Expand thread
Watch thread
Hide thread
Expand selected image
Expand all images
Update now
Reset the unread count to 0
+
+
+
' - dialog = $.el 'div', id: 'options', innerHTML: html - main = $('#main', dialog) + #main for key, obj of config.main ul = $.el 'ul', textContent: key @@ -879,17 +876,28 @@ options = innerHTML: ": #{description}" $.bind $('input', li), 'click', $.cb.checked $.add ul, li - $.add main, ul + $.add $('#main', dialog), ul + hiddenThreads = $.get "hiddenThreads/#{g.BOARD}/", {} + hiddenNum = Object.keys(g.hiddenReplies).length + Object.keys(hiddenThreads).length li = $.el 'li', innerHTML: " : Forget all hidden posts. Useful if you accidentally hide a post and have `show stubs` disabled." $.bind $('button', li), 'click', options.clearHidden $.add $('ul:nth-child(2)', dialog), li - $.bind $('#flavors', dialog), 'change', $.cb.value - $.bind $('input[name=time]', dialog), 'keyup', options.time - $.bind $('input[name=backlink]', dialog), 'keyup', options.backlink + #sauce + (flavors = $ '#flavors', dialog).textContent = conf['flavors'] + $.bind flavors, 'change', $.cb.value + + #rice + (back = $ '[name=backlink]', dialog).value = conf['backlink'] + (time = $ '[name=time]', dialog).value = conf['time'] + $.bind back, 'keyup', options.backlink + $.bind time, 'keyup', options.time + + #keybinds for input in $$ '#keybinds input', dialog + input.type = 'text' input.value = conf[input.name] $.bind input, 'keydown', options.keybind @@ -900,14 +908,13 @@ options = https://bugzilla.mozilla.org/show_bug.cgi?id=579776 ### overlay = $.el 'div', id: 'overlay' + $.bind overlay, 'click', -> $.rm overlay + $.bind dialog.firstElementChild, 'click', (e) -> e.stopPropagation() $.add overlay, dialog $.add d.body, overlay - options.time.call $('input[name=time]', dialog) - options.backlink.call $('input[name=backlink]', dialog) - - $.bind overlay, 'click', -> $.rm overlay - $.bind dialog.firstElementChild, 'click', (e) -> e.stopPropagation() + options.time.call time + options.backlink.call back clearHidden: (e) -> #'hidden' might be misleading; it's the number of IDs we're *looking* for,