ultimate-base 0.4.0.0 → 0.4.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ultimate-base (0.4.0.0)
4
+ ultimate-base (0.4.0.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -5,7 +5,7 @@
5
5
  #= require ultimate/base
6
6
  #= require ultimate/helpers
7
7
 
8
- @Ultimate.Backbone =
8
+ @Ultimate.Backbone ||=
9
9
 
10
10
  debugMode: false
11
11
 
@@ -25,12 +25,12 @@ class Ultimate.Backbone.Views.Slider extends Ultimate.Backbone.View
25
25
  interval: 0
26
26
  durationPerPixel: 2
27
27
  moveItems: 0
28
+ prevItems: 0
29
+ itemSize: 0
28
30
 
29
31
  totalItems: 0
30
- itemSize: 0
31
32
  displayItems: 0
32
33
  overItems: 0
33
- prevItems: 0 # can as setting
34
34
 
35
35
  timeoutId: null # for cycling == true
36
36
  startSide: "left" # set by @vertical
@@ -43,7 +43,7 @@ class Ultimate.Backbone.Views.Slider extends Ultimate.Backbone.View
43
43
  if @totalItems
44
44
  @jItems.each (index) -> $(@).attr "data-slide-index", index
45
45
  jFirstItem = @jItems.first()
46
- @itemSize = jFirstItem[_.string.camelize("outer-#{@sizeAttr}")](true)
46
+ @itemSize ||= jFirstItem[_.string.camelize("outer-#{@sizeAttr}")](true)
47
47
  needSize = @totalItems * @itemSize
48
48
  @jLine[@sizeAttr](needSize) if @jLine[@sizeAttr]() < needSize
49
49
  @displayItems = Math.round(@jDisplay[@sizeAttr]() / @itemSize)
@@ -60,8 +60,17 @@ class Ultimate.Backbone.Views.Slider extends Ultimate.Backbone.View
60
60
  @prevItems = 0
61
61
  #@bus().trigger "slider:slide", 0, @prevItems, jItems.eq(@prevItems)
62
62
 
63
+ _getItemByIndex: (index) ->
64
+ @jItems.filter -> $(@).data('slideIndex') is index
65
+
66
+ _getItemByDomIndex: (index) ->
67
+ @jLine.find(".item:eq(#{index})")
68
+
69
+ _getIndexOf: (jItem) ->
70
+ jItem.data('slideIndex')
71
+
63
72
  currentIndex: ->
64
- @jLine.find(".item:eq(#{@prevItems})").data("slideIndex")
73
+ @_getIndexOf @_getItemByDomIndex(@prevItems)
65
74
 
66
75
  trySlide: (move = 1, moveItems = move * @moveItems) ->
67
76
  if @totalItems and @overItems
@@ -1,6 +1,6 @@
1
1
  #= require ./helpers
2
2
 
3
- @Ultimate =
3
+ @Ultimate ||=
4
4
 
5
5
  debugMode: false
6
6
 
@@ -50,7 +50,7 @@
50
50
  r = {}
51
51
  for e in q
52
52
  t = e.split('=')
53
- r[t[0]] = t[1]
53
+ r[decodeURIComponent(t[0])] = decodeURIComponent(t[1])
54
54
  r
55
55
 
56
56
  @respondFormat = (url, format = null) ->
@@ -31,8 +31,6 @@ class Ultimate.Plugin
31
31
  translations: null
32
32
 
33
33
  constructor: (options) ->
34
- # TODO
35
- throw new Error('Property `el` must be specified at first argument of Ultimate.Plugin.constructor') unless options?.el
36
34
  @cid = _.uniqueId('ultimatePlugin_')
37
35
  @_configure options
38
36
  @$el = $(@el).first()
@@ -118,3 +118,13 @@
118
118
  @function find-color($list, $default: false) {
119
119
  @return find-typed-item($list, color, $default);
120
120
  }
121
+
122
+ @function _dec-size($value, $dec-list...) {
123
+ $value-unit: unit($value);
124
+ @each $dec-value in $dec-list {
125
+ @if unit($dec-value) == $value-unit {
126
+ $value: $value - $dec-value;
127
+ }
128
+ }
129
+ @return $value;
130
+ }
@@ -51,10 +51,10 @@ $support-ie: true !default;
51
51
  @if nth($include-properties, $i) and $property {
52
52
  $complex: complex-list($property);
53
53
  @if isset($width) {
54
- $width: $width - nth($complex, 2) - nth($complex, 4);
54
+ $width: _dec-size($width, nth($complex, 2), nth($complex, 4));
55
55
  }
56
56
  @if isset($height) {
57
- $height: $height - nth($complex, 1) - nth($complex, 3);
57
+ $height: _dec-size($height, nth($complex, 1), nth($complex, 3));
58
58
  }
59
59
  }
60
60
  @if $property-name == border-width and length($property) == 1 {
@@ -1,5 +1,5 @@
1
1
  module Ultimate
2
2
  module Base
3
- VERSION = '0.4.0.0'
3
+ VERSION = '0.4.0.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ultimate-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.0
4
+ version: 0.4.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-17 00:00:00.000000000 Z
12
+ date: 2013-01-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails