[CB-4926] Fixes inappbrowser plugin loading for windows8

This commit is contained in:
Carlos Santana 2013-09-26 13:53:33 -04:00
parent a001cffc30
commit 12bc5d7d8b

View File

@ -1,4 +1,4 @@
cordova.define("org.apache.cordova.inappbrowser.InAppBrowserProxy", function(require, exports, module) { /* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
@ -19,7 +19,8 @@ cordova.define("org.apache.cordova.inappbrowser.InAppBrowserProxy", function(req
* *
*/ */
/*global Windows:true */ /*jslint sloppy:true */
/*global Windows:true, require, document, setTimeout, window, module */
@ -37,20 +38,22 @@ var IAB = {
} }
}, },
show: function (win, lose) { show: function (win, lose) {
/* 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],
var target = args[1]; target = args[1],
var features = args[2]; features = args[2],
url,
elem;
if (target == "_system") { if (target === "_system") {
var url = new Windows.Foundation.Uri(strUrl) url = new Windows.Foundation.Uri(strUrl);
Windows.System.Launcher.launchUriAsync(url); Windows.System.Launcher.launchUriAsync(url);
} } else if (target === "_blank") {
else if (target == "_blank") {
if (!browserWrap) { if (!browserWrap) {
browserWrap = document.createElement("div"); browserWrap = document.createElement("div");
browserWrap.style.position = "absolute"; browserWrap.style.position = "absolute";
@ -64,12 +67,12 @@ var IAB = {
setTimeout(function () { setTimeout(function () {
IAB.close(); IAB.close();
}, 0); }, 0);
} };
document.body.appendChild(browserWrap); document.body.appendChild(browserWrap);
} }
var elem = document.createElement("iframe"); 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.style.borderWidth = "0px";
@ -84,8 +87,7 @@ var IAB = {
}); });
browserWrap.appendChild(elem); browserWrap.appendChild(elem);
} } else {
else {
window.location = strUrl; window.location = strUrl;
} }