Start supporting new semantics.

This commit is contained in:
Mayhem 2014-04-12 18:00:22 +02:00
parent 10ee666e7d
commit c7b7795261
16 changed files with 31 additions and 31 deletions

View File

@ -1,3 +1,5 @@
- Update 4chan namespaces support.
### 3.20.4 - *2014-04-09* ### 3.20.4 - *2014-04-09*
- Better handling of webm playback errors. - Better handling of webm playback errors.

View File

@ -1,4 +1,4 @@
<a href="/#{thread.board}/res/#{thread.ID}" class="thumb"></a> <a href="/#{thread.board}/thread/#{thread.ID}" class="thumb"></a>
<div class="thread-stats" title="Post count / File count / Page count"> <div class="thread-stats" title="Post count / File count / Page count">
<span class="post-count">#{postCount}</span> / <span class="file-count">#{fileCount}</span> / <span class="page-count">#{pageCount}</span> <span class="post-count">#{postCount}</span> / <span class="file-count">#{fileCount}</span> / <span class="page-count">#{pageCount}</span>
<span class="thread-icons"></span> <span class="thread-icons"></span>

View File

@ -42,14 +42,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'
"//i.4cdn.org/#{boardID}/src/#{data.filename}#{data.ext}" "//i.4cdn.org/#{boardID}/#{data.filename}#{data.ext}"
else else
"//i.4cdn.org/#{boardID}/src/#{data.tim}#{data.ext}" "//i.4cdn.org/#{boardID}/#{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: "//#{Build.thumbRotate()}.t.4cdn.org/#{boardID}/thumb/#{data.tim}s.jpg" turl: "//#{Build.thumbRotate()}.t.4cdn.org/#{boardID}/#{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
@ -179,7 +179,7 @@ Build =
if isOP and g.VIEW is 'index' if isOP and g.VIEW is 'index'
pageNum = Index.liveThreadIDs.indexOf(postID) // Index.threadsNumPerPage pageNum = Index.liveThreadIDs.indexOf(postID) // Index.threadsNumPerPage
pageIcon = " <span class=page-num title='This thread is on page #{pageNum} in the original index.'>Page #{pageNum}</span>" pageIcon = " <span class=page-num title='This thread is on page #{pageNum} in the original index.'>Page #{pageNum}</span>"
replyLink = " &nbsp; <span>[<a href='/#{boardID}/res/#{threadID}' class=replylink>Reply</a>]</span>" replyLink = " &nbsp; <span>[<a href='/#{boardID}/thread/#{threadID}' class=replylink>Reply</a>]</span>"
else else
pageIcon = replyLink = '' pageIcon = replyLink = ''
@ -207,12 +207,12 @@ Build =
' </span> ' + ' </span> ' +
"<span class=dateTime data-utc=#{dateUTC}>#{date}</span> " + "<span class=dateTime data-utc=#{dateUTC}>#{date}</span> " +
"<span class='postNum'>" + "<span class='postNum'>" +
"<a href=#{"/#{boardID}/res/#{threadID}#p#{postID}"} title='Highlight this post'>No.</a>" + "<a href=#{"/#{boardID}/thread/#{threadID}#p#{postID}"} title='Highlight this post'>No.</a>" +
"<a href='#{ "<a href='#{
if g.VIEW is 'thread' and g.THREADID is threadID if g.VIEW is 'thread' and g.THREADID is threadID
"javascript:quote(#{postID})" "javascript:quote(#{postID})"
else else
"/#{boardID}/res/#{threadID}#q#{postID}" "/#{boardID}/thread/#{threadID}#q#{postID}"
}' title='Quote this post'>#{postID}</a>" + }' title='Quote this post'>#{postID}</a>" +
pageIcon + sticky + closed + replyLink + pageIcon + sticky + closed + replyLink +
'</span>' + '</span>' +
@ -227,7 +227,7 @@ Build =
for quote in $$ '.quotelink', container for quote in $$ '.quotelink', container
href = quote.getAttribute 'href' href = quote.getAttribute 'href'
continue if href[0] is '/' # Cross-board quote, or board link continue if href[0] is '/' # Cross-board quote, or board link
quote.href = "/#{boardID}/res/#{href}" # Fix pathnames quote.href = "/#{boardID}/thread/#{href}" # Fix pathnames
container container
@ -239,7 +239,7 @@ Build =
$.el 'a', $.el 'a',
className: 'summary' className: 'summary'
textContent: text.join ' ' textContent: text.join ' '
href: "/#{boardID}/res/#{threadID}" href: "/#{boardID}/thread/#{threadID}"
thread: (board, data) -> thread: (board, data) ->
Build.spoilerRange[board] = data.custom_spoiler Build.spoilerRange[board] = data.custom_spoiler

View File

@ -65,7 +65,7 @@ Get =
root.textContent = "Loading post No.#{postID}..." root.textContent = "Loading post No.#{postID}..."
if threadID if threadID
$.cache "//a.4cdn.org/#{boardID}/res/#{threadID}.json", -> $.cache "//a.4cdn.org/#{boardID}/thread/#{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,
@ -219,7 +219,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 "//t.4cdn.org/#{boardID}/thumb/#{data.media.preview_orig}" turl: data.media.thumb_link or "//t.4cdn.org/#{boardID}/#{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'

View File

@ -5,10 +5,8 @@ Main =
return if g.BOARD.ID in ['z', 'fk'] return if g.BOARD.ID in ['z', 'fk']
g.VIEW = g.VIEW =
switch pathname[2] switch pathname[2]
when 'res' when 'thread', 'catalog'
'thread' pathname[2]
when 'catalog'
'catalog'
else else
'index' 'index'
if g.VIEW is 'catalog' if g.VIEW is 'catalog'

View File

@ -98,7 +98,7 @@ class Post
return unless match = quotelink.href.match /// return unless match = quotelink.href.match ///
boards\.4chan\.org/ boards\.4chan\.org/
([^/]+) # boardID ([^/]+) # boardID
/res/\d+#p /thread/\d+#p
(\d+) # postID (\d+) # postID
$ $
/// ///
@ -131,7 +131,7 @@ class Post
@file.thumbURL = if that.isArchived @file.thumbURL = if that.isArchived
thumb.src thumb.src
else else
"#{location.protocol}//t.4cdn.org/#{@board}/thumb/#{@file.URL.match(/(\d+)\./)[1]}s.jpg" "#{location.protocol}//t.4cdn.org/#{@board}/#{@file.URL.match(/(\d+)\./)[1]}s.jpg"
@file.name = if nameNode = $ 'span', fileText @file.name = if nameNode = $ 'span', fileText
nameNode.title or nameNode.textContent nameNode.title or nameNode.textContent
else else

View File

@ -298,7 +298,7 @@ Settings =
data = data =
isReply: true isReply: true
file: file:
URL: '//i.4cdn.org/g/src/1334437723720.jpg' URL: '//i.4cdn.org/g/1334437723720.jpg'
name: 'd9bb2efc98dd0df141a94399ff5880b7.jpg' name: 'd9bb2efc98dd0df141a94399ff5880b7.jpg'
size: '276 KB' size: '276 KB'
sizeInBytes: 276 * 1024 sizeInBytes: 276 * 1024

View File

@ -180,7 +180,7 @@ ImageExpand =
if src[2] is 'i.4cdn.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[4].replace /\?.+$/, ''
if URL if URL
setTimeout ImageExpand.expand, 10000, post, URL setTimeout ImageExpand.expand, 10000, post, URL
return return
@ -198,7 +198,7 @@ ImageExpand =
type: 'head' type: 'head'
<% } else { %> <% } else { %>
# XXX CORS for i.4cdn.org WHEN? # XXX CORS for i.4cdn.org WHEN?
$.ajax "//a.4cdn.org/#{post.board}/res/#{post.thread}.json", onload: -> $.ajax "//a.4cdn.org/#{post.board}/thread/#{post.thread}.json", onload: ->
return if @status isnt 200 return if @status isnt 200
for postObj in @response.posts for postObj in @response.posts
break if postObj.no is post.ID break if postObj.no is post.ID

View File

@ -47,7 +47,7 @@ ImageHover =
if src[2] is 'i.4cdn.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[4].replace /\?.+$/, ''
if URL if URL
@src = URL @src = URL
return return
@ -65,7 +65,7 @@ ImageHover =
type: 'head' type: 'head'
<% } else { %> <% } else { %>
# XXX CORS for i.4cdn.org WHEN? # XXX CORS for i.4cdn.org WHEN?
$.ajax "//a.4cdn.org/#{post.board}/res/#{post.thread}.json", onload: -> $.ajax "//a.4cdn.org/#{post.board}/thread/#{post.thread}.json", onload: ->
return if @status isnt 200 return if @status isnt 200
for postObj in @response.posts for postObj in @response.posts
break if postObj.no is post.ID break if postObj.no is post.ID

View File

@ -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 "//a.4cdn.org/#{thread.board}/res/#{thread}.json", -> status.req = $.cache "//a.4cdn.org/#{thread.board}/thread/#{thread}.json", ->
delete status.req delete status.req
ExpandThread.parse @, thread, a ExpandThread.parse @, thread, a
contract: (thread, a, threadRoot) -> contract: (thread, a, threadRoot) ->

View File

@ -187,7 +187,7 @@ Keybinds =
open: (thread, tab) -> open: (thread, tab) ->
return if g.VIEW isnt 'index' return if g.VIEW isnt 'index'
url = "/#{thread.board}/res/#{thread}" url = "/#{thread.board}/thread/#{thread}"
if tab if tab
$.open url $.open url
else else

View File

@ -153,7 +153,7 @@ ThreadUpdater =
ThreadUpdater.count() ThreadUpdater.count()
ThreadUpdater.set 'timer', '...' ThreadUpdater.set 'timer', '...'
ThreadUpdater.req?.abort() ThreadUpdater.req?.abort()
url = "//a.4cdn.org/#{ThreadUpdater.thread.board}/res/#{ThreadUpdater.thread}.json" url = "//a.4cdn.org/#{ThreadUpdater.thread.board}/thread/#{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

View File

@ -99,7 +99,7 @@ ThreadWatcher =
return if data.isDead return if data.isDead
{fetchCount} = ThreadWatcher {fetchCount} = ThreadWatcher
fetchCount.fetching++ fetchCount.fetching++
$.ajax "//a.4cdn.org/#{boardID}/res/#{threadID}.json", $.ajax "//a.4cdn.org/#{boardID}/thread/#{threadID}.json",
onloadend: -> onloadend: ->
fetchCount.fetched++ fetchCount.fetched++
if fetchCount.fetched is fetchCount.fetching if fetchCount.fetched is fetchCount.fetching
@ -137,7 +137,7 @@ ThreadWatcher =
if data.isDead if data.isDead
href = Redirect.to 'thread', {boardID, threadID} href = Redirect.to 'thread', {boardID, threadID}
link = $.el 'a', link = $.el 'a',
href: href or "/#{boardID}/res/#{threadID}" href: href or "/#{boardID}/thread/#{threadID}"
textContent: data.excerpt textContent: data.excerpt
title: data.excerpt title: data.excerpt

View File

@ -587,9 +587,9 @@ QR =
QR.cooldown.set {req, post, isReply, threadID} QR.cooldown.set {req, post, isReply, threadID}
URL = if threadID is postID # new thread URL = if threadID is postID # new thread
"/#{g.BOARD}/res/#{threadID}" "/#{g.BOARD}/thread/#{threadID}"
else if g.VIEW is 'index' and !QR.cooldown.auto and Conf['Open Post in New Tab'] # replying from the index else if g.VIEW is 'index' and !QR.cooldown.auto and Conf['Open Post in New Tab'] # replying from the index
"/#{g.BOARD}/res/#{threadID}#p#{postID}" "/#{g.BOARD}/thread/#{threadID}#p#{postID}"
if URL if URL
if Conf['Open Post in New Tab'] if Conf['Open Post in New Tab']
$.open URL $.open URL

View File

@ -49,7 +49,7 @@ QuoteBacklink =
buildBacklink: (quoted, quoter) -> buildBacklink: (quoted, quoter) ->
frag = QuoteBacklink.frag.cloneNode true frag = QuoteBacklink.frag.cloneNode true
a = frag.lastElementChild a = frag.lastElementChild
a.href = "/#{quoter.board}/res/#{quoter.thread}#p#{quoter}" a.href = "/#{quoter.board}/thread/#{quoter.thread}#p#{quoter}"
a.textContent = text = QuoteBacklink.funk quoter.ID a.textContent = text = QuoteBacklink.funk quoter.ID
if quoter.isDead if quoter.isDead
$.addClass a, 'deadlink' $.addClass a, 'deadlink'

View File

@ -40,7 +40,7 @@ Quotify =
# Don't add 'deadlink' when quotifying in an archived post, # Don't add 'deadlink' when quotifying in an archived post,
# and we don't know if the post died yet. # and we don't know if the post died yet.
a = $.el 'a', a = $.el 'a',
href: "/#{boardID}/res/#{post.thread}#p#{postID}" href: "/#{boardID}/thread/#{post.thread}#p#{postID}"
className: if post.isDead then 'quotelink deadlink' else 'quotelink' className: if post.isDead then 'quotelink deadlink' else 'quotelink'
textContent: quote textContent: quote
$.extend a.dataset, {boardID, threadID: post.thread.ID, postID} $.extend a.dataset, {boardID, threadID: post.thread.ID, postID}