Merge branch 'testing'

This commit is contained in:
ccd0 2014-07-13 13:25:21 -07:00
commit 70ad4dd289
5 changed files with 18 additions and 5 deletions

View File

@ -53,7 +53,9 @@ Redirect =
post: (archive, {boardID, postID}) ->
# For fuuka-based archives:
# https://github.com/eksopl/fuuka/issues/27
URL = new String "#{Redirect.protocol archive}#{archive.domain}/_/api/chan/post/?board=#{boardID}&num=#{postID}"
protocol = Redirect.protocol archive
return '' unless protocol is 'https://' or location.protocol is 'http:'
URL = new String "#{protocol}#{archive.domain}/_/api/chan/post/?board=#{boardID}&num=#{postID}"
URL.archive = archive
URL
@ -73,3 +75,13 @@ Redirect =
else
"#{boardID}/?task=search2&search_#{if type is 'image' then 'media_hash' else type}=#{value}"
"#{Redirect.protocol archive}#{archive.domain}/#{path}"
navigate: (URL, alternative) ->
if (
/^https:\/\//.test(URL) or
location.protocol is 'http:' or
confirm "Redirect to #{URL}?\n\nYour connection will not be encrypted."
)
location.replace URL
else if alternative
location.replace alternative

View File

@ -54,7 +54,7 @@ Main =
URL = Redirect.to 'file',
boardID: g.BOARD.ID
filename: pathname[pathname.length - 1]
location.replace URL if URL
Redirect.navigate URL
else if Conf['Loop in New Tab'] and video = $ 'video'
Video.configure video
$.on video, 'click', ->
@ -121,7 +121,7 @@ Main =
boardID: g.BOARD.ID
threadID: g.THREADID
postID: +location.hash.match /\d+/ # post number or 0
location.replace href or "/#{g.BOARD}/"
Redirect.navigate href, "/#{g.BOARD}/"
return
# Something might have gone wrong!

View File

@ -180,6 +180,7 @@ Gallery =
filename: src[src.length - 1]
if URL
thumb.href = URL
if URL and (/^https:\/\//.test(URL) or location.protocol is 'http:')
return unless Gallery.nodes.current is file
file.src = URL
return

View File

@ -207,7 +207,7 @@ ImageExpand =
URL = Redirect.to 'file',
boardID: src[3]
filename: src[src.length - 1]
if URL
if URL and (/^https:\/\//.test(URL) or location.protocol is 'http:')
setTimeout ImageExpand.expand, 10000, post, URL
return
if g.DEAD or post.isDead or post.file.isDead

View File

@ -53,7 +53,7 @@ ImageHover =
URL = Redirect.to 'file',
boardID: src[3]
filename: src[src.length - 1].replace /\?.+$/, ''
if URL
if URL and (/^https:\/\//.test(URL) or location.protocol is 'http:')
@src = URL
return
if g.DEAD or post.isDead or post.file.isDead