From c7b779526178282504646e9be10406a8de13534a Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 12 Apr 2014 18:00:22 +0200 Subject: [PATCH] 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}