From 5b349905eb7e967e9b9d8392adfb879f6a8d4987 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 13 Apr 2013 15:00:14 +0200 Subject: [PATCH 01/15] Delete links do not depend on the QR anymore. --- src/features.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features.coffee b/src/features.coffee index 8b6407f91..abd63d5cf 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -1584,7 +1584,7 @@ ReportLink = DeleteLink = init: -> - return if g.VIEW is 'catalog' or !Conf['Menu'] or !Conf['Delete Link'] or !Conf['Quick Reply'] + return if g.VIEW is 'catalog' or !Conf['Menu'] or !Conf['Delete Link'] div = $.el 'div', className: 'delete-link' From 766be903b62b255c61b57920ebe2b56be8a2a6d4 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 13 Apr 2013 18:01:09 +0200 Subject: [PATCH 02/15] Use Element.remove() in $.rm when possible. --- lib/$.coffee | 7 +++++-- src/features.coffee | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/$.coffee b/lib/$.coffee index 4b2e3d293..5de9784a0 100644 --- a/lib/$.coffee +++ b/lib/$.coffee @@ -97,8 +97,11 @@ $.extend $, el.classList.remove className hasClass: (el, className) -> el.classList.contains className - rm: (el) -> - el.parentNode.removeChild el + rm: do -> + if 'remove' of Element.prototype + (el) -> el.remove() + else + (el) -> el.parentNode?.removeChild el tn: (s) -> d.createTextNode s nodes: (nodes) -> diff --git a/src/features.coffee b/src/features.coffee index abd63d5cf..b077b01f2 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -225,7 +225,7 @@ class Notification setTimeout @close, @timeout * $.SECOND if @timeout close = -> - $.rm @el if @el.parentNode + $.rm @el Settings = init: -> @@ -3798,7 +3798,7 @@ Unread = {root} = post.nodes if root isnt $ '.thread > .replyContainer', root.parentNode # not the first reply $.before root, Unread.hr - else if Unread.hr.parentNode + else $.rm Unread.hr update: <% if (type === 'crx') { %>(dontrepeat) <% } %>-> From 25b37552f103f945b77be7798dea5c7b4cecd37d Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 13 Apr 2013 18:23:36 +0200 Subject: [PATCH 03/15] Fix QR cooldown on Opera. --- src/qr.coffee | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/qr.coffee b/src/qr.coffee index 6670cc192..c67145887 100644 --- a/src/qr.coffee +++ b/src/qr.coffee @@ -921,6 +921,11 @@ QR = QR.status() response: -> + <% if (type === 'userjs') { %> + # The upload.onload callback is not called + # or at least not in time with Opera. + QR.req.upload.onload() + <% } %> {req} = QR delete QR.req From 7f949af9057d0ff805e7ed80598436fe853fd939 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 13 Apr 2013 19:04:56 +0200 Subject: [PATCH 04/15] Fix QR remembering the spoiler state. --- CHANGELOG.md | 3 +++ src/qr.coffee | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a71bbf936..68212e550 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +- Fix QR remembering the file spoiler state when it shouldn't. +- Fix QR cooldown in Opera. + ### 3.0.4 - *2013-04-11* - More minor fixes. diff --git a/src/qr.coffee b/src/qr.coffee index c67145887..4f7b0c2d4 100644 --- a/src/qr.coffee +++ b/src/qr.coffee @@ -367,8 +367,6 @@ QR = spoiler: $ 'input', el span: el.lastChild - @nodes.spoiler.checked = @spoiler - $.on el, 'click', @select.bind @ $.on @nodes.rm, 'click', (e) => e.stopPropagation(); @rm() $.on @nodes.label, 'click', (e) => e.stopPropagation() @@ -382,7 +380,7 @@ QR = prev = QR.posts[QR.posts.length - 1] QR.posts.push @ - @spoiler = if prev and Conf['Remember Spoiler'] + @nodes.spoiler.checked = @spoiler = if prev and Conf['Remember Spoiler'] prev.spoiler else false @@ -442,6 +440,9 @@ QR = @showFileData() QR.characterCount() save: (input) -> + if input.type is 'checkbox' + @spoiler = input.checked + return {value} = input @[input.dataset.name] = value return if input.nodeName isnt 'TEXTAREA' @@ -455,7 +456,7 @@ QR = return unless @ is QR.selected # Do this in case people use extensions # that do not trigger the `input` event. - for name in ['name', 'email', 'sub', 'com'] + for name in ['name', 'email', 'sub', 'com', 'spoiler'] @save QR.nodes[name] return setFile: (@file) -> @@ -536,7 +537,7 @@ QR = @showFileData() return unless window.URL URL.revokeObjectURL @URL - showFileData: (hide) -> + showFileData: -> if @file QR.nodes.filename.textContent = @filename QR.nodes.filename.title = @filename From 552ab4c3a9ac3d061c161225cd8013324fc49ee8 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 13 Apr 2013 20:11:43 +0200 Subject: [PATCH 05/15] Fix delete link killing the post instead of the file only when deleting the file. --- src/features.coffee | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/features.coffee b/src/features.coffee index b077b01f2..08982a579 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -1636,20 +1636,22 @@ DeleteLink = else $.id('delPassword').value + fileOnly = $.hasClass @, 'delete-file' + form = mode: 'usrdel' - onlyimgdel: $.hasClass @, 'delete-file' + onlyimgdel: fileOnly pwd: pwd form[post.ID] = 'delete' link = @ $.ajax $.id('delform').action.replace("/#{g.BOARD}/", "/#{post.board}/"), - onload: -> DeleteLink.load link, post, @response + onload: -> DeleteLink.load link, post, fileOnly, @response onerror: -> DeleteLink.error link , cred: true form: $.formData form - load: (link, post, html) -> + load: (link, post, fileOnly, html) -> tmpDoc = d.implementation.createHTMLDocument '' tmpDoc.documentElement.innerHTML = html if tmpDoc.title is '4chan - Banned' # Ban/warn check @@ -1660,7 +1662,7 @@ DeleteLink = else if tmpDoc.title is 'Updating index...' # We're 100% sure. - (post.origin or post).kill() + (post.origin or post).kill fileOnly s = 'Deleted' link.textContent = s error: (link) -> From e65e148e4f0eb041a68b657c3400659c0d2e8b71 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 13 Apr 2013 21:00:23 +0200 Subject: [PATCH 06/15] Handle "You must wait X seconds before posting a reply" QR errors. --- src/qr.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qr.coffee b/src/qr.coffee index 4f7b0c2d4..2e4bc270f 100644 --- a/src/qr.coffee +++ b/src/qr.coffee @@ -968,6 +968,12 @@ QR = # Too many frequent mistyped captchas will auto-ban you! # On connection error, the post most likely didn't go through. QR.cooldown.set delay: 2 + else if err.textContent and m = err.textContent.match /wait\s(\d+)\ssecond/i + QR.cooldown.auto = if QR.captcha.isEnabled + !!QR.captcha.captchas.length + else + true + QR.cooldown.set delay: m[1] else # stop auto-posting QR.cooldown.auto = false QR.status() From cead1dc231966aa2b64d1dacfe2699608051e1fd Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 13 Apr 2013 22:54:54 +0200 Subject: [PATCH 07/15] Save the thread you reply to per post in the QR. Reset the thread selector on each new post. --- src/main.coffee | 2 +- src/qr.coffee | 31 +++++++++++++++---------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/main.coffee b/src/main.coffee index 95fcc6f47..68c95f7b2 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -389,7 +389,7 @@ Main = initFeature 'Keybinds', Keybinds # c.timeEnd 'All initializations' - $.on d, 'AddCallback', Main.addCallback + $.on d, 'AddCallback', Main.addCallback $.ready Main.initReady initStyle: -> diff --git a/src/qr.coffee b/src/qr.coffee index 2e4bc270f..39f3e94ed 100644 --- a/src/qr.coffee +++ b/src/qr.coffee @@ -25,7 +25,6 @@ QR = $.on sc, 'click', -> $.event 'CloseMenu' QR.open() - QR.resetThreadSelector() QR.nodes.com.focus() Header.addShortcut sc @@ -202,7 +201,7 @@ QR = now = Date.now() post = QR.posts[0] - isReply = QR.nodes.thread.value isnt 'new' + isReply = post.thread isnt 'new' isSage = /sage/i.test post.email hasFile = !!post.file seconds = null @@ -345,11 +344,6 @@ QR = post = new QR.post() post.setFile file $.addClass QR.nodes.el, 'dump' - resetThreadSelector: -> - if g.VIEW is 'thread' - QR.nodes.thread.value = g.THREADID - else - QR.nodes.thread.value = 'new' posts: [] post: class @@ -378,6 +372,11 @@ QR = for event in ['dragStart', 'dragEnter', 'dragLeave', 'dragOver', 'dragEnd', 'drop'] $.on el, event.toLowerCase(), @[event] + @thread = if g.VIEW is 'thread' + g.THREADID + else + 'new' + prev = QR.posts[QR.posts.length - 1] QR.posts.push @ @nodes.spoiler.checked = @spoiler = if prev and Conf['Remember Spoiler'] @@ -412,7 +411,7 @@ QR = lock: (lock=true) -> @isLocked = lock return unless @ is QR.selected - for name in ['name', 'email', 'sub', 'com', 'fileButton', 'spoiler'] + for name in ['thread', 'name', 'email', 'sub', 'com', 'fileButton', 'spoiler'] QR.nodes[name].disabled = lock @nodes.rm.style.visibility = QR.nodes.fileRM.style.visibility = if lock then 'hidden' else '' @@ -435,7 +434,7 @@ QR = @load() load: -> # Load this post's values. - for name in ['name', 'email', 'sub', 'com'] + for name in ['thread', 'name', 'email', 'sub', 'com'] QR.nodes[name].value = @[name] or null @showFileData() QR.characterCount() @@ -456,7 +455,7 @@ QR = return unless @ is QR.selected # Do this in case people use extensions # that do not trigger the `input` event. - for name in ['name', 'email', 'sub', 'com', 'spoiler'] + for name in ['thread', 'name', 'email', 'sub', 'com', 'spoiler'] @save QR.nodes[name] return setFile: (@file) -> @@ -693,7 +692,7 @@ QR = dialog = UI.dialog 'qr', 'top:0;right:0;', """
- @@ -791,7 +790,6 @@ QR = value: thread textContent: "Thread No.#{thread}" $.after nodes.autohide, nodes.thread - QR.resetThreadSelector() for node in [nodes.fileButton, nodes.filename.parentNode] $.on node, 'click', QR.openFileInput @@ -803,11 +801,12 @@ QR = $.on nodes.fileRM, 'click', -> QR.selected.rmFile() $.on nodes.spoiler, 'change', -> QR.selected.nodes.spoiler.click() $.on nodes.fileInput, 'change', QR.fileInput - - new QR.post true # save selected post's data for name in ['name', 'email', 'sub', 'com'] - $.on nodes[name], 'input', -> QR.selected.save @ + $.on nodes[name], 'input', -> QR.selected.save @ + $.on nodes.thread, 'change', -> QR.selected.save @ + + new QR.post true QR.status() QR.cooldown.init() @@ -834,7 +833,7 @@ QR = post.forceSave() if g.BOARD.ID is 'f' filetag = QR.nodes.flashTag.value - threadID = QR.nodes.thread.value + threadID = post.thread thread = g.BOARD.threads[threadID] # prevent errors From c9402fdf65b6d25cbffafb548f0903f873284d50 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 13 Apr 2013 22:57:37 +0200 Subject: [PATCH 08/15] The index/reply navigation shouldn't exist on the catalog. --- src/features.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/features.coffee b/src/features.coffee index 08982a579..bc847fea0 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -1974,7 +1974,13 @@ Keybinds = Nav = init: -> - return if g.VIEW is 'index' and !Conf['Index Navigation'] or g.VIEW is 'thread' and !Conf['Reply Navigation'] + switch g.VIEW + when 'index' + return unless Conf['Index Navigation'] + when 'thread' + return unless Conf['Reply Navigation'] + else # catalog + return span = $.el 'span', id: 'navlinks' From f4bf9b5413e54bdb9b7639a868bf9ec9bb4d9152 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 13 Apr 2013 23:26:15 +0200 Subject: [PATCH 09/15] Add the `has-focus` class to the QR element when it has focus. @saxamaphone69 --- CHANGELOG.md | 1 + css/style.css | 2 +- src/qr.coffee | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68212e550..a58503966 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +- The QR won't auto-hide when auto-hide is enabled and one of its input is focused. Doesn't work on Firefox. - Fix QR remembering the file spoiler state when it shouldn't. - Fix QR cooldown in Opera. diff --git a/css/style.css b/css/style.css index a729961c2..30d916302 100644 --- a/css/style.css +++ b/css/style.css @@ -549,7 +549,7 @@ a[href="javascript:;"] { :root.hide-original-post-form #postForm, :root.hide-original-post-form .postingMode, :root.hide-original-post-form #togglePostForm, -#qr.autohide:not(:hover) > form { +#qr.autohide:not(.has-focus):not(:hover) > form { display: none; } #qr select, #dump-button, .remove, .captcha-img { diff --git a/src/qr.coffee b/src/qr.coffee index 39f3e94ed..4323d6ce2 100644 --- a/src/qr.coffee +++ b/src/qr.coffee @@ -73,6 +73,10 @@ QR = QR.status() if !Conf['Remember Spoiler'] and QR.nodes.spoiler.checked QR.nodes.spoiler.click() + focusin: -> + $.addClass QR.nodes.el, 'has-focus' + focusout: -> + $.rmClass QR.nodes.el, 'has-focus' hide: -> d.activeElement.blur() $.addClass QR.nodes.el, 'autohide' @@ -361,6 +365,12 @@ QR = spoiler: $ 'input', el span: el.lastChild + <% if (type === 'userscript') { %> + # XXX Firefox lacks focusin/focusout support. + for elm in $$ '*', el + $.on elm, 'blur', QR.focusout + $.on elm, 'focus', QR.focusin + <% } %> $.on el, 'click', @select.bind @ $.on @nodes.rm, 'click', (e) => e.stopPropagation(); @rm() $.on @nodes.label, 'click', (e) => e.stopPropagation() @@ -619,6 +629,12 @@ QR = # start with an uncached captcha @reload() + <% if (type === 'userscript') { %> + # XXX Firefox lacks focusin/focusout support. + $.on input, 'blur', QR.focusout + $.on input, 'focus', QR.focusin + <% } %> + $.addClass QR.nodes.el, 'has-captcha' $.after QR.nodes.com.parentNode, [imgContainer, input] sync: (@captchas) -> @@ -791,6 +807,14 @@ QR = textContent: "Thread No.#{thread}" $.after nodes.autohide, nodes.thread + <% if (type === 'userscript') { %> + # XXX Firefox lacks focusin/focusout support. + for elm in $$ '*', QR.nodes.el + $.on elm, 'blur', QR.focusout + $.on elm, 'focus', QR.focusin + <% } %> + $.on QR.nodes.el, 'focusin', QR.focusin + $.on QR.nodes.el, 'focusout', QR.focusout for node in [nodes.fileButton, nodes.filename.parentNode] $.on node, 'click', QR.openFileInput $.on nodes.autohide, 'change', QR.toggleHide From 344e1aaa19edfa3ea49e6704601a559535c9116f Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 14 Apr 2013 00:15:38 +0200 Subject: [PATCH 10/15] Made `Scroll to Last Read Post` optional. Close #1009 Fix a bug where it attempted to scroll to a hidden post without stub, effectively scrolling to the end of the thread. --- CHANGELOG.md | 1 + src/config.coffee | 1 + src/features.coffee | 21 +++++++++++++-------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a58503966..34a3272c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +- `Scroll to Last Read Post` is now optional, enabled by default. - The QR won't auto-hide when auto-hide is enabled and one of its input is focused. Doesn't work on Firefox. - Fix QR remembering the file spoiler state when it shouldn't. - Fix QR cooldown in Opera. diff --git a/src/config.coffee b/src/config.coffee index f5b799b59..d03d801e4 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -39,6 +39,7 @@ Config = 'Unread Count': [true, 'Show the unread posts count in the tab title.'] 'Unread Tab Icon': [true, 'Show a different favicon when there are unread posts.'] 'Unread Line': [true, 'Show a line to distinguish read posts from unread ones.'] + 'Scroll to Last Read Post': [true, 'Scroll back to the last read post when reopening a thread.'] 'Thread Excerpt': [true, 'Show an excerpt of the thread in the tab title.'] 'Thread Stats': [true, 'Display reply and image count.'] 'Thread Watcher': [true, 'Bookmark threads.'] diff --git a/src/features.coffee b/src/features.coffee index bc847fea0..e90adbabf 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -160,6 +160,7 @@ Header = (if hide then $.addClass else $.rmClass) Header.bar, 'autohide' hashScroll: -> return unless post = $.id @location.hash[1..] + return if (Get.postFromRoot post).isHidden Header.scrollToPost post scrollToPost: (post) -> {top} = post.getBoundingClientRect() @@ -3709,18 +3710,22 @@ Unread = threadID: @ID defaultValue: 0 Unread.addPosts posts - if (hash = location.hash.match /\d+/) and post = @posts[hash[0]] - Header.scrollToPost post.nodes.root - else if Unread.posts.length - # Scroll to before the first unread post. - $.x('preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root).scrollIntoView false - else if posts.length - # Scroll to the last read post. - Header.scrollToPost posts[posts.length - 1].nodes.root $.on d, 'ThreadUpdate', Unread.onUpdate $.on d, 'scroll visibilitychange', Unread.read $.on d, 'visibilitychange', Unread.setLine if Conf['Unread Line'] + return unless Conf['Scroll to Last Read Post'] + # Let the header's onload callback handle it. + return if (hash = location.hash.match /\d+/) and hash[0] of @posts + if Unread.posts.length + # Scroll to before the first unread post. + while root = $.x 'preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root + break unless (Get.postFromRoot root).isHidden + root.scrollIntoView false + else if posts.length + # Scroll to the last read post. + Header.scrollToPost posts[posts.length - 1].nodes.root + sync: -> lastReadPost = Unread.db.get boardID: Unread.thread.board.ID From 06d77102a4fd5b8590d43a08e63b25fa484b7dff Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 14 Apr 2013 00:19:29 +0200 Subject: [PATCH 11/15] UI should use $.get/$.set instead of localStorage. --- lib/ui.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ui.coffee b/lib/ui.coffee index 14b8fe025..eb06129aa 100644 --- a/lib/ui.coffee +++ b/lib/ui.coffee @@ -4,7 +4,8 @@ UI = do -> className: 'dialog' innerHTML: html id: id - el.style.cssText = localStorage.getItem("#{g.NAMESPACE}#{id}.position") or position + $.get "#{id}.position", position, (item) -> + el.style.cssText = item["#{id}.position"] move = $ '.move', el $.on move, 'touchstart mousedown', dragstart el @@ -273,7 +274,7 @@ UI = do -> else # mouseup $.off d, 'mousemove', @move $.off d, 'mouseup', @up - localStorage.setItem "#{g.NAMESPACE}#{@id}.position", @style.cssText + $.set "#{@id}.position", @style.cssText hoverstart = ({root, el, latestEvent, endEvents, asapTest, cb}) -> o = { From c000d3db2a9307ea6c79d6e978136060a6dd7384 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 14 Apr 2013 00:49:51 +0200 Subject: [PATCH 12/15] Add `Remember QR Size` back in. Close #1021. --- CHANGELOG.md | 3 ++- src/config.coffee | 3 +++ src/qr.coffee | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34a3272c6..76d9b62a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ - `Scroll to Last Read Post` is now optional, enabled by default. - The QR won't auto-hide when auto-hide is enabled and one of its input is focused. Doesn't work on Firefox. +- Added the `Remember QR Size` setting back in, disabled by default. Only on Firefox. - Fix QR remembering the file spoiler state when it shouldn't. - Fix QR cooldown in Opera. @@ -14,7 +15,7 @@ ### 3.0.2 - *2013-04-09* - Added a setting in the Header's menu to move it at the bottom of the screen. -- Added Cooldown setting back in. +- Added the `Cooldown` setting back in. - Fixed the Header going above posts when following quotelinks for example. - Fixed a bug where dead quotelinks would disappear. diff --git a/src/config.coffee b/src/config.coffee index d03d801e4..bd1452991 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -50,6 +50,9 @@ Config = 'Persistent QR': [false, 'The Quick reply won\'t disappear after posting.'] 'Auto-Hide QR': [false, 'Automatically hide the quick reply when posting.'] 'Open Post in New Tab': [true, 'Open new threads or replies to a thread from the index in a new tab.'] + <% if (type === 'userscript') { %> + 'Remember QR Size': [false, 'Remember the size of the Quick reply.'] + <% } %> 'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting.'] 'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting.'] 'Hide Original Post Form': [true, 'Hide the normal post form.'] diff --git a/src/qr.coffee b/src/qr.coffee index 4323d6ce2..4ddb9d5c1 100644 --- a/src/qr.coffee +++ b/src/qr.coffee @@ -830,6 +830,15 @@ QR = $.on nodes[name], 'input', -> QR.selected.save @ $.on nodes.thread, 'change', -> QR.selected.save @ + <% if (type === 'userscript') { %> + if Conf['Remember QR Size'] + $.get 'QR Size', '', (item) -> + nodes.com.style.cssText = item['QR Size'] + $.on nodes.com, 'mouseup', (e) -> + return if e.button isnt 0 + $.set 'QR Size', @style.cssText + <% } %> + new QR.post true QR.status() From 40582724e1686d7f59fca6e5c79246fac5a8e9c3 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 14 Apr 2013 00:52:13 +0200 Subject: [PATCH 13/15] Release 4chan X v3.0.5. --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76d9b62a6..04d70e60e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +### 3.0.5 - *2013-04-14* + - `Scroll to Last Read Post` is now optional, enabled by default. - The QR won't auto-hide when auto-hide is enabled and one of its input is focused. Doesn't work on Firefox. - Added the `Remember QR Size` setting back in, disabled by default. Only on Firefox. diff --git a/package.json b/package.json index 065c3ed6a..da7cfd143 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "3.0.4", + "version": "3.0.5", "description": "Cross-browser extension for productive lurking on 4chan.", "meta": { "name": "4chan X", From e4b195734ac66279a2dee702759cf75dcada7627 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 14 Apr 2013 02:40:35 +0200 Subject: [PATCH 14/15] Fix #1030. --- CHANGELOG.md | 2 ++ src/qr.coffee | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04d70e60e..430958603 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +- Fix regression concerning thread selection when quoting on the index. + ### 3.0.5 - *2013-04-14* - `Scroll to Last Read Post` is now optional, enabled by default. diff --git a/src/qr.coffee b/src/qr.coffee index 4ddb9d5c1..e1ca69e06 100644 --- a/src/qr.coffee +++ b/src/qr.coffee @@ -264,19 +264,19 @@ QR = text += ">#{s}\n" QR.open() - ta = QR.nodes.com - QR.nodes.thread.value = OP.ID unless ta.value + {com, thread} = QR.nodes + thread.value = OP.ID unless com.value - caretPos = ta.selectionStart + caretPos = com.selectionStart # Replace selection for text. - ta.value = ta.value[...caretPos] + text + ta.value[ta.selectionEnd..] + com.value = com.value[...caretPos] + text + com.value[com.selectionEnd..] # Move the caret to the end of the new quote. range = caretPos + text.length - ta.setSelectionRange range, range - ta.focus() + com.setSelectionRange range, range + com.focus() - # Fire the 'input' event - $.event 'input', null, ta + QR.selected.save com + QR.selected.save thread characterCount: -> counter = QR.nodes.charCount From 39edd9a9d3867b3a57c06d0e2dcc0c7302be7fc1 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 14 Apr 2013 02:40:47 +0200 Subject: [PATCH 15/15] Release 4chan X v3.0.6. --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 430958603..2ed9212e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +### 3.0.6 - *2013-04-14* + - Fix regression concerning thread selection when quoting on the index. ### 3.0.5 - *2013-04-14* diff --git a/package.json b/package.json index da7cfd143..4626f8ff3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "3.0.5", + "version": "3.0.6", "description": "Cross-browser extension for productive lurking on 4chan.", "meta": { "name": "4chan X",