From a7b3363d17a2d2d64a9add2e44a7f09a4f7460b1 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 21 Feb 2014 18:19:01 +0100 Subject: [PATCH 01/14] Up min Chrome version. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 412a1d33e..724abbf12 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "*://i.4cdn.org/*" ], "min": { - "chrome": "32", + "chrome": "33", "firefox": "26", "greasemonkey": "1.14" } From 271ee9290f3d53955643b13e41602fa2fa9dce49 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 21 Feb 2014 18:19:10 +0100 Subject: [PATCH 02/14] Remove Notification.permission and page visibility polyfills. --- lib/polyfill.coffee | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/lib/polyfill.coffee b/lib/polyfill.coffee index 08ce47683..e09a458b0 100644 --- a/lib/polyfill.coffee +++ b/lib/polyfill.coffee @@ -1,21 +1,8 @@ Polyfill = init: -> <% if (type === 'crx') { %> - @notificationPermission() @toBlob() - @visibility() <% } %> - notificationPermission: -> - return if !window.Notification or 'permission' of Notification or !window.webkitNotifications - Object.defineProperty Notification, 'permission', - get: -> - switch webkitNotifications.checkPermission() - when 0 - 'granted' - when 1 - 'default' - when 2 - 'denied' toBlob: -> HTMLCanvasElement::toBlob or= (cb) -> data = atob @toDataURL()[22..] @@ -25,12 +12,3 @@ Polyfill = for i in [0...l] by 1 ui8a[i] = data.charCodeAt i cb new Blob [ui8a], type: 'image/png' - visibility: -> - # page visibility API - return if 'visibilityState' of d - Object.defineProperties HTMLDocument.prototype, - visibilityState: - get: -> @webkitVisibilityState - hidden: - get: -> @webkitHidden - $.on d, 'webkitvisibilitychange', -> $.event 'visibilitychange' From 7c97b116017fe8243c902eacea7090bae10d1ca9 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 8 Apr 2014 13:53:21 +0200 Subject: [PATCH 03/14] Refactor ImageExpand.waitExpand(): - wait for the first frame to be loaded instead of the metadata before expanding. - to my understanding, browsers will not always start the download immediately if the video isn't on autoplay, force it with load(). --- src/Images/ImageExpand.coffee | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index 88b4788ac..f21c830d2 100644 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -94,14 +94,12 @@ ImageExpand = ImageExpand.waitExpand post return post.file.fullImage = file = if post.file.isImage - $.el 'img', - className: 'full-image' - src: src or post.file.URL + $.el 'img' else $.el 'video', - className: 'full-image' - src: src or post.file.URL loop: true + file.className = 'full-image' + file.src = src or post.file.URL $.on file, 'error', ImageExpand.error ImageExpand.waitExpand post $.after post.file.thumb, file @@ -113,18 +111,26 @@ ImageExpand = return $.addClass post.file.thumb, 'expanding' + file = post.file.fullImage + if post.file.isImage - $.asap (-> post.file.fullImage.naturalHeight), -> - post.file.isReady = true + $.asap (-> file.naturalHeight), -> ImageExpand.completeExpand post - else if post.file.isVideo - complete = -> - $.off post.file.fullImage, 'loadedmetadata', complete - post.file.isReady = true - ImageExpand.completeExpand post - $.on post.file.fullImage, 'loadedmetadata', complete + return + + # Expand the video when the first frame is available. + if file.readyState >= file.HAVE_CURRENT_DATA + ImageExpand.completeExpand post + return + + file.load() # Don't wait for the browser to lazily preload. + complete = -> + $.off file, 'loadeddata', complete + ImageExpand.completeExpand post + $.on file, 'loadeddata', complete completeExpand: (post) -> + post.file.isReady = true {thumb} = post.file return unless post.file.isExpanding # contracted before the image loaded delete post.file.isExpanding From 82f062ffeb6481b2eedcb4a27bf1103a10fa570e Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 9 Apr 2014 09:21:47 +0200 Subject: [PATCH 04/14] Update deps. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dcf049900..1c3ccb25f 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "grunt-concurrent": "~0.5.0", "grunt-contrib-clean": "~0.5.0", "grunt-contrib-coffee": "~0.10.1", - "grunt-contrib-compress": "~0.7.0", + "grunt-contrib-compress": "~0.8.0", "grunt-contrib-concat": "~0.4.0", "grunt-contrib-copy": "~0.5.0", "grunt-contrib-watch": "~0.6.1", From 06e6f84867a67c222ccd27d76cafebceb08639ba Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 9 Apr 2014 10:04:51 +0200 Subject: [PATCH 05/14] Handle webm playback errors with image expansion. --- CHANGELOG.md | 2 ++ src/Images/ImageExpand.coffee | 23 ++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21ece63cf..0f9a35998 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +- Better handling of webm playback errors. + ### 3.20.3 - *2014-04-07* - Dramatically decreased CPU usage by pausing webm files not in the viewport. diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index f21c830d2..d7d00c0cc 100644 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -17,6 +17,8 @@ ImageExpand = return unless @file and (@file.isImage or @file.isVideo) $.on @file.thumb.parentNode, 'click', ImageExpand.cb.toggle if @isClone + if @file.error + @file.error = $ '.warning', @file.thumb.parentNode if @file.isImage and @file.isExpanding # If we clone a post where the image is still loading, # make it loading in the clone too. @@ -83,7 +85,7 @@ ImageExpand = $.rmClass post.nodes.root, 'expanded-image' $.rmClass post.file.thumb, 'expanding' delete post.file.isExpanding - post.file.isExpanded = false + delete post.file.isExpanded post.file.fullImage.pause() if post.file.isVideo and post.file.fullImage expand: (post, src) -> @@ -102,6 +104,9 @@ ImageExpand = file.src = src or post.file.URL $.on file, 'error', ImageExpand.error ImageExpand.waitExpand post + if post.file.error + $.rm post.file.error + delete post.file.error $.after post.file.thumb, file waitExpand: (post) -> @@ -151,17 +156,29 @@ ImageExpand = error: -> post = Get.postFromNode @ - post.file.isReady = false $.rm @ + delete post.file.isReady delete post.file.fullImage # Images can error: # - before the image started loading. # - after the image started loading. unless post.file.isExpanding or post.file.isExpanded - # Don't try to re-expend if it was already contracted. + # Don't try to re-expand if it was already contracted. return ImageExpand.contract post + if @error and @error.code isnt @error.MEDIA_ERR_NETWORK # video + error = switch @error.code + when 1 then 'MEDIA_ERR_ABORTED' + when 3 then 'MEDIA_ERR_DECODE' + when 4 then 'MEDIA_ERR_SRC_NOT_SUPPORTED' + when 5 then 'MEDIA_ERR_ENCRYPTED' + post.file.error = $.el 'div', + textContent: "Playback error: #{error}" + className: 'warning' + $.after post.file.thumb, post.file.error + return + src = @src.split '/' if src[2] is 'i.4cdn.org' URL = Redirect.to 'file', From 662cff6396addcba8bb95898543f8c626973347e Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 9 Apr 2014 10:20:32 +0200 Subject: [PATCH 06/14] Don't keep running waitExpand's asap func when the image error'd. --- css/style.css | 3 +++ src/Images/ImageExpand.coffee | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/css/style.css b/css/style.css index 11857b167..323abf62f 100644 --- a/css/style.css +++ b/css/style.css @@ -677,6 +677,9 @@ a.hide-announcement { :root.gecko.fit-width .full-image { width: 100%; } +.fileThumb > .warning { + clear: both; +} #ihover { -moz-box-sizing: border-box; box-sizing: border-box; diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index d7d00c0cc..91136d9c4 100644 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -119,7 +119,7 @@ ImageExpand = file = post.file.fullImage if post.file.isImage - $.asap (-> file.naturalHeight), -> + $.asap (-> if post.file.isExpanding then file.naturalHeight else true), -> ImageExpand.completeExpand post return @@ -135,10 +135,9 @@ ImageExpand = $.on file, 'loadeddata', complete completeExpand: (post) -> - post.file.isReady = true - {thumb} = post.file return unless post.file.isExpanding # contracted before the image loaded delete post.file.isExpanding + post.file.isReady = true post.file.isExpanded = true unless post.nodes.root.parentNode # Image might start/finish loading before the post is inserted. From 221973c786582ef3e38805227483e5e445381ba0 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 9 Apr 2014 10:34:42 +0200 Subject: [PATCH 07/14] Better asap test for image hover. --- src/Images/ImageHover.coffee | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Images/ImageHover.coffee b/src/Images/ImageHover.coffee index 7e6f82a8d..35b3c6cf6 100644 --- a/src/Images/ImageHover.coffee +++ b/src/Images/ImageHover.coffee @@ -20,15 +20,13 @@ ImageHover = else Get.postFromNode @ el = if post.file.isImage - $.el 'img', - id: 'ihover' - src: post.file.URL + $.el 'img' else $.el 'video', - id: 'ihover' - src: post.file.URL autoplay: true loop: true + el.id = 'ihover' + el.src = post.file.URL el.dataset.fullID = post.fullID $.add d.body, el UI.hover @@ -36,7 +34,10 @@ ImageHover = el: el latestEvent: e endEvents: 'mouseout click' - asapTest: -> post.file.isVideo or el.naturalHeight + asapTest: if post.file.isImage + -> el.naturalHeight + else + -> el.readyState >= el.HAVE_CURRENT_DATA $.on el, 'error', ImageHover.error error: -> return unless doc.contains @ From 259fd0cc89c724f54cae7258ea3fe06ac16090a1 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 9 Apr 2014 10:51:14 +0200 Subject: [PATCH 08/14] Release 4chan X v3.20.4. --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f9a35998..1ea4eb2c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +### 3.20.4 - *2014-04-09* + - Better handling of webm playback errors. ### 3.20.3 - *2014-04-07* diff --git a/package.json b/package.json index 1c3ccb25f..023e556a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "3.20.3", + "version": "3.20.4", "description": "Cross-browser extension for productive lurking on 4chan.", "meta": { "name": "4chan X", From 9bb234ab5e18fdafa53892aa3972b1cf77060b90 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 9 Apr 2014 14:28:21 +0200 Subject: [PATCH 09/14] Better handling of videos inside of clones. --- src/Images/ImageExpand.coffee | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index 91136d9c4..7d477411f 100644 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -19,15 +19,11 @@ ImageExpand = if @isClone if @file.error @file.error = $ '.warning', @file.thumb.parentNode - if @file.isImage and @file.isExpanding - # If we clone a post where the image is still loading, - # make it loading in the clone too. + else if @file.isExpanding or @file.isExpanded + # Re-expand to make sure everything works/loads fine. ImageExpand.contract @ ImageExpand.expand @ return - if @file.isVideo and @file.isExpanded - @file.fullImage.play() - return if ImageExpand.on and !@isHidden and (Conf['Expand spoilers'] or !@file.isSpoiler) ImageExpand.expand @ cb: @@ -139,13 +135,16 @@ ImageExpand = delete post.file.isExpanding post.file.isReady = true post.file.isExpanded = true + if post.file.isVideo and !d.hidden and (post.isClone and !post.nodes.root.parentNode or Header.isNodeVisible post.nodes.root) + # Play the video if it's in a clone that hasn't been inserted yet, + # otherwise, check if it's in the viewport as usual. + post.file.fullImage.play() unless post.nodes.root.parentNode # Image might start/finish loading before the post is inserted. # Don't scroll when it's expanded in a QP for example. $.addClass post.nodes.root, 'expanded-image' $.rmClass post.file.thumb, 'expanding' return - post.file.fullImage.play() if post.file.isVideo and !d.hidden and Header.isNodeVisible post.nodes.root {bottom} = post.nodes.root.getBoundingClientRect() $.queueTask -> $.addClass post.nodes.root, 'expanded-image' From 5aa0c3f36d44fc09ce49b4141674fad7e4e1c748 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 9 Apr 2014 14:40:55 +0200 Subject: [PATCH 10/14] Oops, video.load() actually sets the autoplaying flag to true. --- src/Images/ImageExpand.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index 7d477411f..af0fea75b 100644 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -124,7 +124,6 @@ ImageExpand = ImageExpand.completeExpand post return - file.load() # Don't wait for the browser to lazily preload. complete = -> $.off file, 'loadeddata', complete ImageExpand.completeExpand post From a2cddaf7cd6358b1a978a958b98faf4f831b510e Mon Sep 17 00:00:00 2001 From: fgts Date: Thu, 10 Apr 2014 11:53:48 +0100 Subject: [PATCH 11/14] Update archives.json --- json/archives.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/json/archives.json b/json/archives.json index 73b76cd14..21c8357c7 100644 --- a/json/archives.json +++ b/json/archives.json @@ -95,8 +95,8 @@ "http": true, "https": true, "software": "foolfuuka", - "boards": ["cm", "hm", "r", "soc", "y"], - "files": ["cm", "hm", "r", "soc", "y"] + "boards": ["cm", "h", "hc", "hm", "r", "s", "soc", "y"], + "files": ["cm", "h", "hc", "hm", "r", "s", "soc", "y"] }, { "uid": 16, "name": "maware", From a4b9c303ab1f0bccd357a4911e52e4f393a8c3fe Mon Sep 17 00:00:00 2001 From: Mayhem Date: Thu, 10 Apr 2014 15:33:50 +0200 Subject: [PATCH 12/14] Don't leave an extra `>` when quoting. --- src/Posting/QR.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 994d5eaa3..81fa8c7f2 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -182,7 +182,7 @@ QR = $.prepend frag, $.tn '[code]' $.add frag, $.tn '[/code]' for node in $$ 'br', frag - $.replace node, $.tn '\n>' + $.replace node, $.tn '\n>' unless node is frag.lastElementChild for node in $$ 's', frag $.replace node, [$.tn('[spoiler]'), node.childNodes..., $.tn '[/spoiler]'] for node in $$ '.prettyprint', frag From 10ee666e7dc15d29188a621430aaab7c0cf8c507 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 12 Apr 2014 02:03:01 +0200 Subject: [PATCH 13/14] rm tmp conversion of hiddenThreads. --- src/Filtering/PostHiding.coffee | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/Filtering/PostHiding.coffee b/src/Filtering/PostHiding.coffee index d36796929..47afc0a12 100644 --- a/src/Filtering/PostHiding.coffee +++ b/src/Filtering/PostHiding.coffee @@ -12,15 +12,6 @@ PostHiding = name: 'Post Hiding' cb: @node - # XXX tmp conversion - $.get 'hiddenThreads', null, ({hiddenThreads}) -> - return unless hiddenThreads - for boardID, board of hiddenThreads.boards - for threadID, val of board - ((PostHiding.db.data.boards[boardID] or= {})[threadID] or= {})[threadID] = val - PostHiding.db.save() - $.delete 'hiddenThreads' - node: -> return if !@isReply and g.VIEW isnt 'index' or @isClone From c7b779526178282504646e9be10406a8de13534a Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 12 Apr 2014 18:00:22 +0200 Subject: [PATCH 14/14] Start supporting new semantics. --- CHANGELOG.md | 2 ++ html/General/Thread-catalog-view.html | 2 +- src/General/Build.coffee | 16 ++++++++-------- src/General/Get.coffee | 4 ++-- src/General/Main.coffee | 6 ++---- src/General/Post.coffee | 4 ++-- src/General/Settings.coffee | 2 +- src/Images/ImageExpand.coffee | 4 ++-- src/Images/ImageHover.coffee | 4 ++-- src/Miscellaneous/ExpandThread.coffee | 2 +- src/Miscellaneous/Keybinds.coffee | 2 +- src/Monitoring/ThreadUpdater.coffee | 2 +- src/Monitoring/ThreadWatcher.coffee | 4 ++-- src/Posting/QR.coffee | 4 ++-- src/Quotelinks/QuoteBacklink.coffee | 2 +- src/Quotelinks/Quotify.coffee | 2 +- 16 files changed, 31 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ea4eb2c1..6c5a95aaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +- Update 4chan namespaces support. + ### 3.20.4 - *2014-04-09* - Better handling of webm playback errors. diff --git a/html/General/Thread-catalog-view.html b/html/General/Thread-catalog-view.html index 798de0cb4..1df9afccb 100644 --- a/html/General/Thread-catalog-view.html +++ b/html/General/Thread-catalog-view.html @@ -1,4 +1,4 @@ - +
#{postCount} / #{fileCount} / #{pageCount} diff --git a/src/General/Build.coffee b/src/General/Build.coffee index decdc8465..fa015b1b5 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -42,14 +42,14 @@ Build = name: data.filename + data.ext timestamp: "#{data.tim}#{data.ext}" url: if boardID is 'f' - "//i.4cdn.org/#{boardID}/src/#{data.filename}#{data.ext}" + "//i.4cdn.org/#{boardID}/#{data.filename}#{data.ext}" else - "//i.4cdn.org/#{boardID}/src/#{data.tim}#{data.ext}" + "//i.4cdn.org/#{boardID}/#{data.tim}#{data.ext}" height: data.h width: data.w MD5: data.md5 size: data.fsize - turl: "//#{Build.thumbRotate()}.t.4cdn.org/#{boardID}/thumb/#{data.tim}s.jpg" + turl: "//#{Build.thumbRotate()}.t.4cdn.org/#{boardID}/#{data.tim}s.jpg" theight: data.tn_h twidth: data.tn_w isSpoiler: !!data.spoiler @@ -179,7 +179,7 @@ Build = if isOP and g.VIEW is 'index' pageNum = Index.liveThreadIDs.indexOf(postID) // Index.threadsNumPerPage pageIcon = " Page #{pageNum}" - replyLink = "   [Reply]" + replyLink = "   [Reply]" else pageIcon = replyLink = '' @@ -207,12 +207,12 @@ Build = ' ' + "#{date} " + "" + - "No." + + "No." + "#{postID}" + pageIcon + sticky + closed + replyLink + '' + @@ -227,7 +227,7 @@ Build = for quote in $$ '.quotelink', container href = quote.getAttribute 'href' continue if href[0] is '/' # Cross-board quote, or board link - quote.href = "/#{boardID}/res/#{href}" # Fix pathnames + quote.href = "/#{boardID}/thread/#{href}" # Fix pathnames container @@ -239,7 +239,7 @@ Build = $.el 'a', className: 'summary' textContent: text.join ' ' - href: "/#{boardID}/res/#{threadID}" + href: "/#{boardID}/thread/#{threadID}" thread: (board, data) -> Build.spoilerRange[board] = data.custom_spoiler diff --git a/src/General/Get.coffee b/src/General/Get.coffee index 116fdc784..dfb1e20ad 100644 --- a/src/General/Get.coffee +++ b/src/General/Get.coffee @@ -65,7 +65,7 @@ Get = root.textContent = "Loading post No.#{postID}..." if threadID - $.cache "//a.4cdn.org/#{boardID}/res/#{threadID}.json", -> + $.cache "//a.4cdn.org/#{boardID}/thread/#{threadID}.json", -> Get.fetchedPost @, boardID, threadID, postID, root, context else if url = Redirect.to 'post', {boardID, postID} $.cache url, @@ -219,7 +219,7 @@ Get = width: data.media.media_w MD5: data.media.media_hash size: data.media.media_size - turl: data.media.thumb_link or "//t.4cdn.org/#{boardID}/thumb/#{data.media.preview_orig}" + turl: data.media.thumb_link or "//t.4cdn.org/#{boardID}/#{data.media.preview_orig}" theight: data.media.preview_h twidth: data.media.preview_w isSpoiler: data.media.spoiler is '1' diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 7795c47b2..5b61ccacb 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -5,10 +5,8 @@ Main = return if g.BOARD.ID in ['z', 'fk'] g.VIEW = switch pathname[2] - when 'res' - 'thread' - when 'catalog' - 'catalog' + when 'thread', 'catalog' + pathname[2] else 'index' if g.VIEW is 'catalog' diff --git a/src/General/Post.coffee b/src/General/Post.coffee index 8556d3fe6..ff4eb437a 100644 --- a/src/General/Post.coffee +++ b/src/General/Post.coffee @@ -98,7 +98,7 @@ class Post return unless match = quotelink.href.match /// boards\.4chan\.org/ ([^/]+) # boardID - /res/\d+#p + /thread/\d+#p (\d+) # postID $ /// @@ -131,7 +131,7 @@ class Post @file.thumbURL = if that.isArchived thumb.src else - "#{location.protocol}//t.4cdn.org/#{@board}/thumb/#{@file.URL.match(/(\d+)\./)[1]}s.jpg" + "#{location.protocol}//t.4cdn.org/#{@board}/#{@file.URL.match(/(\d+)\./)[1]}s.jpg" @file.name = if nameNode = $ 'span', fileText nameNode.title or nameNode.textContent else diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index b6e614267..b3fa0bda8 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -298,7 +298,7 @@ Settings = data = isReply: true file: - URL: '//i.4cdn.org/g/src/1334437723720.jpg' + URL: '//i.4cdn.org/g/1334437723720.jpg' name: 'd9bb2efc98dd0df141a94399ff5880b7.jpg' size: '276 KB' sizeInBytes: 276 * 1024 diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index af0fea75b..7c2310260 100644 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -180,7 +180,7 @@ ImageExpand = if src[2] is 'i.4cdn.org' URL = Redirect.to 'file', boardID: src[3] - filename: src[5].replace /\?.+$/, '' + filename: src[4].replace /\?.+$/, '' if URL setTimeout ImageExpand.expand, 10000, post, URL return @@ -198,7 +198,7 @@ ImageExpand = type: 'head' <% } else { %> # XXX CORS for i.4cdn.org WHEN? - $.ajax "//a.4cdn.org/#{post.board}/res/#{post.thread}.json", onload: -> + $.ajax "//a.4cdn.org/#{post.board}/thread/#{post.thread}.json", onload: -> return if @status isnt 200 for postObj in @response.posts break if postObj.no is post.ID diff --git a/src/Images/ImageHover.coffee b/src/Images/ImageHover.coffee index 35b3c6cf6..2da52b83f 100644 --- a/src/Images/ImageHover.coffee +++ b/src/Images/ImageHover.coffee @@ -47,7 +47,7 @@ ImageHover = if src[2] is 'i.4cdn.org' URL = Redirect.to 'file', boardID: src[3] - filename: src[5].replace /\?.+$/, '' + filename: src[4].replace /\?.+$/, '' if URL @src = URL return @@ -65,7 +65,7 @@ ImageHover = type: 'head' <% } else { %> # XXX CORS for i.4cdn.org WHEN? - $.ajax "//a.4cdn.org/#{post.board}/res/#{post.thread}.json", onload: -> + $.ajax "//a.4cdn.org/#{post.board}/thread/#{post.thread}.json", onload: -> return if @status isnt 200 for postObj in @response.posts break if postObj.no is post.ID diff --git a/src/Miscellaneous/ExpandThread.coffee b/src/Miscellaneous/ExpandThread.coffee index 8cfb24411..8958640bb 100644 --- a/src/Miscellaneous/ExpandThread.coffee +++ b/src/Miscellaneous/ExpandThread.coffee @@ -39,7 +39,7 @@ ExpandThread = expand: (thread, a, threadRoot) -> ExpandThread.statuses[thread] = status = {} a.textContent = ExpandThread.text '...', a.textContent.match(/\d+/g)... - status.req = $.cache "//a.4cdn.org/#{thread.board}/res/#{thread}.json", -> + status.req = $.cache "//a.4cdn.org/#{thread.board}/thread/#{thread}.json", -> delete status.req ExpandThread.parse @, thread, a contract: (thread, a, threadRoot) -> diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index 54d41a222..45580ee4d 100644 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -187,7 +187,7 @@ Keybinds = open: (thread, tab) -> return if g.VIEW isnt 'index' - url = "/#{thread.board}/res/#{thread}" + url = "/#{thread.board}/thread/#{thread}" if tab $.open url else diff --git a/src/Monitoring/ThreadUpdater.coffee b/src/Monitoring/ThreadUpdater.coffee index 39dc11170..838b4403d 100644 --- a/src/Monitoring/ThreadUpdater.coffee +++ b/src/Monitoring/ThreadUpdater.coffee @@ -153,7 +153,7 @@ ThreadUpdater = ThreadUpdater.count() ThreadUpdater.set 'timer', '...' ThreadUpdater.req?.abort() - url = "//a.4cdn.org/#{ThreadUpdater.thread.board}/res/#{ThreadUpdater.thread}.json" + url = "//a.4cdn.org/#{ThreadUpdater.thread.board}/thread/#{ThreadUpdater.thread}.json" ThreadUpdater.req = $.ajax url, onabort: ThreadUpdater.cb.load onloadend: ThreadUpdater.cb.load diff --git a/src/Monitoring/ThreadWatcher.coffee b/src/Monitoring/ThreadWatcher.coffee index da939918c..21c0a3e2d 100644 --- a/src/Monitoring/ThreadWatcher.coffee +++ b/src/Monitoring/ThreadWatcher.coffee @@ -99,7 +99,7 @@ ThreadWatcher = return if data.isDead {fetchCount} = ThreadWatcher fetchCount.fetching++ - $.ajax "//a.4cdn.org/#{boardID}/res/#{threadID}.json", + $.ajax "//a.4cdn.org/#{boardID}/thread/#{threadID}.json", onloadend: -> fetchCount.fetched++ if fetchCount.fetched is fetchCount.fetching @@ -137,7 +137,7 @@ ThreadWatcher = if data.isDead href = Redirect.to 'thread', {boardID, threadID} link = $.el 'a', - href: href or "/#{boardID}/res/#{threadID}" + href: href or "/#{boardID}/thread/#{threadID}" textContent: data.excerpt title: data.excerpt diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 81fa8c7f2..87edcf3a6 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -587,9 +587,9 @@ QR = QR.cooldown.set {req, post, isReply, threadID} URL = if threadID is postID # new thread - "/#{g.BOARD}/res/#{threadID}" + "/#{g.BOARD}/thread/#{threadID}" else if g.VIEW is 'index' and !QR.cooldown.auto and Conf['Open Post in New Tab'] # replying from the index - "/#{g.BOARD}/res/#{threadID}#p#{postID}" + "/#{g.BOARD}/thread/#{threadID}#p#{postID}" if URL if Conf['Open Post in New Tab'] $.open URL diff --git a/src/Quotelinks/QuoteBacklink.coffee b/src/Quotelinks/QuoteBacklink.coffee index f04c0a555..03e11b980 100644 --- a/src/Quotelinks/QuoteBacklink.coffee +++ b/src/Quotelinks/QuoteBacklink.coffee @@ -49,7 +49,7 @@ QuoteBacklink = buildBacklink: (quoted, quoter) -> frag = QuoteBacklink.frag.cloneNode true a = frag.lastElementChild - a.href = "/#{quoter.board}/res/#{quoter.thread}#p#{quoter}" + a.href = "/#{quoter.board}/thread/#{quoter.thread}#p#{quoter}" a.textContent = text = QuoteBacklink.funk quoter.ID if quoter.isDead $.addClass a, 'deadlink' diff --git a/src/Quotelinks/Quotify.coffee b/src/Quotelinks/Quotify.coffee index 333f47ec1..d3866921e 100644 --- a/src/Quotelinks/Quotify.coffee +++ b/src/Quotelinks/Quotify.coffee @@ -40,7 +40,7 @@ Quotify = # Don't add 'deadlink' when quotifying in an archived post, # and we don't know if the post died yet. a = $.el 'a', - href: "/#{boardID}/res/#{post.thread}#p#{postID}" + href: "/#{boardID}/thread/#{post.thread}#p#{postID}" className: if post.isDead then 'quotelink deadlink' else 'quotelink' textContent: quote $.extend a.dataset, {boardID, threadID: post.thread.ID, postID}