Move Build.unescape to $.unescape
This commit is contained in:
parent
ca373dcf36
commit
794027e355
@ -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}) ->
|
||||||
|
|||||||
@ -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
|
||||||
|
|
||||||
|
|||||||
@ -375,6 +375,11 @@ $.minmax = (value, min, max) ->
|
|||||||
$.hasAudio = (video) ->
|
$.hasAudio = (video) ->
|
||||||
video.mozHasAudio or !!video.webkitAudioDecodedByteCount
|
video.mozHasAudio or !!video.webkitAudioDecodedByteCount
|
||||||
|
|
||||||
|
$.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