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