vendor/assets/javascripts/quick_script/classes.js.coffee in quick_script-0.2.2 vs vendor/assets/javascripts/quick_script/classes.js.coffee in quick_script-0.3.0
- old
+ new
@@ -9,13 +9,19 @@
Array.prototype.pushOnce = (item) ->
if (!this.includes(item))
this.push(item)
Date.from_utc = (utc) ->
new Date(utc * 1000)
+Date.prototype.to_utc = ->
+ Math.round(this.getTime() / 1000.0)
String.prototype.endsWith = (suffix) ->
this.indexOf(suffix, this.length - suffix.length) != -1
String.prototype.includes = (str) ->
this.indexOf(str) != -1
+String.prototype.truncate = (val)->
+ ret = this.substring(0, val)
+ ret = ret + "..." if this.length > val
+ return ret
class @SelectOpts
constructor : ->
@options = []
add : (val, str)->