spacers_and_dividers 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/app/assets/javascripts/domready.js +146 -0
- data/app/assets/javascripts/spacer.js +2 -2
- data/lib/spacers_and_dividers/version.rb +1 -1
- metadata +2 -1
data/.gitignore
CHANGED
@@ -0,0 +1,146 @@
|
|
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
|
+
})();
|
@@ -1,8 +1,8 @@
|
|
1
|
-
(function
|
1
|
+
DomReady.ready(function() {
|
2
2
|
var spacers = document.querySelectorAll("[class^='vspacer']");
|
3
3
|
|
4
4
|
for (var x = 0; x < spacers.length; x++ ){
|
5
5
|
var spacer_height = spacers[x].className.split('-')[1];
|
6
6
|
spacers[x].style.height = spacer_height + "px";
|
7
7
|
}
|
8
|
-
})
|
8
|
+
});
|
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
|
+
version: 1.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- LICENSE.txt
|
72
72
|
- README.md
|
73
73
|
- Rakefile
|
74
|
+
- app/assets/javascripts/domready.js
|
74
75
|
- app/assets/javascripts/spacer.js
|
75
76
|
- lib/spacers_and_dividers.rb
|
76
77
|
- lib/spacers_and_dividers/engine.rb
|