[483] | 1 | dojo.provide("dojox.mobile.app.compat"); |
---|
| 2 | dojo.require("dojox.mobile.compat"); |
---|
| 3 | |
---|
| 4 | // summary: |
---|
| 5 | // CSS3 compatibility module for apps |
---|
| 6 | // description: |
---|
| 7 | // This module provides support for some of the CSS3 features to djMobile |
---|
| 8 | // for non-CSS3 browsers, such as IE or Firefox. |
---|
| 9 | // If you load this module, it directly replaces some of the methods of |
---|
| 10 | // djMobile instead of subclassing. This way, html pages remains the same |
---|
| 11 | // regardless of whether this compatibility module is used or not. |
---|
| 12 | // Recommended usage is as follows. the code below loads dojox.mobile.compat |
---|
| 13 | // only when isWebKit is true. |
---|
| 14 | // |
---|
| 15 | // dojo.require("dojox.mobile"); |
---|
| 16 | // dojo.requireIf(!dojo.isWebKit, "dojox.mobile.appCompat"); |
---|
| 17 | |
---|
| 18 | dojo.extend(dojox.mobile.app.AlertDialog, { |
---|
| 19 | _doTransition: function(dir){ |
---|
| 20 | console.log("in _doTransition and this = ", this); |
---|
| 21 | |
---|
| 22 | var h = dojo.marginBox(this.domNode.firstChild).h; |
---|
| 23 | |
---|
| 24 | var bodyHeight = this.controller.getWindowSize().h; |
---|
| 25 | |
---|
| 26 | var high = bodyHeight - h; |
---|
| 27 | var low = bodyHeight; |
---|
| 28 | |
---|
| 29 | var anim1 = dojo.fx.slideTo({ |
---|
| 30 | node: this.domNode, |
---|
| 31 | duration: 400, |
---|
| 32 | top: {start: dir < 0 ? high : low, end: dir < 0 ? low: high} |
---|
| 33 | }); |
---|
| 34 | |
---|
| 35 | var anim2 = dojo[dir < 0 ? "fadeOut" : "fadeIn"]({ |
---|
| 36 | node: this.mask, |
---|
| 37 | duration: 400 |
---|
| 38 | }); |
---|
| 39 | |
---|
| 40 | var anim = dojo.fx.combine([anim1, anim2]); |
---|
| 41 | |
---|
| 42 | var _this = this; |
---|
| 43 | |
---|
| 44 | dojo.connect(anim, "onEnd", this, function(){ |
---|
| 45 | if(dir < 0){ |
---|
| 46 | _this.domNode.style.display = "none"; |
---|
| 47 | dojo.destroy(_this.domNode); |
---|
| 48 | dojo.destroy(_this.mask); |
---|
| 49 | } |
---|
| 50 | }); |
---|
| 51 | anim.play(); |
---|
| 52 | } |
---|
| 53 | }); |
---|
| 54 | |
---|
| 55 | dojo.extend(dojox.mobile.app.List, { |
---|
| 56 | deleteRow: function(){ |
---|
| 57 | console.log("deleteRow in compat mode", row); |
---|
| 58 | |
---|
| 59 | var row = this._selectedRow; |
---|
| 60 | // First make the row invisible |
---|
| 61 | // Put it back where it came from |
---|
| 62 | dojo.style(row, { |
---|
| 63 | visibility: "hidden", |
---|
| 64 | minHeight: "0px" |
---|
| 65 | }); |
---|
| 66 | dojo.removeClass(row, "hold"); |
---|
| 67 | |
---|
| 68 | |
---|
| 69 | // Animate reducing it's height to zero, then delete the data from the |
---|
| 70 | // array |
---|
| 71 | var height = dojo.contentBox(row).h; |
---|
| 72 | dojo.animateProperty({ |
---|
| 73 | node: row, |
---|
| 74 | duration: 800, |
---|
| 75 | properties: { |
---|
| 76 | height: {start: height, end: 1}, |
---|
| 77 | paddingTop: {end: 0}, |
---|
| 78 | paddingBottom: {end: 0} |
---|
| 79 | }, |
---|
| 80 | onEnd: this._postDeleteAnim |
---|
| 81 | }).play(); |
---|
| 82 | } |
---|
| 83 | }); |
---|
| 84 | |
---|
| 85 | if(dojox.mobile.app.ImageView && !dojo.create("canvas").getContext){ |
---|
| 86 | dojo.extend(dojox.mobile.app.ImageView, { |
---|
| 87 | buildRendering: function(){ |
---|
| 88 | this.domNode.innerHTML = |
---|
| 89 | "ImageView widget is not supported on this browser." |
---|
| 90 | + "Please try again with a modern browser, e.g. " |
---|
| 91 | + "Safari, Chrome or Firefox"; |
---|
| 92 | this.canvas = {}; |
---|
| 93 | }, |
---|
| 94 | |
---|
| 95 | postCreate: function(){} |
---|
| 96 | }); |
---|
| 97 | } |
---|
| 98 | |
---|
| 99 | if(dojox.mobile.app.ImageThumbView){ |
---|
| 100 | dojo.extend(dojox.mobile.app.ImageThumbView, { |
---|
| 101 | place: function(node, x, y){ |
---|
| 102 | dojo.style(node, { |
---|
| 103 | top: y + "px", |
---|
| 104 | left: x + "px", |
---|
| 105 | visibility: "visible" |
---|
| 106 | }); |
---|
| 107 | } |
---|
| 108 | }) |
---|
| 109 | } |
---|