WebExtensions doesn't like protocol relative URLs in AJAX requests.
This commit is contained in:
parent
a09d3e846d
commit
c41c6d412b
@ -4,7 +4,7 @@ BoardConfig =
|
||||
init: ->
|
||||
now = Date.now()
|
||||
unless now - 2 * $.HOUR < (Conf['boardConfig'].lastChecked or 0) <= now
|
||||
$.ajax '//a.4cdn.org/boards.json',
|
||||
$.ajax "#{location.protocol}//a.4cdn.org/boards.json",
|
||||
onloadend: @load
|
||||
else
|
||||
@set Conf['boardConfig'].boards
|
||||
|
||||
@ -65,7 +65,7 @@ Build.Test =
|
||||
|
||||
testOne: (post) ->
|
||||
Build.Test.postsRemaining++
|
||||
$.cache "//a.4cdn.org/#{post.board.ID}/thread/#{post.thread.ID}.json", ->
|
||||
$.cache "#{location.protocol}//a.4cdn.org/#{post.board.ID}/thread/#{post.thread.ID}.json", ->
|
||||
{posts} = @response
|
||||
Build.spoilerRange[post.board.ID] = posts[0].custom_spoiler
|
||||
for postData in posts
|
||||
|
||||
@ -591,7 +591,7 @@ Index =
|
||||
location.reload()
|
||||
return
|
||||
|
||||
Index.req = $.ajax "//a.4cdn.org/#{g.BOARD}/catalog.json",
|
||||
Index.req = $.ajax "#{location.protocol}//a.4cdn.org/#{g.BOARD}/catalog.json",
|
||||
onabort: Index.load
|
||||
onloadend: Index.load
|
||||
,
|
||||
|
||||
@ -54,7 +54,7 @@ ImageCommon =
|
||||
clearTimeout timeoutID if delay?
|
||||
cb URL
|
||||
|
||||
$.ajax "//a.4cdn.org/#{post.board}/thread/#{post.thread}.json", onload: ->
|
||||
$.ajax "#{location.protocol}//a.4cdn.org/#{post.board}/thread/#{post.thread}.json", onload: ->
|
||||
post.kill !post.isClone if @status is 404
|
||||
return redirect() if @status isnt 200
|
||||
for postObj in @response.posts
|
||||
|
||||
@ -376,7 +376,7 @@ Embedding =
|
||||
$.el 'iframe',
|
||||
src: "https://w.soundcloud.com/player/?visual=true&show_comments=false&url=https%3A%2F%2Fsoundcloud.com%2F#{encodeURIComponent a.dataset.uid}"
|
||||
title:
|
||||
api: (uid) -> "//soundcloud.com/oembed?format=json&url=https%3A%2F%2Fsoundcloud.com%2F#{encodeURIComponent uid}"
|
||||
api: (uid) -> "#{location.protocol}//soundcloud.com/oembed?format=json&url=https%3A%2F%2Fsoundcloud.com%2F#{encodeURIComponent uid}"
|
||||
text: (_) -> _.title
|
||||
,
|
||||
key: 'StrawPoll'
|
||||
|
||||
@ -26,7 +26,7 @@ ExpandComment =
|
||||
return
|
||||
return if not (a = $ '.abbr > a', post.nodes.comment)
|
||||
a.textContent = "Post No.#{post} Loading..."
|
||||
$.cache "//a.4cdn.org#{a.pathname.split(/\/+/).splice(0,4).join('/')}.json", -> ExpandComment.parse @, a, post
|
||||
$.cache "#{location.protocol}//a.4cdn.org#{a.pathname.split(/\/+/).splice(0,4).join('/')}.json", -> ExpandComment.parse @, a, post
|
||||
|
||||
contract: (post) ->
|
||||
return unless post.nodes.shortComment
|
||||
|
||||
@ -43,7 +43,7 @@ ExpandThread =
|
||||
expand: (thread, a) ->
|
||||
ExpandThread.statuses[thread] = status = {}
|
||||
a.textContent = Build.summaryText '...', a.textContent.match(/\d+/g)...
|
||||
status.req = $.cache "//a.4cdn.org/#{thread.board}/thread/#{thread}.json", ->
|
||||
status.req = $.cache "#{location.protocol}//a.4cdn.org/#{thread.board}/thread/#{thread}.json", ->
|
||||
delete status.req
|
||||
ExpandThread.parse @, thread, a
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ ThreadStats =
|
||||
$.addClass ThreadStats.pageCountEl, 'warning'
|
||||
return
|
||||
ThreadStats.timeout = setTimeout ThreadStats.fetchPage, 2 * $.MINUTE
|
||||
$.ajax "//a.4cdn.org/#{ThreadStats.thread.board}/threads.json", onload: ThreadStats.onThreadsLoad,
|
||||
$.ajax "#{location.protocol}//a.4cdn.org/#{ThreadStats.thread.board}/threads.json", onload: ThreadStats.onThreadsLoad,
|
||||
whenModified: 'ThreadStats'
|
||||
|
||||
onThreadsLoad: ->
|
||||
|
||||
@ -138,7 +138,7 @@ ThreadUpdater =
|
||||
ThreadUpdater.setInterval()
|
||||
when 404
|
||||
# XXX workaround for 4chan sending false 404s
|
||||
$.ajax "//a.4cdn.org/#{ThreadUpdater.thread.board}/catalog.json", onloadend: ->
|
||||
$.ajax "#{location.protocol}//a.4cdn.org/#{ThreadUpdater.thread.board}/catalog.json", onloadend: ->
|
||||
if @status is 200
|
||||
confirmed = true
|
||||
for page in @response
|
||||
@ -231,7 +231,7 @@ ThreadUpdater =
|
||||
clearTimeout ThreadUpdater.timeoutID
|
||||
ThreadUpdater.set 'timer', '...', 'loading'
|
||||
ThreadUpdater.req?.abort()
|
||||
ThreadUpdater.req = $.ajax "//a.4cdn.org/#{ThreadUpdater.thread.board}/thread/#{ThreadUpdater.thread}.json",
|
||||
ThreadUpdater.req = $.ajax "#{location.protocol}//a.4cdn.org/#{ThreadUpdater.thread.board}/thread/#{ThreadUpdater.thread}.json",
|
||||
onloadend: ThreadUpdater.cb.load
|
||||
timeout: $.MINUTE
|
||||
,
|
||||
|
||||
@ -211,7 +211,7 @@ ThreadWatcher =
|
||||
if ThreadWatcher.requests.length is 0
|
||||
ThreadWatcher.status.textContent = '...'
|
||||
$.addClass ThreadWatcher.refreshButton, 'fa-spin'
|
||||
req = $.ajax "//a.4cdn.org/#{boardID}/thread/#{threadID}.json",
|
||||
req = $.ajax "#{location.protocol}//a.4cdn.org/#{boardID}/thread/#{threadID}.json",
|
||||
onloadend: ->
|
||||
ThreadWatcher.parseStatus.call @, thread
|
||||
timeout: $.MINUTE
|
||||
|
||||
@ -91,9 +91,9 @@ class DataBoard
|
||||
return
|
||||
|
||||
ajaxClean: (boardID) ->
|
||||
$.cache "//a.4cdn.org/#{boardID}/threads.json", (e1) =>
|
||||
$.cache "#{location.protocol}//a.4cdn.org/#{boardID}/threads.json", (e1) =>
|
||||
return unless e1.target.status in [200, 404]
|
||||
$.cache "//a.4cdn.org/#{boardID}/archive.json", (e2) =>
|
||||
$.cache "#{location.protocol}//a.4cdn.org/#{boardID}/archive.json", (e2) =>
|
||||
return unless e2.target.status in [200, 404]
|
||||
@ajaxCleanParse boardID, e1.target.response, e2.target.response
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ class Fetcher
|
||||
|
||||
@root.textContent = "Loading post No.#{@postID}..."
|
||||
if @threadID
|
||||
$.cache "//a.4cdn.org/#{@boardID}/thread/#{@threadID}.json", (e, isCached) =>
|
||||
$.cache "#{location.protocol}//a.4cdn.org/#{@boardID}/thread/#{@threadID}.json", (e, isCached) =>
|
||||
@fetchedPost e.target, isCached
|
||||
else
|
||||
@archivedPost()
|
||||
@ -78,7 +78,7 @@ class Fetcher
|
||||
if post.no isnt @postID
|
||||
# Cached requests can be stale and must be rechecked.
|
||||
if isCached
|
||||
api = "//a.4cdn.org/#{@boardID}/thread/#{@threadID}.json"
|
||||
api = "#{location.protocol}//a.4cdn.org/#{@boardID}/thread/#{@threadID}.json"
|
||||
$.cleanCache (url) -> url is api
|
||||
$.cache api, (e) =>
|
||||
@fetchedPost e.target, false
|
||||
|
||||
@ -315,7 +315,7 @@ Main =
|
||||
threads[0].ipCount = if m = scriptData.match /\bunique_ips *= *(\d+)\b/ then +m[1]
|
||||
|
||||
if g.BOARD.ID is 'f' and g.VIEW is 'thread'
|
||||
$.ajax "//a.4cdn.org/f/thread/#{g.THREADID}.json",
|
||||
$.ajax "#{location.protocol}//a.4cdn.org/f/thread/#{g.THREADID}.json",
|
||||
timeout: $.MINUTE
|
||||
onloadend: ->
|
||||
if @response and posts[0].file
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user