Whitespace.
This commit is contained in:
parent
192f985f55
commit
d61ebffdc7
@ -2,10 +2,12 @@ Build =
|
|||||||
staticPath: '//s.4cdn.org/image/'
|
staticPath: '//s.4cdn.org/image/'
|
||||||
gifIcon: if window.devicePixelRatio >= 2 then '@2x.gif' else '.gif'
|
gifIcon: if window.devicePixelRatio >= 2 then '@2x.gif' else '.gif'
|
||||||
spoilerRange: {}
|
spoilerRange: {}
|
||||||
|
|
||||||
unescape: (text) ->
|
unescape: (text) ->
|
||||||
return text unless text?
|
return text unless text?
|
||||||
text.replace(/<[^>]*>/g, '').replace /&(amp|#039|quot|lt|gt);/g, (c) ->
|
text.replace(/<[^>]*>/g, '').replace /&(amp|#039|quot|lt|gt);/g, (c) ->
|
||||||
{'&': '&', ''': "'", '"': '"', '<': '<', '>': '>'}[c]
|
{'&': '&', ''': "'", '"': '"', '<': '<', '>': '>'}[c]
|
||||||
|
|
||||||
shortFilename: (filename) ->
|
shortFilename: (filename) ->
|
||||||
threshold = 30
|
threshold = 30
|
||||||
ext = filename.match(/\.?[^\.]*$/)[0]
|
ext = filename.match(/\.?[^\.]*$/)[0]
|
||||||
@ -13,19 +15,23 @@ Build =
|
|||||||
"#{filename[...threshold - 5]}(...)#{ext}"
|
"#{filename[...threshold - 5]}(...)#{ext}"
|
||||||
else
|
else
|
||||||
filename
|
filename
|
||||||
|
|
||||||
spoilerThumb: (boardID) ->
|
spoilerThumb: (boardID) ->
|
||||||
if spoilerRange = Build.spoilerRange[boardID]
|
if spoilerRange = Build.spoilerRange[boardID]
|
||||||
# Randomize the spoiler image.
|
# Randomize the spoiler image.
|
||||||
"#{Build.staticPath}spoiler-#{boardID}#{Math.floor 1 + spoilerRange * Math.random()}.png"
|
"#{Build.staticPath}spoiler-#{boardID}#{Math.floor 1 + spoilerRange * Math.random()}.png"
|
||||||
else
|
else
|
||||||
"#{Build.staticPath}spoiler.png"
|
"#{Build.staticPath}spoiler.png"
|
||||||
|
|
||||||
sameThread: (boardID, threadID) ->
|
sameThread: (boardID, threadID) ->
|
||||||
g.VIEW is 'thread' and g.BOARD.ID is boardID and g.THREADID is +threadID
|
g.VIEW is 'thread' and g.BOARD.ID is boardID and g.THREADID is +threadID
|
||||||
|
|
||||||
postURL: (boardID, threadID, postID) ->
|
postURL: (boardID, threadID, postID) ->
|
||||||
if Build.sameThread boardID, threadID
|
if Build.sameThread boardID, threadID
|
||||||
"#p#{postID}"
|
"#p#{postID}"
|
||||||
else
|
else
|
||||||
"/#{boardID}/thread/#{threadID}#p#{postID}"
|
"/#{boardID}/thread/#{threadID}#p#{postID}"
|
||||||
|
|
||||||
postFromObject: (data, boardID, suppressThumb) ->
|
postFromObject: (data, boardID, suppressThumb) ->
|
||||||
o =
|
o =
|
||||||
# id
|
# id
|
||||||
@ -70,6 +76,7 @@ Build =
|
|||||||
tag: data.tag
|
tag: data.tag
|
||||||
o.file.dimensions = "#{o.file.width}x#{o.file.height}" unless /\.pdf$/.test o.file.url
|
o.file.dimensions = "#{o.file.width}x#{o.file.height}" unless /\.pdf$/.test o.file.url
|
||||||
Build.post o, suppressThumb
|
Build.post o, suppressThumb
|
||||||
|
|
||||||
post: (o, suppressThumb) ->
|
post: (o, suppressThumb) ->
|
||||||
###
|
###
|
||||||
This function contains code from 4chan-JS (https://github.com/4chan/4chan-JS).
|
This function contains code from 4chan-JS (https://github.com/4chan/4chan-JS).
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user