cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From za...@apache.org
Subject [1/2] git commit: phonegap events supported for _blank target
Date Wed, 27 Aug 2014 11:49:07 GMT
Repository: cordova-plugin-inappbrowser
Updated Branches:
  refs/heads/master 315a0e30d -> 2c018a346


phonegap events supported for _blank target


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/commit/c2c94f31
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/c2c94f31
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/c2c94f31

Branch: refs/heads/master
Commit: c2c94f315b956a6179d45013b30653b4689ad19d
Parents: 8cb876c
Author: Tracktl <tracktl@MacBook-Pro-de-Tracktl.local>
Authored: Tue Aug 5 15:50:49 2014 +0200
Committer: Tracktl <tracktl@MacBook-Pro-de-Tracktl.local>
Committed: Tue Aug 5 15:50:49 2014 +0200

----------------------------------------------------------------------
 src/firefoxos/InAppBrowserProxy.js | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/c2c94f31/src/firefoxos/InAppBrowserProxy.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/InAppBrowserProxy.js b/src/firefoxos/InAppBrowserProxy.js
index 63a85e3..40ffa23 100644
--- a/src/firefoxos/InAppBrowserProxy.js
+++ b/src/firefoxos/InAppBrowserProxy.js
@@ -34,6 +34,7 @@ var IABExecs = {
         if (browserWrap) {
             browserWrap.parentNode.removeChild(browserWrap);
             browserWrap = null;
+            if (typeof(win) == "function") win({type:'exit'});
         }
     },
 
@@ -135,7 +136,7 @@ var IABExecs = {
 
             close.addEventListener('click', function () {
                 setTimeout(function () {
-                    IABExecs.close();
+                    IABExecs.close(win, lose);
                 }, 0);
             }, false);
 
@@ -154,6 +155,23 @@ var IABExecs = {
             browserWrap.appendChild(menu);
             browserWrap.appendChild(browserElem);
             document.body.appendChild(browserWrap);
+
+            //we use mozbrowserlocationchange instead of mozbrowserloadstart to get the url
+            browserElem.addEventListener('mozbrowserlocationchange', function(e){
+                win({
+                    type:'loadstart',
+                    url : e.detail
+                })
+            }, false);
+            browserElem.addEventListener('mozbrowserloadend', function(e){
+                win({type:'loadstop'})
+            }, false);
+            browserElem.addEventListener('mozbrowsererror', function(e){
+                win({type:'loaderror'})
+            }, false);
+            browserElem.addEventListener('mozbrowserclose', function(e){
+                win({type:'exit'})
+            }, false);
         } else {
             window.location = strUrl;
         }


Mime
View raw message