Add 'Randomize Filename' option. #452

This commit is contained in:
ccd0 2015-08-14 00:47:17 -07:00
parent d769c01c80
commit b829bde742
3 changed files with 18 additions and 1 deletions

View File

@ -431,6 +431,11 @@ Config =
'Remember the spoiler state, instead of resetting after posting.'
1
]
'Randomize Filename': [
false
'Set the filename to a random timestamp within the past year. Disabled on /f/.'
1
]
'Show New Thread Option in Threads': [
false
'Show the option to post a new / different thread from inside a thread.'

View File

@ -10,6 +10,15 @@ QR =
'swf': 'application/vnd.adobe.flash.movie'
'webm': 'video/webm'
extensionFromType:
'image/jpeg': 'jpg'
'image/png': 'png'
'image/gif': 'gif'
'application/pdf': 'pdf'
'application/vnd.adobe.flash.movie': 'swf'
'application/x-shockwave-flash': 'swf'
'video/webm': 'webm'
init: ->
return unless Conf['Quick Reply']

View File

@ -179,7 +179,10 @@ QR.post = class
return
setFile: (@file) ->
@filename = @file.name
@filename = if Conf['Randomize Filename'] and g.BOARD.ID isnt 'f'
"#{Date.now() - Math.floor(Math.random() * 365 * $.DAY)}.#{QR.extensionFromType[@file.type] or 'jpg'}"
else
@file.name
@filesize = $.bytesToString @file.size
@checkSize()
@nodes.label.hidden = false if QR.spoiler