This commit is contained in:
Jesse MacFadyen 2015-11-17 15:07:20 -08:00
commit 214763c76b

View File

@ -17,13 +17,12 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
* *
*/ */
/*jslint sloppy:true */ /*jslint sloppy:true */
/*global Windows:true, require, document, setTimeout, window, module */ /*global Windows:true, require, document, setTimeout, window, module */
var cordova = require('cordova'), var cordova = require('cordova'),
channel = require('cordova/channel'); channel = require('cordova/channel');
@ -39,9 +38,9 @@ var IAB = {
}, },
show: function (win, lose) { show: function (win, lose) {
/* empty block, ran out of bacon? /* empty block, ran out of bacon?
if (browserWrap) { if (browserWrap) {
}*/ }*/
}, },
open: function (win, lose, args) { open: function (win, lose, args) {
var strUrl = args[0], var strUrl = args[0],
@ -62,6 +61,7 @@ var IAB = {
browserWrap.style.borderWidth = "40px"; browserWrap.style.borderWidth = "40px";
browserWrap.style.borderStyle = "solid"; browserWrap.style.borderStyle = "solid";
browserWrap.style.borderColor = "rgba(0,0,0,0.25)"; browserWrap.style.borderColor = "rgba(0,0,0,0.25)";
browserWrap.style.zIndex = "9999999";
browserWrap.onclick = function () { browserWrap.onclick = function () {
setTimeout(function () { setTimeout(function () {
@ -71,20 +71,38 @@ var IAB = {
document.body.appendChild(browserWrap); document.body.appendChild(browserWrap);
} }
var localFile = (strUrl.indexOf('ms-appdata:///') > -1);
if (localFile) {
elem = document.createElement("x-ms-webview");
elem.style.width = (window.innerWidth - 80) + "px";
elem.style.height = (window.innerHeight - 80) + "px";
elem.style.borderWidth = "0px";
elem.name = "targetFrame";
elem.src = strUrl;
elem = document.createElement("iframe"); window.addEventListener("resize", function () {
elem.style.width = (window.innerWidth - 80) + "px"; if (browserWrap && elem) {
elem.style.height = (window.innerHeight - 80) + "px"; elem.style.width = (window.innerWidth - 80) + "px";
elem.style.borderWidth = "0px"; elem.style.height = (window.innerHeight - 80) + "px";
elem.name = "targetFrame"; }
elem.src = strUrl; });
window.addEventListener("resize", function () { } else {
if (browserWrap && elem) { elem = document.createElement("iframe");
elem.style.width = (window.innerWidth - 80) + "px"; elem.style.width = (window.innerWidth - 80) + "px";
elem.style.height = (window.innerHeight - 80) + "px"; elem.style.height = (window.innerHeight - 80) + "px";
} elem.style.borderWidth = "0px";
}); elem.name = "targetFrame";
elem.src = strUrl;
window.addEventListener("resize", function () {
if (browserWrap && elem) {
elem.style.width = (window.innerWidth - 80) + "px";
elem.style.height = (window.innerHeight - 80) + "px";
}
});
}
browserWrap.appendChild(elem); browserWrap.appendChild(elem);
} else { } else {