Merge commit '794027e355ba117ae533d15907a45e1e5e85173a' into next2
This commit is contained in:
commit
6f1165da9f
@ -127,7 +127,7 @@ Redirect =
|
|||||||
url
|
url
|
||||||
|
|
||||||
file: (archive, {boardID, filename}) ->
|
file: (archive, {boardID, filename}) ->
|
||||||
filename = encodeURIComponent Build.unescape decodeURIComponent filename if boardID is 'f'
|
filename = encodeURIComponent $.unescape decodeURIComponent filename if boardID is 'f'
|
||||||
"#{Redirect.protocol archive}#{archive.domain}/#{boardID}/full_image/#{filename}"
|
"#{Redirect.protocol archive}#{archive.domain}/#{boardID}/full_image/#{filename}"
|
||||||
|
|
||||||
board: (archive, {boardID}) ->
|
board: (archive, {boardID}) ->
|
||||||
|
|||||||
@ -103,10 +103,9 @@ Filter =
|
|||||||
for boardID in boardsRaw.split(',')
|
for boardID in boardsRaw.split(',')
|
||||||
if ':' in boardID
|
if ':' in boardID
|
||||||
[siteFilter, boardID] = boardID.split(':')[-2..]
|
[siteFilter, boardID] = boardID.split(':')[-2..]
|
||||||
for siteID, siteProperties of Conf['siteProperties']
|
for siteID, site of g.sites when siteID[...siteFilter.length] is siteFilter
|
||||||
continue if siteProperties.canonical or siteID[...siteFilter.length] isnt siteFilter
|
|
||||||
if boardID in ['nsfw', 'sfw']
|
if boardID in ['nsfw', 'sfw']
|
||||||
for boardID2 in SW[siteProperties.software]?.sfwBoards?(boardID is 'sfw') or []
|
for boardID2 in site.sfwBoards?(boardID is 'sfw') or []
|
||||||
boards["#{siteID}/#{boardID2}"] = true
|
boards["#{siteID}/#{boardID2}"] = true
|
||||||
else
|
else
|
||||||
boards["#{siteID}/#{encodeURIComponent boardID}"] = true
|
boards["#{siteID}/#{encodeURIComponent boardID}"] = true
|
||||||
|
|||||||
@ -3,11 +3,6 @@ Build =
|
|||||||
gifIcon: if window.devicePixelRatio >= 2 then '@2x.gif' else '.gif'
|
gifIcon: if window.devicePixelRatio >= 2 then '@2x.gif' else '.gif'
|
||||||
spoilerRange: {}
|
spoilerRange: {}
|
||||||
|
|
||||||
unescape: (text) ->
|
|
||||||
return text unless text?
|
|
||||||
text.replace(/<[^>]*>/g, '').replace /&(amp|#039|quot|lt|gt|#44);/g, (c) ->
|
|
||||||
(({'&': '&', ''': "'", '"': '"', '<': '<', '>': '>', ',': ','})[c])
|
|
||||||
|
|
||||||
shortFilename: (filename) ->
|
shortFilename: (filename) ->
|
||||||
ext = filename.match(/\.?[^\.]*$/)[0]
|
ext = filename.match(/\.?[^\.]*$/)[0]
|
||||||
if filename.length - ext.length > 30
|
if filename.length - ext.length > 30
|
||||||
@ -51,15 +46,15 @@ Build =
|
|||||||
# file status
|
# file status
|
||||||
fileDeleted: !!data.filedeleted
|
fileDeleted: !!data.filedeleted
|
||||||
o.info =
|
o.info =
|
||||||
subject: Build.unescape data.sub
|
subject: $.unescape data.sub
|
||||||
email: Build.unescape data.email
|
email: $.unescape data.email
|
||||||
name: Build.unescape(data.name) or ''
|
name: $.unescape(data.name) or ''
|
||||||
tripcode: data.trip
|
tripcode: data.trip
|
||||||
pass: if data.since4pass? then "#{data.since4pass}" else undefined
|
pass: if data.since4pass? then "#{data.since4pass}" else undefined
|
||||||
uniqueID: data.id
|
uniqueID: data.id
|
||||||
flagCode: data.country
|
flagCode: data.country
|
||||||
flagCodeTroll: data.troll_country
|
flagCodeTroll: data.troll_country
|
||||||
flag: Build.unescape data.country_name
|
flag: $.unescape data.country_name
|
||||||
dateUTC: data.time
|
dateUTC: data.time
|
||||||
dateText: data.now
|
dateText: data.now
|
||||||
commentHTML: {innerHTML: data.com or ''}
|
commentHTML: {innerHTML: data.com or ''}
|
||||||
@ -69,7 +64,7 @@ Build =
|
|||||||
delete o.info.uniqueID
|
delete o.info.uniqueID
|
||||||
if data.ext
|
if data.ext
|
||||||
o.file =
|
o.file =
|
||||||
name: (Build.unescape data.filename) + data.ext
|
name: ($.unescape data.filename) + data.ext
|
||||||
url: if boardID is 'f'
|
url: if boardID is 'f'
|
||||||
"#{location.protocol}//#{ImageHost.flashHost()}/#{boardID}/#{encodeURIComponent data.filename}#{data.ext}"
|
"#{location.protocol}//#{ImageHost.flashHost()}/#{boardID}/#{encodeURIComponent data.filename}#{data.ext}"
|
||||||
else
|
else
|
||||||
@ -95,7 +90,7 @@ Build =
|
|||||||
.replace(/<br\b[^<]*>/gi, '\n')
|
.replace(/<br\b[^<]*>/gi, '\n')
|
||||||
.replace(/\n\n<span\b[^<]* class="abbr"[^]*$/i, '') # EXIF data (/p/)
|
.replace(/\n\n<span\b[^<]* class="abbr"[^]*$/i, '') # EXIF data (/p/)
|
||||||
.replace(/<[^>]*>/g, '')
|
.replace(/<[^>]*>/g, '')
|
||||||
Build.unescape html
|
$.unescape html
|
||||||
|
|
||||||
parseCommentDisplay: (html) ->
|
parseCommentDisplay: (html) ->
|
||||||
# Hide spoilers.
|
# Hide spoilers.
|
||||||
@ -252,9 +247,9 @@ Build =
|
|||||||
if data.com
|
if data.com
|
||||||
excerpt = Build.parseCommentDisplay(data.com).replace(/>>\d+/g, '').trim().replace(/\n+/g, ' // ')
|
excerpt = Build.parseCommentDisplay(data.com).replace(/>>\d+/g, '').trim().replace(/\n+/g, ' // ')
|
||||||
if data.ext
|
if data.ext
|
||||||
excerpt or= "#{Build.unescape data.filename}#{data.ext}"
|
excerpt or= "#{$.unescape data.filename}#{data.ext}"
|
||||||
if data.com
|
if data.com
|
||||||
excerpt or= Build.unescape data.com.replace(/<br\b[^<]*>/gi, ' // ')
|
excerpt or= $.unescape data.com.replace(/<br\b[^<]*>/gi, ' // ')
|
||||||
excerpt or= '\xA0'
|
excerpt or= '\xA0'
|
||||||
excerpt = "#{excerpt[...70]}..." if excerpt.length > 73
|
excerpt = "#{excerpt[...70]}..." if excerpt.length > 73
|
||||||
|
|
||||||
|
|||||||
@ -264,16 +264,16 @@ ThreadWatcher =
|
|||||||
return unless board.some (thread) -> !thread.data.isDead
|
return unless board.some (thread) -> !thread.data.isDead
|
||||||
force = Conf['Show Page'] and board.some((thread) -> !thread.data.page? and !thread.data.isDead and thread.data.last isnt -1)
|
force = Conf['Show Page'] and board.some((thread) -> !thread.data.page? and !thread.data.isDead and thread.data.last isnt -1)
|
||||||
{siteID, boardID} = board[0]
|
{siteID, boardID} = board[0]
|
||||||
software = Conf['siteProperties'][siteID]?.software
|
site = g.sites[siteID]
|
||||||
urlF = if deep and software is 'tinyboard' then 'catalogJSON' else 'threadsListJSON'
|
return unless site
|
||||||
url = SW[software]?.urls[urlF]?({siteID, boardID})
|
urlF = if deep and site.software is 'tinyboard' then 'catalogJSON' else 'threadsListJSON'
|
||||||
|
url = site.urls[urlF]?({siteID, boardID})
|
||||||
return unless url
|
return unless url
|
||||||
ThreadWatcher.fetch url, {siteID, force}, [board, url], ThreadWatcher.parseBoard
|
ThreadWatcher.fetch url, {siteID, force}, [board, url], ThreadWatcher.parseBoard
|
||||||
|
|
||||||
parseBoard: (board, url) ->
|
parseBoard: (board, url) ->
|
||||||
return unless @status is 200
|
return unless @status is 200
|
||||||
{siteID, boardID} = board[0]
|
{siteID, boardID} = board[0]
|
||||||
software = Conf['siteProperties'][siteID]?.software
|
|
||||||
lmDate = @getResponseHeader('Last-Modified')
|
lmDate = @getResponseHeader('Last-Modified')
|
||||||
ThreadWatcher.dbLM.extend {siteID, boardID, val: $.item(url, lmDate)}
|
ThreadWatcher.dbLM.extend {siteID, boardID, val: $.item(url, lmDate)}
|
||||||
threads = {}
|
threads = {}
|
||||||
@ -300,7 +300,7 @@ ThreadWatcher =
|
|||||||
if threads[threadID]
|
if threads[threadID]
|
||||||
{page, index, modified, replies} = threads[threadID]
|
{page, index, modified, replies} = threads[threadID]
|
||||||
if Conf['Show Page']
|
if Conf['Show Page']
|
||||||
lastPage = if SW[software]?.isPrunedByAge?({siteID, boardID})
|
lastPage = if g.sites[siteID].isPrunedByAge?({siteID, boardID})
|
||||||
threadID is oldest
|
threadID is oldest
|
||||||
else
|
else
|
||||||
index >= nThreads - pageLength
|
index >= nThreads - pageLength
|
||||||
@ -318,16 +318,13 @@ ThreadWatcher =
|
|||||||
|
|
||||||
fetchStatus: (thread) ->
|
fetchStatus: (thread) ->
|
||||||
{siteID, boardID, threadID, data, force} = thread
|
{siteID, boardID, threadID, data, force} = thread
|
||||||
software = Conf['siteProperties'][siteID]?.software
|
url = g.sites[siteID]?.urls.threadJSON?({siteID, boardID, threadID})
|
||||||
url = SW[software]?.urls.threadJSON?({siteID, boardID, threadID})
|
|
||||||
return unless url
|
return unless url
|
||||||
return if data.isDead and not force
|
return if data.isDead and not force
|
||||||
return if data.last is -1 # 404 or no JSON API
|
return if data.last is -1 # 404 or no JSON API
|
||||||
ThreadWatcher.fetch url, {siteID, force}, [thread], ThreadWatcher.parseStatus
|
ThreadWatcher.fetch url, {siteID, force}, [thread], ThreadWatcher.parseStatus
|
||||||
|
|
||||||
parseStatus: ({siteID, boardID, threadID, data, newData}) ->
|
parseStatus: ({siteID, boardID, threadID, data, newData}) ->
|
||||||
software = Conf['siteProperties'][siteID]?.software
|
|
||||||
|
|
||||||
if @status is 200 and @response
|
if @status is 200 and @response
|
||||||
last = @response.posts[@response.posts.length-1].no
|
last = @response.posts[@response.posts.length-1].no
|
||||||
replies = @response.posts.length-1
|
replies = @response.posts.length-1
|
||||||
@ -356,7 +353,7 @@ ThreadWatcher =
|
|||||||
continue unless !quotingYou and QuoteYou.db and postObj.com
|
continue unless !quotingYou and QuoteYou.db and postObj.com
|
||||||
|
|
||||||
quotesYou = false
|
quotesYou = false
|
||||||
regexp = SW[software].regexp.quotelinkHTML
|
regexp = g.sites[siteID].regexp.quotelinkHTML
|
||||||
regexp.lastIndex = 0
|
regexp.lastIndex = 0
|
||||||
while match = regexp.exec postObj.com
|
while match = regexp.exec postObj.com
|
||||||
if QuoteYou.db.get {
|
if QuoteYou.db.get {
|
||||||
@ -375,7 +372,7 @@ ThreadWatcher =
|
|||||||
ThreadWatcher.update siteID, boardID, threadID, newData
|
ThreadWatcher.update siteID, boardID, threadID, newData
|
||||||
|
|
||||||
else if @status is 404
|
else if @status is 404
|
||||||
if SW[software].mayLackJSON and !data.last?
|
if g.sites[siteID].mayLackJSON and !data.last?
|
||||||
ThreadWatcher.update siteID, boardID, threadID, {last: -1}
|
ThreadWatcher.update siteID, boardID, threadID, {last: -1}
|
||||||
else
|
else
|
||||||
ThreadWatcher.update siteID, boardID, threadID, {isDead: true}
|
ThreadWatcher.update siteID, boardID, threadID, {isDead: true}
|
||||||
@ -393,8 +390,6 @@ ThreadWatcher =
|
|||||||
all
|
all
|
||||||
|
|
||||||
makeLine: (siteID, boardID, threadID, data) ->
|
makeLine: (siteID, boardID, threadID, data) ->
|
||||||
software = Conf['siteProperties'][siteID]?.software
|
|
||||||
|
|
||||||
x = $.el 'a',
|
x = $.el 'a',
|
||||||
className: 'fa fa-times'
|
className: 'fa fa-times'
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
@ -405,7 +400,7 @@ ThreadWatcher =
|
|||||||
excerpt = ThreadWatcher.prefixes[siteID] + excerpt if Conf['Show Site Prefix']
|
excerpt = ThreadWatcher.prefixes[siteID] + excerpt if Conf['Show Site Prefix']
|
||||||
|
|
||||||
link = $.el 'a',
|
link = $.el 'a',
|
||||||
href: SW[software]?.urls.thread({siteID, boardID, threadID}) or ''
|
href: g.sites[siteID]?.urls.thread({siteID, boardID, threadID}) or ''
|
||||||
title: excerpt
|
title: excerpt
|
||||||
className: 'watcher-link'
|
className: 'watcher-link'
|
||||||
|
|
||||||
|
|||||||
@ -463,6 +463,11 @@ $.hasAudio = (video) ->
|
|||||||
$.luma = (rgb) ->
|
$.luma = (rgb) ->
|
||||||
rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114
|
rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114
|
||||||
|
|
||||||
|
$.unescape = (text) ->
|
||||||
|
return text unless text?
|
||||||
|
text.replace(/<[^>]*>/g, '').replace /&(amp|#039|quot|lt|gt|#44);/g, (c) ->
|
||||||
|
(({'&': '&', ''': "'", '"': '"', '<': '<', '>': '>', ',': ','})[c])
|
||||||
|
|
||||||
$.engine = do ->
|
$.engine = do ->
|
||||||
return 'edge' if /Edge\//.test navigator.userAgent
|
return 'edge' if /Edge\//.test navigator.userAgent
|
||||||
return 'blink' if /Chrome\//.test navigator.userAgent
|
return 'blink' if /Chrome\//.test navigator.userAgent
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user