mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-24 03:40:00 -04:00
Fixed #886.
This commit is contained in:
parent
92b29915e2
commit
2ef7bff2c5
4 changed files with 19 additions and 0 deletions
|
@ -21,6 +21,11 @@
|
||||||
margin-left: 5px
|
margin-left: 5px
|
||||||
input[type="file"]
|
input[type="file"]
|
||||||
display: none
|
display: none
|
||||||
|
|
||||||
|
#thang-type-file-size
|
||||||
|
width: 350px
|
||||||
|
float: left
|
||||||
|
margin: 20px 10px
|
||||||
|
|
||||||
.treema-row img
|
.treema-row img
|
||||||
max-width: 100%
|
max-width: 100%
|
||||||
|
|
|
@ -86,6 +86,7 @@ block outer_content
|
||||||
span.glyphicon.glyphicon-remove
|
span.glyphicon.glyphicon-remove
|
||||||
span.spl Clear Data
|
span.spl Clear Data
|
||||||
input#real-upload-button(type="file")
|
input#real-upload-button(type="file")
|
||||||
|
#thang-type-file-size= fileSizeString
|
||||||
div#thang-type-treema
|
div#thang-type-treema
|
||||||
.clearfix
|
.clearfix
|
||||||
div#display-col.well
|
div#display-col.well
|
||||||
|
|
|
@ -56,6 +56,7 @@ module.exports = class ThangTypeEditView extends RootView
|
||||||
@thangType.saveBackups = true
|
@thangType.saveBackups = true
|
||||||
@listenToOnce @thangType, 'sync', ->
|
@listenToOnce @thangType, 'sync', ->
|
||||||
@files = @supermodel.loadCollection(new DocumentFiles(@thangType), 'files').model
|
@files = @supermodel.loadCollection(new DocumentFiles(@thangType), 'files').model
|
||||||
|
@updateFileSize()
|
||||||
@refreshAnimation = _.debounce @refreshAnimation, 500
|
@refreshAnimation = _.debounce @refreshAnimation, 500
|
||||||
|
|
||||||
getRenderData: (context={}) ->
|
getRenderData: (context={}) ->
|
||||||
|
@ -64,6 +65,7 @@ module.exports = class ThangTypeEditView extends RootView
|
||||||
context.animations = @getAnimationNames()
|
context.animations = @getAnimationNames()
|
||||||
context.authorized = not me.get('anonymous')
|
context.authorized = not me.get('anonymous')
|
||||||
context.recentlyPlayedLevels = storage.load('recently-played-levels') ? ['items']
|
context.recentlyPlayedLevels = storage.load('recently-played-levels') ? ['items']
|
||||||
|
context.fileSizeString = @fileSizeString
|
||||||
context
|
context
|
||||||
|
|
||||||
getAnimationNames: ->
|
getAnimationNames: ->
|
||||||
|
@ -197,6 +199,16 @@ module.exports = class ThangTypeEditView extends RootView
|
||||||
@treema.set('raw', @thangType.get('raw'))
|
@treema.set('raw', @thangType.get('raw'))
|
||||||
@updateSelectBox()
|
@updateSelectBox()
|
||||||
@refreshAnimation()
|
@refreshAnimation()
|
||||||
|
@updateFileSize()
|
||||||
|
|
||||||
|
updateFileSize: ->
|
||||||
|
file = JSON.stringify(@thangType.attributes)
|
||||||
|
compressed = LZString.compress(file)
|
||||||
|
size = (file.length / 1024).toFixed(1) + "KB"
|
||||||
|
compressedSize = (compressed.length / 1024).toFixed(1) + "KB"
|
||||||
|
gzipCompressedSize = compressedSize * 1.65 # just based on comparing ogre barracks
|
||||||
|
@fileSizeString = "Size: #{size} (~#{compressedSize} gzipped)"
|
||||||
|
@$el.find('#thang-type-file-size').text @fileSizeString
|
||||||
|
|
||||||
# animation select
|
# animation select
|
||||||
|
|
||||||
|
|
1
vendor/scripts/lz-string-1.3.3-min.js
vendored
Normal file
1
vendor/scripts/lz-string-1.3.3-min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue