]> git.wh0rd.org - tt-rss.git/blame - lib/dojo/hccss.js.uncompressed.js
dojo: add some more controls to the layer
[tt-rss.git] / lib / dojo / hccss.js.uncompressed.js
CommitLineData
f0cfe83e
AD
1define("dojo/hccss", [
2 "require", // require.toUrl
3 "./_base/config", // config.blankGif
4 "./dom-class", // domClass.add
5 "./dom-style", // domStyle.getComputedStyle
6 "./has",
7 "./ready", // ready
8 "./_base/window" // win.body
9], function(require, config, domClass, domStyle, has, ready, win){
10
11 // module:
12 // dojo/hccss
13
14 /*=====
15 return function(){
16 // summary:
17 // Test if computer is in high contrast mode (i.e. if browser is not displaying background images).
18 // Defines `has("highcontrast")` and sets `dj_a11y` CSS class on `<body>` if machine is in high contrast mode.
19 // Returns `has()` method;
20 };
21 =====*/
22
23 // Has() test for when background images aren't displayed. Don't call has("highcontrast") before dojo/domReady!.
24 has.add("highcontrast", function(){
25 // note: if multiple documents, doesn't matter which one we use
26 var div = win.doc.createElement("div");
27 div.style.cssText = "border: 1px solid; border-color:red green; position: absolute; height: 5px; top: -999px;" +
28 "background-image: url(" + (config.blankGif || require.toUrl("./resources/blank.gif")) + ");";
29 win.body().appendChild(div);
30
31 var cs = domStyle.getComputedStyle(div),
32 bkImg = cs.backgroundImage,
33 hc = (cs.borderTopColor == cs.borderRightColor) ||
34 (bkImg && (bkImg == "none" || bkImg == "url(invalid-url:)" ));
35
36 if(has("ie") <= 8){
37 div.outerHTML = ""; // prevent mixed-content warning, see http://support.microsoft.com/kb/925014
38 }else{
39 win.body().removeChild(div);
40 }
41
42 return hc;
43 });
44
45 // Priority is 90 to run ahead of parser priority of 100. For 2.0, remove the ready() call and instead
46 // change this module to depend on dojo/domReady!
47 ready(90, function(){
48 if(has("highcontrast")){
49 domClass.add(win.body(), "dj_a11y");
50 }
51 });
52
53 return has;
54});