phrasing 3.2.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -1
- data/Gemfile.lock +21 -3
- data/app/assets/javascripts/phrasing.js.erb +0 -1
- data/app/assets/stylesheets/phrasing_edit_mode_bubble.css.scss +6 -0
- data/app/helpers/inline_helper.rb +1 -1
- data/app/models/phrasing_phrase.rb +16 -7
- data/lib/phrasing/implementation.rb +3 -6
- data/lib/phrasing/version.rb +1 -1
- data/phrasing.gemspec +2 -0
- data/spec/dummy/app/views/site/index.html.erb +2 -0
- data/spec/dummy/config/locales/en.yml +1 -0
- data/spec/dummy/log/test.log +55916 -0
- data/spec/features/dummy_spec.rb +23 -9
- metadata +33 -47
- data/app/assets/javascripts/spin.js +0 -355
- data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/1524a8ae0986ae8836d789001277cb2a +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2577540db9b91552e445c6f71fe549a5 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5e5dccf46135893ba5aa04b2f6dcb9c2 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/61d7673b6096c7fe71678968db1270e8 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/668ce79999306d7c256f7c849c29384a +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/7f0eeee40ad7d0ee3deb01c58a3c9604 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/9bb92a90f001d659da46cceb6760405d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b247b072c0cb3d44ce31c524e74253c9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e1058f33db77649b2d01d1c4e7a32cbc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e64cfbce519bf7c3f6b387e85dabc7b7 +0 -0
data/spec/features/dummy_spec.rb
CHANGED
@@ -1,15 +1,20 @@
|
|
1
1
|
#encoding: utf-8
|
2
|
-
|
2
|
+
require 'pry-debugger'
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
feature "use #
|
5
|
+
feature "use #phrase" do
|
6
6
|
|
7
7
|
it "should see the header phrase" do
|
8
|
-
FactoryGirl.create(:phrasing_phrase, key: 'site.index.header', value: 'The Header')
|
9
8
|
visit root_path
|
10
9
|
page.should have_content 'The Header'
|
11
10
|
end
|
12
11
|
|
12
|
+
it "should see the header phrase modified if created before visiting" do
|
13
|
+
FactoryGirl.create(:phrasing_phrase, key: 'site.index.header', value: 'The Header1')
|
14
|
+
visit root_path
|
15
|
+
page.should have_content 'The Header1'
|
16
|
+
end
|
17
|
+
|
13
18
|
it "creates a phrasing_phrase if the yaml has an entry" do
|
14
19
|
PhrasingPhrase.find_by_key('site.index.header').should be_nil
|
15
20
|
visit root_path
|
@@ -67,11 +72,20 @@ end
|
|
67
72
|
|
68
73
|
feature "yaml" do
|
69
74
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
75
|
+
describe 'on first visit value should be' do
|
76
|
+
|
77
|
+
it "same as keys" do
|
78
|
+
visit root_path
|
79
|
+
PhrasingPhrase.find_by_key('site.index.intro').value.should == 'site.index.intro'
|
80
|
+
PhrasingPhrase.count.should == 3
|
81
|
+
end
|
82
|
+
|
83
|
+
it "same as translations in the yaml file" do
|
84
|
+
visit root_path
|
85
|
+
PhrasingPhrase.find_by_key('site.index.header').value.should == 'The Header'
|
86
|
+
PhrasingPhrase.find_by_key('site.index.footer').value.should == 'The Footer'
|
87
|
+
PhrasingPhrase.count.should == 3
|
88
|
+
end
|
76
89
|
|
90
|
+
end
|
77
91
|
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phrasing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
5
|
-
prerelease:
|
4
|
+
version: 3.2.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Tomislav Car
|
@@ -10,102 +9,104 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2014-01-
|
12
|
+
date: 2014-01-29 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: rails
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - '>='
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: 3.1.0
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - '>='
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: 3.1.0
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: railties
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- -
|
32
|
+
- - '>='
|
37
33
|
- !ruby/object:Gem::Version
|
38
34
|
version: '3.1'
|
39
35
|
type: :runtime
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- -
|
39
|
+
- - '>='
|
45
40
|
- !ruby/object:Gem::Version
|
46
41
|
version: '3.1'
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: haml-rails
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
|
-
- -
|
46
|
+
- - '>='
|
53
47
|
- !ruby/object:Gem::Version
|
54
48
|
version: '0'
|
55
49
|
type: :runtime
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
|
-
- -
|
53
|
+
- - '>='
|
61
54
|
- !ruby/object:Gem::Version
|
62
55
|
version: '0'
|
63
56
|
- !ruby/object:Gem::Dependency
|
64
57
|
name: jquery-rails
|
65
58
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
59
|
requirements:
|
68
|
-
- -
|
60
|
+
- - '>='
|
69
61
|
- !ruby/object:Gem::Version
|
70
62
|
version: '0'
|
71
63
|
type: :runtime
|
72
64
|
prerelease: false
|
73
65
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
66
|
requirements:
|
76
|
-
- -
|
67
|
+
- - '>='
|
77
68
|
- !ruby/object:Gem::Version
|
78
69
|
version: '0'
|
79
70
|
- !ruby/object:Gem::Dependency
|
80
71
|
name: jquery-cookie-rails
|
81
72
|
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
73
|
requirements:
|
84
|
-
- -
|
74
|
+
- - '>='
|
85
75
|
- !ruby/object:Gem::Version
|
86
76
|
version: '0'
|
87
77
|
type: :runtime
|
88
78
|
prerelease: false
|
89
79
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
80
|
requirements:
|
92
|
-
- -
|
81
|
+
- - '>='
|
93
82
|
- !ruby/object:Gem::Version
|
94
83
|
version: '0'
|
95
84
|
- !ruby/object:Gem::Dependency
|
96
85
|
name: sass
|
97
86
|
requirement: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
87
|
requirements:
|
100
|
-
- -
|
88
|
+
- - '>='
|
101
89
|
- !ruby/object:Gem::Version
|
102
90
|
version: '0'
|
103
91
|
type: :runtime
|
104
92
|
prerelease: false
|
105
93
|
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
94
|
requirements:
|
108
|
-
- -
|
95
|
+
- - '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: pry-debugger
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - '>='
|
109
110
|
- !ruby/object:Gem::Version
|
110
111
|
version: '0'
|
111
112
|
description: Phrasing!
|
@@ -130,7 +131,6 @@ files:
|
|
130
131
|
- app/assets/javascripts/head.js
|
131
132
|
- app/assets/javascripts/phrasing.js.erb
|
132
133
|
- app/assets/javascripts/phrasing_engine.js
|
133
|
-
- app/assets/javascripts/spin.js
|
134
134
|
- app/assets/stylesheets/phrasing.css.scss
|
135
135
|
- app/assets/stylesheets/phrasing_edit_mode_bubble.css.scss
|
136
136
|
- app/assets/stylesheets/phrasing_engine.css
|
@@ -201,19 +201,6 @@ files:
|
|
201
201
|
- spec/dummy/public/500.html
|
202
202
|
- spec/dummy/public/favicon.ico
|
203
203
|
- spec/dummy/script/rails
|
204
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
|
205
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/1524a8ae0986ae8836d789001277cb2a
|
206
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/2577540db9b91552e445c6f71fe549a5
|
207
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
|
208
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/5e5dccf46135893ba5aa04b2f6dcb9c2
|
209
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/61d7673b6096c7fe71678968db1270e8
|
210
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/668ce79999306d7c256f7c849c29384a
|
211
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/7f0eeee40ad7d0ee3deb01c58a3c9604
|
212
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/9bb92a90f001d659da46cceb6760405d
|
213
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/b247b072c0cb3d44ce31c524e74253c9
|
214
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
|
215
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/e1058f33db77649b2d01d1c4e7a32cbc
|
216
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/e64cfbce519bf7c3f6b387e85dabc7b7
|
217
204
|
- spec/factories/phrasing_phrases.rb
|
218
205
|
- spec/features/dummy_spec.rb
|
219
206
|
- spec/features/phrasing_spec.rb
|
@@ -223,26 +210,25 @@ files:
|
|
223
210
|
homepage: http://github.com/infinum/phrasing
|
224
211
|
licenses:
|
225
212
|
- MIT
|
213
|
+
metadata: {}
|
226
214
|
post_install_message:
|
227
215
|
rdoc_options: []
|
228
216
|
require_paths:
|
229
217
|
- lib
|
230
218
|
required_ruby_version: !ruby/object:Gem::Requirement
|
231
|
-
none: false
|
232
219
|
requirements:
|
233
|
-
- -
|
220
|
+
- - '>='
|
234
221
|
- !ruby/object:Gem::Version
|
235
222
|
version: '0'
|
236
223
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
237
|
-
none: false
|
238
224
|
requirements:
|
239
|
-
- -
|
225
|
+
- - '>='
|
240
226
|
- !ruby/object:Gem::Version
|
241
227
|
version: '0'
|
242
228
|
requirements: []
|
243
229
|
rubyforge_project:
|
244
|
-
rubygems_version: 1.
|
230
|
+
rubygems_version: 2.1.5
|
245
231
|
signing_key:
|
246
|
-
specification_version:
|
232
|
+
specification_version: 4
|
247
233
|
summary: Edit phrases inline for Rails applications!
|
248
234
|
test_files: []
|
@@ -1,355 +0,0 @@
|
|
1
|
-
//fgnass.github.com/spin.js#v1.3.2
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Copyright (c) 2011-2013 Felix Gnass
|
5
|
-
* Licensed under the MIT license
|
6
|
-
*/
|
7
|
-
(function(root, factory) {
|
8
|
-
|
9
|
-
/* CommonJS */
|
10
|
-
if (typeof exports == 'object') module.exports = factory()
|
11
|
-
|
12
|
-
/* AMD module */
|
13
|
-
else if (typeof define == 'function' && define.amd) define(factory)
|
14
|
-
|
15
|
-
/* Browser global */
|
16
|
-
else root.Spinner = factory()
|
17
|
-
}
|
18
|
-
(this, function() {
|
19
|
-
"use strict";
|
20
|
-
|
21
|
-
var prefixes = ['webkit', 'Moz', 'ms', 'O'] /* Vendor prefixes */
|
22
|
-
, animations = {} /* Animation rules keyed by their name */
|
23
|
-
, useCssAnimations /* Whether to use CSS animations or setTimeout */
|
24
|
-
|
25
|
-
/**
|
26
|
-
* Utility function to create elements. If no tag name is given,
|
27
|
-
* a DIV is created. Optionally properties can be passed.
|
28
|
-
*/
|
29
|
-
function createEl(tag, prop) {
|
30
|
-
var el = document.createElement(tag || 'div')
|
31
|
-
, n
|
32
|
-
|
33
|
-
for(n in prop) el[n] = prop[n]
|
34
|
-
return el
|
35
|
-
}
|
36
|
-
|
37
|
-
/**
|
38
|
-
* Appends children and returns the parent.
|
39
|
-
*/
|
40
|
-
function ins(parent /* child1, child2, ...*/) {
|
41
|
-
for (var i=1, n=arguments.length; i<n; i++)
|
42
|
-
parent.appendChild(arguments[i])
|
43
|
-
|
44
|
-
return parent
|
45
|
-
}
|
46
|
-
|
47
|
-
/**
|
48
|
-
* Insert a new stylesheet to hold the @keyframe or VML rules.
|
49
|
-
*/
|
50
|
-
var sheet = (function() {
|
51
|
-
var el = createEl('style', {type : 'text/css'})
|
52
|
-
ins(document.getElementsByTagName('head')[0], el)
|
53
|
-
return el.sheet || el.styleSheet
|
54
|
-
}())
|
55
|
-
|
56
|
-
/**
|
57
|
-
* Creates an opacity keyframe animation rule and returns its name.
|
58
|
-
* Since most mobile Webkits have timing issues with animation-delay,
|
59
|
-
* we create separate rules for each line/segment.
|
60
|
-
*/
|
61
|
-
function addAnimation(alpha, trail, i, lines) {
|
62
|
-
var name = ['opacity', trail, ~~(alpha*100), i, lines].join('-')
|
63
|
-
, start = 0.01 + i/lines * 100
|
64
|
-
, z = Math.max(1 - (1-alpha) / trail * (100-start), alpha)
|
65
|
-
, prefix = useCssAnimations.substring(0, useCssAnimations.indexOf('Animation')).toLowerCase()
|
66
|
-
, pre = prefix && '-' + prefix + '-' || ''
|
67
|
-
|
68
|
-
if (!animations[name]) {
|
69
|
-
sheet.insertRule(
|
70
|
-
'@' + pre + 'keyframes ' + name + '{' +
|
71
|
-
'0%{opacity:' + z + '}' +
|
72
|
-
start + '%{opacity:' + alpha + '}' +
|
73
|
-
(start+0.01) + '%{opacity:1}' +
|
74
|
-
(start+trail) % 100 + '%{opacity:' + alpha + '}' +
|
75
|
-
'100%{opacity:' + z + '}' +
|
76
|
-
'}', sheet.cssRules.length)
|
77
|
-
|
78
|
-
animations[name] = 1
|
79
|
-
}
|
80
|
-
|
81
|
-
return name
|
82
|
-
}
|
83
|
-
|
84
|
-
/**
|
85
|
-
* Tries various vendor prefixes and returns the first supported property.
|
86
|
-
*/
|
87
|
-
function vendor(el, prop) {
|
88
|
-
var s = el.style
|
89
|
-
, pp
|
90
|
-
, i
|
91
|
-
|
92
|
-
prop = prop.charAt(0).toUpperCase() + prop.slice(1)
|
93
|
-
for(i=0; i<prefixes.length; i++) {
|
94
|
-
pp = prefixes[i]+prop
|
95
|
-
if(s[pp] !== undefined) return pp
|
96
|
-
}
|
97
|
-
if(s[prop] !== undefined) return prop
|
98
|
-
}
|
99
|
-
|
100
|
-
/**
|
101
|
-
* Sets multiple style properties at once.
|
102
|
-
*/
|
103
|
-
function css(el, prop) {
|
104
|
-
for (var n in prop)
|
105
|
-
el.style[vendor(el, n)||n] = prop[n]
|
106
|
-
|
107
|
-
return el
|
108
|
-
}
|
109
|
-
|
110
|
-
/**
|
111
|
-
* Fills in default values.
|
112
|
-
*/
|
113
|
-
function merge(obj) {
|
114
|
-
for (var i=1; i < arguments.length; i++) {
|
115
|
-
var def = arguments[i]
|
116
|
-
for (var n in def)
|
117
|
-
if (obj[n] === undefined) obj[n] = def[n]
|
118
|
-
}
|
119
|
-
return obj
|
120
|
-
}
|
121
|
-
|
122
|
-
/**
|
123
|
-
* Returns the absolute page-offset of the given element.
|
124
|
-
*/
|
125
|
-
function pos(el) {
|
126
|
-
var o = { x:el.offsetLeft, y:el.offsetTop }
|
127
|
-
while((el = el.offsetParent))
|
128
|
-
o.x+=el.offsetLeft, o.y+=el.offsetTop
|
129
|
-
|
130
|
-
return o
|
131
|
-
}
|
132
|
-
|
133
|
-
/**
|
134
|
-
* Returns the line color from the given string or array.
|
135
|
-
*/
|
136
|
-
function getColor(color, idx) {
|
137
|
-
return typeof color == 'string' ? color : color[idx % color.length]
|
138
|
-
}
|
139
|
-
|
140
|
-
// Built-in defaults
|
141
|
-
|
142
|
-
var defaults = {
|
143
|
-
lines: 12, // The number of lines to draw
|
144
|
-
length: 7, // The length of each line
|
145
|
-
width: 5, // The line thickness
|
146
|
-
radius: 10, // The radius of the inner circle
|
147
|
-
rotate: 0, // Rotation offset
|
148
|
-
corners: 1, // Roundness (0..1)
|
149
|
-
color: '#000', // #rgb or #rrggbb
|
150
|
-
direction: 1, // 1: clockwise, -1: counterclockwise
|
151
|
-
speed: 1, // Rounds per second
|
152
|
-
trail: 100, // Afterglow percentage
|
153
|
-
opacity: 1/4, // Opacity of the lines
|
154
|
-
fps: 20, // Frames per second when using setTimeout()
|
155
|
-
zIndex: 2e9, // Use a high z-index by default
|
156
|
-
className: 'spinner', // CSS class to assign to the element
|
157
|
-
top: 'auto', // center vertically
|
158
|
-
left: 'auto', // center horizontally
|
159
|
-
position: 'relative' // element position
|
160
|
-
}
|
161
|
-
|
162
|
-
/** The constructor */
|
163
|
-
function Spinner(o) {
|
164
|
-
if (typeof this == 'undefined') return new Spinner(o)
|
165
|
-
this.opts = merge(o || {}, Spinner.defaults, defaults)
|
166
|
-
}
|
167
|
-
|
168
|
-
// Global defaults that override the built-ins:
|
169
|
-
Spinner.defaults = {}
|
170
|
-
|
171
|
-
merge(Spinner.prototype, {
|
172
|
-
|
173
|
-
/**
|
174
|
-
* Adds the spinner to the given target element. If this instance is already
|
175
|
-
* spinning, it is automatically removed from its previous target b calling
|
176
|
-
* stop() internally.
|
177
|
-
*/
|
178
|
-
spin: function(target) {
|
179
|
-
this.stop()
|
180
|
-
|
181
|
-
var self = this
|
182
|
-
, o = self.opts
|
183
|
-
, el = self.el = css(createEl(0, {className: o.className}), {position: o.position, width: 0, zIndex: o.zIndex})
|
184
|
-
, mid = o.radius+o.length+o.width
|
185
|
-
, ep // element position
|
186
|
-
, tp // target position
|
187
|
-
|
188
|
-
if (target) {
|
189
|
-
target.insertBefore(el, target.firstChild||null)
|
190
|
-
tp = pos(target)
|
191
|
-
ep = pos(el)
|
192
|
-
css(el, {
|
193
|
-
left: (o.left == 'auto' ? tp.x-ep.x + (target.offsetWidth >> 1) : parseInt(o.left, 10) + mid) + 'px',
|
194
|
-
top: (o.top == 'auto' ? tp.y-ep.y + (target.offsetHeight >> 1) : parseInt(o.top, 10) + mid) + 'px'
|
195
|
-
})
|
196
|
-
}
|
197
|
-
|
198
|
-
el.setAttribute('role', 'progressbar')
|
199
|
-
self.lines(el, self.opts)
|
200
|
-
|
201
|
-
if (!useCssAnimations) {
|
202
|
-
// No CSS animation support, use setTimeout() instead
|
203
|
-
var i = 0
|
204
|
-
, start = (o.lines - 1) * (1 - o.direction) / 2
|
205
|
-
, alpha
|
206
|
-
, fps = o.fps
|
207
|
-
, f = fps/o.speed
|
208
|
-
, ostep = (1-o.opacity) / (f*o.trail / 100)
|
209
|
-
, astep = f/o.lines
|
210
|
-
|
211
|
-
;(function anim() {
|
212
|
-
i++;
|
213
|
-
for (var j = 0; j < o.lines; j++) {
|
214
|
-
alpha = Math.max(1 - (i + (o.lines - j) * astep) % f * ostep, o.opacity)
|
215
|
-
|
216
|
-
self.opacity(el, j * o.direction + start, alpha, o)
|
217
|
-
}
|
218
|
-
self.timeout = self.el && setTimeout(anim, ~~(1000/fps))
|
219
|
-
})()
|
220
|
-
}
|
221
|
-
return self
|
222
|
-
},
|
223
|
-
|
224
|
-
/**
|
225
|
-
* Stops and removes the Spinner.
|
226
|
-
*/
|
227
|
-
stop: function() {
|
228
|
-
var el = this.el
|
229
|
-
if (el) {
|
230
|
-
clearTimeout(this.timeout)
|
231
|
-
if (el.parentNode) el.parentNode.removeChild(el)
|
232
|
-
this.el = undefined
|
233
|
-
}
|
234
|
-
return this
|
235
|
-
},
|
236
|
-
|
237
|
-
/**
|
238
|
-
* Internal method that draws the individual lines. Will be overwritten
|
239
|
-
* in VML fallback mode below.
|
240
|
-
*/
|
241
|
-
lines: function(el, o) {
|
242
|
-
var i = 0
|
243
|
-
, start = (o.lines - 1) * (1 - o.direction) / 2
|
244
|
-
, seg
|
245
|
-
|
246
|
-
function fill(color, shadow) {
|
247
|
-
return css(createEl(), {
|
248
|
-
position: 'absolute',
|
249
|
-
width: (o.length+o.width) + 'px',
|
250
|
-
height: o.width + 'px',
|
251
|
-
background: color,
|
252
|
-
boxShadow: shadow,
|
253
|
-
transformOrigin: 'left',
|
254
|
-
transform: 'rotate(' + ~~(360/o.lines*i+o.rotate) + 'deg) translate(' + o.radius+'px' +',0)',
|
255
|
-
borderRadius: (o.corners * o.width>>1) + 'px'
|
256
|
-
})
|
257
|
-
}
|
258
|
-
|
259
|
-
for (; i < o.lines; i++) {
|
260
|
-
seg = css(createEl(), {
|
261
|
-
position: 'absolute',
|
262
|
-
top: 1+~(o.width/2) + 'px',
|
263
|
-
transform: o.hwaccel ? 'translate3d(0,0,0)' : '',
|
264
|
-
opacity: o.opacity,
|
265
|
-
animation: useCssAnimations && addAnimation(o.opacity, o.trail, start + i * o.direction, o.lines) + ' ' + 1/o.speed + 's linear infinite'
|
266
|
-
})
|
267
|
-
|
268
|
-
if (o.shadow) ins(seg, css(fill('#000', '0 0 4px ' + '#000'), {top: 2+'px'}))
|
269
|
-
ins(el, ins(seg, fill(getColor(o.color, i), '0 0 1px rgba(0,0,0,.1)')))
|
270
|
-
}
|
271
|
-
return el
|
272
|
-
},
|
273
|
-
|
274
|
-
/**
|
275
|
-
* Internal method that adjusts the opacity of a single line.
|
276
|
-
* Will be overwritten in VML fallback mode below.
|
277
|
-
*/
|
278
|
-
opacity: function(el, i, val) {
|
279
|
-
if (i < el.childNodes.length) el.childNodes[i].style.opacity = val
|
280
|
-
}
|
281
|
-
|
282
|
-
})
|
283
|
-
|
284
|
-
|
285
|
-
function initVML() {
|
286
|
-
|
287
|
-
/* Utility function to create a VML tag */
|
288
|
-
function vml(tag, attr) {
|
289
|
-
return createEl('<' + tag + ' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">', attr)
|
290
|
-
}
|
291
|
-
|
292
|
-
// No CSS transforms but VML support, add a CSS rule for VML elements:
|
293
|
-
sheet.addRule('.spin-vml', 'behavior:url(#default#VML)')
|
294
|
-
|
295
|
-
Spinner.prototype.lines = function(el, o) {
|
296
|
-
var r = o.length+o.width
|
297
|
-
, s = 2*r
|
298
|
-
|
299
|
-
function grp() {
|
300
|
-
return css(
|
301
|
-
vml('group', {
|
302
|
-
coordsize: s + ' ' + s,
|
303
|
-
coordorigin: -r + ' ' + -r
|
304
|
-
}),
|
305
|
-
{ width: s, height: s }
|
306
|
-
)
|
307
|
-
}
|
308
|
-
|
309
|
-
var margin = -(o.width+o.length)*2 + 'px'
|
310
|
-
, g = css(grp(), {position: 'absolute', top: margin, left: margin})
|
311
|
-
, i
|
312
|
-
|
313
|
-
function seg(i, dx, filter) {
|
314
|
-
ins(g,
|
315
|
-
ins(css(grp(), {rotation: 360 / o.lines * i + 'deg', left: ~~dx}),
|
316
|
-
ins(css(vml('roundrect', {arcsize: o.corners}), {
|
317
|
-
width: r,
|
318
|
-
height: o.width,
|
319
|
-
left: o.radius,
|
320
|
-
top: -o.width>>1,
|
321
|
-
filter: filter
|
322
|
-
}),
|
323
|
-
vml('fill', {color: getColor(o.color, i), opacity: o.opacity}),
|
324
|
-
vml('stroke', {opacity: 0}) // transparent stroke to fix color bleeding upon opacity change
|
325
|
-
)
|
326
|
-
)
|
327
|
-
)
|
328
|
-
}
|
329
|
-
|
330
|
-
if (o.shadow)
|
331
|
-
for (i = 1; i <= o.lines; i++)
|
332
|
-
seg(i, -2, 'progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)')
|
333
|
-
|
334
|
-
for (i = 1; i <= o.lines; i++) seg(i)
|
335
|
-
return ins(el, g)
|
336
|
-
}
|
337
|
-
|
338
|
-
Spinner.prototype.opacity = function(el, i, val, o) {
|
339
|
-
var c = el.firstChild
|
340
|
-
o = o.shadow && o.lines || 0
|
341
|
-
if (c && i+o < c.childNodes.length) {
|
342
|
-
c = c.childNodes[i+o]; c = c && c.firstChild; c = c && c.firstChild
|
343
|
-
if (c) c.opacity = val
|
344
|
-
}
|
345
|
-
}
|
346
|
-
}
|
347
|
-
|
348
|
-
var probe = css(createEl('group'), {behavior: 'url(#default#VML)'})
|
349
|
-
|
350
|
-
if (!vendor(probe, 'transform') && probe.adj) initVML()
|
351
|
-
else useCssAnimations = vendor(probe, 'animation')
|
352
|
-
|
353
|
-
return Spinner
|
354
|
-
|
355
|
-
}));
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|