root = root || dojo.body(); var nodes = root.getElementsByTagName("IMG"); var blank = dojo.moduleUrl("dojo", "resources/blank.gif"); for(var i = 0, len = nodes.length; i < len; i++){ var img = nodes[i]; var w = img.offsetWidth; var h = img.offsetHeight; if(w === 0 || h === 0){ // The reason why the image has no width/height may be because // display is "none". If that is the case, let's change the // display to "" temporarily and see if the image returns them. if(dojo.style(img, "display") != "none"){ continue; } img.style.display = ""; w = img.offsetWidth; h = img.offsetHeight; img.style.display = "none"; if(w === 0 || h === 0){ continue; } } var src = img.src; if(src.indexOf("resources/blank.gif") != -1){ continue; } img.src = blank; img.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src+"')"; img.style.width = w + "px"; img.style.height = h + "px"; }
// summary: // CSS3 compatibility module // description: // This module provides support for some of the CSS3 features to dojox.mobile // for non-CSS3 browsers, such as IE or Firefox. // If you load this module, it directly replaces some of the methods of // dojox.mobile instead of subclassing. This way, html pages remains the same // regardless of whether this compatibility module is used or not. // Recommended usage is as follows. the code below loads dojox.mobile.compat // only when isWebKit is true. // // dojo.require("dojox.mobile"); // dojo.requireIf(!dojo.isWebKit, "dojox.mobile.compat"); // // This module also loads compatibility CSS files, which has -compat.css // suffix. You can use either the tag or @import to load theme // CSS files. Then, this module searches for the loaded CSS files and loads // compatibility CSS files. For example, if you load iphone.css in a page, // this module automatically loads iphone-compat.css. // If you explicitly load iphone-compat.css with or @import, // this module will not load the already loaded file.
wakeUp: function(node){ // summary: // Function to force IE to redraw a node since its layout code tends to misrender // in partial draws. // node: // The node to forcibly redraw. // tags: // public if(dojo.isIE && !node._wokeup){ node._wokeup = true; var disp = node.style.display; node.style.display = ""; var nodes = node.getElementsByTagName("*"); for(var i = 0, len = nodes.length; i < len; i++){ var val = nodes[i].style.display; nodes[i].style.display = "none"; nodes[i].style.display = ""; nodes[i].style.display = val; } node.style.display = disp; } } });
dojo.extend(dojox.mobile.Switch, { buildRendering: function(){ // summary: // Function to simulate the mobile device style switches on // browsers such as IE and FireFox. // tags: // protected this.domNode = this.srcNodeRef || dojo.doc.createElement("DIV"); this.domNode.className = "mblSwitch"; this.domNode.innerHTML = '
' + '
' + '' + '' + '' + '
'+this.leftLabel+'
' + '' + '' + '' + '
' + '
' + '' + '' + '' + '
'+this.rightLabel+'
' + '' + '' + '' + '
' + '
' + '' + '' + '' + '' + '' + '' + '' + '
' + '
'; var n = this.inner = this.domNode.firstChild; this.left = n.childNodes[0]; this.right = n.childNodes[1]; this.knob = n.childNodes[2];
dojo.extend(dojox.mobile.RoundRect, { buildRendering: function(){ // summary: // Function to simulate the borderRadius appearance on IE, since // IE does not support this CSS style. // tags: // protected dojox.mobile.createRoundRect(this); this.domNode.className = "mblRoundRect"; } });
dojox.mobile.RoundRectList._addChild = dojox.mobile.RoundRectList.prototype.addChild; dojo.extend(dojox.mobile.RoundRectList, { buildRendering: function(){ // summary: // Function to simulate the borderRadius appearance on IE, since // IE does not support this CSS style. // tags: // protected dojox.mobile.createRoundRect(this, true); this.domNode.className = "mblRoundRectList"; },
dojo.extend(dojox.mobile.ScrollableView, { postCreate: function(){ // On IE, margin-top of the first child does not seem to be effective, // probably because padding-top is specified for containerNode // to make room for a fixed header. This dummy node is a workaround for that. var dummy = dojo.create("DIV", {className:"mblDummyForIE", innerHTML:" "}, this.containerNode, "first"); dojo.style(dummy, { position: "relative", marginBottom: "-2px", fontSize: "1px" }); } });
} // if(dojox.mobile.ScrollableView)
} // if(dojo.isIE)
if(dojo.isIE <= 6){ dojox.mobile.applyPngFilter = function(root){ root = root || dojo.body(); var nodes = root.getElementsByTagName("IMG"); var blank = dojo.moduleUrl("dojo", "resources/blank.gif"); for(var i = 0, len = nodes.length; i < len; i++){ var img = nodes[i]; var w = img.offsetWidth; var h = img.offsetHeight; if(w === 0 || h === 0){ // The reason why the image has no width/height may be because // display is "none". If that is the case, let's change the // display to "" temporarily and see if the image returns them. if(dojo.style(img, "display") != "none"){ continue; } img.style.display = ""; w = img.offsetWidth; h = img.offsetHeight; img.style.display = "none"; if(w === 0 || h === 0){ continue; } } var src = img.src; if(src.indexOf("resources/blank.gif") != -1){ continue; } img.src = blank; img.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src+"')"; img.style.width = w + "px"; img.style.height = h + "px"; } }; } // if(dojo.isIE <= 6)
dojox.mobile.loadCss = function(/*String|Array*/files){ // summary: // Function to load and register CSS files with the page // files: String|Array // The CSS files to load and register with the page. // tags: // private if(!dojo.global._loadedCss){ var obj = {}; dojo.forEach(dojox.mobile.getCssPaths(), function(path){ obj[path] = true; }); dojo.global._loadedCss = obj; } if(!dojo.isArray(files)){ files = [files]; } for(var i = 0; i < files.length; i++){ var file = files[i]; if(!dojo.global._loadedCss[file]){ dojo.global._loadedCss[file] = true; if(dojo.doc.createStyleSheet){ // for some reason, IE hangs when you try to load // multiple css files almost at once. setTimeout(function(file){ return function(){ dojo.doc.createStyleSheet(file); }; }(file), 0); }else{ var link = dojo.doc.createElement("link"); link.href = file; link.type = "text/css"; link.rel = "stylesheet"; var head = dojo.doc.getElementsByTagName('head')[0]; head.appendChild(link); } } } };
dojox.mobile.getCssPaths = function(){ var paths = []; var i, j;
// find @import var s = dojo.doc.styleSheets; for(i = 0; i < s.length; i++){ var r = s[i].cssRules || s[i].imports; if(!r){ continue; } for(j = 0; j < r.length; j++){ if(r[j].href){ paths.push(r[j].href); } } }
// find var elems = dojo.doc.getElementsByTagName("link"); for(i = 0, len = elems.length; i < len; i++){ if(elems[i].href){ paths.push(elems[i].href); } } return paths; };
dojox.mobile.loadCompatCssFiles = function(){ // summary: // Function to perform page-level adjustments on browsers such as // IE and firefox. It loads compat specific css files into the // page header. var paths = dojox.mobile.getCssPaths(); for(var i = 0; i < paths.length; i++){ var href = paths[i]; if(href.match(dojox.mobile.loadCompatPattern) && href.indexOf("-compat.css") == -1){ var compatCss = href.substring(0, href.length-4)+"-compat.css"; dojox.mobile.loadCss(compatCss); } } };
// summary: // CSS3 compatibility module // description: // This module provides support for some of the CSS3 features to dojox.mobile // for non-CSS3 browsers, such as IE or Firefox. // If you load this module, it directly replaces some of the methods of // dojox.mobile instead of subclassing. This way, html pages remains the same // regardless of whether this compatibility module is used or not. // Recommended usage is as follows. the code below loads dojox.mobile.compat // only when isWebKit is true. // // dojo.require("dojox.mobile"); // dojo.requireIf(!dojo.isWebKit, "dojox.mobile.compat"); // // This module also loads compatibility CSS files, which has -compat.css // suffix. You can use either the tag or @import to load theme // CSS files. Then, this module searches for the loaded CSS files and loads // compatibility CSS files. For example, if you load iphone.css in a page, // this module automatically loads iphone-compat.css. // If you explicitly load iphone-compat.css with or @import, // this module will not load the already loaded file.
wakeUp: function(node){ // summary: // Function to force IE to redraw a node since its layout code tends to misrender // in partial draws. // node: // The node to forcibly redraw. // tags: // public if(dojo.isIE && !node._wokeup){ node._wokeup = true; var disp = node.style.display; node.style.display = ""; var nodes = node.getElementsByTagName("*"); for(var i = 0, len = nodes.length; i < len; i++){ var val = nodes[i].style.display; nodes[i].style.display = "none"; nodes[i].style.display = ""; nodes[i].style.display = val; } node.style.display = disp; } } });
dojo.extend(dojox.mobile.Switch, { buildRendering: function(){ // summary: // Function to simulate the mobile device style switches on // browsers such as IE and FireFox. // tags: // protected this.domNode = this.srcNodeRef || dojo.doc.createElement("DIV"); this.domNode.className = "mblSwitch"; this.domNode.innerHTML = '
' + '
' + '' + '' + '' + '
'+this.leftLabel+'
' + '' + '' + '' + '
' + '
' + '' + '' + '' + '
'+this.rightLabel+'
' + '' + '' + '' + '
' + '
' + '' + '' + '' + '' + '' + '' + '' + '
' + '
'; var n = this.inner = this.domNode.firstChild; this.left = n.childNodes[0]; this.right = n.childNodes[1]; this.knob = n.childNodes[2];
dojo.extend(dojox.mobile.RoundRect, { buildRendering: function(){ // summary: // Function to simulate the borderRadius appearance on IE, since // IE does not support this CSS style. // tags: // protected dojox.mobile.createRoundRect(this); this.domNode.className = "mblRoundRect"; } });
dojox.mobile.RoundRectList._addChild = dojox.mobile.RoundRectList.prototype.addChild; dojo.extend(dojox.mobile.RoundRectList, { buildRendering: function(){ // summary: // Function to simulate the borderRadius appearance on IE, since // IE does not support this CSS style. // tags: // protected dojox.mobile.createRoundRect(this, true); this.domNode.className = "mblRoundRectList"; },
// summary: // CSS3 compatibility module // description: // This module provides support for some of the CSS3 features to dojox.mobile // for non-CSS3 browsers, such as IE or Firefox. // If you load this module, it directly replaces some of the methods of // dojox.mobile instead of subclassing. This way, html pages remains the same // regardless of whether this compatibility module is used or not. // Recommended usage is as follows. the code below loads dojox.mobile.compat // only when isWebKit is true. // // dojo.require("dojox.mobile"); // dojo.requireIf(!dojo.isWebKit, "dojox.mobile.compat"); // // This module also loads compatibility CSS files, which has -compat.css // suffix. You can use either the tag or @import to load theme // CSS files. Then, this module searches for the loaded CSS files and loads // compatibility CSS files. For example, if you load iphone.css in a page, // this module automatically loads iphone-compat.css. // If you explicitly load iphone-compat.css with or @import, // this module will not load the already loaded file.
wakeUp: function(node){ // summary: // Function to force IE to redraw a node since its layout code tends to misrender // in partial draws. // node: // The node to forcibly redraw. // tags: // public if(dojo.isIE && !node._wokeup){ node._wokeup = true; var disp = node.style.display; node.style.display = ""; var nodes = node.getElementsByTagName("*"); for(var i = 0, len = nodes.length; i < len; i++){ var val = nodes[i].style.display; nodes[i].style.display = "none"; nodes[i].style.display = ""; nodes[i].style.display = val; } node.style.display = disp; } } });
dojo.extend(dojox.mobile.Switch, { buildRendering: function(){ // summary: // Function to simulate the mobile device style switches on // browsers such as IE and FireFox. // tags: // protected this.domNode = this.srcNodeRef || dojo.doc.createElement("DIV"); this.domNode.className = "mblSwitch"; this.domNode.innerHTML = '
' + '
' + '' + '' + '' + '
'+this.leftLabel+'
' + '' + '' + '' + '
' + '
' + '' + '' + '' + '
'+this.rightLabel+'
' + '' + '' + '' + '
' + '
' + '' + '' + '' + '' + '' + '' + '' + '
' + '
'; var n = this.inner = this.domNode.firstChild; this.left = n.childNodes[0]; this.right = n.childNodes[1]; this.knob = n.childNodes[2];
dojo.extend(dojox.mobile.RoundRect, { buildRendering: function(){ // summary: // Function to simulate the borderRadius appearance on IE, since // IE does not support this CSS style. // tags: // protected dojox.mobile.createRoundRect(this); this.domNode.className = "mblRoundRect"; } });
dojox.mobile.RoundRectList._addChild = dojox.mobile.RoundRectList.prototype.addChild; dojo.extend(dojox.mobile.RoundRectList, { buildRendering: function(){ // summary: // Function to simulate the borderRadius appearance on IE, since // IE does not support this CSS style. // tags: // protected dojox.mobile.createRoundRect(this, true); this.domNode.className = "mblRoundRectList"; },
dojo.extend(dojox.mobile.ScrollableView, { postCreate: function(){ // On IE, margin-top of the first child does not seem to be effective, // probably because padding-top is specified for containerNode // to make room for a fixed header. This dummy node is a workaround for that. var dummy = dojo.create("DIV", {className:"mblDummyForIE", innerHTML:" "}, this.containerNode, "first"); dojo.style(dummy, { position: "relative", marginBottom: "-2px", fontSize: "1px" });