quick_script 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
data/lib/quick_script/version.rb
CHANGED
@@ -222,32 +222,36 @@ Overlay.popover = (el, vm, tmp, opts)->
|
|
222
222
|
id = vm.name
|
223
223
|
opts.placement = opts.placement || 'bottom'
|
224
224
|
$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>")
|
225
|
-
$po.remove().css({ top: 0, left: 0, display: 'block', width: 'auto' }).prependTo(document.body)
|
226
|
-
$po.koBind(vm)
|
227
|
-
$po.click (ev)->
|
228
|
-
ev.stopPropagation()
|
229
225
|
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
226
|
+
setTimeout ->
|
227
|
+
$po.remove().css({ top: 0, left: 0, display: 'block', width: 'auto' }).prependTo(document.body)
|
228
|
+
$po.koBind(vm)
|
229
|
+
$po.click (ev)->
|
230
|
+
ev.stopPropagation()
|
235
231
|
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
232
|
+
pos = getElementPosition(el)
|
233
|
+
actualWidth = $po[0].offsetWidth
|
234
|
+
actualHeight = $po[0].offsetHeight
|
235
|
+
#console.log(actualWidth + ' ' + actualHeight)
|
236
|
+
#console.log(pos)
|
237
|
+
|
238
|
+
switch (opts.placement)
|
239
|
+
when 'bottom'
|
240
|
+
tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
|
241
|
+
when 'top'
|
242
|
+
tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
|
243
|
+
when 'left'
|
244
|
+
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
|
245
|
+
when 'right'
|
246
|
+
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
|
247
|
+
|
248
|
+
tp.top = 0 if tp.top < 0
|
249
|
+
tp.left = 0 if tp.left < 0
|
250
|
+
|
251
|
+
tp.display = 'block'
|
252
|
+
$po.css(opts.style) if opts.style?
|
253
|
+
$po.css(tp).addClass(opts.placement).addClass('in')
|
254
|
+
, 100
|
251
255
|
|
252
256
|
|
253
257
|
## TIMELENGTH
|
@@ -254,10 +254,12 @@
|
|
254
254
|
|
255
255
|
ko.bindingHandlers.center =
|
256
256
|
init : (element, valueAccessor, bindingsAccessor, viewModel) ->
|
257
|
-
|
257
|
+
fn = ->
|
258
258
|
setTimeout ->
|
259
259
|
$(element).center()
|
260
260
|
, 1
|
261
|
+
viewModel.task.subscribe(fn)
|
262
|
+
viewModel.is_visible.subscribe(fn)
|
261
263
|
|
262
264
|
ko.bindingHandlers.progressbar =
|
263
265
|
update: (element, valueAccessor) ->
|
@@ -286,6 +288,13 @@
|
|
286
288
|
title: ->
|
287
289
|
ko.utils.unwrapObservable(opts.content)
|
288
290
|
|
291
|
+
# popover : {template : <tmp>, placement : <pos>}
|
292
|
+
ko.bindingHandlers.popover =
|
293
|
+
init : (element, valueAccessor, bindingsAccessor, viewModel) ->
|
294
|
+
opts = valueAccessor()
|
295
|
+
$(element).click ->
|
296
|
+
Overlay.popover element, viewModel, opts.template, opts
|
297
|
+
|
289
298
|
ko.absorbModel = (data, self) ->
|
290
299
|
for prop, val of data
|
291
300
|
continue if typeof(val) == "function"
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 11
|
8
|
-
-
|
9
|
-
version: 0.11.
|
8
|
+
- 1
|
9
|
+
version: 0.11.1
|
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-
|
17
|
+
date: 2012-10-21 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|