quick_script 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  module QuickScript
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -6,6 +6,8 @@ Array.prototype.indexAt = (val) ->
6
6
  return -1
7
7
  Array.prototype.includes = (val) ->
8
8
  return this.indexAt(val) != -1
9
+ Array.prototype.itemAt = (val)->
10
+ return this.slice(val)[0]
9
11
  Array.prototype.pushOnce = (item) ->
10
12
  if (!this.includes(item))
11
13
  this.push(item)
@@ -43,6 +45,9 @@ class @PageTimer
43
45
  @t_id = setInterval(@callback, @frequency)
44
46
  stop : =>
45
47
  clearInterval(@t_id)
48
+ @t_id = -1
49
+ isRunning : =>
50
+ @t_id != -1
46
51
  setFrequency : (time) =>
47
52
  @stop()
48
53
  @frequency = time * 1000
@@ -101,7 +101,7 @@
101
101
  model.selectFile = ->
102
102
  $(element).click()
103
103
 
104
- ko.bindingHandlers.tabs =
104
+ ko.bindingHandlers.jqtabs =
105
105
  init : (element, valueAccessor, bindingsAccessor, viewModel) ->
106
106
  $(element).addClass('ui-tabs ui-widget ui-widget-content ui-corner-all')
107
107
  $(element).children('ul').first().addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all')
@@ -118,6 +118,19 @@
118
118
  $(element).children('div').addClass('ui-tabs-hide')
119
119
  $(element).children("div##{sel_tab}").removeClass('ui-tabs-hide')
120
120
 
121
+ ko.bindingHandlers.tabs =
122
+ init : (element, valueAccessor, bindingsAccessor, viewModel) ->
123
+ $(element).children('ul').first().find('li').each (idx, el)->
124
+ tab_id = $(el)[0].id
125
+ $(el).click ->
126
+ valueAccessor()(tab_id)
127
+ update : (element, valueAccessor, bindingsAccessor, viewModel) ->
128
+ sel_tab = ko.utils.unwrapObservable(valueAccessor())
129
+ $(element).children('ul').first().children('li').removeClass('selected')
130
+ $(element).children('ul').first().children("li##{sel_tab}").addClass('selected')
131
+ $(element).children('div').addClass('hidden')
132
+ $(element).children("div##{sel_tab}").removeClass('hidden')
133
+
121
134
  ko.bindingHandlers.calendar =
122
135
  init : (element, valueAccessor, bindingsAccessor, viewModel) ->
123
136
  $(element).fullCalendar('destroy')
@@ -360,7 +373,7 @@ class @Model
360
373
  @model_state(ko.modelStates.READY)
361
374
  @model_state(ko.modelStates.SAVING)
362
375
  reset : ->
363
- @model_state(ko.modelStates.LOADING)
376
+ #@model_state(ko.modelStates.LOADING)
364
377
  @id('')
365
378
  @init()
366
379
  @db_state(@toJS())
@@ -585,9 +598,15 @@ class @Collection
585
598
  @items.push(item)
586
599
  @views.push(view)
587
600
  return view
601
+ removeItem : (idx)->
602
+ @items.splice(idx, 1)
603
+ @views.splice(idx, 1)
588
604
  getItemById : (id)->
589
605
  list = @items().filter ((item)=> item.id() == id)
590
606
  ret = if list.length > 0 then list[0] else null
607
+ nthViews : (n, offset) ->
608
+ @views().filter (el, i)->
609
+ (i-offset) % n == 0
591
610
  removeDuplicates : ->
592
611
  ids = []
593
612
  @items().forEach (item, idx, array)=>
@@ -30,6 +30,8 @@
30
30
  +inline
31
31
  .table-cell
32
32
  +table-cell
33
+ .hidden
34
+ +hidden
33
35
 
34
36
  .img-shadow-dark
35
37
  +img-shadow-dark
@@ -41,6 +41,8 @@ $dark-gray: rgba(0,0,0,.75)
41
41
  letter-spacing: $val
42
42
  =inline
43
43
  display: inline-block
44
+ =hidden
45
+ display: none
44
46
  =table-cell
45
47
  display: table-cell
46
48
  =padded
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quick_script
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alan Graham
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-06 00:00:00 Z
18
+ date: 2012-05-15 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: Framework for single-page web applications