diff --git a/CHANGELOG.md b/CHANGELOG.md index 837e00d1c..4035b2d2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ - **New option**: `Auto-hide header on scroll`. +- Added support for `4cdn.org`. ## 3.13.0 - *2013-11-16* diff --git a/package.json b/package.json index 51a2aaa56..f297c9f51 100644 --- a/package.json +++ b/package.json @@ -9,10 +9,10 @@ "buildsPath": "builds/", "mainBranch": "v3", "matches": [ - "*://api.4chan.org/*", "*://boards.4chan.org/*", - "*://images.4chan.org/*", - "*://sys.4chan.org/*" + "*://sys.4chan.org/*", + "*://a.4cdn.org/*", + "*://i.4cdn.org/*" ], "min": { "chrome": "29", diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index 920bfe4f2..a5ecb82de 100644 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -58,7 +58,7 @@ ThreadHiding = # We need to clean hidden threads on the catalog ourselves, # otherwise if we don't visit the catalog regularly # it will pollute the localStorage and our data. - $.cache "//api.4chan.org/#{g.BOARD}/threads.json", -> + $.cache "//a.4cdn.org/#{g.BOARD}/threads.json", -> return unless @status is 200 threads = {} for page in JSON.parse @response diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 8c4c96144..1536bb30f 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -36,14 +36,14 @@ Build = name: data.filename + data.ext timestamp: "#{data.tim}#{data.ext}" url: if boardID is 'f' - "//images.4channel.org/#{boardID}/src/#{data.filename}#{data.ext}" + "//i.4cdn.org/#{boardID}/src/#{data.filename}#{data.ext}" else - "//images.4chan.org/#{boardID}/src/#{data.tim}#{data.ext}" + "//i.4cdn.org/#{boardID}/src/#{data.tim}#{data.ext}" height: data.h width: data.w MD5: data.md5 size: data.fsize - turl: "//thumbs.4chan.org/#{boardID}/thumb/#{data.tim}s.jpg" + turl: "//t.4cdn.org/#{boardID}/thumb/#{data.tim}s.jpg" theight: data.tn_h twidth: data.tn_w isSpoiler: !!data.spoiler @@ -59,7 +59,7 @@ Build = } = o isOP = postID is threadID - staticPath = '//static.4chan.org/image/' + staticPath = '//s.4cdn.org/image/' gifIcon = if window.devicePixelRatio >= 2 '@2x.gif' else diff --git a/src/General/DataBoard.coffee b/src/General/DataBoard.coffee index 0e366ff50..c3e9a6ebc 100644 --- a/src/General/DataBoard.coffee +++ b/src/General/DataBoard.coffee @@ -69,7 +69,7 @@ class DataBoard @save() ajaxClean: (boardID) -> - $.cache "//api.4chan.org/#{boardID}/threads.json", (e) => + $.cache "//a.4cdn.org/#{boardID}/threads.json", (e) => if e.target.status isnt 200 @delete boardID if e.target.status is 404 return diff --git a/src/General/Get.coffee b/src/General/Get.coffee index d19e8db11..e2afc668a 100644 --- a/src/General/Get.coffee +++ b/src/General/Get.coffee @@ -70,7 +70,7 @@ Get = root.textContent = "Loading post No.#{postID}..." if threadID - $.cache "//api.4chan.org/#{boardID}/res/#{threadID}.json", -> + $.cache "//a.4cdn.org/#{boardID}/res/#{threadID}.json", -> Get.fetchedPost @, boardID, threadID, postID, root, context else if url = Redirect.to 'post', {boardID, postID} $.cache url, @@ -222,7 +222,7 @@ Get = width: data.media.media_w MD5: data.media.media_hash size: data.media.media_size - turl: data.media.thumb_link or "//thumbs.4chan.org/#{boardID}/thumb/#{data.media.preview_orig}" + turl: data.media.thumb_link or "//t.4cdn.org/#{boardID}/thumb/#{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/Index.coffee b/src/General/Index.coffee index 14af9acbc..81c04d9bb 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -188,7 +188,7 @@ Index = return unless Index.req and !Index.notice Index.notice = new Notice 'info', 'Refreshing index...' ), 5 * $.SECOND - (Date.now() - now) - Index.req = $.ajax "//api.4chan.org/#{g.BOARD}/catalog.json", + Index.req = $.ajax "//a.4cdn.org/#{g.BOARD}/catalog.json", onabort: Index.load onloadend: Index.load , diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 56dc4d618..07d495cde 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -38,12 +38,12 @@ Main = initFeatures: -> switch location.hostname - when 'api.4chan.org' + when 'a.4cdn.org' return when 'sys.4chan.org' Report.init() return - when 'images.4chan.org' + when 'i.4cdn.org' $.ready -> if Conf['404 Redirect'] and d.title is '4chan - 404 Not Found' Redirect.init() diff --git a/src/General/Post.coffee b/src/General/Post.coffee index 5cb484309..f7bc31918 100644 --- a/src/General/Post.coffee +++ b/src/General/Post.coffee @@ -127,7 +127,7 @@ class Post @file.thumbURL = if that.isArchived thumb.src else - "#{location.protocol}//thumbs.4chan.org/#{@board}/thumb/#{@file.URL.match(/(\d+)\./)[1]}s.jpg" + "#{location.protocol}//t.4cdn.org/#{@board}/thumb/#{@file.URL.match(/(\d+)\./)[1]}s.jpg" @file.name = $('span[title]', fileInfo).title <% if (type === 'crx') { %> # replace %22 with quotes, see: diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 4c0499e4c..8f7cc2d5c 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -353,7 +353,7 @@ Settings = data = isReply: true file: - URL: '//images.4chan.org/g/src/1334437723720.jpg' + URL: '//i.4cdn.org/g/src/1334437723720.jpg' name: 'd9bb2efc98dd0df141a94399ff5880b7.jpg' size: '276 KB' sizeInBytes: 276 * 1024 diff --git a/src/General/Thread.coffee b/src/General/Thread.coffee index 60de5ed4d..27987723d 100644 --- a/src/General/Thread.coffee +++ b/src/General/Thread.coffee @@ -27,7 +27,7 @@ class Thread $.rm $ ".#{typeLC}Icon", @OP.nodes.info return icon = $.el 'img', - src: "//static.4chan.org/image/#{typeLC}#{if window.devicePixelRatio >= 2 then '@2x' else ''}.gif" + src: "//s.4cdn.org/image/#{typeLC}#{if window.devicePixelRatio >= 2 then '@2x' else ''}.gif" alt: type title: type className: "#{typeLC}Icon" diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index 8d20eb4bb..47779828b 100644 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -121,7 +121,7 @@ ImageExpand = ImageExpand.contract post src = @src.split '/' - if src[2] is 'images.4chan.org' + if src[2] is 'i.4cdn.org' URL = Redirect.to 'file', boardID: src[3] filename: src[5].replace /\?.+$/, '' @@ -132,8 +132,8 @@ ImageExpand = return timeoutID = setTimeout ImageExpand.expand, 10000, post - # XXX CORS for images.4chan.org WHEN? - $.ajax "//api.4chan.org/#{post.board}/res/#{post.thread}.json", onload: -> + # XXX CORS for i.4cdn.org WHEN? + $.ajax "//a.4cdn.org/#{post.board}/res/#{post.thread}.json", onload: -> return if @status isnt 200 for postObj in JSON.parse(@response).posts break if postObj.no is post.ID diff --git a/src/Images/ImageHover.coffee b/src/Images/ImageHover.coffee index c2c1eac99..5e1dcd501 100644 --- a/src/Images/ImageHover.coffee +++ b/src/Images/ImageHover.coffee @@ -27,7 +27,7 @@ ImageHover = post = g.posts[@dataset.fullID] src = @src.split '/' - if src[2] is 'images.4chan.org' + if src[2] is 'i.4cdn.org' URL = Redirect.to 'file', boardID: src[3] filename: src[5].replace /\?.+$/, '' @@ -38,8 +38,8 @@ ImageHover = return timeoutID = setTimeout (=> @src = post.file.URL + '?' + Date.now()), 3000 - # XXX CORS for images.4chan.org WHEN? - $.ajax "//api.4chan.org/#{post.board}/res/#{post.thread}.json", onload: -> + # XXX CORS for i.4cdn.org WHEN? + $.ajax "//a.4cdn.org/#{post.board}/res/#{post.thread}.json", onload: -> return if @status isnt 200 for postObj in JSON.parse(@response).posts break if postObj.no is post.ID diff --git a/src/Miscellaneous/ExpandThread.coffee b/src/Miscellaneous/ExpandThread.coffee index 086f76d8d..3acd11bba 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 "//api.4chan.org/#{thread.board}/res/#{thread}.json", -> + status.req = $.cache "//a.4cdn.org/#{thread.board}/res/#{thread}.json", -> delete status.req ExpandThread.parse @, thread, a contract: (thread, a, threadRoot) -> diff --git a/src/Monitoring/ThreadStats.coffee b/src/Monitoring/ThreadStats.coffee index 89d1be0c8..dc189a572 100644 --- a/src/Monitoring/ThreadStats.coffee +++ b/src/Monitoring/ThreadStats.coffee @@ -37,7 +37,7 @@ ThreadStats = $.addClass ThreadStats.pageCountEl, 'warning' return setTimeout ThreadStats.fetchPage, 2 * $.MINUTE - $.ajax "//api.4chan.org/#{ThreadStats.thread.board}/threads.json", onload: ThreadStats.onThreadsLoad, + $.ajax "//a.4cdn.org/#{ThreadStats.thread.board}/threads.json", onload: ThreadStats.onThreadsLoad, whenModified: true onThreadsLoad: -> return if @status isnt 200 diff --git a/src/Monitoring/ThreadUpdater.coffee b/src/Monitoring/ThreadUpdater.coffee index 0ef1d04bf..f42dc1283 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 = "//api.4chan.org/#{ThreadUpdater.thread.board}/res/#{ThreadUpdater.thread}.json" + url = "//a.4cdn.org/#{ThreadUpdater.thread.board}/res/#{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 ad9e710ee..3eac7ae4c 100644 --- a/src/Monitoring/ThreadWatcher.coffee +++ b/src/Monitoring/ThreadWatcher.coffee @@ -100,7 +100,7 @@ ThreadWatcher = return if data.isDead {fetchCount} = ThreadWatcher fetchCount.fetching++ - $.ajax "//api.4chan.org/#{boardID}/res/#{threadID}.json", + $.ajax "//a.4cdn.org/#{boardID}/res/#{threadID}.json", onloadend: -> fetchCount.fetched++ if fetchCount.fetched is fetchCount.fetching