diff --git a/src/General/BoardConfig.coffee b/src/General/BoardConfig.coffee index 206d78d49..bd05250a0 100644 --- a/src/General/BoardConfig.coffee +++ b/src/General/BoardConfig.coffee @@ -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 diff --git a/src/General/Build.Test.coffee b/src/General/Build.Test.coffee index b12520405..9ff50cceb 100644 --- a/src/General/Build.Test.coffee +++ b/src/General/Build.Test.coffee @@ -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 diff --git a/src/General/Index.coffee b/src/General/Index.coffee index e1fb9cb69..8e5ebd73b 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -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 , diff --git a/src/Images/ImageCommon.coffee b/src/Images/ImageCommon.coffee index 7ec92690e..eec68dafa 100644 --- a/src/Images/ImageCommon.coffee +++ b/src/Images/ImageCommon.coffee @@ -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 diff --git a/src/Linkification/Embedding.coffee b/src/Linkification/Embedding.coffee index 473050a88..f6d398160 100644 --- a/src/Linkification/Embedding.coffee +++ b/src/Linkification/Embedding.coffee @@ -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' diff --git a/src/Miscellaneous/ExpandComment.coffee b/src/Miscellaneous/ExpandComment.coffee index 91cfe17dc..09d596774 100644 --- a/src/Miscellaneous/ExpandComment.coffee +++ b/src/Miscellaneous/ExpandComment.coffee @@ -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 diff --git a/src/Miscellaneous/ExpandThread.coffee b/src/Miscellaneous/ExpandThread.coffee index ce9e1d91a..0fba9b288 100644 --- a/src/Miscellaneous/ExpandThread.coffee +++ b/src/Miscellaneous/ExpandThread.coffee @@ -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 diff --git a/src/Monitoring/ThreadStats.coffee b/src/Monitoring/ThreadStats.coffee index 1ad67cb3c..a274ac80a 100644 --- a/src/Monitoring/ThreadStats.coffee +++ b/src/Monitoring/ThreadStats.coffee @@ -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: -> diff --git a/src/Monitoring/ThreadUpdater.coffee b/src/Monitoring/ThreadUpdater.coffee index f2596a8da..d23988e62 100644 --- a/src/Monitoring/ThreadUpdater.coffee +++ b/src/Monitoring/ThreadUpdater.coffee @@ -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 , diff --git a/src/Monitoring/ThreadWatcher.coffee b/src/Monitoring/ThreadWatcher.coffee index 970921c60..144a8a34b 100644 --- a/src/Monitoring/ThreadWatcher.coffee +++ b/src/Monitoring/ThreadWatcher.coffee @@ -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 diff --git a/src/classes/DataBoard.coffee b/src/classes/DataBoard.coffee index 8bcd7a3bb..7c89a4a8d 100644 --- a/src/classes/DataBoard.coffee +++ b/src/classes/DataBoard.coffee @@ -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 diff --git a/src/classes/Fetcher.coffee b/src/classes/Fetcher.coffee index 38c846c11..d268c73d1 100644 --- a/src/classes/Fetcher.coffee +++ b/src/classes/Fetcher.coffee @@ -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 diff --git a/src/main/Main.coffee b/src/main/Main.coffee index 0aeed1220..6841ead9a 100644 --- a/src/main/Main.coffee +++ b/src/main/Main.coffee @@ -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