spacers_and_dividers 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,153 @@
1
+ // DomReady
2
+ (function(){
3
+
4
+ var DomReady = window.DomReady = {};
5
+
6
+ // Everything that has to do with properly supporting our document ready event. Brought over from the most awesome jQuery.
7
+
8
+ var userAgent = navigator.userAgent.toLowerCase();
9
+
10
+ // Figure out what browser is being used
11
+ var browser = {
12
+ version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
13
+ safari: /webkit/.test(userAgent),
14
+ opera: /opera/.test(userAgent),
15
+ msie: (/msie/.test(userAgent)) && (!/opera/.test( userAgent )),
16
+ mozilla: (/mozilla/.test(userAgent)) && (!/(compatible|webkit)/.test(userAgent))
17
+ };
18
+
19
+ var readyBound = false;
20
+ var isReady = false;
21
+ var readyList = [];
22
+
23
+ // Handle when the DOM is ready
24
+ function domReady() {
25
+ // Make sure that the DOM is not already loaded
26
+ if(!isReady) {
27
+ // Remember that the DOM is ready
28
+ isReady = true;
29
+
30
+ if(readyList) {
31
+ for(var fn = 0; fn < readyList.length; fn++) {
32
+ readyList[fn].call(window, []);
33
+ }
34
+
35
+ readyList = [];
36
+ }
37
+ }
38
+ };
39
+
40
+ // From Simon Willison. A safe way to fire onload w/o screwing up everyone else.
41
+ function addLoadEvent(func) {
42
+ var oldonload = window.onload;
43
+ if (typeof window.onload != 'function') {
44
+ window.onload = func;
45
+ } else {
46
+ window.onload = function() {
47
+ if (oldonload) {
48
+ oldonload();
49
+ }
50
+ func();
51
+ }
52
+ }
53
+ };
54
+
55
+ // does the heavy work of working through the browsers idiosyncracies (let's call them that) to hook onload.
56
+ function bindReady() {
57
+ if(readyBound) {
58
+ return;
59
+ }
60
+
61
+ readyBound = true;
62
+
63
+ // Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
64
+ if (document.addEventListener && !browser.opera) {
65
+ // Use the handy event callback
66
+ document.addEventListener("DOMContentLoaded", domReady, false);
67
+ }
68
+
69
+ // If IE is used and is not in a frame
70
+ // Continually check to see if the document is ready
71
+ if (browser.msie && window == top) (function(){
72
+ if (isReady) return;
73
+ try {
74
+ // If IE is used, use the trick by Diego Perini
75
+ // http://javascript.nwbox.com/IEContentLoaded/
76
+ document.documentElement.doScroll("left");
77
+ } catch(error) {
78
+ setTimeout(arguments.callee, 0);
79
+ return;
80
+ }
81
+ // and execute any waiting functions
82
+ domReady();
83
+ })();
84
+
85
+ if(browser.opera) {
86
+ document.addEventListener( "DOMContentLoaded", function () {
87
+ if (isReady) return;
88
+ for (var i = 0; i < document.styleSheets.length; i++)
89
+ if (document.styleSheets[i].disabled) {
90
+ setTimeout( arguments.callee, 0 );
91
+ return;
92
+ }
93
+ // and execute any waiting functions
94
+ domReady();
95
+ }, false);
96
+ }
97
+
98
+ if(browser.safari) {
99
+ var numStyles;
100
+ (function(){
101
+ if (isReady) return;
102
+ if (document.readyState != "loaded" && document.readyState != "complete") {
103
+ setTimeout( arguments.callee, 0 );
104
+ return;
105
+ }
106
+ if (numStyles === undefined) {
107
+ var links = document.getElementsByTagName("link");
108
+ for (var i=0; i < links.length; i++) {
109
+ if(links[i].getAttribute('rel') == 'stylesheet') {
110
+ numStyles++;
111
+ }
112
+ }
113
+ var styles = document.getElementsByTagName("style");
114
+ numStyles += styles.length;
115
+ }
116
+ if (document.styleSheets.length != numStyles) {
117
+ setTimeout( arguments.callee, 0 );
118
+ return;
119
+ }
120
+
121
+ // and execute any waiting functions
122
+ domReady();
123
+ })();
124
+ }
125
+
126
+ // A fallback to window.onload, that will always work
127
+ addLoadEvent(domReady);
128
+ };
129
+
130
+ // This is the public function that people can use to hook up ready.
131
+ DomReady.ready = function(fn, args) {
132
+ // Attach the listeners
133
+ bindReady();
134
+
135
+ // If the DOM is already ready
136
+ if (isReady) {
137
+ // Execute the function immediately
138
+ fn.call(window, []);
139
+ } else {
140
+ // Add the function to the wait list
141
+ readyList.push( function() { return fn.call(window, []); } );
142
+ }
143
+ };
144
+
145
+ bindReady();
146
+
147
+ })();
148
+
149
+
150
+ // Actual spacer code
1
151
  DomReady.ready(function() {
2
152
  var spacers = document.querySelectorAll("[class^='vspacer']");
3
153
 
@@ -1,3 +1,3 @@
1
1
  module SpacersAndDividers
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spacers_and_dividers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -71,7 +71,6 @@ files:
71
71
  - LICENSE.txt
72
72
  - README.md
73
73
  - Rakefile
74
- - app/assets/javascripts/domready.js
75
74
  - app/assets/javascripts/spacer.js
76
75
  - lib/spacers_and_dividers.rb
77
76
  - lib/spacers_and_dividers/engine.rb
@@ -1,146 +0,0 @@
1
- (function(){
2
-
3
- var DomReady = window.DomReady = {};
4
-
5
- // Everything that has to do with properly supporting our document ready event. Brought over from the most awesome jQuery.
6
-
7
- var userAgent = navigator.userAgent.toLowerCase();
8
-
9
- // Figure out what browser is being used
10
- var browser = {
11
- version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
12
- safari: /webkit/.test(userAgent),
13
- opera: /opera/.test(userAgent),
14
- msie: (/msie/.test(userAgent)) && (!/opera/.test( userAgent )),
15
- mozilla: (/mozilla/.test(userAgent)) && (!/(compatible|webkit)/.test(userAgent))
16
- };
17
-
18
- var readyBound = false;
19
- var isReady = false;
20
- var readyList = [];
21
-
22
- // Handle when the DOM is ready
23
- function domReady() {
24
- // Make sure that the DOM is not already loaded
25
- if(!isReady) {
26
- // Remember that the DOM is ready
27
- isReady = true;
28
-
29
- if(readyList) {
30
- for(var fn = 0; fn < readyList.length; fn++) {
31
- readyList[fn].call(window, []);
32
- }
33
-
34
- readyList = [];
35
- }
36
- }
37
- };
38
-
39
- // From Simon Willison. A safe way to fire onload w/o screwing up everyone else.
40
- function addLoadEvent(func) {
41
- var oldonload = window.onload;
42
- if (typeof window.onload != 'function') {
43
- window.onload = func;
44
- } else {
45
- window.onload = function() {
46
- if (oldonload) {
47
- oldonload();
48
- }
49
- func();
50
- }
51
- }
52
- };
53
-
54
- // does the heavy work of working through the browsers idiosyncracies (let's call them that) to hook onload.
55
- function bindReady() {
56
- if(readyBound) {
57
- return;
58
- }
59
-
60
- readyBound = true;
61
-
62
- // Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
63
- if (document.addEventListener && !browser.opera) {
64
- // Use the handy event callback
65
- document.addEventListener("DOMContentLoaded", domReady, false);
66
- }
67
-
68
- // If IE is used and is not in a frame
69
- // Continually check to see if the document is ready
70
- if (browser.msie && window == top) (function(){
71
- if (isReady) return;
72
- try {
73
- // If IE is used, use the trick by Diego Perini
74
- // http://javascript.nwbox.com/IEContentLoaded/
75
- document.documentElement.doScroll("left");
76
- } catch(error) {
77
- setTimeout(arguments.callee, 0);
78
- return;
79
- }
80
- // and execute any waiting functions
81
- domReady();
82
- })();
83
-
84
- if(browser.opera) {
85
- document.addEventListener( "DOMContentLoaded", function () {
86
- if (isReady) return;
87
- for (var i = 0; i < document.styleSheets.length; i++)
88
- if (document.styleSheets[i].disabled) {
89
- setTimeout( arguments.callee, 0 );
90
- return;
91
- }
92
- // and execute any waiting functions
93
- domReady();
94
- }, false);
95
- }
96
-
97
- if(browser.safari) {
98
- var numStyles;
99
- (function(){
100
- if (isReady) return;
101
- if (document.readyState != "loaded" && document.readyState != "complete") {
102
- setTimeout( arguments.callee, 0 );
103
- return;
104
- }
105
- if (numStyles === undefined) {
106
- var links = document.getElementsByTagName("link");
107
- for (var i=0; i < links.length; i++) {
108
- if(links[i].getAttribute('rel') == 'stylesheet') {
109
- numStyles++;
110
- }
111
- }
112
- var styles = document.getElementsByTagName("style");
113
- numStyles += styles.length;
114
- }
115
- if (document.styleSheets.length != numStyles) {
116
- setTimeout( arguments.callee, 0 );
117
- return;
118
- }
119
-
120
- // and execute any waiting functions
121
- domReady();
122
- })();
123
- }
124
-
125
- // A fallback to window.onload, that will always work
126
- addLoadEvent(domReady);
127
- };
128
-
129
- // This is the public function that people can use to hook up ready.
130
- DomReady.ready = function(fn, args) {
131
- // Attach the listeners
132
- bindReady();
133
-
134
- // If the DOM is already ready
135
- if (isReady) {
136
- // Execute the function immediately
137
- fn.call(window, []);
138
- } else {
139
- // Add the function to the wait list
140
- readyList.push( function() { return fn.call(window, []); } );
141
- }
142
- };
143
-
144
- bindReady();
145
-
146
- })();