Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix syntax on ChildBrowser.js with dual support

partly why having dual support is being avoided
  • Loading branch information...
commit 2bd48dfe4f59be3b0e5946ed7f7ef63e7aab13f8 1 parent 5657dcc
@RandyMcMillan RandyMcMillan authored
View
103 iPhone/ChildBrowser/ChildBrowser.js
@@ -3,91 +3,78 @@
/*global PhoneGap/Cordova */
-function ChildBrowser() {
- // Does nothing
+function ChildBrowser()
+{
+ // Does nothing
}
-
// Callback when the location of the page changes
// called from native
ChildBrowser._onLocationChange = function(newLoc)
{
- window.plugins.childBrowser.onLocationChange(newLoc);
+ window.plugins.childBrowser.onLocationChange(newLoc);
};
-
// Callback when the user chooses the 'Done' button
// called from native
ChildBrowser._onClose = function()
{
- window.plugins.childBrowser.onClose();
+ window.plugins.childBrowser.onClose();
};
-
// Callback when the user chooses the 'open in Safari' button
// called from native
ChildBrowser._onOpenExternal = function()
{
- window.plugins.childBrowser.onOpenExternal();
+ window.plugins.childBrowser.onOpenExternal();
};
-
// Pages loaded into the ChildBrowser can execute callback scripts, so be careful to
// check location, and make sure it is a location you trust.
// Warning ... don't exec arbitrary code, it's risky and could fuck up your app.
// called from native
ChildBrowser._onJSCallback = function(js,loc)
{
- // Not Implemented
- //window.plugins.childBrowser.onJSCallback(js,loc);
+ // Not Implemented
+ //window.plugins.childBrowser.onJSCallback(js,loc);
};
-
/* The interface that you will use to access functionality */
// Show a webpage, will result in a callback to onLocationChange
ChildBrowser.prototype.showWebPage = function(loc)
{
- if (typeof PhoneGap !== "undefined") {
-
- PhoneGap.exec("ChildBrowserCommand.showWebPage", loc);
-
- } else {
-
- if (typeof Cordova !== "undefined") {
-
- Cordova.exec("ChildBrowserCommand.showWebPage", loc);
- }
- }
+ if (typeof PhoneGap !== "undefined")
+ {
+ PhoneGap.exec("ChildBrowserCommand.showWebPage", loc);
+ }
+ if (typeof Cordova !== "undefined")
+ {
+ Cordova.exec("ChildBrowserCommand.showWebPage", loc);
+ }
};
-
- // close the browser, will NOT result in close callback
- ChildBrowser.prototype.close = function()
- {
- if (typeof PhoneGap !== "undefined") {
-
- PhoneGap.exec("ChildBrowserCommand.close");
-
- } else {
-
- if (typeof Cordova !== "undefined") {
-
- Cordova.exec("ChildBrowserCommand.close");
- }
- }
+// close the browser, will NOT result in close callback
+ChildBrowser.prototype.close = function()
+{
+ if (typeof PhoneGap !== "undefined")
+ {
+ PhoneGap.exec("ChildBrowserCommand.close");
+ }
+ if (typeof Cordova !== "undefined")
+ {
+ Cordova.exec("ChildBrowserCommand.close");
+ }
+};
+// Not Implemented
+ChildBrowser.prototype.jsExec = function(jsString)
+{
+ // Not Implemented!!
+ //PhoneGap.exec("ChildBrowserCommand.jsExec",jsString);
+};
+// Note: this plugin does NOT install itself, call this method some time after deviceready to install it
+// it will be returned, and also available globally from window.plugins.childBrowser
+ChildBrowser.install = function()
+{
+ if(!window.plugins)
+ {
+ window.plugins = {
+ };
+ }
+ window.plugins.childBrowser = new ChildBrowser();
+ return window.plugins.childBrowser;
};
-
- // Not Implemented
- ChildBrowser.prototype.jsExec = function(jsString)
- {
- // Not Implemented!!
- //PhoneGap.exec("ChildBrowserCommand.jsExec",jsString);
- };
-
- // Note: this plugin does NOT install itself, call this method some time after deviceready to install it
- // it will be returned, and also available globally from window.plugins.childBrowser
- ChildBrowser.install = function()
- {
- if(!window.plugins) {
- window.plugins = {};
- }
-
- window.plugins.childBrowser = new ChildBrowser();
- return window.plugins.childBrowser;
- };
-
View
1  iPhone/ChildBrowser/ChildBrowser.min.js
@@ -1 +0,0 @@
-function ChildBrowser(){}ChildBrowser._onLocationChange=function(newLoc){window.plugins.childBrowser.onLocationChange(newLoc)};ChildBrowser._onClose=function(){window.plugins.childBrowser.onClose()};ChildBrowser._onOpenExternal=function(){window.plugins.childBrowser.onOpenExternal()};ChildBrowser._onJSCallback=function(js,loc){};ChildBrowser.prototype.showWebPage=function(loc){if(typeof PhoneGap!=="undefined"){PhoneGap.exec("ChildBrowserCommand.showWebPage",loc)}else{if(typeof Cordova!=="undefined"){Cordova.exec("ChildBrowserCommand.showWebPage",loc)}}};ChildBrowser.prototype.close=function(){if(typeof PhoneGap!=="undefined"){PhoneGap.exec("ChildBrowserCommand.close")}else{if(typeof Cordova!=="undefined"){Cordova.exec("ChildBrowserCommand.close")}}};ChildBrowser.prototype.jsExec=function(jsString){};ChildBrowser.install=function(){if(!window.plugins){window.plugins={}}window.plugins.childBrowser=new ChildBrowser();return window.plugins.childBrowser};
View
85 iPhone/ChildBrowser/README.txt
@@ -1,85 +0,0 @@
-The child browser allows you to display external webpages within your PhoneGap application.
-
-A simple use case would be:
-
-- Users can post links, and you don't want your users to exit your app to view the link.
-
-This command creates a popup browser that is shown in front of your app, when the user presses the done button they are simply returned to your app ( actually they never left )
-
-The ChildBrowser has buttons for refreshing, navigating back + forwards, as well as the option to open in Safari.
-
-Note, because this is open source, I could not include the graphics I usually use for the back/forward and safari buttons. I have changed the XIB file to use system buttons ( rewind / fast-forward + action ) Ideally you should modify the XIB to use your own look.
-
-Here is a sample command to open google in a childbrowser :
-
-PhoneGap.exec("ChildBrowserCommand.showWebPage", "http://www.google.com" );
-
-=================================
-
-June 1, 2010
-Added support for orientations, supportedOrientations are passed through to the child view controller. -jm
-
-
-================================
-
-Sept 13, 2010
-+ added callbacks for location change, close, opening in safari,
-+ added method to close the browser from js.
-( This should allow easy additions for facebook connect as you can monitor the browser's address and respond accordingly. )
-+ added images to the XIB, these need to be attached as resources in your xcode project.
-
-Sample use:
-
-<code>
- var root = this;
-
- /* When this function is called, PhoneGap has been initialized and is ready to roll */
- function onDeviceReady()
- {
- var cb = ChildBrowser.install();
- if(cb != null)
- {
- cb.onLocationChange = function(loc){ root.locChanged(loc); };
- cb.onClose = function(){root.onCloseBrowser()};
- cb.onOpenExternal = function(){root.onOpenExternal();};
-
- window.plugins.childBrowser.showWebPage("http://google.com");
-
- }
- }
-
- function onCloseBrowser()
- {
- alert("In index.html child browser closed");
- }
-
- function locChanged(loc)
- {
- alert("In index.html new loc = " + loc);
- }
-
- function onOpenExternal()
- {
- alert("In index.html onOpenExternal");
- }
-</code>
-
-================================
-
-Oct 6, 2011
-
-SubDomains must be listed individually.
-
-EXAMPLE:
-
-geoiplookup.wikimedia.org
-meta.wikimedia.org
-wikipedia.org
-upload.wikimedia.org
-
-================================ @RandyMcMillan
-
-
-
-
-
Please sign in to comment.
Something went wrong with that request. Please try again.