mootools-plus 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,19 +1,3 @@
1
- *.rbc
2
- *.sassc
3
- .sass-cache
4
- capybara-*.html
5
- .rspec
6
- .rvmrc
7
- .DS_Store
8
- /.bundle
9
- /vendor/bundle
10
- /log/*
11
- /tmp/*
12
- /db/*.sqlite3
13
- /public/system/*
14
- /coverage/
15
- /spec/tmp/*
16
- **.orig
17
- rerun.txt
18
- pickle-email-*.html
1
+ npm-debug.log
2
+ /node_modules
19
3
  *.gem
data/Gemfile CHANGED
@@ -1,3 +1,7 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
+ group :development do
4
+ gem 'thor'
5
+ end
6
+
3
7
  gemspec
@@ -1,56 +1,35 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mootools-plus (0.0.1)
5
- rails (~> 3.2.3)
4
+ mootools-plus (0.2.1)
5
+ railties (>= 3.1.0, < 5.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- actionmailer (3.2.3)
11
- actionpack (= 3.2.3)
12
- mail (~> 2.4.4)
13
- actionpack (3.2.3)
14
- activemodel (= 3.2.3)
15
- activesupport (= 3.2.3)
10
+ actionpack (3.2.8)
11
+ activemodel (= 3.2.8)
12
+ activesupport (= 3.2.8)
16
13
  builder (~> 3.0.0)
17
14
  erubis (~> 2.7.0)
18
- journey (~> 1.0.1)
15
+ journey (~> 1.0.4)
19
16
  rack (~> 1.4.0)
20
17
  rack-cache (~> 1.2)
21
18
  rack-test (~> 0.6.1)
22
- sprockets (~> 2.1.2)
23
- activemodel (3.2.3)
24
- activesupport (= 3.2.3)
19
+ sprockets (~> 2.1.3)
20
+ activemodel (3.2.8)
21
+ activesupport (= 3.2.8)
25
22
  builder (~> 3.0.0)
26
- activerecord (3.2.3)
27
- activemodel (= 3.2.3)
28
- activesupport (= 3.2.3)
29
- arel (~> 3.0.2)
30
- tzinfo (~> 0.3.29)
31
- activeresource (3.2.3)
32
- activemodel (= 3.2.3)
33
- activesupport (= 3.2.3)
34
- activesupport (3.2.3)
23
+ activesupport (3.2.8)
35
24
  i18n (~> 0.6)
36
25
  multi_json (~> 1.0)
37
- arel (3.0.2)
38
- builder (3.0.0)
26
+ builder (3.0.3)
39
27
  erubis (2.7.0)
40
28
  hike (1.2.1)
41
- i18n (0.6.0)
42
- journey (1.0.3)
43
- jquery-rails (2.0.2)
44
- railties (>= 3.2.0, < 5.0)
45
- thor (~> 0.14)
46
- json (1.6.6)
47
- mail (2.4.4)
48
- i18n (>= 0.4.0)
49
- mime-types (~> 1.16)
50
- treetop (~> 1.4.8)
51
- mime-types (1.18)
52
- multi_json (1.2.0)
53
- polyglot (0.3.3)
29
+ i18n (0.6.1)
30
+ journey (1.0.4)
31
+ json (1.7.5)
32
+ multi_json (1.3.6)
54
33
  rack (1.4.1)
55
34
  rack-cache (1.2)
56
35
  rack (>= 0.4)
@@ -58,40 +37,26 @@ GEM
58
37
  rack
59
38
  rack-test (0.6.1)
60
39
  rack (>= 1.0)
61
- rails (3.2.3)
62
- actionmailer (= 3.2.3)
63
- actionpack (= 3.2.3)
64
- activerecord (= 3.2.3)
65
- activeresource (= 3.2.3)
66
- activesupport (= 3.2.3)
67
- bundler (~> 1.0)
68
- railties (= 3.2.3)
69
- railties (3.2.3)
70
- actionpack (= 3.2.3)
71
- activesupport (= 3.2.3)
40
+ railties (3.2.8)
41
+ actionpack (= 3.2.8)
42
+ activesupport (= 3.2.8)
72
43
  rack-ssl (~> 1.3.2)
73
44
  rake (>= 0.8.7)
74
45
  rdoc (~> 3.4)
75
- thor (~> 0.14.6)
46
+ thor (>= 0.14.6, < 2.0)
76
47
  rake (0.9.2.2)
77
48
  rdoc (3.12)
78
49
  json (~> 1.4)
79
- sprockets (2.1.2)
50
+ sprockets (2.1.3)
80
51
  hike (~> 1.2)
81
52
  rack (~> 1.0)
82
53
  tilt (~> 1.1, != 1.3.0)
83
- sqlite3 (1.3.5)
84
- thor (0.14.6)
54
+ thor (0.16.0)
85
55
  tilt (1.3.3)
86
- treetop (1.4.10)
87
- polyglot
88
- polyglot (>= 0.3.1)
89
- tzinfo (0.3.33)
90
56
 
91
57
  PLATFORMS
92
58
  ruby
93
59
 
94
60
  DEPENDENCIES
95
- jquery-rails
96
61
  mootools-plus!
97
- sqlite3
62
+ thor
@@ -0,0 +1,7 @@
1
+ **© Copyright 2012 caedes**
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,14 +1,16 @@
1
1
  # mootools-plus
2
2
 
3
- mootools-plus provides helpers and Ruby-like methods to Javascript MooTools core classes and plus.
3
+ *Provide some helpers and some Ruby-like methods to MooTools core classes*
4
4
 
5
5
  ## Installation
6
6
 
7
+ ### Rails 3.1.x
8
+
7
9
  Add the gem in your `Gemfile`:
8
10
 
9
11
  ```ruby
10
12
  group :assets do
11
- gem 'mootools-plus', '~> 0.2.0'
13
+ gem 'mootools-plus'
12
14
  end
13
15
  ```
14
16
 
@@ -20,169 +22,21 @@ Add mootools-plus to the asset pipeline:
20
22
  //= require mootools-plus
21
23
  ```
22
24
 
23
- Enjoy!
24
-
25
- ## Documentation
26
-
27
- ### Array
28
-
29
- #### `compact() → array`
30
-
31
- Alias of Array#clean
32
-
33
- #### `deleteIf(function) → array`
34
-
35
- Deletes every element of the array for which function evaluates to true.
36
-
37
- * Example
38
-
39
- ```javascript
40
- [1, 2, 3, 4].deleteIf(function(){
41
- return this < 3
42
- })
43
- // => [1, 2]
44
- ```
45
-
46
- * [Source](https://github.com/caedes/mootools-plus/blob/stable/vendor/assets/javascripts/mootools-plus/array.js#L12)
47
-
48
- #### `filterOne(fn, bind) → other`
49
-
50
- Returns only the first element of the array for which function evaluates to true.
51
-
52
- * Example
53
-
54
- ```javascript
55
- [1, 2, 3, 4, 3, 4].filterOne(function(){
56
- return this == 3
57
- })
58
- // => 3
59
- ```
60
-
61
- * [Source](https://github.com/caedes/mootools-plus/blob/stable/vendor/assets/javascripts/mootools-plus/array.js#L20)
62
-
63
- #### `first(int) → array|other`
64
-
65
- Alias of Array#getFirst
66
-
67
- #### `getFirst(int) → array|other`
68
-
69
- Returns the first element(s) of an array.
70
-
71
- * Example
72
-
73
- ```javascript
74
- [1, 2, 3, 4].getFirst()
75
- // => 1
76
- [1, 2, 3, 4].getFirst(3)
77
- // => [1, 2, 3]
78
- ```
79
-
80
- * [Source](https://github.com/caedes/mootools-plus/blob/stable/vendor/assets/javascripts/mootools-plus/array.js#L3)
81
-
82
- #### `getLast(int) → array|other`
83
-
84
- Returns the last element(s) of an array.
85
-
86
- * Example
87
-
88
- ```javascript
89
- [1, 2, 3, 4].getLast()
90
- // => 1
91
- [1, 2, 3, 4].getLast(2)
92
- // => [1, 2]
93
- ```
94
-
95
- * [Source](https://github.com/caedes/mootools-plus/blob/stable/vendor/assets/javascripts/mootools-plus/array.js#L7)
96
-
97
- #### `hasAny() → boolean`
98
-
99
- Returns true if the array contains at least one element.
100
-
101
- * Example
102
-
103
- ```javascript
104
- [1, 2, 3, 4].hasAny()
105
- // => true
106
- [].hasAny()
107
- // => false
108
- ```
109
-
110
- * [Source](https://github.com/caedes/mootools-plus/blob/stable/vendor/assets/javascripts/mootools-plus/array.js#L28)
111
-
112
- #### `isBlank() → boolean`
113
-
114
- Returns true if the array contains no elements.
115
-
116
- * Example
117
-
118
- ```javascript
119
- [1, 2, 3, 4].isBlank()
120
- // => false
121
- [].isBlank()
122
- // => true
123
- ```
124
-
125
- * [Source](https://github.com/caedes/mootools-plus/blob/stable/vendor/assets/javascripts/mootools-plus/array.js#L24)
126
-
127
- #### `isEmpty() → boolean`
25
+ ## Download
128
26
 
129
- Alias of Array#isBlank
27
+ [Minified](https://raw.github.com/caedes/mootools-plus/master/dist/mootools-plus-0.2.1.min.js) - [Uncompressed](https://raw.github.com/caedes/mootools-plus/master/dist/mootools-plus-0.2.1.js)
130
28
 
131
- #### `last(int) → array|other`
29
+ ## Contributing
132
30
 
133
- Alias of Array#getLast
134
-
135
- #### `select(fn, bind) → array`
136
-
137
- Alias of Array#filter
138
-
139
- #### `selectOne(fn, bind) → other`
140
-
141
- Alias of Array#filterOne
142
-
143
- ### ui.Dropdown
144
-
145
- #### Use
146
-
147
- ```haml
148
- %div
149
- %header
150
- %a= 'Pipo'
151
- %ol
152
- %li
153
- %a= 'item 1'
154
- %li
155
- %a= 'item 2'
156
- %li
157
- %a= 'item 3'
158
- %li
159
- %a= 'item 4'
160
- %li
161
- %a= 'item 5'
162
- %li
163
- %a= 'item 6'
164
- ```
165
-
166
- ```javascript
167
- new ui.Dropdown($$('div')[0])
168
- ```
169
-
170
- [Example](http://jsfiddle.net/9BZw9/)
171
-
172
- #### Options
173
-
174
- ```javascript
175
- {
176
- panel: {
177
- openAtStart: false // Set to true to open the dropdown at initialization
178
- }
179
- }
180
- ```
31
+ 1. Fork repository
32
+ 2. Create a branch following a [successfull branching model](http://nvie.com/posts/a-successful-git-branching-model/)
33
+ 3. Write your feature/fix
34
+ 4. Pull request
181
35
 
182
- ## Changelog
36
+ ## Building
183
37
 
184
- View [CHANGELOG](https://github.com/caedes/mootools-plus/blob/stable/CHANGELOG.md) of the latest stable version.
38
+ Read [how to build your own version](http://caedes.github.com/2012/09/12/javascript-build-with-node-and-grunt.html).
185
39
 
186
- ## License
40
+ ## Licence
187
41
 
188
- This project uses MIT-LICENSE.
42
+ Released under the MIT License. See the [LICENSE](https://github.com/caedes/mootools-plus/blob/master/LICENSE.md) file for further details.
@@ -0,0 +1,35 @@
1
+ module.exports = function(grunt) {
2
+
3
+ var newline = "\n"
4
+
5
+ grunt.initConfig({
6
+ pkg: '<json:package.json>',
7
+ meta: {
8
+ banner: '/**'+newline+
9
+ ' * <%= pkg.name %> v<%= pkg.version %>'+newline+
10
+ ' *'+newline+
11
+ ' * <%= pkg.description %>'+newline+
12
+ ' * More details on <%= pkg.homepage %>'+newline+
13
+ ' * Last build: <%= grunt.template.today("yyyy-mm-dd") %>'+newline+
14
+ ' */'
15
+ },
16
+ concat: {
17
+ version: {
18
+ src: ['<banner>', 'src/function.js', 'src/array.js', 'src/element.js'],
19
+ dest: 'vendor/assets/javascripts/<%= pkg.name %>-<%= pkg.version %>.js'
20
+ }
21
+ },
22
+ min: {
23
+ version: {
24
+ src: ['vendor/assets/javascripts/<%= pkg.name %>-<%= pkg.version %>.js'],
25
+ dest: 'vendor/assets/javascripts/<%= pkg.name %>-<%= pkg.version %>.min.js'
26
+ },
27
+ use: {
28
+ src: ['vendor/assets/javascripts/<%= pkg.name %>-<%= pkg.version %>.js'],
29
+ dest: 'vendor/assets/javascripts/<%= pkg.name %>.js'
30
+ }
31
+ }
32
+ })
33
+
34
+ grunt.registerTask('default', 'concat min')
35
+ }
@@ -1,4 +1,4 @@
1
- module Mootools
1
+ module MootoolsPlus
2
2
  module Rails
3
3
  require 'mootools-plus/rails/engine'
4
4
  require 'mootools-plus/rails/version'
@@ -1,5 +1,5 @@
1
1
  module MootoolsPlus
2
2
  module Rails
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.authors = ['caedes']
7
7
  s.email = ['laurentromain@gmail.com']
8
8
  s.homepage = 'https://github.com/caedes/mootools-plus'
9
- s.summary = 'mootools-plus provides helpers and Ruby-like methods to Javascript MooTools core classes and plus'
9
+ s.summary = 'A gem to handle the use mootools-plus'
10
10
  s.description = s.summary
11
11
 
12
12
  s.files = `git ls-files`.split("\n")
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "mootools-plus",
3
+ "description": "Provide some helpers and some Ruby-like methods to MooTools core classes",
4
+ "version": "0.2.1",
5
+ "homepage": "https://github.com/caedes/mootools-plus",
6
+ "dependencies": {},
7
+ "devDependencies": {
8
+ "grunt-compare-size": ">=0.1.0",
9
+ "grunt-git-authors": ">=1.0.0",
10
+ "grunt": "~0.3.9",
11
+ "testswarm": "0.2.2"
12
+ }
13
+ }
@@ -24,5 +24,26 @@ Element.implement({
24
24
  enable: function(){
25
25
  this.set('disabled', false)
26
26
  return this
27
+ },
28
+
29
+ getWidth: function(){
30
+ return this.getComputedSize().totalWidth
31
+ },
32
+
33
+ getHeight: function(){
34
+ return this.getComputedSize().totalHeight
35
+ },
36
+
37
+ hide: function(){
38
+ this.setStyle('display', 'none')
39
+ return this;
40
+ },
41
+ show: function(display){
42
+ display = display ? display : 'block'
43
+ this.setStyle('display', display)
44
+ return this;
27
45
  }
28
46
  })
47
+
48
+ Element.alias('width', 'getWidth')
49
+ Element.alias('height', 'getHeight')
@@ -0,0 +1,11 @@
1
+ Function.implement({
2
+ bindWithEvent: function(){
3
+ var self = this,
4
+ args = Array.from(arguments),
5
+ bind = args.shift()
6
+
7
+ return function(event){
8
+ return self.apply(bind, (args == null) ? arguments : [event].concat(args))
9
+ }
10
+ }
11
+ })
@@ -0,0 +1,107 @@
1
+ /**
2
+ * mootools-plus v0.2.0
3
+ *
4
+ * Provide some helpers and some Ruby-like methods to MooTools core classes
5
+ * More details on https://github.com/caedes/mootools-plus
6
+ * Last build: 2012-09-17
7
+ */
8
+
9
+ Function.implement({
10
+ bindWithEvent: function(){
11
+ var self = this,
12
+ args = Array.from(arguments),
13
+ bind = args.shift()
14
+
15
+ return function(event){
16
+ return self.apply(bind, (args == null) ? arguments : [event].concat(args))
17
+ }
18
+ }
19
+ })
20
+
21
+ Array.implement({
22
+ getFirst: function(n){
23
+ return (n || n === 0) ? this.slice(0, n) : this[0]
24
+ },
25
+
26
+ getLast: function(n){
27
+ if (n >= this.length) return this
28
+ return (n || n === 0) ? this.slice(this.length - n, this.length) : this[this.length - 1]
29
+ },
30
+
31
+ deleteIf: function(fn){
32
+ for (var i = 0, length = this.length; i < length; i++) {
33
+ var el = this.shift()
34
+ if (!fn.call(el)) this.push(el)
35
+ }
36
+ return this
37
+ },
38
+
39
+ filterOne: function(fn, bind){
40
+ return this.filter(fn, bind).getFirst()
41
+ },
42
+
43
+ isBlank: function(){
44
+ return this.length == 0
45
+ },
46
+
47
+ hasAny: function(){
48
+ return !this.isBlank()
49
+ }
50
+ })
51
+
52
+ Array.alias('first', 'getFirst')
53
+ Array.alias('last', 'getLast')
54
+ Array.alias('select', 'filter')
55
+ Array.alias('selectOne', 'filterOne')
56
+ Array.alias('compact', 'clean')
57
+ Array.alias('isEmpty', 'isBlank')
58
+
59
+ Element.implement({
60
+ hasElement: function(tag){
61
+ return (tag == undefined) ? (this.getChildren().length > 0) : (this.getElement(tag) != null)
62
+ },
63
+
64
+ hasElements: function(tag){
65
+ return (tag == undefined) ? (this.getChildren().length > 0) : (this.getElements(tag).length > 1)
66
+ },
67
+
68
+ hasEvent: function(eventType, fn){
69
+ var myEvents = this.retrieve('events')
70
+ return myEvents && myEvents[eventType] && (fn == undefined || myEvents[eventType].keys.contains(fn))
71
+ },
72
+
73
+ hasParent: function(tag){
74
+ return (tag == undefined) ? (this.getParent().length > 0) : (this.getParent(tag) != null)
75
+ },
76
+
77
+ disable: function(){
78
+ this.set('disabled', true)
79
+ return this
80
+ },
81
+
82
+ enable: function(){
83
+ this.set('disabled', false)
84
+ return this
85
+ },
86
+
87
+ getWidth: function(){
88
+ return this.getComputedSize().totalWidth
89
+ },
90
+
91
+ getHeight: function(){
92
+ return this.getComputedSize().totalHeight
93
+ },
94
+
95
+ hide: function(){
96
+ this.setStyle('display', 'none')
97
+ return this;
98
+ },
99
+ show: function(display){
100
+ display = display ? display : 'block'
101
+ this.setStyle('display', display)
102
+ return this;
103
+ }
104
+ })
105
+
106
+ Element.alias('width', 'getWidth')
107
+ Element.alias('height', 'getHeight')
@@ -0,0 +1 @@
1
+ Function.implement({bindWithEvent:function(){var e=this,t=Array.from(arguments),n=t.shift();return function(r){return e.apply(n,t==null?arguments:[r].concat(t))}}}),Array.implement({getFirst:function(e){return e||e===0?this.slice(0,e):this[0]},getLast:function(e){return e>=this.length?this:e||e===0?this.slice(this.length-e,this.length):this[this.length-1]},deleteIf:function(e){for(var t=0,n=this.length;t<n;t++){var r=this.shift();e.call(r)||this.push(r)}return this},filterOne:function(e,t){return this.filter(e,t).getFirst()},isBlank:function(){return this.length==0},hasAny:function(){return!this.isBlank()}}),Array.alias("first","getFirst"),Array.alias("last","getLast"),Array.alias("select","filter"),Array.alias("selectOne","filterOne"),Array.alias("compact","clean"),Array.alias("isEmpty","isBlank"),Element.implement({hasElement:function(e){return e==undefined?this.getChildren().length>0:this.getElement(e)!=null},hasElements:function(e){return e==undefined?this.getChildren().length>0:this.getElements(e).length>1},hasEvent:function(e,t){var n=this.retrieve("events");return n&&n[e]&&(t==undefined||n[e].keys.contains(t))},hasParent:function(e){return e==undefined?this.getParent().length>0:this.getParent(e)!=null},disable:function(){return this.set("disabled",!0),this},enable:function(){return this.set("disabled",!1),this},getWidth:function(){return this.getComputedSize().totalWidth},getHeight:function(){return this.getComputedSize().totalHeight},hide:function(){return this.setStyle("display","none"),this},show:function(e){return e=e?e:"block",this.setStyle("display",e),this}}),Element.alias("width","getWidth"),Element.alias("height","getHeight");
@@ -0,0 +1,107 @@
1
+ /**
2
+ * mootools-plus v0.2.1
3
+ *
4
+ * Provide some helpers and some Ruby-like methods to MooTools core classes
5
+ * More details on https://github.com/caedes/mootools-plus
6
+ * Last build: 2012-09-17
7
+ */
8
+
9
+ Function.implement({
10
+ bindWithEvent: function(){
11
+ var self = this,
12
+ args = Array.from(arguments),
13
+ bind = args.shift()
14
+
15
+ return function(event){
16
+ return self.apply(bind, (args == null) ? arguments : [event].concat(args))
17
+ }
18
+ }
19
+ })
20
+
21
+ Array.implement({
22
+ getFirst: function(n){
23
+ return (n || n === 0) ? this.slice(0, n) : this[0]
24
+ },
25
+
26
+ getLast: function(n){
27
+ if (n >= this.length) return this
28
+ return (n || n === 0) ? this.slice(this.length - n, this.length) : this[this.length - 1]
29
+ },
30
+
31
+ deleteIf: function(fn){
32
+ for (var i = 0, length = this.length; i < length; i++) {
33
+ var el = this.shift()
34
+ if (!fn.call(el)) this.push(el)
35
+ }
36
+ return this
37
+ },
38
+
39
+ filterOne: function(fn, bind){
40
+ return this.filter(fn, bind).getFirst()
41
+ },
42
+
43
+ isBlank: function(){
44
+ return this.length == 0
45
+ },
46
+
47
+ hasAny: function(){
48
+ return !this.isBlank()
49
+ }
50
+ })
51
+
52
+ Array.alias('first', 'getFirst')
53
+ Array.alias('last', 'getLast')
54
+ Array.alias('select', 'filter')
55
+ Array.alias('selectOne', 'filterOne')
56
+ Array.alias('compact', 'clean')
57
+ Array.alias('isEmpty', 'isBlank')
58
+
59
+ Element.implement({
60
+ hasElement: function(tag){
61
+ return (tag == undefined) ? (this.getChildren().length > 0) : (this.getElement(tag) != null)
62
+ },
63
+
64
+ hasElements: function(tag){
65
+ return (tag == undefined) ? (this.getChildren().length > 0) : (this.getElements(tag).length > 1)
66
+ },
67
+
68
+ hasEvent: function(eventType, fn){
69
+ var myEvents = this.retrieve('events')
70
+ return myEvents && myEvents[eventType] && (fn == undefined || myEvents[eventType].keys.contains(fn))
71
+ },
72
+
73
+ hasParent: function(tag){
74
+ return (tag == undefined) ? (this.getParent().length > 0) : (this.getParent(tag) != null)
75
+ },
76
+
77
+ disable: function(){
78
+ this.set('disabled', true)
79
+ return this
80
+ },
81
+
82
+ enable: function(){
83
+ this.set('disabled', false)
84
+ return this
85
+ },
86
+
87
+ getWidth: function(){
88
+ return this.getComputedSize().totalWidth
89
+ },
90
+
91
+ getHeight: function(){
92
+ return this.getComputedSize().totalHeight
93
+ },
94
+
95
+ hide: function(){
96
+ this.setStyle('display', 'none')
97
+ return this;
98
+ },
99
+ show: function(display){
100
+ display = display ? display : 'block'
101
+ this.setStyle('display', display)
102
+ return this;
103
+ }
104
+ })
105
+
106
+ Element.alias('width', 'getWidth')
107
+ Element.alias('height', 'getHeight')
@@ -0,0 +1 @@
1
+ Function.implement({bindWithEvent:function(){var e=this,t=Array.from(arguments),n=t.shift();return function(r){return e.apply(n,t==null?arguments:[r].concat(t))}}}),Array.implement({getFirst:function(e){return e||e===0?this.slice(0,e):this[0]},getLast:function(e){return e>=this.length?this:e||e===0?this.slice(this.length-e,this.length):this[this.length-1]},deleteIf:function(e){for(var t=0,n=this.length;t<n;t++){var r=this.shift();e.call(r)||this.push(r)}return this},filterOne:function(e,t){return this.filter(e,t).getFirst()},isBlank:function(){return this.length==0},hasAny:function(){return!this.isBlank()}}),Array.alias("first","getFirst"),Array.alias("last","getLast"),Array.alias("select","filter"),Array.alias("selectOne","filterOne"),Array.alias("compact","clean"),Array.alias("isEmpty","isBlank"),Element.implement({hasElement:function(e){return e==undefined?this.getChildren().length>0:this.getElement(e)!=null},hasElements:function(e){return e==undefined?this.getChildren().length>0:this.getElements(e).length>1},hasEvent:function(e,t){var n=this.retrieve("events");return n&&n[e]&&(t==undefined||n[e].keys.contains(t))},hasParent:function(e){return e==undefined?this.getParent().length>0:this.getParent(e)!=null},disable:function(){return this.set("disabled",!0),this},enable:function(){return this.set("disabled",!1),this},getWidth:function(){return this.getComputedSize().totalWidth},getHeight:function(){return this.getComputedSize().totalHeight},hide:function(){return this.setStyle("display","none"),this},show:function(e){return e=e?e:"block",this.setStyle("display",e),this}}),Element.alias("width","getWidth"),Element.alias("height","getHeight");
@@ -1,5 +1 @@
1
- //= require_self
2
- //= require namespace
3
- //= require_tree .
4
-
5
- if (!window.MooTools && console && console.error) console.error('Mootools is not yet installed.')
1
+ Function.implement({bindWithEvent:function(){var e=this,t=Array.from(arguments),n=t.shift();return function(r){return e.apply(n,t==null?arguments:[r].concat(t))}}}),Array.implement({getFirst:function(e){return e||e===0?this.slice(0,e):this[0]},getLast:function(e){return e>=this.length?this:e||e===0?this.slice(this.length-e,this.length):this[this.length-1]},deleteIf:function(e){for(var t=0,n=this.length;t<n;t++){var r=this.shift();e.call(r)||this.push(r)}return this},filterOne:function(e,t){return this.filter(e,t).getFirst()},isBlank:function(){return this.length==0},hasAny:function(){return!this.isBlank()}}),Array.alias("first","getFirst"),Array.alias("last","getLast"),Array.alias("select","filter"),Array.alias("selectOne","filterOne"),Array.alias("compact","clean"),Array.alias("isEmpty","isBlank"),Element.implement({hasElement:function(e){return e==undefined?this.getChildren().length>0:this.getElement(e)!=null},hasElements:function(e){return e==undefined?this.getChildren().length>0:this.getElements(e).length>1},hasEvent:function(e,t){var n=this.retrieve("events");return n&&n[e]&&(t==undefined||n[e].keys.contains(t))},hasParent:function(e){return e==undefined?this.getParent().length>0:this.getParent(e)!=null},disable:function(){return this.set("disabled",!0),this},enable:function(){return this.set("disabled",!1),this},getWidth:function(){return this.getComputedSize().totalWidth},getHeight:function(){return this.getComputedSize().totalHeight},hide:function(){return this.setStyle("display","none"),this},show:function(e){return e=e?e:"block",this.setStyle("display",e),this}}),Element.alias("width","getWidth"),Element.alias("height","getHeight");
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.2.0
4
+ version: 0.2.1
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-08 00:00:00.000000000Z
12
+ date: 2012-09-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &2156056380 !ruby/object:Gem::Requirement
16
+ requirement: &2152275940 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -24,9 +24,8 @@ dependencies:
24
24
  version: '5.0'
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *2156056380
28
- description: mootools-plus provides helpers and Ruby-like methods to Javascript MooTools
29
- core classes and plus
27
+ version_requirements: *2152275940
28
+ description: A gem to handle the use mootools-plus
30
29
  email:
31
30
  - laurentromain@gmail.com
32
31
  executables: []
@@ -34,23 +33,25 @@ extensions: []
34
33
  extra_rdoc_files: []
35
34
  files:
36
35
  - .gitignore
37
- - CHANGELOG.md
38
36
  - Gemfile
39
37
  - Gemfile.lock
40
- - MIT-LICENSE
38
+ - LICENSE.md
41
39
  - README.md
42
- - Rakefile
40
+ - grunt.js
43
41
  - lib/mootools-plus.rb
44
42
  - lib/mootools-plus/rails.rb
45
43
  - lib/mootools-plus/rails/engine.rb
46
44
  - lib/mootools-plus/rails/version.rb
47
45
  - mootools-plus.gemspec
46
+ - package.json
47
+ - src/array.js
48
+ - src/element.js
49
+ - src/function.js
50
+ - vendor/assets/javascripts/mootools-plus-0.2.0.js
51
+ - vendor/assets/javascripts/mootools-plus-0.2.0.min.js
52
+ - vendor/assets/javascripts/mootools-plus-0.2.1.js
53
+ - vendor/assets/javascripts/mootools-plus-0.2.1.min.js
48
54
  - vendor/assets/javascripts/mootools-plus.js
49
- - vendor/assets/javascripts/mootools-plus/array.js
50
- - vendor/assets/javascripts/mootools-plus/core/logger.js
51
- - vendor/assets/javascripts/mootools-plus/element.js
52
- - vendor/assets/javascripts/mootools-plus/ui/dropdown.js
53
- - vendor/assets/javascripts/namespace.js
54
55
  homepage: https://github.com/caedes/mootools-plus
55
56
  licenses: []
56
57
  post_install_message:
@@ -63,17 +64,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
63
64
  - - ! '>='
64
65
  - !ruby/object:Gem::Version
65
66
  version: '0'
67
+ segments:
68
+ - 0
69
+ hash: 4517576897910394465
66
70
  required_rubygems_version: !ruby/object:Gem::Requirement
67
71
  none: false
68
72
  requirements:
69
73
  - - ! '>='
70
74
  - !ruby/object:Gem::Version
71
75
  version: '0'
76
+ segments:
77
+ - 0
78
+ hash: 4517576897910394465
72
79
  requirements: []
73
80
  rubyforge_project:
74
81
  rubygems_version: 1.8.6
75
82
  signing_key:
76
83
  specification_version: 3
77
- summary: mootools-plus provides helpers and Ruby-like methods to Javascript MooTools
78
- core classes and plus
84
+ summary: A gem to handle the use mootools-plus
79
85
  test_files: []
@@ -1,53 +0,0 @@
1
- ## 0.2.0
2
-
3
- * Add namespace creation
4
- * Update Logger to core.Logger
5
- * Add mootools-plus JS file
6
- * Add ui.Dropdown
7
-
8
- ## 0.1.6
9
-
10
- * Fix Array#deleteIf
11
-
12
- ## 0.1.5
13
-
14
- * Add Array#filterOne, Add Array#selectOne as alias
15
- * Add Array#isEmpty, Array#hasAny and Array#isBlank, Add Array#isEmpty as alias
16
- * Fix Array#deleteIf
17
- * Add Array documentation into README
18
-
19
- ## 0.1.4
20
-
21
- * Fix Array#last alias
22
-
23
- ## 0.1.3
24
-
25
- * Add email and description in gemspec file
26
-
27
- ## 0.1.2
28
-
29
- * Update Logger#warning
30
- * Update Array#compact as Array#clean alias
31
- * Add Array#select as Array#filter alias
32
- * Update Array#first|last as Array#getFirst|getLast alias
33
- * Update MooTools checking method
34
-
35
- ## 0.1.1
36
-
37
- * Add Logger class
38
-
39
- ## 0.1.0
40
-
41
- * It can now be used in 3.1 version of rails
42
-
43
- ## 0.0.3
44
-
45
- * Add condition on Mootools presence
46
-
47
- ## 0.0.2
48
-
49
- * Add documentation in Github wiki
50
-
51
- ## 0.0.1
52
-
53
- * First version
@@ -1,20 +0,0 @@
1
- Copyright 2012 caedes
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env rake
2
- begin
3
- require 'bundler/setup'
4
- rescue LoadError
5
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
- end
7
-
8
- Bundler::GemHelper.install_tasks
@@ -1,40 +0,0 @@
1
- (function(){
2
- var Logger = new Class('core.Logger', {})
3
-
4
- Logger.log = function(param){
5
- Logger.trace(param, 'log')
6
- }
7
-
8
- Logger.info = function(param){
9
- Logger.trace(param, 'info')
10
- }
11
-
12
- Logger.error = function(param){
13
- Logger.trace(param, 'error')
14
- }
15
-
16
- Logger.warning = function(param){
17
- Logger.trace(param, 'warning')
18
- }
19
-
20
- Logger.warn = Logger.warning
21
-
22
- Logger.trace = function(param, level){
23
- if (console != undefined) {
24
- switch (level) {
25
- case 'log':
26
- if (console.log != undefined) console.log(param)
27
- break
28
- case 'warning':
29
- if (console.warn != undefined) console.warn(param)
30
- break
31
- case 'info':
32
- if (console.info != undefined) console.info(param)
33
- break
34
- case 'error':
35
- if (console.error != undefined) console.error(param)
36
- break
37
- }
38
- }
39
- }
40
- })()
@@ -1,116 +0,0 @@
1
- (function(){
2
-
3
- /**
4
- * DROPDOWN
5
- */
6
-
7
- var Dropdown = new Class('ui.Dropdown', {
8
- Implements: [Options],
9
-
10
- options: {
11
- header: {},
12
- panel: {}
13
- },
14
-
15
- initialize: function(element, options){
16
- this.element = element
17
- this.options = Object.merge(this.options, options)
18
- this.build()
19
- this.addEvents()
20
- this.element.store('dropdown', this)
21
- },
22
-
23
- build: function(){
24
- this.header = new ui.DropdownHeader(this.element.getElement('header'), this.options.header)
25
- this.panel = new ui.DropdownPanel(this.element.getElement('ol'), this.options.panel)
26
- },
27
-
28
- addEvents: function(){
29
- this.header.addEvent('onDropdownHeaderEnter', this.panel.show.bind(this.panel))
30
- this.header.addEvent('onDropdownHeaderLeave', this.panel.hide.bind(this.panel))
31
- this.panel.addEvent('onDropdownPanelEnter', this.header.killTimer.bind(this.header))
32
- this.panel.addEvent('onDropdownPanelLeave', this.panel.hide.bind(this.panel))
33
- }
34
- })
35
-
36
- /**
37
- * DROPDOWN HEADER
38
- */
39
-
40
- var DropdownHeader = new Class('ui.DropdownHeader', {
41
- Implements: [Options, Events],
42
-
43
- options: {},
44
-
45
- initialize: function(element, options){
46
- this.element = element
47
- this.options = Object.merge(this.options, options)
48
- this.addEvents()
49
- this.element.store('dropdown_header', this)
50
- },
51
-
52
- addEvents: function(){
53
- this.element.addEvent('mouseenter', this.onMouseEnter.bind(this))
54
- this.element.addEvent('mouseleave', this.onMouseLeave.bind(this))
55
- },
56
-
57
- onMouseEnter: function(event){
58
- this.killTimer()
59
- this.fireEvent('onDropdownHeaderEnter')
60
- },
61
-
62
- onMouseLeave: function(event){
63
- this.timer = this.fireEvent.delay(500, this, 'onDropdownHeaderLeave')
64
- },
65
-
66
- killTimer: function(event){
67
- if (this.timer) clearTimeout(this.timer)
68
- }
69
- })
70
-
71
- /**
72
- * DROPDOWN PANEL
73
- */
74
-
75
- var DropdownPanel = new Class('ui.DropdownPanel', {
76
- Implements: [Options, Events],
77
-
78
- options: {
79
- openAtStart: false
80
- },
81
-
82
- initialize: function(element, options){
83
- this.element = element
84
- this.options = Object.merge(this.options, options)
85
- this.build()
86
- this.addEvents()
87
- this.element.store('dropdown_panel', this)
88
- },
89
-
90
- build: function(){
91
- this.hide()
92
- if (this.options.openAtStart) this.show()
93
- },
94
-
95
- addEvents: function(){
96
- this.element.addEvent('mouseenter', this.onMouseEnter.bind(this))
97
- this.element.addEvent('mouseleave', this.onMouseLeave.bind(this))
98
- },
99
-
100
- show: function(event){
101
- this.element.show()
102
- },
103
-
104
- hide: function(event){
105
- this.element.hide()
106
- },
107
-
108
- onMouseEnter: function(event){
109
- this.fireEvent('onDropdownPanelEnter')
110
- },
111
-
112
- onMouseLeave: function(event){
113
- this.fireEvent('onDropdownPanelLeave')
114
- }
115
- })
116
- })()
@@ -1,46 +0,0 @@
1
- (function() {
2
- // Utility method to get and set objects that may or may not exist
3
- var objectifier = function(splits, create, context) {
4
- var result = context || window
5
- for(var i = 0, s; result && (s = splits[i]); i++) {
6
- result = (s in result ? result[s] : (create ? result[s] = {} : undefined))
7
- }
8
- return result
9
- }
10
-
11
- // Creates an object if it doesn't already exist
12
- Object.extend('place', function(name, value, context) {
13
- var splits = name.split("."), s = splits.pop(), result = objectifier(splits, true, context)
14
- return result && s ? (result[s] = value) : undefined
15
- })
16
-
17
- // Retrieves an object if not already present
18
- Object.extend('retrieve', function(name, create, context) {
19
- return objectifier(name.split('.'), create, context)
20
- })
21
-
22
- // Checks to see if the object exists
23
- Object.extend('exists', function(name, context) {
24
- return Object.retrieve(name, false, context) !== undefined
25
- })
26
-
27
- var klass = Class;
28
-
29
- // Redefine class
30
- Class = function(name, params, context) {
31
- // Find out if this is namespaced or the original method
32
- var namespaced = arguments.length > 1
33
-
34
- // Add the class name to the param list
35
- if(namespaced) params.$name = name
36
-
37
- // Create and get the original class
38
- var original = new klass(namespaced ? params : name)
39
-
40
- // If namespaced, set class into namespace
41
- if(namespaced) Object.place(name, original, context)
42
-
43
- // Return this newly created class!
44
- return original
45
- }
46
- })()