mootools-plus 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +7 -0
- data/README.md +121 -3
- data/lib/mootools-plus/rails/version.rb +1 -1
- data/vendor/assets/javascripts/mootools-plus/array.js +15 -1
- metadata +5 -13
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
|
1
|
+
# mootools-plus
|
2
2
|
|
3
3
|
mootools-plus provides helpers and Ruby-like methods to Javascript MooTools core classes and plus.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
7
|
Add the gem in your `Gemfile`:
|
8
|
+
|
8
9
|
```ruby
|
9
10
|
group :assets do
|
10
11
|
gem 'mootools-plus', '~> 0.1.0'
|
@@ -25,8 +26,125 @@ Enjoy!
|
|
25
26
|
|
26
27
|
## Documentation
|
27
28
|
|
28
|
-
|
29
|
-
|
29
|
+
### Array
|
30
|
+
|
31
|
+
#### `compact() → array`
|
32
|
+
|
33
|
+
Alias of Array#clean
|
34
|
+
|
35
|
+
#### `deleteIf(function) → array`
|
36
|
+
|
37
|
+
Deletes every element of the array for which function evaluates to true.
|
38
|
+
|
39
|
+
* Example
|
40
|
+
|
41
|
+
```javascript
|
42
|
+
[1, 2, 3, 4].deleteIf(function(){
|
43
|
+
return this < 3
|
44
|
+
})
|
45
|
+
// => [1, 2]
|
46
|
+
```
|
47
|
+
|
48
|
+
* [Source](https://github.com/caedes/mootools-plus/blob/stable/vendor/assets/javascripts/mootools-plus/array.js#L12)
|
49
|
+
|
50
|
+
#### `filterOne(fn, bind) → other`
|
51
|
+
|
52
|
+
Returns only the first element of the array for which function evaluates to true.
|
53
|
+
|
54
|
+
* Example
|
55
|
+
|
56
|
+
```javascript
|
57
|
+
[1, 2, 3, 4, 3, 4].filterOne(function(){
|
58
|
+
return this == 3
|
59
|
+
})
|
60
|
+
// => 3
|
61
|
+
```
|
62
|
+
|
63
|
+
* [Source](https://github.com/caedes/mootools-plus/blob/stable/vendor/assets/javascripts/mootools-plus/array.js#L20)
|
64
|
+
|
65
|
+
#### `first(int) → array|other`
|
66
|
+
|
67
|
+
Alias of Array#getFirst
|
68
|
+
|
69
|
+
#### `getFirst(int) → array|other`
|
70
|
+
|
71
|
+
Returns the first element(s) of an array.
|
72
|
+
|
73
|
+
* Example
|
74
|
+
|
75
|
+
```javascript
|
76
|
+
[1, 2, 3, 4].getFirst()
|
77
|
+
// => 1
|
78
|
+
[1, 2, 3, 4].getFirst(3)
|
79
|
+
// => [1, 2, 3]
|
80
|
+
```
|
81
|
+
|
82
|
+
* [Source](https://github.com/caedes/mootools-plus/blob/stable/vendor/assets/javascripts/mootools-plus/array.js#L3)
|
83
|
+
|
84
|
+
#### `getLast(int) → array|other`
|
85
|
+
|
86
|
+
Returns the last element(s) of an array.
|
87
|
+
|
88
|
+
* Example
|
89
|
+
|
90
|
+
```javascript
|
91
|
+
[1, 2, 3, 4].getLast()
|
92
|
+
// => 1
|
93
|
+
[1, 2, 3, 4].getLast(2)
|
94
|
+
// => [1, 2]
|
95
|
+
```
|
96
|
+
|
97
|
+
* [Source](https://github.com/caedes/mootools-plus/blob/stable/vendor/assets/javascripts/mootools-plus/array.js#L7)
|
98
|
+
|
99
|
+
#### `hasAny() → boolean`
|
100
|
+
|
101
|
+
Returns true if the array contains at least one element.
|
102
|
+
|
103
|
+
* Example
|
104
|
+
|
105
|
+
```javascript
|
106
|
+
[1, 2, 3, 4].hasAny()
|
107
|
+
// => true
|
108
|
+
[].hasAny()
|
109
|
+
// => false
|
110
|
+
```
|
111
|
+
|
112
|
+
* [Source](https://github.com/caedes/mootools-plus/blob/stable/vendor/assets/javascripts/mootools-plus/array.js#L28)
|
113
|
+
|
114
|
+
#### `isBlank() → boolean`
|
115
|
+
|
116
|
+
Returns true if the array contains no elements.
|
117
|
+
|
118
|
+
* Example
|
119
|
+
|
120
|
+
```javascript
|
121
|
+
[1, 2, 3, 4].isBlank()
|
122
|
+
// => false
|
123
|
+
[].isBlank()
|
124
|
+
// => true
|
125
|
+
```
|
126
|
+
|
127
|
+
* [Source](https://github.com/caedes/mootools-plus/blob/stable/vendor/assets/javascripts/mootools-plus/array.js#L24)
|
128
|
+
|
129
|
+
#### `isEmpty() → boolean`
|
130
|
+
|
131
|
+
Alias of Array#isBlank
|
132
|
+
|
133
|
+
#### `last(int) → array|other`
|
134
|
+
|
135
|
+
Alias of Array#getLast
|
136
|
+
|
137
|
+
#### `select(fn, bind) → array`
|
138
|
+
|
139
|
+
Alias of Array#filter
|
140
|
+
|
141
|
+
#### `selectOne(fn, bind) → other`
|
142
|
+
|
143
|
+
Alias of Array#filterOne
|
144
|
+
|
145
|
+
## Changelog
|
146
|
+
|
147
|
+
View [CHANGELOG](https://github.com/caedes/mootools-plus/blob/stable/CHANGELOG.md) of the latest stable version.
|
30
148
|
|
31
149
|
## License
|
32
150
|
|
@@ -12,16 +12,30 @@ if (window.MooTools) {
|
|
12
12
|
deleteIf: function(fn){
|
13
13
|
for (var i = 0, length = this.length; i < length; i++) {
|
14
14
|
var el = this.shift()
|
15
|
-
if (
|
15
|
+
if (fn.call(el)) this.push(el)
|
16
16
|
}
|
17
17
|
return this
|
18
|
+
},
|
19
|
+
|
20
|
+
filterOne: function(fn, bind){
|
21
|
+
return this.filter(fn, bind).getFirst()
|
22
|
+
},
|
23
|
+
|
24
|
+
isBlank: function(){
|
25
|
+
return this.length == 0
|
26
|
+
},
|
27
|
+
|
28
|
+
hasAny: function(){
|
29
|
+
return !this.isBlank()
|
18
30
|
}
|
19
31
|
})
|
20
32
|
|
21
33
|
Array.alias('first', 'getFirst')
|
22
34
|
Array.alias('last', 'getLast')
|
23
35
|
Array.alias('select', 'filter')
|
36
|
+
Array.alias('selectOne', 'filterOne')
|
24
37
|
Array.alias('compact', 'clean')
|
38
|
+
Array.alias('isEmpty', 'isBlank')
|
25
39
|
}
|
26
40
|
else {
|
27
41
|
if (console && console.error) console.error('Mootools is not yet installed.')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mootools-plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-05 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2155919620 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -24,15 +24,7 @@ dependencies:
|
|
24
24
|
version: '5.0'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements:
|
28
|
-
none: false
|
29
|
-
requirements:
|
30
|
-
- - ! '>='
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 3.1.0
|
33
|
-
- - <
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: '5.0'
|
27
|
+
version_requirements: *2155919620
|
36
28
|
description: mootools-plus provides helpers and Ruby-like methods to Javascript MooTools
|
37
29
|
core classes and plus
|
38
30
|
email:
|
@@ -76,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
68
|
version: '0'
|
77
69
|
requirements: []
|
78
70
|
rubyforge_project:
|
79
|
-
rubygems_version: 1.8.
|
71
|
+
rubygems_version: 1.8.6
|
80
72
|
signing_key:
|
81
73
|
specification_version: 3
|
82
74
|
summary: mootools-plus provides helpers and Ruby-like methods to Javascript MooTools
|