role-rails 0.3.2 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/role-rails/version.rb +1 -1
- data/role-rails-0.3.2/data/.gitignore +4 -0
- data/role-rails-0.3.2/data/Gemfile +3 -0
- data/role-rails-0.3.2/data/Rakefile +1 -0
- data/role-rails-0.3.2/data/lib/role-rails/engine.rb +8 -0
- data/role-rails-0.3.2/data/lib/role-rails/version.rb +5 -0
- data/role-rails-0.3.2/data/lib/role-rails.rb +8 -0
- data/role-rails-0.3.2/data/role-rails.gemspec +22 -0
- data/role-rails-0.3.2/data/vendor/assets/javascripts/jquery.role.js +45 -0
- data/role-rails-0.3.2/data.tar.gz +0 -0
- data/role-rails-0.3.2/metadata +88 -0
- data/role-rails-0.3.2/metadata.gz +0 -0
- data/role-rails-0.3.2.zip +0 -0
- data/vendor/assets/javascripts/jquery.role.js +97 -1
- metadata +40 -52
data/lib/role-rails/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'role-rails/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'role-rails'
|
7
|
+
s.version = Role::Rails::VERSION
|
8
|
+
s.authors = ['Sasha Koss']
|
9
|
+
s.email = ['koss@nocorp.me']
|
10
|
+
s.homepage = ''
|
11
|
+
s.summary = 'jQuery plugin to provide easy way to handle DOM elements by role attribute'
|
12
|
+
s.description = 'jQuery plugin to provide easy way to handle DOM elements by role attribute'
|
13
|
+
|
14
|
+
s.rubyforge_project = 'role-rails'
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ['lib']
|
20
|
+
|
21
|
+
s.add_dependency 'rails', '>= 3.1.0'
|
22
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/*
|
2
|
+
jquery.role.js
|
3
|
+
|
4
|
+
Version: 0.3.2
|
5
|
+
|
6
|
+
Copyright (c) 2011 Sasha Koss
|
7
|
+
*/
|
8
|
+
|
9
|
+
(function ($) {
|
10
|
+
$.expr.match['ROLE'] = /@((?:[\w\u00c0-\uFFFF\-]|\\.)+)/;
|
11
|
+
|
12
|
+
$.expr.preFilter['ROLE'] = function( match, curLoop, inplace, result, not, isXML ) {
|
13
|
+
match = " " + match[1] + " ";
|
14
|
+
|
15
|
+
return match;
|
16
|
+
}
|
17
|
+
|
18
|
+
$.expr.filter['ROLE'] = function( elem, match ) {
|
19
|
+
return (" " + elem.getAttribute('role') + " ").indexOf( match ) > -1;
|
20
|
+
}
|
21
|
+
|
22
|
+
for ( var type in $.expr.match ) {
|
23
|
+
$.expr.match[ type ] = new RegExp( $.expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
|
24
|
+
$.expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + $.expr.match[ type ].source.replace(/\\(\d+)/g, function(all, num) {
|
25
|
+
return "\\" + (num - 0 + 1);
|
26
|
+
}));
|
27
|
+
}
|
28
|
+
|
29
|
+
$.role = function (roleName, context) {
|
30
|
+
|
31
|
+
var selector;
|
32
|
+
|
33
|
+
if ( roleName.charAt(0) === '#' ) {
|
34
|
+
selector = '#role-' + roleName.substring(1);
|
35
|
+
} else {
|
36
|
+
selector = '[role="' + roleName + '"]';
|
37
|
+
}
|
38
|
+
|
39
|
+
return $(selector, context);
|
40
|
+
};
|
41
|
+
|
42
|
+
if (typeof $.r === 'undefined') {
|
43
|
+
$.r = $.role;
|
44
|
+
}
|
45
|
+
})(jQuery);
|
Binary file
|
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: role-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 3
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Sasha Koss
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-09-06 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rails
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 3
|
31
|
+
- 1
|
32
|
+
- 0
|
33
|
+
version: 3.1.0
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
description: jQuery plugin to provide easy way to handle DOM elements by role attribute
|
37
|
+
email:
|
38
|
+
- koss@nocorp.me
|
39
|
+
executables: []
|
40
|
+
|
41
|
+
extensions: []
|
42
|
+
|
43
|
+
extra_rdoc_files: []
|
44
|
+
|
45
|
+
files:
|
46
|
+
- .gitignore
|
47
|
+
- Gemfile
|
48
|
+
- Rakefile
|
49
|
+
- lib/role-rails.rb
|
50
|
+
- lib/role-rails/engine.rb
|
51
|
+
- lib/role-rails/version.rb
|
52
|
+
- role-rails.gemspec
|
53
|
+
- vendor/assets/javascripts/jquery.role.js
|
54
|
+
homepage: ""
|
55
|
+
licenses: []
|
56
|
+
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
hash: 3
|
68
|
+
segments:
|
69
|
+
- 0
|
70
|
+
version: "0"
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
version: "0"
|
80
|
+
requirements: []
|
81
|
+
|
82
|
+
rubyforge_project: role-rails
|
83
|
+
rubygems_version: 1.8.6
|
84
|
+
signing_key:
|
85
|
+
specification_version: 3
|
86
|
+
summary: jQuery plugin to provide easy way to handle DOM elements by role attribute
|
87
|
+
test_files: []
|
88
|
+
|
Binary file
|
Binary file
|
@@ -1,12 +1,106 @@
|
|
1
1
|
/*
|
2
2
|
jquery.role.js
|
3
3
|
|
4
|
-
Version: 0.
|
4
|
+
Version: 0.4.1
|
5
5
|
|
6
6
|
Copyright (c) 2011 Sasha Koss
|
7
7
|
*/
|
8
8
|
|
9
9
|
(function ($) {
|
10
|
+
var initSizzleNewLayer = function() {
|
11
|
+
var div = document.createElement("div"),
|
12
|
+
id = "__sizzle__";
|
13
|
+
div.innerHTML = "<p class='TEST'></p>";
|
14
|
+
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length !== 0 ) {
|
15
|
+
var makeArray = function( array, results ) {
|
16
|
+
array = Array.prototype.slice.call( array, 0 );
|
17
|
+
if ( results ) {
|
18
|
+
results.push.apply( results, array );
|
19
|
+
return results;
|
20
|
+
}
|
21
|
+
return array;
|
22
|
+
};
|
23
|
+
try {
|
24
|
+
Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
|
25
|
+
} catch( e ) {
|
26
|
+
makeArray = function( array, results ) {
|
27
|
+
var i = 0,
|
28
|
+
ret = results || [];
|
29
|
+
if ( toString.call(array) === "[object Array]" ) {
|
30
|
+
Array.prototype.push.apply( ret, array );
|
31
|
+
} else {
|
32
|
+
if ( typeof array.length === "number" ) {
|
33
|
+
for ( var l = array.length; i < l; i++ ) {
|
34
|
+
ret.push( array[i] );
|
35
|
+
}
|
36
|
+
} else {
|
37
|
+
for ( ; array[i]; i++ ) {
|
38
|
+
ret.push( array[i] );
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
return ret;
|
43
|
+
};
|
44
|
+
}
|
45
|
+
|
46
|
+
var oldFind = $.find;
|
47
|
+
$.find = function( query, context, extra, seed ) {
|
48
|
+
context = context || document;
|
49
|
+
if ( !seed && !$.find.isXML(context) ) {
|
50
|
+
var match = /^@([\w\-]+$)/.exec( query );
|
51
|
+
if ( match ) {
|
52
|
+
if ( context.nodeType === 9 ) {
|
53
|
+
return makeArray( context.querySelectorAll('[role~='+match[1]+']'), extra );
|
54
|
+
} else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
|
55
|
+
var oldContext = context,
|
56
|
+
old = context.getAttribute( "id" ),
|
57
|
+
nid = old || id,
|
58
|
+
hasParent = context.parentNode,
|
59
|
+
relativeHierarchySelector = /^\s*[+~]/.test( query );
|
60
|
+
if ( !old ) {
|
61
|
+
context.setAttribute( "id", nid );
|
62
|
+
} else {
|
63
|
+
nid = nid.replace( /'/g, "\\$&" );
|
64
|
+
}
|
65
|
+
if ( relativeHierarchySelector && hasParent ) {
|
66
|
+
context = context.parentNode;
|
67
|
+
}
|
68
|
+
try {
|
69
|
+
if ( !relativeHierarchySelector || hasParent ) {
|
70
|
+
return makeArray( context.querySelectorAll( "[id='" + nid + "'] [role~='" + match[1] + "']" ), extra );
|
71
|
+
}
|
72
|
+
} catch(pseudoError) {
|
73
|
+
} finally {
|
74
|
+
if ( !old ) {
|
75
|
+
oldContext.removeAttribute( "id" );
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
return oldFind(query, context, extra, seed);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
// Add jQuery.find.* properties to new find
|
85
|
+
for ( var prop in oldFind ) {
|
86
|
+
$.find[ prop ] = oldFind[ prop ];
|
87
|
+
}
|
88
|
+
|
89
|
+
// Save original of matchesSelector
|
90
|
+
var _oldMatchesSelector = $.find.matchesSelector;
|
91
|
+
$.find.matchesSelector = function (node, expr) {
|
92
|
+
return _oldMatchesSelector(
|
93
|
+
node,
|
94
|
+
expr.replace(/(@[\w\-]+)/g, function ($0) {
|
95
|
+
return $0.replace(/^@([\w\-]+)$/, function ($0, $1) {
|
96
|
+
return '[role="' + $1 + '"]';
|
97
|
+
});
|
98
|
+
})
|
99
|
+
)
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
10
104
|
$.expr.match['ROLE'] = /@((?:[\w\u00c0-\uFFFF\-]|\\.)+)/;
|
11
105
|
|
12
106
|
$.expr.preFilter['ROLE'] = function( match, curLoop, inplace, result, not, isXML ) {
|
@@ -26,6 +120,8 @@
|
|
26
120
|
}));
|
27
121
|
}
|
28
122
|
|
123
|
+
initSizzleNewLayer();
|
124
|
+
|
29
125
|
$.role = function (roleName, context) {
|
30
126
|
|
31
127
|
var selector;
|
metadata
CHANGED
@@ -1,88 +1,76 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: role-rails
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
- 2
|
10
|
-
version: 0.3.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Sasha Koss
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-12-08 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rails
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70282949902560 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 3
|
29
|
-
segments:
|
30
|
-
- 3
|
31
|
-
- 1
|
32
|
-
- 0
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
33
21
|
version: 3.1.0
|
34
22
|
type: :runtime
|
35
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70282949902560
|
36
25
|
description: jQuery plugin to provide easy way to handle DOM elements by role attribute
|
37
|
-
email:
|
26
|
+
email:
|
38
27
|
- koss@nocorp.me
|
39
28
|
executables: []
|
40
|
-
|
41
29
|
extensions: []
|
42
|
-
|
43
30
|
extra_rdoc_files: []
|
44
|
-
|
45
|
-
files:
|
31
|
+
files:
|
46
32
|
- .gitignore
|
47
33
|
- Gemfile
|
48
34
|
- Rakefile
|
49
35
|
- lib/role-rails.rb
|
50
36
|
- lib/role-rails/engine.rb
|
51
37
|
- lib/role-rails/version.rb
|
38
|
+
- role-rails-0.3.2.zip
|
39
|
+
- role-rails-0.3.2/data.tar.gz
|
40
|
+
- role-rails-0.3.2/data/.gitignore
|
41
|
+
- role-rails-0.3.2/data/Gemfile
|
42
|
+
- role-rails-0.3.2/data/Rakefile
|
43
|
+
- role-rails-0.3.2/data/lib/role-rails.rb
|
44
|
+
- role-rails-0.3.2/data/lib/role-rails/engine.rb
|
45
|
+
- role-rails-0.3.2/data/lib/role-rails/version.rb
|
46
|
+
- role-rails-0.3.2/data/role-rails.gemspec
|
47
|
+
- role-rails-0.3.2/data/vendor/assets/javascripts/jquery.role.js
|
48
|
+
- role-rails-0.3.2/metadata
|
49
|
+
- role-rails-0.3.2/metadata.gz
|
52
50
|
- role-rails.gemspec
|
53
51
|
- vendor/assets/javascripts/jquery.role.js
|
54
|
-
homepage:
|
52
|
+
homepage: ''
|
55
53
|
licenses: []
|
56
|
-
|
57
54
|
post_install_message:
|
58
55
|
rdoc_options: []
|
59
|
-
|
60
|
-
require_paths:
|
56
|
+
require_paths:
|
61
57
|
- lib
|
62
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
59
|
none: false
|
64
|
-
requirements:
|
65
|
-
- -
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
|
68
|
-
|
69
|
-
- 0
|
70
|
-
version: "0"
|
71
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
65
|
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
|
77
|
-
segments:
|
78
|
-
- 0
|
79
|
-
version: "0"
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
80
70
|
requirements: []
|
81
|
-
|
82
71
|
rubyforge_project: role-rails
|
83
|
-
rubygems_version: 1.8.
|
72
|
+
rubygems_version: 1.8.10
|
84
73
|
signing_key:
|
85
74
|
specification_version: 3
|
86
75
|
summary: jQuery plugin to provide easy way to handle DOM elements by role attribute
|
87
76
|
test_files: []
|
88
|
-
|