diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 929197c24..6fa1278b8 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -1,4 +1,6 @@ Build = + staticPath: '//s.4cdn.org/image/' + gifIcon: if window.devicePixelRatio >= 2 then '@2x.gif' else '.gif' spoilerRange: {} shortFilename: (filename, isReply) -> # FILENAME SHORTENING SCIENCE: @@ -61,9 +63,12 @@ Build = file } = o isOP = postID is threadID + {staticPath, gifIcon} = Build - staticPath = '//s.4cdn.org/image/' - gifIcon = if window.devicePixelRatio >= 2 then '@2x.gif' else '.gif' + tripcode = if tripcode + " #{tripcode}" + else + '' if email emailStart = '' @@ -72,41 +77,35 @@ Build = emailStart = '' emailEnd = '' - subject = "#{subject or ''}" - - userID = - if !capcode and uniqueID - " (ID: " + - "#{uniqueID}) " - else - '' - switch capcode when 'admin', 'admin_highlight' capcodeClass = " capcodeAdmin" capcodeStart = " ## Admin" - capcode = " " when 'mod' capcodeClass = " capcodeMod" capcodeStart = " ## Mod" - capcode = " " when 'developer' capcodeClass = " capcodeDeveloper" capcodeStart = " ## Developer" - capcode = " " else capcodeClass = '' capcodeStart = '' - capcode = '' + capcodeIcon = '' + + userID = if uniqueID and !capcode + " (ID: " + + "#{uniqueID})" + else + '' flag = unless flagCode '' @@ -125,13 +124,7 @@ Build = "File deleted." + "" else if file - ext = file.name[-3..] - if !file.twidth and !file.theight and ext is 'gif' # wtf ? - file.twidth = file.width - file.theight = file.height - - fileSize = $.bytesToString file.size - + fileSize = $.bytesToString file.size fileThumb = file.turl if file.isSpoiler fileSize = "Spoiler Image, #{fileSize}" @@ -150,20 +143,17 @@ Build = "#{fileSize}" + "" - # Ha ha, filenames! # html -> text, translate WebKit's %22s into "s a = $.el 'a', innerHTML: file.name filename = a.textContent.replace /%22/g, '"' - # shorten filename, get html a.textContent = Build.shortFilename filename shortFilename = a.innerHTML - # get html a.textContent = filename filename = a.innerHTML.replace /'/g, ''' - fileDims = if ext is 'pdf' then 'PDF' else "#{file.width}x#{file.height}" + fileDims = if file.name[-3..] is 'pdf' then 'PDF' else "#{file.width}x#{file.height}" fileInfo = "
File: #{file.timestamp}" + "-(#{fileSize}, #{fileDims}#{ if file.isSpoiler @@ -176,11 +166,6 @@ Build = else fileHTML = '' - tripcode = if tripcode - " #{tripcode}" - else - '' - sticky = if isSticky " Sticky" else @@ -213,11 +198,11 @@ Build = "
" + " " + - "#{subject} " + + "#{subject or ''} " + "" + emailStart + "#{name or ''}" + tripcode + - capcodeStart + emailEnd + capcode + userID + flag + + capcodeStart + emailEnd + capcodeIcon + userID + flag + ' ' + "#{date} " + "" +