nouislider-rails 7.0.2 → 8.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/Gemfile.lock +70 -0
- data/README.md +7 -36
- data/lib/nouislider/rails/version.rb +1 -1
- data/nouislider-rails.gemspec +2 -2
- data/vendor/assets/javascripts/nouislider.js +1629 -0
- data/vendor/assets/stylesheets/nouislider.css +4 -0
- data/vendor/assets/stylesheets/nouislider/nouislider.css +162 -0
- data/vendor/assets/stylesheets/nouislider/nouislider.pips.css +98 -0
- metadata +10 -11
- data/vendor/assets/javascripts/jquery.nouislider.js +0 -3
- data/vendor/assets/javascripts/libLink/jquery.liblink.js +0 -311
- data/vendor/assets/javascripts/nouislider/jquery.nouislider.js +0 -1626
- data/vendor/assets/javascripts/wnumb/wNumb.js +0 -335
- data/vendor/assets/stylesheets/jquery.nouislider.css +0 -3
- data/vendor/assets/stylesheets/nouislider/jquery.nouislider.css +0 -265
@@ -0,0 +1,162 @@
|
|
1
|
+
|
2
|
+
/* Functional styling;
|
3
|
+
* These styles are required for noUiSlider to function.
|
4
|
+
* You don't need to change these rules to apply your design.
|
5
|
+
*/
|
6
|
+
.noUi-target,
|
7
|
+
.noUi-target * {
|
8
|
+
-webkit-touch-callout: none;
|
9
|
+
-webkit-user-select: none;
|
10
|
+
-ms-touch-action: none;
|
11
|
+
-ms-user-select: none;
|
12
|
+
-moz-user-select: none;
|
13
|
+
-moz-box-sizing: border-box;
|
14
|
+
box-sizing: border-box;
|
15
|
+
}
|
16
|
+
.noUi-target {
|
17
|
+
position: relative;
|
18
|
+
direction: ltr;
|
19
|
+
}
|
20
|
+
.noUi-base {
|
21
|
+
width: 100%;
|
22
|
+
height: 100%;
|
23
|
+
position: relative;
|
24
|
+
z-index: 1; /* Fix 401 */
|
25
|
+
}
|
26
|
+
.noUi-origin {
|
27
|
+
position: absolute;
|
28
|
+
right: 0;
|
29
|
+
top: 0;
|
30
|
+
left: 0;
|
31
|
+
bottom: 0;
|
32
|
+
}
|
33
|
+
.noUi-handle {
|
34
|
+
position: relative;
|
35
|
+
z-index: 1;
|
36
|
+
}
|
37
|
+
.noUi-stacking .noUi-handle {
|
38
|
+
/* This class is applied to the lower origin when
|
39
|
+
its values is > 50%. */
|
40
|
+
z-index: 10;
|
41
|
+
}
|
42
|
+
.noUi-state-tap .noUi-origin {
|
43
|
+
-webkit-transition: left 0.3s, top 0.3s;
|
44
|
+
transition: left 0.3s, top 0.3s;
|
45
|
+
}
|
46
|
+
.noUi-state-drag * {
|
47
|
+
cursor: inherit !important;
|
48
|
+
}
|
49
|
+
|
50
|
+
/* Painting and performance;
|
51
|
+
* Browsers can paint handles in their own layer.
|
52
|
+
*/
|
53
|
+
.noUi-base {
|
54
|
+
-webkit-transform: translate3d(0,0,0);
|
55
|
+
transform: translate3d(0,0,0);
|
56
|
+
}
|
57
|
+
|
58
|
+
/* Slider size and handle placement;
|
59
|
+
*/
|
60
|
+
.noUi-horizontal {
|
61
|
+
height: 18px;
|
62
|
+
}
|
63
|
+
.noUi-horizontal .noUi-handle {
|
64
|
+
width: 34px;
|
65
|
+
height: 28px;
|
66
|
+
left: -17px;
|
67
|
+
top: -6px;
|
68
|
+
}
|
69
|
+
.noUi-vertical {
|
70
|
+
width: 18px;
|
71
|
+
}
|
72
|
+
.noUi-vertical .noUi-handle {
|
73
|
+
width: 28px;
|
74
|
+
height: 34px;
|
75
|
+
left: -6px;
|
76
|
+
top: -17px;
|
77
|
+
}
|
78
|
+
|
79
|
+
/* Styling;
|
80
|
+
*/
|
81
|
+
.noUi-background {
|
82
|
+
background: #FAFAFA;
|
83
|
+
box-shadow: inset 0 1px 1px #f0f0f0;
|
84
|
+
}
|
85
|
+
.noUi-connect {
|
86
|
+
background: #3FB8AF;
|
87
|
+
box-shadow: inset 0 0 3px rgba(51,51,51,0.45);
|
88
|
+
-webkit-transition: background 450ms;
|
89
|
+
transition: background 450ms;
|
90
|
+
}
|
91
|
+
.noUi-origin {
|
92
|
+
border-radius: 2px;
|
93
|
+
}
|
94
|
+
.noUi-target {
|
95
|
+
border-radius: 4px;
|
96
|
+
border: 1px solid #D3D3D3;
|
97
|
+
box-shadow: inset 0 1px 1px #F0F0F0, 0 3px 6px -5px #BBB;
|
98
|
+
}
|
99
|
+
.noUi-target.noUi-connect {
|
100
|
+
box-shadow: inset 0 0 3px rgba(51,51,51,0.45), 0 3px 6px -5px #BBB;
|
101
|
+
}
|
102
|
+
|
103
|
+
/* Handles and cursors;
|
104
|
+
*/
|
105
|
+
.noUi-dragable {
|
106
|
+
cursor: w-resize;
|
107
|
+
}
|
108
|
+
.noUi-vertical .noUi-dragable {
|
109
|
+
cursor: n-resize;
|
110
|
+
}
|
111
|
+
.noUi-handle {
|
112
|
+
border: 1px solid #D9D9D9;
|
113
|
+
border-radius: 3px;
|
114
|
+
background: #FFF;
|
115
|
+
cursor: default;
|
116
|
+
box-shadow: inset 0 0 1px #FFF,
|
117
|
+
inset 0 1px 7px #EBEBEB,
|
118
|
+
0 3px 6px -3px #BBB;
|
119
|
+
}
|
120
|
+
.noUi-active {
|
121
|
+
box-shadow: inset 0 0 1px #FFF,
|
122
|
+
inset 0 1px 7px #DDD,
|
123
|
+
0 3px 6px -3px #BBB;
|
124
|
+
}
|
125
|
+
|
126
|
+
/* Handle stripes;
|
127
|
+
*/
|
128
|
+
.noUi-handle:before,
|
129
|
+
.noUi-handle:after {
|
130
|
+
content: "";
|
131
|
+
display: block;
|
132
|
+
position: absolute;
|
133
|
+
height: 14px;
|
134
|
+
width: 1px;
|
135
|
+
background: #E8E7E6;
|
136
|
+
left: 14px;
|
137
|
+
top: 6px;
|
138
|
+
}
|
139
|
+
.noUi-handle:after {
|
140
|
+
left: 17px;
|
141
|
+
}
|
142
|
+
.noUi-vertical .noUi-handle:before,
|
143
|
+
.noUi-vertical .noUi-handle:after {
|
144
|
+
width: 14px;
|
145
|
+
height: 1px;
|
146
|
+
left: 6px;
|
147
|
+
top: 14px;
|
148
|
+
}
|
149
|
+
.noUi-vertical .noUi-handle:after {
|
150
|
+
top: 17px;
|
151
|
+
}
|
152
|
+
|
153
|
+
/* Disabled state;
|
154
|
+
*/
|
155
|
+
[disabled].noUi-connect,
|
156
|
+
[disabled] .noUi-connect {
|
157
|
+
background: #B8B8B8;
|
158
|
+
}
|
159
|
+
[disabled].noUi-origin,
|
160
|
+
[disabled] .noUi-handle {
|
161
|
+
cursor: not-allowed;
|
162
|
+
}
|
@@ -0,0 +1,98 @@
|
|
1
|
+
|
2
|
+
/* Base;
|
3
|
+
*
|
4
|
+
*/
|
5
|
+
.noUi-pips,
|
6
|
+
.noUi-pips * {
|
7
|
+
-moz-box-sizing: border-box;
|
8
|
+
box-sizing: border-box;
|
9
|
+
}
|
10
|
+
.noUi-pips {
|
11
|
+
position: absolute;
|
12
|
+
font: 400 12px Arial;
|
13
|
+
color: #999;
|
14
|
+
}
|
15
|
+
|
16
|
+
/* Values;
|
17
|
+
*
|
18
|
+
*/
|
19
|
+
.noUi-value {
|
20
|
+
width: 40px;
|
21
|
+
position: absolute;
|
22
|
+
text-align: center;
|
23
|
+
}
|
24
|
+
.noUi-value-sub {
|
25
|
+
color: #ccc;
|
26
|
+
font-size: 10px;
|
27
|
+
}
|
28
|
+
|
29
|
+
/* Markings;
|
30
|
+
*
|
31
|
+
*/
|
32
|
+
.noUi-marker {
|
33
|
+
position: absolute;
|
34
|
+
background: #CCC;
|
35
|
+
}
|
36
|
+
.noUi-marker-sub {
|
37
|
+
background: #AAA;
|
38
|
+
}
|
39
|
+
.noUi-marker-large {
|
40
|
+
background: #AAA;
|
41
|
+
}
|
42
|
+
|
43
|
+
/* Horizontal layout;
|
44
|
+
*
|
45
|
+
*/
|
46
|
+
.noUi-pips-horizontal {
|
47
|
+
padding: 10px 0;
|
48
|
+
height: 50px;
|
49
|
+
top: 100%;
|
50
|
+
left: 0;
|
51
|
+
width: 100%;
|
52
|
+
}
|
53
|
+
.noUi-value-horizontal {
|
54
|
+
margin-left: -20px;
|
55
|
+
padding-top: 20px;
|
56
|
+
}
|
57
|
+
.noUi-value-horizontal.noUi-value-sub {
|
58
|
+
padding-top: 15px;
|
59
|
+
}
|
60
|
+
|
61
|
+
.noUi-marker-horizontal.noUi-marker {
|
62
|
+
margin-left: -1px;
|
63
|
+
width: 2px;
|
64
|
+
height: 5px;
|
65
|
+
}
|
66
|
+
.noUi-marker-horizontal.noUi-marker-sub {
|
67
|
+
height: 10px;
|
68
|
+
}
|
69
|
+
.noUi-marker-horizontal.noUi-marker-large {
|
70
|
+
height: 15px;
|
71
|
+
}
|
72
|
+
|
73
|
+
/* Vertical layout;
|
74
|
+
*
|
75
|
+
*/
|
76
|
+
.noUi-pips-vertical {
|
77
|
+
padding: 0 10px;
|
78
|
+
height: 100%;
|
79
|
+
top: 0;
|
80
|
+
left: 100%;
|
81
|
+
}
|
82
|
+
.noUi-value-vertical {
|
83
|
+
width: 15px;
|
84
|
+
margin-left: 20px;
|
85
|
+
margin-top: -5px;
|
86
|
+
}
|
87
|
+
|
88
|
+
.noUi-marker-vertical.noUi-marker {
|
89
|
+
width: 5px;
|
90
|
+
height: 2px;
|
91
|
+
margin-top: -1px;
|
92
|
+
}
|
93
|
+
.noUi-marker-vertical.noUi-marker-sub {
|
94
|
+
width: 10px;
|
95
|
+
}
|
96
|
+
.noUi-marker-vertical.noUi-marker-large {
|
97
|
+
width: 15px;
|
98
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nouislider-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 8.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charles Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description: 'Currently tracking
|
55
|
+
description: 'Currently tracking 8.0.2 of noUiSlider: https://github.com/leongersen/noUiSlider).
|
56
56
|
All credit and thanks to @leongersen for the awesome library.'
|
57
57
|
email:
|
58
58
|
- chug2k@gmail.com
|
@@ -62,6 +62,7 @@ extra_rdoc_files: []
|
|
62
62
|
files:
|
63
63
|
- ".gitignore"
|
64
64
|
- Gemfile
|
65
|
+
- Gemfile.lock
|
65
66
|
- LICENSE.txt
|
66
67
|
- README.md
|
67
68
|
- Rakefile
|
@@ -69,12 +70,10 @@ files:
|
|
69
70
|
- lib/nouislider/rails/version.rb
|
70
71
|
- nouislider-rails.gemspec
|
71
72
|
- screenshot.png
|
72
|
-
- vendor/assets/javascripts/
|
73
|
-
- vendor/assets/
|
74
|
-
- vendor/assets/
|
75
|
-
- vendor/assets/
|
76
|
-
- vendor/assets/stylesheets/jquery.nouislider.css
|
77
|
-
- vendor/assets/stylesheets/nouislider/jquery.nouislider.css
|
73
|
+
- vendor/assets/javascripts/nouislider.js
|
74
|
+
- vendor/assets/stylesheets/nouislider.css
|
75
|
+
- vendor/assets/stylesheets/nouislider/nouislider.css
|
76
|
+
- vendor/assets/stylesheets/nouislider/nouislider.pips.css
|
78
77
|
homepage: https://github.com/chug2k/nouislider-rails
|
79
78
|
licenses:
|
80
79
|
- MIT
|
@@ -95,8 +94,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
94
|
version: '0'
|
96
95
|
requirements: []
|
97
96
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.
|
97
|
+
rubygems_version: 2.4.6
|
99
98
|
signing_key:
|
100
99
|
specification_version: 4
|
101
|
-
summary:
|
100
|
+
summary: nouislider.js for the Rails asset pipeline.
|
102
101
|
test_files: []
|
@@ -1,311 +0,0 @@
|
|
1
|
-
/*jslint browser: true */
|
2
|
-
/*jslint white: true */
|
3
|
-
|
4
|
-
(function( $ ){
|
5
|
-
|
6
|
-
'use strict';
|
7
|
-
|
8
|
-
// Helpers
|
9
|
-
|
10
|
-
// Test in an object is an instance of jQuery or Zepto.
|
11
|
-
function isInstance ( a ) {
|
12
|
-
return a instanceof $ || ( $.zepto && $.zepto.isZ(a) );
|
13
|
-
}
|
14
|
-
|
15
|
-
|
16
|
-
// Link types
|
17
|
-
|
18
|
-
function fromPrefix ( target, method ) {
|
19
|
-
|
20
|
-
// If target is a string, a new hidden input will be created.
|
21
|
-
if ( typeof target === 'string' && target.indexOf('-inline-') === 0 ) {
|
22
|
-
|
23
|
-
// By default, use the 'html' method.
|
24
|
-
this.method = method || 'html';
|
25
|
-
|
26
|
-
// Use jQuery to create the element
|
27
|
-
this.target = this.el = $( target.replace('-inline-', '') || '<div/>' );
|
28
|
-
|
29
|
-
return true;
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
function fromString ( target ) {
|
34
|
-
|
35
|
-
// If the string doesn't begin with '-', which is reserved, add a new hidden input.
|
36
|
-
if ( typeof target === 'string' && target.indexOf('-') !== 0 ) {
|
37
|
-
|
38
|
-
this.method = 'val';
|
39
|
-
|
40
|
-
var element = document.createElement('input');
|
41
|
-
element.name = target;
|
42
|
-
element.type = 'hidden';
|
43
|
-
this.target = this.el = $(element);
|
44
|
-
|
45
|
-
return true;
|
46
|
-
}
|
47
|
-
}
|
48
|
-
|
49
|
-
function fromFunction ( target ) {
|
50
|
-
|
51
|
-
// The target can also be a function, which will be called.
|
52
|
-
if ( typeof target === 'function' ) {
|
53
|
-
this.target = false;
|
54
|
-
this.method = target;
|
55
|
-
|
56
|
-
return true;
|
57
|
-
}
|
58
|
-
}
|
59
|
-
|
60
|
-
function fromInstance ( target, method ) {
|
61
|
-
|
62
|
-
if ( isInstance( target ) && !method ) {
|
63
|
-
|
64
|
-
// If a jQuery/Zepto input element is provided, but no method is set,
|
65
|
-
// the element can assume it needs to respond to 'change'...
|
66
|
-
if ( target.is('input, select, textarea') ) {
|
67
|
-
|
68
|
-
// Default to .val if this is an input element.
|
69
|
-
this.method = 'val';
|
70
|
-
|
71
|
-
// Fire the API changehandler when the target changes.
|
72
|
-
this.target = target.on('change.liblink', this.changeHandler);
|
73
|
-
|
74
|
-
} else {
|
75
|
-
|
76
|
-
this.target = target;
|
77
|
-
|
78
|
-
// If no method is set, and we are not auto-binding an input, default to 'html'.
|
79
|
-
this.method = 'html';
|
80
|
-
}
|
81
|
-
|
82
|
-
return true;
|
83
|
-
}
|
84
|
-
}
|
85
|
-
|
86
|
-
function fromInstanceMethod ( target, method ) {
|
87
|
-
|
88
|
-
// The method must exist on the element.
|
89
|
-
if ( isInstance( target ) &&
|
90
|
-
(typeof method === 'function' ||
|
91
|
-
(typeof method === 'string' && target[method]))
|
92
|
-
) {
|
93
|
-
this.method = method;
|
94
|
-
this.target = target;
|
95
|
-
|
96
|
-
return true;
|
97
|
-
}
|
98
|
-
}
|
99
|
-
|
100
|
-
var
|
101
|
-
/** @const */
|
102
|
-
creationFunctions = [fromPrefix, fromString, fromFunction, fromInstance, fromInstanceMethod];
|
103
|
-
|
104
|
-
|
105
|
-
// Link Instance
|
106
|
-
|
107
|
-
/** @constructor */
|
108
|
-
function Link ( target, method, format ) {
|
109
|
-
|
110
|
-
var that = this, valid = false;
|
111
|
-
|
112
|
-
// Forward calls within scope.
|
113
|
-
this.changeHandler = function ( changeEvent ) {
|
114
|
-
var decodedValue = that.formatInstance.from( $(this).val() );
|
115
|
-
|
116
|
-
// If the value is invalid, stop this event, as well as it's propagation.
|
117
|
-
if ( decodedValue === false || isNaN(decodedValue) ) {
|
118
|
-
|
119
|
-
// Reset the value.
|
120
|
-
$(this).val(that.lastSetValue);
|
121
|
-
return false;
|
122
|
-
}
|
123
|
-
|
124
|
-
that.changeHandlerMethod.call( '', changeEvent, decodedValue );
|
125
|
-
};
|
126
|
-
|
127
|
-
// See if this Link needs individual targets based on its usage.
|
128
|
-
// If so, return the element that needs to be copied by the
|
129
|
-
// implementing interface.
|
130
|
-
// Default the element to false.
|
131
|
-
this.el = false;
|
132
|
-
|
133
|
-
// Store the formatter, or use the default.
|
134
|
-
this.formatInstance = format;
|
135
|
-
|
136
|
-
// Try all Link types.
|
137
|
-
/*jslint unparam: true*/
|
138
|
-
$.each(creationFunctions, function(i, fn){
|
139
|
-
valid = fn.call(that, target, method);
|
140
|
-
return !valid;
|
141
|
-
});
|
142
|
-
/*jslint unparam: false*/
|
143
|
-
|
144
|
-
// Nothing matched, throw error.
|
145
|
-
if ( !valid ) {
|
146
|
-
throw new RangeError("(Link) Invalid Link.");
|
147
|
-
}
|
148
|
-
}
|
149
|
-
|
150
|
-
// Provides external items with the object value.
|
151
|
-
Link.prototype.set = function ( value ) {
|
152
|
-
|
153
|
-
// Ignore the value, so only the passed-on arguments remain.
|
154
|
-
var args = Array.prototype.slice.call( arguments ),
|
155
|
-
additionalArgs = args.slice(1);
|
156
|
-
|
157
|
-
// Store some values. The actual, numerical value,
|
158
|
-
// the formatted value and the parameters for use in 'resetValue'.
|
159
|
-
// Slice additionalArgs to break the relation.
|
160
|
-
this.lastSetValue = this.formatInstance.to( value );
|
161
|
-
|
162
|
-
// Prepend the value to the function arguments.
|
163
|
-
additionalArgs.unshift(
|
164
|
-
this.lastSetValue
|
165
|
-
);
|
166
|
-
|
167
|
-
// When target is undefined, the target was a function.
|
168
|
-
// In that case, provided the object as the calling scope.
|
169
|
-
// Branch between writing to a function or an object.
|
170
|
-
( typeof this.method === 'function' ?
|
171
|
-
this.method :
|
172
|
-
this.target[ this.method ] ).apply( this.target, additionalArgs );
|
173
|
-
};
|
174
|
-
|
175
|
-
|
176
|
-
// Developer API
|
177
|
-
|
178
|
-
/** @constructor */
|
179
|
-
function LinkAPI ( origin ) {
|
180
|
-
this.items = [];
|
181
|
-
this.elements = [];
|
182
|
-
this.origin = origin;
|
183
|
-
}
|
184
|
-
|
185
|
-
LinkAPI.prototype.push = function( item, element ) {
|
186
|
-
this.items.push(item);
|
187
|
-
|
188
|
-
// Prevent 'false' elements
|
189
|
-
if ( element ) {
|
190
|
-
this.elements.push(element);
|
191
|
-
}
|
192
|
-
};
|
193
|
-
|
194
|
-
LinkAPI.prototype.reconfirm = function ( flag ) {
|
195
|
-
var i;
|
196
|
-
for ( i = 0; i < this.elements.length; i += 1 ) {
|
197
|
-
this.origin.LinkConfirm(flag, this.elements[i]);
|
198
|
-
}
|
199
|
-
};
|
200
|
-
|
201
|
-
LinkAPI.prototype.remove = function ( flag ) {
|
202
|
-
var i;
|
203
|
-
for ( i = 0; i < this.items.length; i += 1 ) {
|
204
|
-
this.items[i].target.off('.liblink');
|
205
|
-
}
|
206
|
-
for ( i = 0; i < this.elements.length; i += 1 ) {
|
207
|
-
this.elements[i].remove();
|
208
|
-
}
|
209
|
-
};
|
210
|
-
|
211
|
-
LinkAPI.prototype.change = function ( value ) {
|
212
|
-
|
213
|
-
if ( this.origin.LinkIsEmitting ) {
|
214
|
-
return false;
|
215
|
-
}
|
216
|
-
|
217
|
-
this.origin.LinkIsEmitting = true;
|
218
|
-
|
219
|
-
var args = Array.prototype.slice.call( arguments, 1 ), i;
|
220
|
-
args.unshift( value );
|
221
|
-
|
222
|
-
// Write values to serialization Links.
|
223
|
-
// Convert the value to the correct relative representation.
|
224
|
-
for ( i = 0; i < this.items.length; i += 1 ) {
|
225
|
-
this.items[i].set.apply(this.items[i], args);
|
226
|
-
}
|
227
|
-
|
228
|
-
this.origin.LinkIsEmitting = false;
|
229
|
-
};
|
230
|
-
|
231
|
-
|
232
|
-
// jQuery plugin
|
233
|
-
|
234
|
-
function binder ( flag, target, method, format ){
|
235
|
-
|
236
|
-
if ( flag === 0 ) {
|
237
|
-
flag = this.LinkDefaultFlag;
|
238
|
-
}
|
239
|
-
|
240
|
-
// Create a list of API's (if it didn't exist yet);
|
241
|
-
if ( !this.linkAPI ) {
|
242
|
-
this.linkAPI = {};
|
243
|
-
}
|
244
|
-
|
245
|
-
// Add an API point.
|
246
|
-
if ( !this.linkAPI[flag] ) {
|
247
|
-
this.linkAPI[flag] = new LinkAPI(this);
|
248
|
-
}
|
249
|
-
|
250
|
-
var linkInstance = new Link ( target, method, format || this.LinkDefaultFormatter );
|
251
|
-
|
252
|
-
// Default the calling scope to the linked object.
|
253
|
-
if ( !linkInstance.target ) {
|
254
|
-
linkInstance.target = $(this);
|
255
|
-
}
|
256
|
-
|
257
|
-
// If the Link requires creation of a new element,
|
258
|
-
// Pass the element and request confirmation to get the changehandler.
|
259
|
-
// Set the method to be called when a Link changes.
|
260
|
-
linkInstance.changeHandlerMethod = this.LinkConfirm( flag, linkInstance.el );
|
261
|
-
|
262
|
-
// Store the linkInstance in the flagged list.
|
263
|
-
this.linkAPI[flag].push( linkInstance, linkInstance.el );
|
264
|
-
|
265
|
-
// Now that Link have been connected, request an update.
|
266
|
-
this.LinkUpdate( flag );
|
267
|
-
}
|
268
|
-
|
269
|
-
/** @export */
|
270
|
-
$.fn.Link = function( flag ){
|
271
|
-
|
272
|
-
var that = this;
|
273
|
-
|
274
|
-
// Delete all linkAPI
|
275
|
-
if ( flag === false ) {
|
276
|
-
|
277
|
-
return that.each(function(){
|
278
|
-
|
279
|
-
// .Link(false) can be called on elements without Links.
|
280
|
-
// When that happens, the objects can't be looped.
|
281
|
-
if ( !this.linkAPI ) {
|
282
|
-
return;
|
283
|
-
}
|
284
|
-
|
285
|
-
$.map(this.linkAPI, function(api){
|
286
|
-
api.remove();
|
287
|
-
});
|
288
|
-
|
289
|
-
delete this.linkAPI;
|
290
|
-
});
|
291
|
-
}
|
292
|
-
|
293
|
-
if ( flag === undefined ) {
|
294
|
-
|
295
|
-
flag = 0;
|
296
|
-
|
297
|
-
} else if ( typeof flag !== 'string') {
|
298
|
-
|
299
|
-
throw new Error("Flag must be string.");
|
300
|
-
}
|
301
|
-
|
302
|
-
return {
|
303
|
-
to: function( a, b, c ){
|
304
|
-
return that.each(function(){
|
305
|
-
binder.call(this, flag, a, b, c);
|
306
|
-
});
|
307
|
-
}
|
308
|
-
};
|
309
|
-
};
|
310
|
-
|
311
|
-
}( window.jQuery || window.Zepto ));
|