quick_script 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module QuickScript
2
- VERSION = "0.9.6"
2
+ VERSION = "0.9.7"
3
3
  end
@@ -16,10 +16,18 @@ Array.prototype.remove = (item) ->
16
16
  this.splice(idx, 1) if idx > -1
17
17
  Date.from_utc = (utc) ->
18
18
  new Date(utc * 1000)
19
+ Date.from_now = ->
20
+ new Date()
19
21
  Date.now_utc = ->
20
22
  Math.round( (new Date()).getTime() / 1000.0)
21
23
  Date.prototype.to_utc = ->
22
24
  Math.round(this.getTime() / 1000.0)
25
+ Date.prototype.remove_time = ->
26
+ this.setHours(0)
27
+ this.setMinutes(0)
28
+ this.setSeconds(0)
29
+ this.setMilliseconds(0)
30
+ return this
23
31
  String.prototype.endsWith = (suffix) ->
24
32
  this.indexOf(suffix, this.length - suffix.length) != -1
25
33
  String.prototype.includes = (str) ->
@@ -197,11 +205,11 @@ Overlay.remove = (id) ->
197
205
  Overlay.removePopovers = ->
198
206
  $('.popover').remove()
199
207
 
200
- Overlay.popover = (el, tmp, vm, opts)->
208
+ Overlay.popover = (el, vm, tmp, opts)->
201
209
  id = vm.name
202
210
  opts.placement = opts.placement || 'bottom'
203
211
  $po = $("<div id='popover-#{id}' class='popover fade'><div class='arrow'></div><div class='popover-inner'><h3 class='popover-title'>#{opts.title}</h3><div class='popover-content' data-bind=\"template : '#{tmp}'\"></div></div></div>")
204
- $po.remove().css({ top: 0, left: 0, display: 'block' }).prependTo(document.body)
212
+ $po.remove().css({ top: 0, left: 0, display: 'block', width: 'auto' }).prependTo(document.body)
205
213
  $po.koBind(vm)
206
214
  $po.click (ev)->
207
215
  ev.stopPropagation()
@@ -265,9 +273,12 @@ class @TimeLength
265
273
  else if @minutes() > 0
266
274
  val = @minutes()
267
275
  str = "minute"
268
- else
276
+ else if @seconds() > 0
269
277
  val = @seconds()
270
278
  str = "second"
279
+ else
280
+ val = 0
281
+ str = "minutes"
271
282
  attr = str + ( if (val > 1) then "s" else "" )
272
283
  "#{val} #{attr}"
273
284
  TimeLength.DAY = 86400
@@ -879,6 +879,8 @@ class @View
879
879
  , 500
880
880
  showAsOverlay : (tmp, opts, cls)=>
881
881
  Overlay.add(this, tmp, opts, cls)
882
+ showAsPopover : (el, tmp, opts)=>
883
+ Overlay.popover(el, this, tmp, opts)
882
884
  hideOverlay : =>
883
885
  Overlay.remove(@name)
884
886
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 6
9
- version: 0.9.6
8
+ - 7
9
+ version: 0.9.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Alan Graham
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-10-03 00:00:00 -04:00
17
+ date: 2012-10-04 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies: []
20
20