Support 4cdn.
This commit is contained in:
parent
16a21fd087
commit
985afb2a1a
@ -1,4 +1,5 @@
|
|||||||
- **New option**: `Auto-hide header on scroll`.
|
- **New option**: `Auto-hide header on scroll`.
|
||||||
|
- Added support for `4cdn.org`.
|
||||||
|
|
||||||
## 3.13.0 - *2013-11-16*
|
## 3.13.0 - *2013-11-16*
|
||||||
|
|
||||||
|
|||||||
@ -9,10 +9,10 @@
|
|||||||
"buildsPath": "builds/",
|
"buildsPath": "builds/",
|
||||||
"mainBranch": "v3",
|
"mainBranch": "v3",
|
||||||
"matches": [
|
"matches": [
|
||||||
"*://api.4chan.org/*",
|
|
||||||
"*://boards.4chan.org/*",
|
"*://boards.4chan.org/*",
|
||||||
"*://images.4chan.org/*",
|
"*://sys.4chan.org/*",
|
||||||
"*://sys.4chan.org/*"
|
"*://a.4cdn.org/*",
|
||||||
|
"*://i.4cdn.org/*"
|
||||||
],
|
],
|
||||||
"min": {
|
"min": {
|
||||||
"chrome": "29",
|
"chrome": "29",
|
||||||
|
|||||||
@ -58,7 +58,7 @@ ThreadHiding =
|
|||||||
# We need to clean hidden threads on the catalog ourselves,
|
# We need to clean hidden threads on the catalog ourselves,
|
||||||
# otherwise if we don't visit the catalog regularly
|
# otherwise if we don't visit the catalog regularly
|
||||||
# it will pollute the localStorage and our data.
|
# it will pollute the localStorage and our data.
|
||||||
$.cache "//api.4chan.org/#{g.BOARD}/threads.json", ->
|
$.cache "//a.4cdn.org/#{g.BOARD}/threads.json", ->
|
||||||
return unless @status is 200
|
return unless @status is 200
|
||||||
threads = {}
|
threads = {}
|
||||||
for page in JSON.parse @response
|
for page in JSON.parse @response
|
||||||
|
|||||||
@ -36,14 +36,14 @@ Build =
|
|||||||
name: data.filename + data.ext
|
name: data.filename + data.ext
|
||||||
timestamp: "#{data.tim}#{data.ext}"
|
timestamp: "#{data.tim}#{data.ext}"
|
||||||
url: if boardID is 'f'
|
url: if boardID is 'f'
|
||||||
"//images.4channel.org/#{boardID}/src/#{data.filename}#{data.ext}"
|
"//i.4cdn.org/#{boardID}/src/#{data.filename}#{data.ext}"
|
||||||
else
|
else
|
||||||
"//images.4chan.org/#{boardID}/src/#{data.tim}#{data.ext}"
|
"//i.4cdn.org/#{boardID}/src/#{data.tim}#{data.ext}"
|
||||||
height: data.h
|
height: data.h
|
||||||
width: data.w
|
width: data.w
|
||||||
MD5: data.md5
|
MD5: data.md5
|
||||||
size: data.fsize
|
size: data.fsize
|
||||||
turl: "//thumbs.4chan.org/#{boardID}/thumb/#{data.tim}s.jpg"
|
turl: "//t.4cdn.org/#{boardID}/thumb/#{data.tim}s.jpg"
|
||||||
theight: data.tn_h
|
theight: data.tn_h
|
||||||
twidth: data.tn_w
|
twidth: data.tn_w
|
||||||
isSpoiler: !!data.spoiler
|
isSpoiler: !!data.spoiler
|
||||||
@ -59,7 +59,7 @@ Build =
|
|||||||
} = o
|
} = o
|
||||||
isOP = postID is threadID
|
isOP = postID is threadID
|
||||||
|
|
||||||
staticPath = '//static.4chan.org/image/'
|
staticPath = '//s.4cdn.org/image/'
|
||||||
gifIcon = if window.devicePixelRatio >= 2
|
gifIcon = if window.devicePixelRatio >= 2
|
||||||
'@2x.gif'
|
'@2x.gif'
|
||||||
else
|
else
|
||||||
|
|||||||
@ -69,7 +69,7 @@ class DataBoard
|
|||||||
|
|
||||||
@save()
|
@save()
|
||||||
ajaxClean: (boardID) ->
|
ajaxClean: (boardID) ->
|
||||||
$.cache "//api.4chan.org/#{boardID}/threads.json", (e) =>
|
$.cache "//a.4cdn.org/#{boardID}/threads.json", (e) =>
|
||||||
if e.target.status isnt 200
|
if e.target.status isnt 200
|
||||||
@delete boardID if e.target.status is 404
|
@delete boardID if e.target.status is 404
|
||||||
return
|
return
|
||||||
|
|||||||
@ -70,7 +70,7 @@ Get =
|
|||||||
|
|
||||||
root.textContent = "Loading post No.#{postID}..."
|
root.textContent = "Loading post No.#{postID}..."
|
||||||
if threadID
|
if threadID
|
||||||
$.cache "//api.4chan.org/#{boardID}/res/#{threadID}.json", ->
|
$.cache "//a.4cdn.org/#{boardID}/res/#{threadID}.json", ->
|
||||||
Get.fetchedPost @, boardID, threadID, postID, root, context
|
Get.fetchedPost @, boardID, threadID, postID, root, context
|
||||||
else if url = Redirect.to 'post', {boardID, postID}
|
else if url = Redirect.to 'post', {boardID, postID}
|
||||||
$.cache url,
|
$.cache url,
|
||||||
@ -222,7 +222,7 @@ Get =
|
|||||||
width: data.media.media_w
|
width: data.media.media_w
|
||||||
MD5: data.media.media_hash
|
MD5: data.media.media_hash
|
||||||
size: data.media.media_size
|
size: data.media.media_size
|
||||||
turl: data.media.thumb_link or "//thumbs.4chan.org/#{boardID}/thumb/#{data.media.preview_orig}"
|
turl: data.media.thumb_link or "//t.4cdn.org/#{boardID}/thumb/#{data.media.preview_orig}"
|
||||||
theight: data.media.preview_h
|
theight: data.media.preview_h
|
||||||
twidth: data.media.preview_w
|
twidth: data.media.preview_w
|
||||||
isSpoiler: data.media.spoiler is '1'
|
isSpoiler: data.media.spoiler is '1'
|
||||||
|
|||||||
@ -188,7 +188,7 @@ Index =
|
|||||||
return unless Index.req and !Index.notice
|
return unless Index.req and !Index.notice
|
||||||
Index.notice = new Notice 'info', 'Refreshing index...'
|
Index.notice = new Notice 'info', 'Refreshing index...'
|
||||||
), 5 * $.SECOND - (Date.now() - now)
|
), 5 * $.SECOND - (Date.now() - now)
|
||||||
Index.req = $.ajax "//api.4chan.org/#{g.BOARD}/catalog.json",
|
Index.req = $.ajax "//a.4cdn.org/#{g.BOARD}/catalog.json",
|
||||||
onabort: Index.load
|
onabort: Index.load
|
||||||
onloadend: Index.load
|
onloadend: Index.load
|
||||||
,
|
,
|
||||||
|
|||||||
@ -38,12 +38,12 @@ Main =
|
|||||||
|
|
||||||
initFeatures: ->
|
initFeatures: ->
|
||||||
switch location.hostname
|
switch location.hostname
|
||||||
when 'api.4chan.org'
|
when 'a.4cdn.org'
|
||||||
return
|
return
|
||||||
when 'sys.4chan.org'
|
when 'sys.4chan.org'
|
||||||
Report.init()
|
Report.init()
|
||||||
return
|
return
|
||||||
when 'images.4chan.org'
|
when 'i.4cdn.org'
|
||||||
$.ready ->
|
$.ready ->
|
||||||
if Conf['404 Redirect'] and d.title is '4chan - 404 Not Found'
|
if Conf['404 Redirect'] and d.title is '4chan - 404 Not Found'
|
||||||
Redirect.init()
|
Redirect.init()
|
||||||
|
|||||||
@ -127,7 +127,7 @@ class Post
|
|||||||
@file.thumbURL = if that.isArchived
|
@file.thumbURL = if that.isArchived
|
||||||
thumb.src
|
thumb.src
|
||||||
else
|
else
|
||||||
"#{location.protocol}//thumbs.4chan.org/#{@board}/thumb/#{@file.URL.match(/(\d+)\./)[1]}s.jpg"
|
"#{location.protocol}//t.4cdn.org/#{@board}/thumb/#{@file.URL.match(/(\d+)\./)[1]}s.jpg"
|
||||||
@file.name = $('span[title]', fileInfo).title
|
@file.name = $('span[title]', fileInfo).title
|
||||||
<% if (type === 'crx') { %>
|
<% if (type === 'crx') { %>
|
||||||
# replace %22 with quotes, see:
|
# replace %22 with quotes, see:
|
||||||
|
|||||||
@ -353,7 +353,7 @@ Settings =
|
|||||||
data =
|
data =
|
||||||
isReply: true
|
isReply: true
|
||||||
file:
|
file:
|
||||||
URL: '//images.4chan.org/g/src/1334437723720.jpg'
|
URL: '//i.4cdn.org/g/src/1334437723720.jpg'
|
||||||
name: 'd9bb2efc98dd0df141a94399ff5880b7.jpg'
|
name: 'd9bb2efc98dd0df141a94399ff5880b7.jpg'
|
||||||
size: '276 KB'
|
size: '276 KB'
|
||||||
sizeInBytes: 276 * 1024
|
sizeInBytes: 276 * 1024
|
||||||
|
|||||||
@ -27,7 +27,7 @@ class Thread
|
|||||||
$.rm $ ".#{typeLC}Icon", @OP.nodes.info
|
$.rm $ ".#{typeLC}Icon", @OP.nodes.info
|
||||||
return
|
return
|
||||||
icon = $.el 'img',
|
icon = $.el 'img',
|
||||||
src: "//static.4chan.org/image/#{typeLC}#{if window.devicePixelRatio >= 2 then '@2x' else ''}.gif"
|
src: "//s.4cdn.org/image/#{typeLC}#{if window.devicePixelRatio >= 2 then '@2x' else ''}.gif"
|
||||||
alt: type
|
alt: type
|
||||||
title: type
|
title: type
|
||||||
className: "#{typeLC}Icon"
|
className: "#{typeLC}Icon"
|
||||||
|
|||||||
@ -121,7 +121,7 @@ ImageExpand =
|
|||||||
ImageExpand.contract post
|
ImageExpand.contract post
|
||||||
|
|
||||||
src = @src.split '/'
|
src = @src.split '/'
|
||||||
if src[2] is 'images.4chan.org'
|
if src[2] is 'i.4cdn.org'
|
||||||
URL = Redirect.to 'file',
|
URL = Redirect.to 'file',
|
||||||
boardID: src[3]
|
boardID: src[3]
|
||||||
filename: src[5].replace /\?.+$/, ''
|
filename: src[5].replace /\?.+$/, ''
|
||||||
@ -132,8 +132,8 @@ ImageExpand =
|
|||||||
return
|
return
|
||||||
|
|
||||||
timeoutID = setTimeout ImageExpand.expand, 10000, post
|
timeoutID = setTimeout ImageExpand.expand, 10000, post
|
||||||
# XXX CORS for images.4chan.org WHEN?
|
# XXX CORS for i.4cdn.org WHEN?
|
||||||
$.ajax "//api.4chan.org/#{post.board}/res/#{post.thread}.json", onload: ->
|
$.ajax "//a.4cdn.org/#{post.board}/res/#{post.thread}.json", onload: ->
|
||||||
return if @status isnt 200
|
return if @status isnt 200
|
||||||
for postObj in JSON.parse(@response).posts
|
for postObj in JSON.parse(@response).posts
|
||||||
break if postObj.no is post.ID
|
break if postObj.no is post.ID
|
||||||
|
|||||||
@ -27,7 +27,7 @@ ImageHover =
|
|||||||
post = g.posts[@dataset.fullID]
|
post = g.posts[@dataset.fullID]
|
||||||
|
|
||||||
src = @src.split '/'
|
src = @src.split '/'
|
||||||
if src[2] is 'images.4chan.org'
|
if src[2] is 'i.4cdn.org'
|
||||||
URL = Redirect.to 'file',
|
URL = Redirect.to 'file',
|
||||||
boardID: src[3]
|
boardID: src[3]
|
||||||
filename: src[5].replace /\?.+$/, ''
|
filename: src[5].replace /\?.+$/, ''
|
||||||
@ -38,8 +38,8 @@ ImageHover =
|
|||||||
return
|
return
|
||||||
|
|
||||||
timeoutID = setTimeout (=> @src = post.file.URL + '?' + Date.now()), 3000
|
timeoutID = setTimeout (=> @src = post.file.URL + '?' + Date.now()), 3000
|
||||||
# XXX CORS for images.4chan.org WHEN?
|
# XXX CORS for i.4cdn.org WHEN?
|
||||||
$.ajax "//api.4chan.org/#{post.board}/res/#{post.thread}.json", onload: ->
|
$.ajax "//a.4cdn.org/#{post.board}/res/#{post.thread}.json", onload: ->
|
||||||
return if @status isnt 200
|
return if @status isnt 200
|
||||||
for postObj in JSON.parse(@response).posts
|
for postObj in JSON.parse(@response).posts
|
||||||
break if postObj.no is post.ID
|
break if postObj.no is post.ID
|
||||||
|
|||||||
@ -39,7 +39,7 @@ ExpandThread =
|
|||||||
expand: (thread, a, threadRoot) ->
|
expand: (thread, a, threadRoot) ->
|
||||||
ExpandThread.statuses[thread] = status = {}
|
ExpandThread.statuses[thread] = status = {}
|
||||||
a.textContent = ExpandThread.text '...', a.textContent.match(/\d+/g)...
|
a.textContent = ExpandThread.text '...', a.textContent.match(/\d+/g)...
|
||||||
status.req = $.cache "//api.4chan.org/#{thread.board}/res/#{thread}.json", ->
|
status.req = $.cache "//a.4cdn.org/#{thread.board}/res/#{thread}.json", ->
|
||||||
delete status.req
|
delete status.req
|
||||||
ExpandThread.parse @, thread, a
|
ExpandThread.parse @, thread, a
|
||||||
contract: (thread, a, threadRoot) ->
|
contract: (thread, a, threadRoot) ->
|
||||||
|
|||||||
@ -37,7 +37,7 @@ ThreadStats =
|
|||||||
$.addClass ThreadStats.pageCountEl, 'warning'
|
$.addClass ThreadStats.pageCountEl, 'warning'
|
||||||
return
|
return
|
||||||
setTimeout ThreadStats.fetchPage, 2 * $.MINUTE
|
setTimeout ThreadStats.fetchPage, 2 * $.MINUTE
|
||||||
$.ajax "//api.4chan.org/#{ThreadStats.thread.board}/threads.json", onload: ThreadStats.onThreadsLoad,
|
$.ajax "//a.4cdn.org/#{ThreadStats.thread.board}/threads.json", onload: ThreadStats.onThreadsLoad,
|
||||||
whenModified: true
|
whenModified: true
|
||||||
onThreadsLoad: ->
|
onThreadsLoad: ->
|
||||||
return if @status isnt 200
|
return if @status isnt 200
|
||||||
|
|||||||
@ -153,7 +153,7 @@ ThreadUpdater =
|
|||||||
ThreadUpdater.count()
|
ThreadUpdater.count()
|
||||||
ThreadUpdater.set 'timer', '...'
|
ThreadUpdater.set 'timer', '...'
|
||||||
ThreadUpdater.req?.abort()
|
ThreadUpdater.req?.abort()
|
||||||
url = "//api.4chan.org/#{ThreadUpdater.thread.board}/res/#{ThreadUpdater.thread}.json"
|
url = "//a.4cdn.org/#{ThreadUpdater.thread.board}/res/#{ThreadUpdater.thread}.json"
|
||||||
ThreadUpdater.req = $.ajax url,
|
ThreadUpdater.req = $.ajax url,
|
||||||
onabort: ThreadUpdater.cb.load
|
onabort: ThreadUpdater.cb.load
|
||||||
onloadend: ThreadUpdater.cb.load
|
onloadend: ThreadUpdater.cb.load
|
||||||
|
|||||||
@ -100,7 +100,7 @@ ThreadWatcher =
|
|||||||
return if data.isDead
|
return if data.isDead
|
||||||
{fetchCount} = ThreadWatcher
|
{fetchCount} = ThreadWatcher
|
||||||
fetchCount.fetching++
|
fetchCount.fetching++
|
||||||
$.ajax "//api.4chan.org/#{boardID}/res/#{threadID}.json",
|
$.ajax "//a.4cdn.org/#{boardID}/res/#{threadID}.json",
|
||||||
onloadend: ->
|
onloadend: ->
|
||||||
fetchCount.fetched++
|
fetchCount.fetched++
|
||||||
if fetchCount.fetched is fetchCount.fetching
|
if fetchCount.fetched is fetchCount.fetching
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user