selectivizr-rails 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,5 +2,5 @@ module Selectivizr
2
2
  module Rails
3
3
  require 'selectivizr/rails/engine'
4
4
  require "selectivizr/rails/version"
5
- end
6
- end
5
+ end
6
+ end
@@ -3,5 +3,5 @@ module Selectivizr
3
3
  class Engine < ::Rails::Engine
4
4
  # auto wire
5
5
  end
6
- end
7
- end
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
1
  module Selectivizr
2
2
  module Rails
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
- end
5
+ end
data/readme.md CHANGED
@@ -1,22 +1,29 @@
1
1
  About
2
2
  ======
3
- The selectivizr-rails gem will include the Selectivizr.js library (http://selectivizr.com/) into your Rails 3.1 or higher app via the asset pipeline.
3
+ The selectivizr-rails gem will include the [selectivizr.js](http://selectivizr.com/) library into your Rails app via the asset pipeline.
4
4
 
5
5
  How to Use
6
6
  ===========
7
- Add the following to your GemFile:<br>
8
- `gem 'selectivizr-rails'`<br>
7
+ Add the following to your Gemfile and run `bundle install`:
9
8
 
10
- Then add the following to your application.js manifest:<br>
11
- `//= require selectivizr`<br>
9
+ gem 'selectivizr-rails'
12
10
 
13
- Don't forget to run `bundle update` after upgrading to the latest gem version to ensure it's used by your rails app.
11
+ Add the following to the `head` tag in your layout:
12
+
13
+ <!--[if lte IE 8]>
14
+ = javascript_include_tag 'selectivizr'
15
+ <![endif]-->
16
+
17
+ Requirements
18
+ ============
19
+ * Rails 3.1+
20
+ * The main JavaScript library (JQuery, Prototype, etc.) must be included prior to the selectivizr include tag.
14
21
 
15
22
  License
16
23
  =======
17
- This gem code is free to use, modify, distribute or use in any way you would like. The selectivizr library is released under the MIT License ( http://www.opensource.org/licenses/mit-license.php )
24
+ This gem code is free to use, modify, distribute or use in any way you would like. The selectivizr.js library is released under the [MIT License](http://www.opensource.org/licenses/mit-license.php).
18
25
 
19
26
 
20
27
  Thanks
21
28
  ======
22
- A large portion of this gem was assembled based on the source code for the modernizer-rails gem (https://github.com/russfrisch/modernizr-rails) by Russ Frisch (https://github.com/russfrisch)
29
+ A large portion of this gem was assembled based on the source code for the [modernizer-rails gem](https://github.com/russfrisch/modernizr-rails) by [Russ Frisch](https://github.com/russfrisch).
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
8
8
  s.authors = ["Jeremy Hubert"]
9
9
  s.email = ["jhubert@gmail.com"]
10
10
  s.homepage = "https://github.com/jhubert/selectivizr-rails"
11
- s.summary = %q{Gem wrapper to include the Selectivizr.js library via the asset pipeline.}
12
- s.description = %q{This Selectivizr.js was built using the download at http://www.selectivizr.com}
11
+ s.summary = %q{Gem wrapper to include the selectivizr.js library via the asset pipeline.}
12
+ s.description = %q{This selectivizr.js was built using the download at http://www.selectivizr.com}
13
13
 
14
14
  s.rubyforge_project = "selectivizr-rails"
15
15
 
@@ -19,4 +19,4 @@ Gem::Specification.new do |s|
19
19
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
20
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
21
  s.require_paths = ["lib"]
22
- end
22
+ end
@@ -1,5 +1,563 @@
1
- /*!
2
- * selectivizr v1.0.2 - (c) Keith Clark, freely distributable under the terms of the MIT license.
3
- * selectivizr.com
4
- */
5
- (function(j){function A(a){return a.replace(B,h).replace(C,function(a,d,b){for(var a=b.split(","),b=0,e=a.length;b<e;b++){var s=D(a[b].replace(E,h).replace(F,h))+o,l=[];a[b]=s.replace(G,function(a,b,c,d,e){if(b){if(l.length>0){var a=l,f,e=s.substring(0,e).replace(H,i);if(e==i||e.charAt(e.length-1)==o)e+="*";try{f=t(e)}catch(k){}if(f){e=0;for(c=f.length;e<c;e++){for(var d=f[e],h=d.className,j=0,m=a.length;j<m;j++){var g=a[j];if(!RegExp("(^|\\s)"+g.className+"(\\s|$)").test(d.className)&&g.b&&(g.b===!0||g.b(d)===!0))h=u(h,g.className,!0)}d.className=h}}l=[]}return b}else{if(b=c?I(c):!v||v.test(d)?{className:w(d),b:!0}:null)return l.push(b),"."+b.className;return a}})}return d+a.join(",")})}function I(a){var c=!0,d=w(a.slice(1)),b=a.substring(0,5)==":not(",e,f;b&&(a=a.slice(5,-1));var l=a.indexOf("(");l>-1&&(a=a.substring(0,l));if(a.charAt(0)==":")switch(a.slice(1)){case "root":c=function(a){return b?a!=p:a==p};break;case "target":if(m==8){c=function(a){function c(){var d=location.hash,e=d.slice(1);return b?d==i||a.id!=e:d!=i&&a.id==e}k(j,"hashchange",function(){g(a,d,c())});return c()};break}return!1;case "checked":c=function(a){J.test(a.type)&&k(a,"propertychange",function(){event.propertyName=="checked"&&g(a,d,a.checked!==b)});return a.checked!==b};break;case "disabled":b=!b;case "enabled":c=function(c){if(K.test(c.tagName))return k(c,"propertychange",function(){event.propertyName=="$disabled"&&g(c,d,c.a===b)}),q.push(c),c.a=c.disabled,c.disabled===b;return a==":enabled"?b:!b};break;case "focus":e="focus",f="blur";case "hover":e||(e="mouseenter",f="mouseleave");c=function(a){k(a,b?f:e,function(){g(a,d,!0)});k(a,b?e:f,function(){g(a,d,!1)});return b};break;default:if(!L.test(a))return!1}return{className:d,b:c}}function w(a){return M+"-"+(m==6&&N?O++:a.replace(P,function(a){return a.charCodeAt(0)}))}function D(a){return a.replace(x,h).replace(Q,o)}function g(a,c,d){var b=a.className,c=u(b,c,d);if(c!=b)a.className=c,a.parentNode.className+=i}function u(a,c,d){var b=RegExp("(^|\\s)"+c+"(\\s|$)"),e=b.test(a);return d?e?a:a+o+c:e?a.replace(b,h).replace(x,h):a}function k(a,c,d){a.attachEvent("on"+c,d)}function r(a,c){if(/^https?:\/\//i.test(a))return c.substring(0,c.indexOf("/",8))==a.substring(0,a.indexOf("/",8))?a:null;if(a.charAt(0)=="/")return c.substring(0,c.indexOf("/",8))+a;var d=c.split(/[?#]/)[0];a.charAt(0)!="?"&&d.charAt(d.length-1)!="/"&&(d=d.substring(0,d.lastIndexOf("/")+1));return d+a}function y(a){if(a)return n.open("GET",a,!1),n.send(),(n.status==200?n.responseText:i).replace(R,i).replace(S,function(c,d,b,e,f){return y(r(b||f,a))}).replace(T,function(c,d,b){d=d||i;return" url("+d+r(b,a)+d+") "});return i}function U(){var a,c;a=f.getElementsByTagName("BASE");for(var d=a.length>0?a[0].href:f.location.href,b=0;b<f.styleSheets.length;b++)if(c=f.styleSheets[b],c.href!=i&&(a=r(c.href,d)))c.cssText=A(y(a));q.length>0&&setInterval(function(){for(var a=0,c=q.length;a<c;a++){var b=q[a];if(b.disabled!==b.a)b.disabled?(b.disabled=!1,b.a=!0,b.disabled=!0):b.a=b.disabled}},250)}if(!/*@cc_on!@*/true){var f=document,p=f.documentElement,n=function(){if(j.XMLHttpRequest)return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){return null}}(),m=/MSIE (\d+)/.exec(navigator.userAgent)[1];if(!(f.compatMode!="CSS1Compat"||m<6||m>8||!n)){var z={NW:"*.Dom.select",MooTools:"$$",DOMAssistant:"*.$",Prototype:"$$",YAHOO:"*.util.Selector.query",Sizzle:"*",jQuery:"*",dojo:"*.query"},t,q=[],O=0,N=!0,M="slvzr",R=/(\/\*[^*]*\*+([^\/][^*]*\*+)*\/)\s*/g,S=/@import\s*(?:(?:(?:url\(\s*(['"]?)(.*)\1)\s*\))|(?:(['"])(.*)\3))[^;]*;/g,T=/\burl\(\s*(["']?)(?!data:)([^"')]+)\1\s*\)/g,L=/^:(empty|(first|last|only|nth(-last)?)-(child|of-type))$/,B=/:(:first-(?:line|letter))/g,C=/(^|})\s*([^\{]*?[\[:][^{]+)/g,G=/([ +~>])|(:[a-z-]+(?:\(.*?\)+)?)|(\[.*?\])/g,H=/(:not\()?:(hover|enabled|disabled|focus|checked|target|active|visited|first-line|first-letter)\)?/g,P=/[^\w-]/g,K=/^(INPUT|SELECT|TEXTAREA|BUTTON)$/,J=/^(checkbox|radio)$/,v=m>6?/[\$\^*]=(['"])\1/:null,E=/([(\[+~])\s+/g,F=/\s+([)\]+~])/g,Q=/\s+/g,x=/^\s*((?:[\S\s]*\S)?)\s*$/,i="",o=" ",h="$1";(function(a,c){function d(){try{p.doScroll("left")}catch(a){setTimeout(d,50);return}b("poll")}function b(d){if(!(d.type=="readystatechange"&&f.readyState!="complete")&&((d.type=="load"?a:f).detachEvent("on"+d.type,b,!1),!e&&(e=!0)))c.call(a,d.type||d)}var e=!1,g=!0;if(f.readyState=="complete")c.call(a,i);else{if(f.createEventObject&&p.doScroll){try{g=!a.frameElement}catch(h){}g&&d()}k(f,"readystatechange",b);k(a,"load",b)}})(j,function(){for(var a in z){var c,d,b=j;if(j[a]){for(c=z[a].replace("*",a).split(".");(d=c.shift())&&(b=b[d]););if(typeof b=="function"){t=b;U();break}}}})}}})(this);
1
+ /*
2
+ selectivizr v1.0.3b - (c) Keith Clark, freely distributable under the terms
3
+ of the MIT license.
4
+
5
+ selectivizr.com
6
+ */
7
+ /*
8
+
9
+ Notes about this source
10
+ -----------------------
11
+
12
+ * The #DEBUG_START and #DEBUG_END comments are used to mark blocks of code
13
+ that will be removed prior to building a final release version (using a
14
+ pre-compression script)
15
+
16
+
17
+ References:
18
+ -----------
19
+
20
+ * CSS Syntax : http://www.w3.org/TR/2003/WD-css3-syntax-20030813/#style
21
+ * Selectors : http://www.w3.org/TR/css3-selectors/#selectors
22
+ * IE Compatability : http://msdn.microsoft.com/en-us/library/cc351024(VS.85).aspx
23
+ * W3C Selector Tests : http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/
24
+
25
+ */
26
+
27
+ (function(win) {
28
+
29
+ // Determine IE version and stop execution if browser isn't IE. This
30
+ // handles the script being loaded by non IE browsers because the
31
+ // developer didn't use conditional comments.
32
+ var ieUserAgent = navigator.userAgent.match(/MSIE (\d+)/);
33
+ if (!ieUserAgent) {
34
+ return false;
35
+ }
36
+
37
+ // =========================== Init Objects ============================
38
+
39
+ var doc = document;
40
+ var root = doc.documentElement;
41
+ var xhr = getXHRObject();
42
+ var ieVersion = ieUserAgent[1];
43
+
44
+ // If were not in standards mode, IE is too old / new or we can't create
45
+ // an XMLHttpRequest object then we should get out now.
46
+ if (doc.compatMode != 'CSS1Compat' || ieVersion<6 || ieVersion>8 || !xhr) {
47
+ return;
48
+ }
49
+
50
+
51
+ // ========================= Common Objects ============================
52
+
53
+ // Compatiable selector engines in order of CSS3 support. Note: '*' is
54
+ // a placholder for the object key name. (basically, crude compression)
55
+ var selectorEngines = {
56
+ "NW" : "*.Dom.select",
57
+ "MooTools" : "$$",
58
+ "DOMAssistant" : "*.$",
59
+ "Prototype" : "$$",
60
+ "YAHOO" : "*.util.Selector.query",
61
+ "Sizzle" : "*",
62
+ "jQuery" : "*",
63
+ "dojo" : "*.query"
64
+ };
65
+
66
+ var selectorMethod;
67
+ var enabledWatchers = []; // array of :enabled/:disabled elements to poll
68
+ var domPatches = [];
69
+ var ie6PatchID = 0; // used to solve ie6's multiple class bug
70
+ var patchIE6MultipleClasses = true; // if true adds class bloat to ie6
71
+ var namespace = "slvzr";
72
+
73
+ // Stylesheet parsing regexp's
74
+ var RE_COMMENT = /(\/\*[^*]*\*+([^\/][^*]*\*+)*\/)\s*?/g;
75
+ var RE_IMPORT = /@import\s*(?:(?:(?:url\(\s*(['"]?)(.*)\1)\s*\))|(?:(['"])(.*)\3))\s*([^;]*);/g;
76
+ var RE_ASSET_URL = /(behavior\s*?:\s*)?\burl\(\s*(["']?)(?!data:)([^"')]+)\2\s*\)/g;
77
+ var RE_PSEUDO_STRUCTURAL = /^:(empty|(first|last|only|nth(-last)?)-(child|of-type))$/;
78
+ var RE_PSEUDO_ELEMENTS = /:(:first-(?:line|letter))/g;
79
+ var RE_SELECTOR_GROUP = /((?:^|(?:\s*})+)(?:\s*@media[^{]+{)?)\s*([^\{]*?[\[:][^{]+)/g;
80
+ var RE_SELECTOR_PARSE = /([ +~>])|(:[a-z-]+(?:\(.*?\)+)?)|(\[.*?\])/g;
81
+ var RE_LIBRARY_INCOMPATIBLE_PSEUDOS = /(:not\()?:(hover|enabled|disabled|focus|checked|target|active|visited|first-line|first-letter)\)?/g;
82
+ var RE_PATCH_CLASS_NAME_REPLACE = /[^\w-]/g;
83
+
84
+ // HTML UI element regexp's
85
+ var RE_INPUT_ELEMENTS = /^(INPUT|SELECT|TEXTAREA|BUTTON)$/;
86
+ var RE_INPUT_CHECKABLE_TYPES = /^(checkbox|radio)$/;
87
+
88
+ // Broken attribute selector implementations (IE7/8 native [^=""], [$=""] and [*=""])
89
+ var BROKEN_ATTR_IMPLEMENTATIONS = ieVersion>6 ? /[\$\^*]=(['"])\1/ : null;
90
+
91
+ // Whitespace normalization regexp's
92
+ var RE_TIDY_TRAILING_WHITESPACE = /([(\[+~])\s+/g;
93
+ var RE_TIDY_LEADING_WHITESPACE = /\s+([)\]+~])/g;
94
+ var RE_TIDY_CONSECUTIVE_WHITESPACE = /\s+/g;
95
+ var RE_TIDY_TRIM_WHITESPACE = /^\s*((?:[\S\s]*\S)?)\s*$/;
96
+
97
+ // String constants
98
+ var EMPTY_STRING = "";
99
+ var SPACE_STRING = " ";
100
+ var PLACEHOLDER_STRING = "$1";
101
+
102
+ // =========================== Patching ================================
103
+
104
+ // --[ patchStyleSheet() ]----------------------------------------------
105
+ // Scans the passed cssText for selectors that require emulation and
106
+ // creates one or more patches for each matched selector.
107
+ function patchStyleSheet( cssText ) {
108
+ return cssText.replace(RE_PSEUDO_ELEMENTS, PLACEHOLDER_STRING).
109
+ replace(RE_SELECTOR_GROUP, function(m, prefix, selectorText) {
110
+ var selectorGroups = selectorText.split(",");
111
+ for (var c = 0, cs = selectorGroups.length; c < cs; c++) {
112
+ var selector = normalizeSelectorWhitespace(selectorGroups[c]) + SPACE_STRING;
113
+ var patches = [];
114
+ selectorGroups[c] = selector.replace(RE_SELECTOR_PARSE,
115
+ function(match, combinator, pseudo, attribute, index) {
116
+ if (combinator) {
117
+ if (patches.length>0) {
118
+ domPatches.push( { selector: selector.substring(0, index), patches: patches } )
119
+ patches = [];
120
+ }
121
+ return combinator;
122
+ }
123
+ else {
124
+ var patch = (pseudo) ? patchPseudoClass( pseudo ) : patchAttribute( attribute );
125
+ if (patch) {
126
+ patches.push(patch);
127
+ return "." + patch.className;
128
+ }
129
+ return match;
130
+ }
131
+ }
132
+ );
133
+ }
134
+ return prefix + selectorGroups.join(",");
135
+ });
136
+ };
137
+
138
+ // --[ patchAttribute() ]-----------------------------------------------
139
+ // returns a patch for an attribute selector.
140
+ function patchAttribute( attr ) {
141
+ return (!BROKEN_ATTR_IMPLEMENTATIONS || BROKEN_ATTR_IMPLEMENTATIONS.test(attr)) ?
142
+ { className: createClassName(attr), applyClass: true } : null;
143
+ };
144
+
145
+ // --[ patchPseudoClass() ]---------------------------------------------
146
+ // returns a patch for a pseudo-class
147
+ function patchPseudoClass( pseudo ) {
148
+
149
+ var applyClass = true;
150
+ var className = createClassName(pseudo.slice(1));
151
+ var isNegated = pseudo.substring(0, 5) == ":not(";
152
+ var activateEventName;
153
+ var deactivateEventName;
154
+
155
+ // if negated, remove :not()
156
+ if (isNegated) {
157
+ pseudo = pseudo.slice(5, -1);
158
+ }
159
+
160
+ // bracket contents are irrelevant - remove them
161
+ var bracketIndex = pseudo.indexOf("(")
162
+ if (bracketIndex > -1) {
163
+ pseudo = pseudo.substring(0, bracketIndex);
164
+ }
165
+
166
+ // check we're still dealing with a pseudo-class
167
+ if (pseudo.charAt(0) == ":") {
168
+ switch (pseudo.slice(1)) {
169
+
170
+ case "root":
171
+ applyClass = function(e) {
172
+ return isNegated ? e != root : e == root;
173
+ }
174
+ break;
175
+
176
+ case "target":
177
+ // :target is only supported in IE8
178
+ if (ieVersion == 8) {
179
+ applyClass = function(e) {
180
+ var handler = function() {
181
+ var hash = location.hash;
182
+ var hashID = hash.slice(1);
183
+ return isNegated ? (hash == EMPTY_STRING || e.id != hashID) : (hash != EMPTY_STRING && e.id == hashID);
184
+ };
185
+ addEvent( win, "hashchange", function() {
186
+ toggleElementClass(e, className, handler());
187
+ })
188
+ return handler();
189
+ }
190
+ break;
191
+ }
192
+ return false;
193
+
194
+ case "checked":
195
+ applyClass = function(e) {
196
+ if (RE_INPUT_CHECKABLE_TYPES.test(e.type)) {
197
+ addEvent( e, "propertychange", function() {
198
+ if (event.propertyName == "checked") {
199
+ toggleElementClass( e, className, e.checked !== isNegated );
200
+ }
201
+ })
202
+ }
203
+ return e.checked !== isNegated;
204
+ }
205
+ break;
206
+
207
+ case "disabled":
208
+ isNegated = !isNegated;
209
+
210
+ case "enabled":
211
+ applyClass = function(e) {
212
+ if (RE_INPUT_ELEMENTS.test(e.tagName)) {
213
+ addEvent( e, "propertychange", function() {
214
+ if (event.propertyName == "$disabled") {
215
+ toggleElementClass( e, className, e.$disabled === isNegated );
216
+ }
217
+ });
218
+ enabledWatchers.push(e);
219
+ e.$disabled = e.disabled;
220
+ return e.disabled === isNegated;
221
+ }
222
+ return pseudo == ":enabled" ? isNegated : !isNegated;
223
+ }
224
+ break;
225
+
226
+ case "focus":
227
+ activateEventName = "focus";
228
+ deactivateEventName = "blur";
229
+
230
+ case "hover":
231
+ if (!activateEventName) {
232
+ activateEventName = "mouseenter";
233
+ deactivateEventName = "mouseleave";
234
+ }
235
+ applyClass = function(e) {
236
+ addEvent( e, isNegated ? deactivateEventName : activateEventName, function() {
237
+ toggleElementClass( e, className, true );
238
+ })
239
+ addEvent( e, isNegated ? activateEventName : deactivateEventName, function() {
240
+ toggleElementClass( e, className, false );
241
+ })
242
+ return isNegated;
243
+ }
244
+ break;
245
+
246
+ // everything else
247
+ default:
248
+ // If we don't support this pseudo-class don't create
249
+ // a patch for it
250
+ if (!RE_PSEUDO_STRUCTURAL.test(pseudo)) {
251
+ return false;
252
+ }
253
+ break;
254
+ }
255
+ }
256
+ return { className: className, applyClass: applyClass };
257
+ };
258
+
259
+ // --[ applyPatches() ]-------------------------------------------------
260
+ function applyPatches() {
261
+ var elms, selectorText, patches, domSelectorText;
262
+
263
+ for (var c=0; c<domPatches.length; c++) {
264
+ selectorText = domPatches[c].selector;
265
+ patches = domPatches[c].patches;
266
+
267
+ // Although some selector libraries can find :checked :enabled etc.
268
+ // we need to find all elements that could have that state because
269
+ // it can be changed by the user.
270
+ domSelectorText = selectorText.replace(RE_LIBRARY_INCOMPATIBLE_PSEUDOS, EMPTY_STRING);
271
+
272
+ // If the dom selector equates to an empty string or ends with
273
+ // whitespace then we need to append a universal selector (*) to it.
274
+ if (domSelectorText == EMPTY_STRING || domSelectorText.charAt(domSelectorText.length - 1) == SPACE_STRING) {
275
+ domSelectorText += "*";
276
+ }
277
+
278
+ // Ensure we catch errors from the selector library
279
+ try {
280
+ elms = selectorMethod( domSelectorText );
281
+ } catch (ex) {
282
+ // #DEBUG_START
283
+ log( "Selector '" + selectorText + "' threw exception '" + ex + "'" );
284
+ // #DEBUG_END
285
+ }
286
+
287
+
288
+ if (elms) {
289
+ for (var d = 0, dl = elms.length; d < dl; d++) {
290
+ var elm = elms[d];
291
+ var cssClasses = elm.className;
292
+ for (var f = 0, fl = patches.length; f < fl; f++) {
293
+ var patch = patches[f];
294
+ if (!hasPatch(elm, patch)) {
295
+ if (patch.applyClass && (patch.applyClass === true || patch.applyClass(elm) === true)) {
296
+ cssClasses = toggleClass(cssClasses, patch.className, true );
297
+ }
298
+ }
299
+ }
300
+ elm.className = cssClasses;
301
+ }
302
+ }
303
+ }
304
+ };
305
+
306
+ // --[ hasPatch() ]-----------------------------------------------------
307
+ // checks for the exsistence of a patch on an element
308
+ function hasPatch( elm, patch ) {
309
+ return new RegExp("(^|\\s)" + patch.className + "(\\s|$)").test(elm.className);
310
+ };
311
+
312
+
313
+ // =========================== Utility =================================
314
+
315
+ function createClassName( className ) {
316
+ return namespace + "-" + ((ieVersion == 6 && patchIE6MultipleClasses) ?
317
+ ie6PatchID++
318
+ :
319
+ className.replace(RE_PATCH_CLASS_NAME_REPLACE, function(a) { return a.charCodeAt(0) }));
320
+ };
321
+
322
+ // --[ log() ]----------------------------------------------------------
323
+ // #DEBUG_START
324
+ function log( message ) {
325
+ if (win.console) {
326
+ win.console.log(message);
327
+ }
328
+ };
329
+ // #DEBUG_END
330
+
331
+ // --[ trim() ]---------------------------------------------------------
332
+ // removes leading, trailing whitespace from a string
333
+ function trim( text ) {
334
+ return text.replace(RE_TIDY_TRIM_WHITESPACE, PLACEHOLDER_STRING);
335
+ };
336
+
337
+ // --[ normalizeWhitespace() ]------------------------------------------
338
+ // removes leading, trailing and consecutive whitespace from a string
339
+ function normalizeWhitespace( text ) {
340
+ return trim(text).replace(RE_TIDY_CONSECUTIVE_WHITESPACE, SPACE_STRING);
341
+ };
342
+
343
+ // --[ normalizeSelectorWhitespace() ]----------------------------------
344
+ // tidies whitespace around selector brackets and combinators
345
+ function normalizeSelectorWhitespace( selectorText ) {
346
+ return normalizeWhitespace(selectorText.
347
+ replace(RE_TIDY_TRAILING_WHITESPACE, PLACEHOLDER_STRING).
348
+ replace(RE_TIDY_LEADING_WHITESPACE, PLACEHOLDER_STRING)
349
+ );
350
+ };
351
+
352
+ // --[ toggleElementClass() ]-------------------------------------------
353
+ // toggles a single className on an element
354
+ function toggleElementClass( elm, className, on ) {
355
+ var oldClassName = elm.className;
356
+ var newClassName = toggleClass(oldClassName, className, on);
357
+ if (newClassName != oldClassName) {
358
+ elm.className = newClassName;
359
+ elm.parentNode.className += EMPTY_STRING;
360
+ }
361
+ };
362
+
363
+ // --[ toggleClass() ]--------------------------------------------------
364
+ // adds / removes a className from a string of classNames. Used to
365
+ // manage multiple class changes without forcing a DOM redraw
366
+ function toggleClass( classList, className, on ) {
367
+ var re = RegExp("(^|\\s)" + className + "(\\s|$)");
368
+ var classExists = re.test(classList);
369
+ if (on) {
370
+ return classExists ? classList : classList + SPACE_STRING + className;
371
+ } else {
372
+ return classExists ? trim(classList.replace(re, PLACEHOLDER_STRING)) : classList;
373
+ }
374
+ };
375
+
376
+ // --[ addEvent() ]-----------------------------------------------------
377
+ function addEvent(elm, eventName, eventHandler) {
378
+ elm.attachEvent("on" + eventName, eventHandler);
379
+ };
380
+
381
+ // --[ getXHRObject() ]-------------------------------------------------
382
+ function getXHRObject() {
383
+ if (win.XMLHttpRequest) {
384
+ return new XMLHttpRequest;
385
+ }
386
+ try {
387
+ return new ActiveXObject('Microsoft.XMLHTTP');
388
+ } catch(e) {
389
+ return null;
390
+ }
391
+ };
392
+
393
+ // --[ loadStyleSheet() ]-----------------------------------------------
394
+ function loadStyleSheet( url ) {
395
+ xhr.open("GET", url, false);
396
+ xhr.send();
397
+ return (xhr.status==200) ? xhr.responseText : EMPTY_STRING;
398
+ };
399
+
400
+ // --[ resolveUrl() ]---------------------------------------------------
401
+ // Converts a URL fragment to a fully qualified URL using the specified
402
+ // context URL. Returns null if same-origin policy is broken
403
+ function resolveUrl( url, contextUrl, ignoreSameOriginPolicy ) {
404
+
405
+ function getProtocol( url ) {
406
+ return url.substring(0, url.indexOf("//"));
407
+ };
408
+
409
+ function getProtocolAndHost( url ) {
410
+ return url.substring(0, url.indexOf("/", 8));
411
+ };
412
+
413
+ if (!contextUrl) {
414
+ contextUrl = baseUrl;
415
+ }
416
+
417
+ // protocol-relative path
418
+ if (url.substring(0,2)=="//") {
419
+ url = getProtocol(contextUrl) + url;
420
+ }
421
+
422
+ // absolute path
423
+ if (/^https?:\/\//i.test(url)) {
424
+ return !ignoreSameOriginPolicy && getProtocolAndHost(contextUrl) != getProtocolAndHost(url) ? null : url ;
425
+ }
426
+
427
+ // root-relative path
428
+ if (url.charAt(0)=="/") {
429
+ return getProtocolAndHost(contextUrl) + url;
430
+ }
431
+
432
+ // relative path
433
+ var contextUrlPath = contextUrl.split(/[?#]/)[0]; // ignore query string in the contextUrl
434
+ if (url.charAt(0) != "?" && contextUrlPath.charAt(contextUrlPath.length - 1) != "/") {
435
+ contextUrlPath = contextUrlPath.substring(0, contextUrlPath.lastIndexOf("/") + 1);
436
+ }
437
+
438
+ return contextUrlPath + url;
439
+ };
440
+
441
+ // --[ parseStyleSheet() ]----------------------------------------------
442
+ // Downloads the stylesheet specified by the URL, removes it's comments
443
+ // and recursivly replaces @import rules with their contents, ultimately
444
+ // returning the full cssText.
445
+ function parseStyleSheet( url ) {
446
+ if (url) {
447
+ return loadStyleSheet(url).replace(RE_COMMENT, EMPTY_STRING).
448
+ replace(RE_IMPORT, function( match, quoteChar, importUrl, quoteChar2, importUrl2, media ) {
449
+ var cssText = parseStyleSheet(resolveUrl(importUrl || importUrl2, url));
450
+ return (media) ? "@media " + media + " {" + cssText + "}" : cssText;
451
+ }).
452
+ replace(RE_ASSET_URL, function( match, isBehavior, quoteChar, assetUrl ) {
453
+ quoteChar = quoteChar || EMPTY_STRING;
454
+ return isBehavior ? match : " url(" + quoteChar + resolveUrl(assetUrl, url, true) + quoteChar + ") ";
455
+ });
456
+ }
457
+ return EMPTY_STRING;
458
+ };
459
+
460
+ // --[ getStyleSheets() ]-----------------------------------------------
461
+ function getStyleSheets() {
462
+ var url, stylesheet;
463
+ for (var c = 0; c < doc.styleSheets.length; c++) {
464
+ stylesheet = doc.styleSheets[c];
465
+ if (stylesheet.href != EMPTY_STRING) {
466
+ url = resolveUrl(stylesheet.href);
467
+ if (url) {
468
+ stylesheet.cssText = stylesheet["rawCssText"] = patchStyleSheet( parseStyleSheet( url ) );
469
+ }
470
+ }
471
+ }
472
+ };
473
+
474
+ // --[ init() ]---------------------------------------------------------
475
+ function init() {
476
+ applyPatches();
477
+
478
+ // :enabled & :disabled polling script (since we can't hook
479
+ // onpropertychange event when an element is disabled)
480
+ if (enabledWatchers.length > 0) {
481
+ setInterval( function() {
482
+ for (var c = 0, cl = enabledWatchers.length; c < cl; c++) {
483
+ var e = enabledWatchers[c];
484
+ if (e.disabled !== e.$disabled) {
485
+ if (e.disabled) {
486
+ e.disabled = false;
487
+ e.$disabled = true;
488
+ e.disabled = true;
489
+ }
490
+ else {
491
+ e.$disabled = e.disabled;
492
+ }
493
+ }
494
+ }
495
+ }, 250)
496
+ }
497
+ };
498
+
499
+ // Determine the baseUrl and download the stylesheets
500
+ var baseTags = doc.getElementsByTagName("BASE");
501
+ var baseUrl = (baseTags.length > 0) ? baseTags[0].href : doc.location.href;
502
+ getStyleSheets();
503
+
504
+ // Bind selectivizr to the ContentLoaded event.
505
+ ContentLoaded(win, function() {
506
+ // Determine the "best fit" selector engine
507
+ for (var engine in selectorEngines) {
508
+ var members, member, context = win;
509
+ if (win[engine]) {
510
+ members = selectorEngines[engine].replace("*", engine).split(".");
511
+ while ((member = members.shift()) && (context = context[member])) {}
512
+ if (typeof context == "function") {
513
+ selectorMethod = context;
514
+ init();
515
+ return;
516
+ }
517
+ }
518
+ }
519
+ });
520
+
521
+
522
+
523
+ /*!
524
+ * ContentLoaded.js by Diego Perini, modified for IE<9 only (to save space)
525
+ *
526
+ * Author: Diego Perini (diego.perini at gmail.com)
527
+ * Summary: cross-browser wrapper for DOMContentLoaded
528
+ * Updated: 20101020
529
+ * License: MIT
530
+ * Version: 1.2
531
+ *
532
+ * URL:
533
+ * http://javascript.nwbox.com/ContentLoaded/
534
+ * http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE
535
+ *
536
+ */
537
+
538
+ // @w window reference
539
+ // @f function reference
540
+ function ContentLoaded(win, fn) {
541
+
542
+ var done = false, top = true,
543
+ init = function(e) {
544
+ if (e.type == "readystatechange" && doc.readyState != "complete") return;
545
+ (e.type == "load" ? win : doc).detachEvent("on" + e.type, init, false);
546
+ if (!done && (done = true)) fn.call(win, e.type || e);
547
+ },
548
+ poll = function() {
549
+ try { root.doScroll("left"); } catch(e) { setTimeout(poll, 50); return; }
550
+ init('poll');
551
+ };
552
+
553
+ if (doc.readyState == "complete") fn.call(win, EMPTY_STRING);
554
+ else {
555
+ if (doc.createEventObject && root.doScroll) {
556
+ try { top = !win.frameElement; } catch(e) { }
557
+ if (top) poll();
558
+ }
559
+ addEvent(doc,"readystatechange", init);
560
+ addEvent(win,"load", init);
561
+ }
562
+ };
563
+ })(this);
metadata CHANGED
@@ -1,50 +1,39 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: selectivizr-rails
3
- version: !ruby/object:Gem::Version
4
- hash: 21
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 1
10
- version: 1.0.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Jeremy Hubert
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-04-30 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2013-06-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rails
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 15424109
29
- segments:
30
- - 3
31
- - 1
32
- - 0
33
- - rc
34
- - 4
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
35
21
  version: 3.1.0.rc4
36
22
  type: :development
37
- version_requirements: *id001
38
- description: This Selectivizr.js was built using the download at http://www.selectivizr.com
39
- email:
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.1.0.rc4
30
+ description: This selectivizr.js was built using the download at http://www.selectivizr.com
31
+ email:
40
32
  - jhubert@gmail.com
41
33
  executables: []
42
-
43
34
  extensions: []
44
-
45
35
  extra_rdoc_files: []
46
-
47
- files:
36
+ files:
48
37
  - .gitignore
49
38
  - Gemfile
50
39
  - Rakefile
@@ -56,36 +45,26 @@ files:
56
45
  - vendor/assets/javascripts/selectivizr.js
57
46
  homepage: https://github.com/jhubert/selectivizr-rails
58
47
  licenses: []
59
-
60
48
  post_install_message:
61
49
  rdoc_options: []
62
-
63
- require_paths:
50
+ require_paths:
64
51
  - lib
65
- required_ruby_version: !ruby/object:Gem::Requirement
52
+ required_ruby_version: !ruby/object:Gem::Requirement
66
53
  none: false
67
- requirements:
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- hash: 3
71
- segments:
72
- - 0
73
- version: "0"
74
- required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
59
  none: false
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- hash: 3
80
- segments:
81
- - 0
82
- version: "0"
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
83
64
  requirements: []
84
-
85
65
  rubyforge_project: selectivizr-rails
86
- rubygems_version: 1.8.15
66
+ rubygems_version: 1.8.23
87
67
  signing_key:
88
68
  specification_version: 3
89
- summary: Gem wrapper to include the Selectivizr.js library via the asset pipeline.
69
+ summary: Gem wrapper to include the selectivizr.js library via the asset pipeline.
90
70
  test_files: []
91
-