-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathwidgets.js
More file actions
72 lines (63 loc) · 2.27 KB
/
Copy pathwidgets.js
File metadata and controls
72 lines (63 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
* @name glow.widgets
* @namespace
* @description Widget core module.
* The glow.widgets module contains generic functionality used by our
* widgets, but currently no public API.
*/
(window.gloader || glow).module({
name: "glow.widgets",
library: ["glow", "@VERSION@"],
depends: [["glow", "@VERSION@", 'glow.dom', 'glow.events']],
builder: function(glow) {
var doc,
docBody,
env = glow.env;
glow.ready(function() {
doc = document;
docBody = doc.body;
//check if css or images are disabled, add class name "glow-basic" to body if they aren't
var testDiv = glow.dom.create('<div class="glowCSSVERSION-cssTest" style="height:0;position:absolute;visibility:hidden;top:-20px;display:block"></div>').appendTo(docBody);
// not testing for height as that break in some browsers' 'zoom' implementations
if (testDiv.css("visibility") != 'hidden') {
//css disabled
docBody.className += " glowCSSVERSION-basic";
} else {
// block any further ready calls until our widgets CSS has loaded
glow._addReadyBlock("glow_widgetsCSS");
(function() {
if (testDiv.css("z-index") != "1234") {
//css hasn't loaded yet
setTimeout( arguments.callee, 10 );
return;
}
// BRING ON THE WALLLLL!
glow._removeReadyBlock("glow_widgetsCSS");
if (testDiv.css("background-image").indexOf("ctr.png") == -1) {
docBody.className += " glowCSSVERSION-basic";
}
})();
}
//add some IE class names to the body to help widget styling
env.ie && (docBody.className += " glowCSSVERSION-ie");
//note: we apply the class "glow-ielt7" for IE7 if it's in quirks mode
(env.ie < 7 || !env.standardsMode) && (docBody.className += " glowCSSVERSION-ielt7");
//some rounding issues in firefox when using opacity, so need to have a workaround
env.gecko && (docBody.className += " glowCSSVERSION-gecko");
});
glow.widgets = {
/*
PrivateMethod: _scrollPos
Get the scroll position of the document. Candidate for moving into glow.dom?
*/
_scrollPos: function() {
var win = window,
docElm = env.standardsMode ? doc.documentElement : docBody;
return {
x: docElm.scrollLeft || win.pageXOffset || 0,
y: docElm.scrollTop || win.pageYOffset || 0
};
}
};
}
});