Get rid of more API URLs spread about the codebase.
This commit is contained in:
parent
3da684a08c
commit
19c7e73d14
@ -65,7 +65,7 @@ Build.Test =
|
||||
|
||||
testOne: (post) ->
|
||||
Build.Test.postsRemaining++
|
||||
$.cache "#{location.protocol}//a.4cdn.org/#{post.board.ID}/thread/#{post.thread.ID}.json", ->
|
||||
$.cache Site.urls.threadJSON({boardID: post.boardID, threadID: post.threadID}), ->
|
||||
return unless @response
|
||||
{posts} = @response
|
||||
Build.spoilerRange[post.board.ID] = posts[0].custom_spoiler
|
||||
|
||||
@ -26,7 +26,7 @@ ExpandComment =
|
||||
return
|
||||
return if not (a = $ '.abbr > a', post.nodes.comment)
|
||||
a.textContent = "Post No.#{post} Loading..."
|
||||
$.cache "#{location.protocol}//a.4cdn.org#{a.pathname.split(/\/+/).splice(0,4).join('/')}.json", -> ExpandComment.parse @, a, post
|
||||
$.cache Site.urls.threadJSON({boardID: post.boardID, threadID: post.threadID}), -> ExpandComment.parse @, a, post
|
||||
|
||||
contract: (post) ->
|
||||
return unless post.nodes.shortComment
|
||||
|
||||
@ -138,7 +138,7 @@ ThreadUpdater =
|
||||
ThreadUpdater.setInterval()
|
||||
when 404
|
||||
# XXX workaround for 4chan sending false 404s
|
||||
$.ajax "#{location.protocol}//a.4cdn.org/#{ThreadUpdater.thread.board}/catalog.json", onloadend: ->
|
||||
$.ajax Site.urls.catalogJSON({boardID: ThreadUpdater.thread.board.ID}), onloadend: ->
|
||||
if @status is 200
|
||||
confirmed = true
|
||||
for page in @response
|
||||
|
||||
@ -16,7 +16,7 @@ class Fetcher
|
||||
@root.textContent = "Loading post No.#{@postID}..."
|
||||
if @threadID
|
||||
that = @
|
||||
$.cache "#{location.protocol}//a.4cdn.org/#{@boardID}/thread/#{@threadID}.json", ({isCached}) ->
|
||||
$.cache Site.urls.threadJSON({boardID: @boardID, threadID: @threadID}), ({isCached}) ->
|
||||
that.fetchedPost @, isCached
|
||||
else
|
||||
@archivedPost()
|
||||
@ -81,7 +81,7 @@ class Fetcher
|
||||
if post.no isnt @postID
|
||||
# Cached requests can be stale and must be rechecked.
|
||||
if isCached
|
||||
api = "#{location.protocol}//a.4cdn.org/#{@boardID}/thread/#{@threadID}.json"
|
||||
api = Site.urls.threadJSON({boardID: @boardID, threadID: @threadID})
|
||||
$.cleanCache (url) -> url is api
|
||||
that = @
|
||||
$.cache api, ->
|
||||
|
||||
@ -98,7 +98,7 @@ SW.yotsuba =
|
||||
|
||||
if g.BOARD.ID is 'f' and thread.OP.file
|
||||
{file} = thread.OP
|
||||
$.ajax "#{location.protocol}//a.4cdn.org/f/thread/#{thread}.json",
|
||||
$.ajax Site.urls.threadJSON({boardID: 'f', threadID: thread.ID}),
|
||||
timeout: $.MINUTE
|
||||
onloadend: ->
|
||||
if @response
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user