From e5862bf820b98bfebe8dfa737b6f6c89e3972172 Mon Sep 17 00:00:00 2001 From: Yangtb Date: Wed, 11 Sep 2013 16:18:47 +0800 Subject: [PATCH 001/106] [CB-4724] fixed UriFormatException fixed UriFormatException & InvalidOperationException --- src/wp/InAppBrowser.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp/InAppBrowser.cs b/src/wp/InAppBrowser.cs index 46e1384..007fd34 100644 --- a/src/wp/InAppBrowser.cs +++ b/src/wp/InAppBrowser.cs @@ -96,7 +96,7 @@ namespace WPCordovaClassLib.Cordova.Commands private void ShowInAppBrowser(string url) { - Uri loc = new Uri(url); + Uri loc = new Uri(url, UriKind.RelativeOrAbsolute); Deployment.Current.Dispatcher.BeginInvoke(() => { @@ -251,7 +251,7 @@ namespace WPCordovaClassLib.Cordova.Commands } #endif - string message = "{\"type\":\"loadstop\", \"url\":\"" + e.Uri.AbsoluteUri + "\"}"; + string message = "{\"type\":\"loadstop\", \"url\":\"" + e.Uri.OriginalString + "\"}"; PluginResult result = new PluginResult(PluginResult.Status.OK, message); result.KeepCallback = true; this.DispatchCommandResult(result); @@ -259,7 +259,7 @@ namespace WPCordovaClassLib.Cordova.Commands void browser_NavigationFailed(object sender, System.Windows.Navigation.NavigationFailedEventArgs e) { - string message = "{\"type\":\"error\",\"url\":\"" + e.Uri.AbsoluteUri + "\"}"; + string message = "{\"type\":\"error\",\"url\":\"" + e.Uri.OriginalString + "\"}"; PluginResult result = new PluginResult(PluginResult.Status.ERROR, message); result.KeepCallback = true; this.DispatchCommandResult(result); @@ -267,7 +267,7 @@ namespace WPCordovaClassLib.Cordova.Commands void browser_Navigating(object sender, NavigatingEventArgs e) { - string message = "{\"type\":\"loadstart\",\"url\":\"" + e.Uri.AbsoluteUri + "\"}"; + string message = "{\"type\":\"loadstart\",\"url\":\"" + e.Uri.OriginalString + "\"}"; PluginResult result = new PluginResult(PluginResult.Status.OK, message); result.KeepCallback = true; this.DispatchCommandResult(result); From ef5eddac9add2200e91a846cdea9e54d66b66074 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Wed, 9 Oct 2013 21:25:24 -0400 Subject: [PATCH 002/106] CB-5021 Make it safe to call close() multiple times --- www/InAppBrowser.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/www/InAppBrowser.js b/www/InAppBrowser.js index 5da53fd..83f5a22 100644 --- a/www/InAppBrowser.js +++ b/www/InAppBrowser.js @@ -30,6 +30,7 @@ function InAppBrowser() { 'loaderror' : channel.create('loaderror'), 'exit' : channel.create('exit') }; + this._alive = true; } InAppBrowser.prototype = { @@ -39,7 +40,10 @@ InAppBrowser.prototype = { } }, close: function (eventname) { - exec(null, null, "InAppBrowser", "close", []); + if (this._alive) { + this._alive = false; + exec(null, null, "InAppBrowser", "close", []); + } }, show: function (eventname) { exec(null, null, "InAppBrowser", "show", []); From 8cd786b6035d1da9b58ecafd6752df690058ca6b Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 10 Oct 2013 08:07:46 -0400 Subject: [PATCH 003/106] CB-5021 Expose closeDialog() as a public function and make it safe to call multiple times. --- src/android/InAppBrowser.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 3be0316..dfe1a50 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -157,7 +157,7 @@ public class InAppBrowser extends CordovaPlugin { } else if (action.equals("close")) { closeDialog(); - this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK)); + this.callbackContext.success(); } else if (action.equals("injectScriptCode")) { String jsWrapper = null; @@ -311,11 +311,15 @@ public class InAppBrowser extends CordovaPlugin { /** * Closes the dialog */ - private void closeDialog() { + public void closeDialog() { + final WebView childView = this.inAppWebView; + // The JS protects against multiple calls, so this should happen only when + // closeDialog() is called by other native code. + if (childView == null) { + return; + } try { - final WebView childView = this.inAppWebView; Runnable runnable = new Runnable() { - @Override public void run() { childView.loadUrl("about:blank"); From 8df4b7d03b3766cce03e26f996dfa3b54e417f04 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 10 Oct 2013 11:49:00 -0400 Subject: [PATCH 004/106] CB-3747 Fix back button having different dismiss logic from the close button. Also made the IAB close when the owner page is navigated (implemented onReset). --- src/android/InAppBrowser.java | 71 ++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 31 deletions(-) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index dfe1a50..940a409 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -18,20 +18,6 @@ */ package org.apache.cordova.inappbrowser; -import java.util.HashMap; -import java.util.StringTokenizer; - - -import org.apache.cordova.Config; -import org.apache.cordova.CordovaWebView; -import org.apache.cordova.CallbackContext; -import org.apache.cordova.CordovaPlugin; -import org.apache.cordova.LOG; -import org.apache.cordova.PluginResult; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - import android.annotation.SuppressLint; import android.app.Dialog; import android.content.Context; @@ -52,11 +38,7 @@ import android.view.WindowManager.LayoutParams; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.webkit.CookieManager; -import android.webkit.WebChromeClient; -import android.webkit.GeolocationPermissions.Callback; -import android.webkit.JsPromptResult; import android.webkit.WebSettings; -import android.webkit.WebStorage; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Button; @@ -64,6 +46,19 @@ import android.widget.EditText; import android.widget.LinearLayout; import android.widget.RelativeLayout; +import org.apache.cordova.CallbackContext; +import org.apache.cordova.Config; +import org.apache.cordova.CordovaPlugin; +import org.apache.cordova.CordovaWebView; +import org.apache.cordova.LOG; +import org.apache.cordova.PluginResult; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.HashMap; +import java.util.StringTokenizer; + @SuppressLint("SetJavaScriptEnabled") public class InAppBrowser extends CordovaPlugin { @@ -157,7 +152,6 @@ public class InAppBrowser extends CordovaPlugin { } else if (action.equals("close")) { closeDialog(); - this.callbackContext.success(); } else if (action.equals("injectScriptCode")) { String jsWrapper = null; @@ -214,6 +208,22 @@ public class InAppBrowser extends CordovaPlugin { return true; } + /** + * Called when the view navigates. + */ + @Override + public void onReset() { + closeDialog(); + } + + /** + * Called by AccelBroker when listener is to be shut down. + * Stop listener. + */ + public void onDestroy() { + closeDialog(); + } + /** * Inject an object (script or style) into the InAppBrowser WebView. * @@ -442,14 +452,7 @@ public class InAppBrowser extends CordovaPlugin { dialog.setCancelable(true); dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { public void onDismiss(DialogInterface dialog) { - try { - JSONObject obj = new JSONObject(); - obj.put("type", EXIT_EVENT); - - sendUpdate(obj, false); - } catch (JSONException e) { - Log.d(LOG_TAG, "Should never happen"); - } + closeDialog(); } }); @@ -624,10 +627,16 @@ public class InAppBrowser extends CordovaPlugin { * * @param obj a JSONObject contain event payload information * @param status the status code to return to the JavaScript environment - */ private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Status status) { - PluginResult result = new PluginResult(status, obj); - result.setKeepCallback(keepCallback); - this.callbackContext.sendPluginResult(result); + */ + private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Status status) { + if (callbackContext != null) { + PluginResult result = new PluginResult(status, obj); + result.setKeepCallback(keepCallback); + callbackContext.sendPluginResult(result); + if (!keepCallback) { + callbackContext = null; + } + } } From 8a6bc01814b6d7eb3f605ad47a45d33163153a66 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 10 Oct 2013 12:21:35 -0400 Subject: [PATCH 005/106] CB-4858 Convert relative URLs to absolute URLs in JS --- plugin.xml | 3 +++ www/InAppBrowser.js | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/plugin.xml b/plugin.xml index 9a53bd2..341b4be 100644 --- a/plugin.xml +++ b/plugin.xml @@ -8,6 +8,9 @@ Apache 2.0 cordova,in,app,browser,inappbrowser + + + diff --git a/www/InAppBrowser.js b/www/InAppBrowser.js index 83f5a22..3fe9261 100644 --- a/www/InAppBrowser.js +++ b/www/InAppBrowser.js @@ -22,6 +22,7 @@ var exec = require('cordova/exec'); var channel = require('cordova/channel'); var modulemapper = require('cordova/modulemapper'); +var urlutil = require('cordova/urlutil'); function InAppBrowser() { this.channels = { @@ -81,17 +82,18 @@ InAppBrowser.prototype = { }; module.exports = function(strUrl, strWindowName, strWindowFeatures) { - var iab = new InAppBrowser(); - var cb = function(eventname) { - iab._eventHandler(eventname); - }; - // Don't catch calls that write to existing frames (e.g. named iframes). if (window.frames && window.frames[strWindowName]) { var origOpenFunc = modulemapper.getOriginalSymbol(window, 'open'); return origOpenFunc.apply(window, arguments); } + strUrl = urlutil.makeAbsolute(strUrl); + var iab = new InAppBrowser(); + var cb = function(eventname) { + iab._eventHandler(eventname); + }; + exec(cb, cb, "InAppBrowser", "open", [strUrl, strWindowName, strWindowFeatures]); return iab; }; From 5ef5171003e5e550e85cfa5c021fb1c7c77e83e3 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 10 Oct 2013 12:40:27 -0400 Subject: [PATCH 006/106] CB-4858 - Run IAB methods on the UI thread. --- src/android/InAppBrowser.java | 251 ++++++++++++++++------------------ 1 file changed, 119 insertions(+), 132 deletions(-) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 940a409..da6b241 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -48,11 +48,11 @@ import android.widget.RelativeLayout; import org.apache.cordova.CallbackContext; import org.apache.cordova.Config; +import org.apache.cordova.CordovaArgs; import org.apache.cordova.CordovaPlugin; import org.apache.cordova.CordovaWebView; import org.apache.cordova.LOG; import org.apache.cordova.PluginResult; -import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -95,115 +95,114 @@ public class InAppBrowser extends CordovaPlugin { * @param callbackId The callback id used when calling back into JavaScript. * @return A PluginResult object with a status and message. */ - public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { - try { - if (action.equals("open")) { - this.callbackContext = callbackContext; - String url = args.getString(0); - String target = args.optString(1); - if (target == null || target.equals("") || target.equals(NULL)) { - target = SELF; - } - HashMap features = parseFeature(args.optString(2)); - - Log.d(LOG_TAG, "target = " + target); - - url = updateUrl(url); - String result = ""; - - // SELF - if (SELF.equals(target)) { - Log.d(LOG_TAG, "in self"); - // load in webview - if (url.startsWith("file://") || url.startsWith("javascript:") - || Config.isUrlWhiteListed(url)) { - this.webView.loadUrl(url); - } - //Load the dialer - else if (url.startsWith(WebView.SCHEME_TEL)) - { - try { - Intent intent = new Intent(Intent.ACTION_DIAL); - intent.setData(Uri.parse(url)); - this.cordova.getActivity().startActivity(intent); - } catch (android.content.ActivityNotFoundException e) { - LOG.e(LOG_TAG, "Error dialing " + url + ": " + e.toString()); + public boolean execute(String action, CordovaArgs args, final CallbackContext callbackContext) throws JSONException { + if (action.equals("open")) { + this.callbackContext = callbackContext; + final String url = args.getString(0); + String t = args.optString(1); + if (t == null || t.equals("") || t.equals(NULL)) { + t = SELF; + } + final String target = t; + final HashMap features = parseFeature(args.optString(2)); + + Log.d(LOG_TAG, "target = " + target); + + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + String result = ""; + // SELF + if (SELF.equals(target)) { + Log.d(LOG_TAG, "in self"); + // load in webview + if (url.startsWith("file://") || url.startsWith("javascript:") + || Config.isUrlWhiteListed(url)) { + webView.loadUrl(url); + } + //Load the dialer + else if (url.startsWith(WebView.SCHEME_TEL)) + { + try { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse(url)); + cordova.getActivity().startActivity(intent); + } catch (android.content.ActivityNotFoundException e) { + LOG.e(LOG_TAG, "Error dialing " + url + ": " + e.toString()); + } + } + // load in InAppBrowser + else { + result = showWebPage(url, features); } } - // load in InAppBrowser + // SYSTEM + else if (SYSTEM.equals(target)) { + Log.d(LOG_TAG, "in system"); + result = openExternal(url); + } + // BLANK - or anything else else { - result = this.showWebPage(url, features); + Log.d(LOG_TAG, "in blank"); + result = showWebPage(url, features); } + + PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, result); + pluginResult.setKeepCallback(true); + callbackContext.sendPluginResult(pluginResult); } - // SYSTEM - else if (SYSTEM.equals(target)) { - Log.d(LOG_TAG, "in system"); - result = this.openExternal(url); + }); + } + else if (action.equals("close")) { + closeDialog(); + } + else if (action.equals("injectScriptCode")) { + String jsWrapper = null; + if (args.getBoolean(1)) { + jsWrapper = String.format("prompt(JSON.stringify([eval(%%s)]), 'gap-iab://%s')", callbackContext.getCallbackId()); + } + injectDeferredObject(args.getString(0), jsWrapper); + } + else if (action.equals("injectScriptFile")) { + String jsWrapper; + if (args.getBoolean(1)) { + jsWrapper = String.format("(function(d) { var c = d.createElement('script'); c.src = %%s; c.onload = function() { prompt('', 'gap-iab://%s'); }; d.body.appendChild(c); })(document)", callbackContext.getCallbackId()); + } else { + jsWrapper = "(function(d) { var c = d.createElement('script'); c.src = %s; d.body.appendChild(c); })(document)"; + } + injectDeferredObject(args.getString(0), jsWrapper); + } + else if (action.equals("injectStyleCode")) { + String jsWrapper; + if (args.getBoolean(1)) { + jsWrapper = String.format("(function(d) { var c = d.createElement('style'); c.innerHTML = %%s; d.body.appendChild(c); prompt('', 'gap-iab://%s');})(document)", callbackContext.getCallbackId()); + } else { + jsWrapper = "(function(d) { var c = d.createElement('style'); c.innerHTML = %s; d.body.appendChild(c); })(document)"; + } + injectDeferredObject(args.getString(0), jsWrapper); + } + else if (action.equals("injectStyleFile")) { + String jsWrapper; + if (args.getBoolean(1)) { + jsWrapper = String.format("(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %%s; d.head.appendChild(c); prompt('', 'gap-iab://%s');})(document)", callbackContext.getCallbackId()); + } else { + jsWrapper = "(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %s; d.head.appendChild(c); })(document)"; + } + injectDeferredObject(args.getString(0), jsWrapper); + } + else if (action.equals("show")) { + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + dialog.show(); } - // BLANK - or anything else - else { - Log.d(LOG_TAG, "in blank"); - result = this.showWebPage(url, features); - } - - PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, result); - pluginResult.setKeepCallback(true); - this.callbackContext.sendPluginResult(pluginResult); - } - else if (action.equals("close")) { - closeDialog(); - } - else if (action.equals("injectScriptCode")) { - String jsWrapper = null; - if (args.getBoolean(1)) { - jsWrapper = String.format("prompt(JSON.stringify([eval(%%s)]), 'gap-iab://%s')", callbackContext.getCallbackId()); - } - injectDeferredObject(args.getString(0), jsWrapper); - } - else if (action.equals("injectScriptFile")) { - String jsWrapper; - if (args.getBoolean(1)) { - jsWrapper = String.format("(function(d) { var c = d.createElement('script'); c.src = %%s; c.onload = function() { prompt('', 'gap-iab://%s'); }; d.body.appendChild(c); })(document)", callbackContext.getCallbackId()); - } else { - jsWrapper = "(function(d) { var c = d.createElement('script'); c.src = %s; d.body.appendChild(c); })(document)"; - } - injectDeferredObject(args.getString(0), jsWrapper); - } - else if (action.equals("injectStyleCode")) { - String jsWrapper; - if (args.getBoolean(1)) { - jsWrapper = String.format("(function(d) { var c = d.createElement('style'); c.innerHTML = %%s; d.body.appendChild(c); prompt('', 'gap-iab://%s');})(document)", callbackContext.getCallbackId()); - } else { - jsWrapper = "(function(d) { var c = d.createElement('style'); c.innerHTML = %s; d.body.appendChild(c); })(document)"; - } - injectDeferredObject(args.getString(0), jsWrapper); - } - else if (action.equals("injectStyleFile")) { - String jsWrapper; - if (args.getBoolean(1)) { - jsWrapper = String.format("(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %%s; d.head.appendChild(c); prompt('', 'gap-iab://%s');})(document)", callbackContext.getCallbackId()); - } else { - jsWrapper = "(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %s; d.head.appendChild(c); })(document)"; - } - injectDeferredObject(args.getString(0), jsWrapper); - } - else if (action.equals("show")) { - Runnable runnable = new Runnable() { - @Override - public void run() { - dialog.show(); - } - }; - this.cordova.getActivity().runOnUiThread(runnable); - PluginResult pluginResult = new PluginResult(PluginResult.Status.OK); - pluginResult.setKeepCallback(true); - this.callbackContext.sendPluginResult(pluginResult); - } - else { - return false; - } - } catch (JSONException e) { - this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION)); + }); + PluginResult pluginResult = new PluginResult(PluginResult.Status.OK); + pluginResult.setKeepCallback(true); + this.callbackContext.sendPluginResult(pluginResult); + } + else { + return false; } return true; } @@ -251,8 +250,14 @@ public class InAppBrowser extends CordovaPlugin { } else { scriptToInject = source; } + final String finalScriptToInject = scriptToInject; // This action will have the side-effect of blurring the currently focused element - this.inAppWebView.loadUrl("javascript:" + scriptToInject); + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + inAppWebView.loadUrl("javascript:" + finalScriptToInject); + } + }); } /** @@ -284,20 +289,6 @@ public class InAppBrowser extends CordovaPlugin { } } - /** - * Convert relative URL to full path - * - * @param url - * @return - */ - private String updateUrl(String url) { - Uri newUrl = Uri.parse(url); - if (newUrl.isRelative()) { - url = this.webView.getUrl().substring(0, this.webView.getUrl().lastIndexOf("/")+1) + url; - } - return url; - } - /** * Display a new browser with the specified URL. * @@ -328,27 +319,23 @@ public class InAppBrowser extends CordovaPlugin { if (childView == null) { return; } - try { - Runnable runnable = new Runnable() { - @Override - public void run() { - childView.loadUrl("about:blank"); + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + childView.loadUrl("about:blank"); + if (dialog != null) { + dialog.dismiss(); } - - }; - - this.cordova.getActivity().runOnUiThread(runnable); + } + }); + try { JSONObject obj = new JSONObject(); obj.put("type", EXIT_EVENT); - sendUpdate(obj, false); } catch (JSONException ex) { Log.d(LOG_TAG, "Should never happen"); } - if (dialog != null) { - dialog.dismiss(); - } } /** From a76a0a3920e81c56db7c070e002eb24e4a1a478a Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Wed, 9 Oct 2013 15:27:18 -0700 Subject: [PATCH 007/106] [CB-5010] Updated version and RELEASENOTES.md for release 0.2.3 --- RELEASENOTES.md | 4 ++++ plugin.xml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 0dbdbc5..548a6a2 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -32,3 +32,7 @@ * Rename CHANGELOG.md -> RELEASENOTES.md * [CB-4792] Added keepCallback to the show function. * [CB-4752] Incremented plugin version on dev branch. + +### 0.2.3 (Oct 9, 2013) +* [CB-4915] Incremented plugin version on dev branch. +* [CB-4926] Fixes inappbrowser plugin loading for windows8 \ No newline at end of file diff --git a/plugin.xml b/plugin.xml index 341b4be..9f75db2 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.2.3"> InAppBrowser Cordova InAppBrowser Plugin Apache 2.0 From ce7a796cb0c5421db0490ae97d9ca99b96dd23e7 Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Wed, 9 Oct 2013 16:06:19 -0700 Subject: [PATCH 008/106] [CB-5010] Incremented plugin version on dev branch. --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index 9f75db2..5ad40e2 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.2.4-dev"> InAppBrowser Cordova InAppBrowser Plugin Apache 2.0 From c7972b6cffcedae7a9bbbeb66875a5d2fb37ce29 Mon Sep 17 00:00:00 2001 From: Shazron Abdullah Date: Tue, 15 Oct 2013 15:00:09 -0700 Subject: [PATCH 009/106] CB-4930 - iOS - InAppBrowser should take into account the status bar --- src/ios/CDVInAppBrowser.m | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 4170dd2..5711e76 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -32,6 +32,11 @@ #pragma mark CDVInAppBrowser +@interface CDVInAppBrowser () { + UIStatusBarStyle _previousStatusBarStyle; +} +@end + @implementation CDVInAppBrowser - (CDVInAppBrowser*)initWithWebView:(UIWebView*)theWebView @@ -115,6 +120,7 @@ } } + _previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle; CDVInAppBrowserOptions* browserOptions = [CDVInAppBrowserOptions parseOptions:options]; [self.inAppBrowserViewController showLocationBar:browserOptions.location]; @@ -155,8 +161,13 @@ } if (! browserOptions.hidden) { + + UINavigationController* nav = [[UINavigationController alloc] + initWithRootViewController:self.inAppBrowserViewController]; + nav.navigationBarHidden = YES; + if (self.viewController.modalViewController != self.inAppBrowserViewController) { - [self.viewController presentModalViewController:self.inAppBrowserViewController animated:YES]; + [self.viewController presentModalViewController:nav animated:YES]; } } [self.inAppBrowserViewController navigateTo:url]; @@ -166,7 +177,13 @@ { if ([self.inAppBrowserViewController isViewLoaded] && self.inAppBrowserViewController.view.window) return; - [self.viewController presentModalViewController:self.inAppBrowserViewController animated:YES]; + + _previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle; + + UINavigationController* nav = [[UINavigationController alloc] + initWithRootViewController:self.inAppBrowserViewController]; + nav.navigationBarHidden = YES; + [self.viewController presentModalViewController:nav animated:YES]; } - (void)openInCordovaWebView:(NSURL*)url withOptions:(NSString*)options @@ -362,6 +379,10 @@ // Don't recycle the ViewController since it may be consuming a lot of memory. // Also - this is required for the PDF/User-Agent bug work-around. self.inAppBrowserViewController = nil; + + if (IsAtLeastiOSVersion(@"7.0")) { + [[UIApplication sharedApplication] setStatusBarStyle:_previousStatusBarStyle]; + } } @end @@ -632,6 +653,11 @@ [CDVUserAgentUtil releaseLock:&_userAgentLockToken]; [super viewDidUnload]; } + +- (UIStatusBarStyle)preferredStatusBarStyle +{ + return UIStatusBarStyleDefault; +} - (void)close { @@ -674,6 +700,15 @@ { [self.webView goForward]; } + +- (void)viewWillAppear:(BOOL)animated +{ + if (IsAtLeastiOSVersion(@"7.0")) { + [[UIApplication sharedApplication] setStatusBarStyle:[self preferredStatusBarStyle]]; + } + + [super viewWillAppear:animated]; +} #pragma mark UIWebViewDelegate From a8f79e1fd6f86bfdda2eccc6a40835feda5b65ee Mon Sep 17 00:00:00 2001 From: Maxim Ermilov Date: Wed, 16 Oct 2013 21:13:03 +0400 Subject: [PATCH 010/106] add ubuntu platform --- plugin.xml | 10 +++- src/ubuntu/InAppBrowser.qml | 69 +++++++++++++++++++++++ src/ubuntu/close.png | Bin 0 -> 461 bytes src/ubuntu/inappbrowser.cpp | 106 ++++++++++++++++++++++++++++++++++++ src/ubuntu/inappbrowser.h | 61 +++++++++++++++++++++ 5 files changed, 245 insertions(+), 1 deletion(-) create mode 100644 src/ubuntu/InAppBrowser.qml create mode 100644 src/ubuntu/close.png create mode 100644 src/ubuntu/inappbrowser.cpp create mode 100644 src/ubuntu/inappbrowser.h diff --git a/plugin.xml b/plugin.xml index 21990af..5febd9d 100644 --- a/plugin.xml +++ b/plugin.xml @@ -24,7 +24,15 @@ - + + + + + + + + + diff --git a/src/ubuntu/InAppBrowser.qml b/src/ubuntu/InAppBrowser.qml new file mode 100644 index 0000000..03448f6 --- /dev/null +++ b/src/ubuntu/InAppBrowser.qml @@ -0,0 +1,69 @@ +/* + * + * Copyright 2013 Canonical Ltd. + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ +import QtQuick 2.0 +import QtWebKit 3.0 +import Ubuntu.Components.Popups 0.1 +import Ubuntu.Components 0.1 + +Rectangle { + anchors.fill: parent + id: inappbrowser + property string url1 + Rectangle { + border.color: "black" + width: parent.width + height: urlEntry.height + color: "gray" + TextInput { + id: urlEntry + width: parent.width - closeButton.width + text: url1 + activeFocusOnPress: false + } + Image { + id: closeButton + width: height + x: parent.width - width + height: parent.height + source: "close.png" + MouseArea { + anchors.fill: parent + onClicked: { + root.exec("InAppBrowser", "close", [0, 0]) + } + } + } + } + + WebView { + width: parent.width + y: urlEntry.height + height: parent.height - y + url: url1 + onLoadingChanged: { + if (loadRequest.status) { + root.exec("InAppBrowser", "loadFinished", [loadRequest.status]) + } + } + } +} diff --git a/src/ubuntu/close.png b/src/ubuntu/close.png new file mode 100644 index 0000000000000000000000000000000000000000..56373d1fab22ebf492ea9e145d866e444e0ed46e GIT binary patch literal 461 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA3?vioaBc-s-T^)#uK)l42QrBS0s;aC1_l8E z0SO5S1qB5Q7A!b$;J}3o7e0LW05pe>cjHx{L3|}ae!&d<^7{Vq`Stzt*Pp-t-e~@; zDh38dWltB!kcwMpFFQ_ZG7xaM=)%##mnhP5=l_zl6%X`Z$W>*pUvuvFQ>BBoKYv`f z_WP{rmaG5wy-MyWe?Q~H_Lt}W?BjUdq#g~d~TfSj$?1SDzA4I05U;D24E?e@`w(nif{~GTp%dgmd;CAbm zvc~P)FW)}8G{5R+ui32lEr&iHJ$wAOX!$>d6;Ec*IPz@f#eVJL+gvu%HEWLUJ{ezP(7s~RXqJYD@<);T3K0RZo?&l3Ou literal 0 HcmV?d00001 diff --git a/src/ubuntu/inappbrowser.cpp b/src/ubuntu/inappbrowser.cpp new file mode 100644 index 0000000..d172bab --- /dev/null +++ b/src/ubuntu/inappbrowser.cpp @@ -0,0 +1,106 @@ +/* + * + * Copyright 2013 Canonical Ltd. + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +#include +#include + +#include "inappbrowser.h" +#include + +Inappbrowser::Inappbrowser(Cordova *cordova): CPlugin(cordova), _eventCb(0) { +} + +const char code[] = "\ +var component, object; \ +function createObject() { \ + component = Qt.createComponent(%1); \ + if (component.status == Component.Ready) \ + finishCreation(); \ + else \ + component.statusChanged.connect(finishCreation); \ +} \ +function finishCreation() { \ + CordovaWrapper.object = component.createObject(root, \ + {root: root, cordova: cordova, url1: %2}); \ +} \ +createObject()"; + +const char EXIT_EVENT[] = "'exit'"; +const char LOADSTART_EVENT[] = "'loadstart'"; +const char LOADSTOP_EVENT[] = "'loadstop'"; +const char LOADERROR_EVENT[] = "'loaderror'"; + +void Inappbrowser::open(int cb, int, const QString &url, const QString &windowName, const QString &windowFeatures) { + assert(_eventCb == 0); + + _eventCb = cb; + + QString path = m_cordova->get_app_dir() + "/../qml/InAppBrowser.qml"; + + // TODO: relative url + QString qml = QString(code) + .arg(CordovaInternal::format(path)).arg(CordovaInternal::format(url)); + m_cordova->execQML(qml); +} + +void Inappbrowser::show(int, int) { + m_cordova->execQML("CordovaWrapper.object.visible = true"); +} + +void Inappbrowser::close(int, int) { + m_cordova->execQML("CordovaWrapper.object.destroy()"); + this->callbackWithoutRemove(_eventCb, EXIT_EVENT); + _eventCb = 0; +} + +void Inappbrowser::injectStyleFile(int cb, int, const QString&, bool) { + // TODO: + qCritical() << "unimplemented " << __PRETTY_FUNCTION__; +} + +void Inappbrowser::injectStyleCode(int cb, int, const QString&, bool) { + // TODO: + qCritical() << "unimplemented " << __PRETTY_FUNCTION__; +} + +void Inappbrowser::injectScriptFile(int cb, int, const QString&, bool) { + // TODO: + qCritical() << "unimplemented " << __PRETTY_FUNCTION__; +} + +void Inappbrowser::injectScriptCode(int cb, int, const QString&, bool) { + // TODO: + qCritical() << "unimplemented " << __PRETTY_FUNCTION__; +} + +void Inappbrowser::loadFinished(int status) { + if (status == 2) { + this->callbackWithoutRemove(_eventCb, LOADERROR_EVENT); + } + if (status == 0) { + this->callbackWithoutRemove(_eventCb, LOADSTART_EVENT); + } + if (status == 3) { + this->callbackWithoutRemove(_eventCb, LOADSTOP_EVENT); + } +} diff --git a/src/ubuntu/inappbrowser.h b/src/ubuntu/inappbrowser.h new file mode 100644 index 0000000..7a4a68a --- /dev/null +++ b/src/ubuntu/inappbrowser.h @@ -0,0 +1,61 @@ +/* + * + * Copyright 2013 Canonical Ltd. + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ +#ifndef INAPPBROWSER_H +#define INAPPBROWSER_H + +#include +#include + +class Inappbrowser: public CPlugin { + Q_OBJECT +public: + Inappbrowser(Cordova *cordova); + + virtual const QString fullName() override { + return Inappbrowser::fullID(); + } + + virtual const QString shortName() override { + return "InAppBrowser"; + } + + static const QString fullID() { + return "InAppBrowser"; + } + +public slots: + void open(int cb, int, const QString &url, const QString &windowName, const QString &windowFeatures); + void show(int, int); + void close(int, int); + void injectStyleFile(int cb, int, const QString&, bool); + void injectStyleCode(int cb, int, const QString&, bool); + void injectScriptFile(int cb, int, const QString&, bool); + void injectScriptCode(int cb, int, const QString&, bool); + + void loadFinished(int status); + +private: + int _eventCb; +}; + +#endif From aa81c3267a5b1c337b09933ff5ceb06a93f9dbb7 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Mon, 21 Oct 2013 13:16:54 -0400 Subject: [PATCH 011/106] CB-4995 Fix crash when WebView is quickly opened then closed. Also fixes a leak where callback was never being cleared. --- src/ios/CDVInAppBrowser.m | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 5711e76..4ef051f 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -56,12 +56,8 @@ - (void)close:(CDVInvokedUrlCommand*)command { - if (self.inAppBrowserViewController != nil) { - [self.inAppBrowserViewController close]; - self.inAppBrowserViewController = nil; - } - - self.callbackId = nil; + // Things are cleaned up in browserExit. + [self.inAppBrowserViewController close]; } - (BOOL) isSystemUrl:(NSURL*)url @@ -372,14 +368,15 @@ if (self.callbackId != nil) { CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:@{@"type":@"exit"}]; - [pluginResult setKeepCallback:[NSNumber numberWithBool:YES]]; - [self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId]; + self.callbackId = nil; } + // Set navigationDelegate to nil to ensure no callbacks are received from it. + self.inAppBrowserViewController.navigationDelegate = nil; // Don't recycle the ViewController since it may be consuming a lot of memory. // Also - this is required for the PDF/User-Agent bug work-around. self.inAppBrowserViewController = nil; - + if (IsAtLeastiOSVersion(@"7.0")) { [[UIApplication sharedApplication] setStatusBarStyle:_previousStatusBarStyle]; } From b3348cff6c3f0e66a2bad573dbc1a47c986ada37 Mon Sep 17 00:00:00 2001 From: hermwong Date: Tue, 22 Oct 2013 13:40:00 -0700 Subject: [PATCH 012/106] CB-5128: added repo + issue tag to plugin.xml for inappbrowser plugin --- plugin.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin.xml b/plugin.xml index 5ad40e2..e844766 100644 --- a/plugin.xml +++ b/plugin.xml @@ -7,6 +7,8 @@ Cordova InAppBrowser Plugin Apache 2.0 cordova,in,app,browser,inappbrowser + https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git + https://issues.apache.org/jira/browse/CB/component/12320641 From e5868f8ecb0bd1f1a7a4fd868a437efab7dd020a Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Mon, 28 Oct 2013 12:03:26 -0700 Subject: [PATCH 013/106] [CB-5188] Updated version and RELEASENOTES.md for release 0.2.4 --- RELEASENOTES.md | 14 +++++++++++++- plugin.xml | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 548a6a2..a85c6d6 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -35,4 +35,16 @@ ### 0.2.3 (Oct 9, 2013) * [CB-4915] Incremented plugin version on dev branch. -* [CB-4926] Fixes inappbrowser plugin loading for windows8 \ No newline at end of file +* [CB-4926] Fixes inappbrowser plugin loading for windows8 + +### 0.2.4 (Oct 28, 2013) +* CB-5128: added repo + issue tag to plugin.xml for inappbrowser plugin +* CB-4995 Fix crash when WebView is quickly opened then closed. +* CB-4930 - iOS - InAppBrowser should take into account the status bar +* [CB-5010] Incremented plugin version on dev branch. +* [CB-5010] Updated version and RELEASENOTES.md for release 0.2.3 +* CB-4858 - Run IAB methods on the UI thread. +* CB-4858 Convert relative URLs to absolute URLs in JS +* CB-3747 Fix back button having different dismiss logic from the close button. +* CB-5021 Expose closeDialog() as a public function and make it safe to call multiple times. +* CB-5021 Make it safe to call close() multiple times diff --git a/plugin.xml b/plugin.xml index e844766..d0f2bf4 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.2.4"> InAppBrowser Cordova InAppBrowser Plugin Apache 2.0 From d49d6ec62f21029dcd6da23a9cb6b024ddf556de Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Mon, 28 Oct 2013 12:27:15 -0700 Subject: [PATCH 014/106] CB-5188: --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index 94cfb82..74c9c3b 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.2.5-dev"> InAppBrowser Cordova InAppBrowser Plugin From e5101ba8e1a3e75723753f6b79a17e997ec1d698 Mon Sep 17 00:00:00 2001 From: Archana Naik Date: Fri, 18 Oct 2013 16:38:34 -0700 Subject: [PATCH 015/106] Added amazon-fireos platform. Change to use amazon-fireos as the platform if user agent string contains 'cordova-amazon-fireos' --- plugin.xml | 13 + src/amazon/InAppBrowser.java | 769 ++++++++++++++++++++++++++++++ src/amazon/InAppChromeClient.java | 128 +++++ test/cordova-incl.js | 6 +- 4 files changed, 914 insertions(+), 2 deletions(-) create mode 100644 src/amazon/InAppBrowser.java create mode 100644 src/amazon/InAppChromeClient.java diff --git a/plugin.xml b/plugin.xml index 74c9c3b..a630d66 100644 --- a/plugin.xml +++ b/plugin.xml @@ -31,6 +31,19 @@ + + + + + + + + + + + + + diff --git a/src/amazon/InAppBrowser.java b/src/amazon/InAppBrowser.java new file mode 100644 index 0000000..261cb86 --- /dev/null +++ b/src/amazon/InAppBrowser.java @@ -0,0 +1,769 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ +package org.apache.cordova.inappbrowser; + +import android.annotation.SuppressLint; +import android.app.Dialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.graphics.Bitmap; +import android.net.Uri; +import android.os.Bundle; +import android.text.InputType; +import android.util.Log; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.KeyEvent; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.view.WindowManager.LayoutParams; +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodManager; +import com.amazon.android.webkit.AmazonWebChromeClient; +import com.amazon.android.webkit.AmazonGeolocationPermissions.Callback; +import com.amazon.android.webkit.AmazonJsPromptResult; +import com.amazon.android.webkit.AmazonWebSettings; +import com.amazon.android.webkit.AmazonWebStorage; +import com.amazon.android.webkit.AmazonWebView; +import com.amazon.android.webkit.AmazonWebViewClient; +import com.amazon.android.webkit.AmazonCookieManager; +import android.widget.Button; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; + +import org.apache.cordova.CallbackContext; +import org.apache.cordova.Config; +import org.apache.cordova.CordovaArgs; +import org.apache.cordova.CordovaPlugin; +import org.apache.cordova.CordovaWebView; +import org.apache.cordova.LOG; +import org.apache.cordova.PluginResult; +import org.apache.cordova.CordovaActivity; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.HashMap; +import java.util.StringTokenizer; + +@SuppressLint("SetJavaScriptEnabled") +public class InAppBrowser extends CordovaPlugin { + + private static final String NULL = "null"; + protected static final String LOG_TAG = "InAppBrowser"; + private static final String SELF = "_self"; + private static final String SYSTEM = "_system"; + // private static final String BLANK = "_blank"; + private static final String EXIT_EVENT = "exit"; + private static final String LOCATION = "location"; + private static final String HIDDEN = "hidden"; + private static final String LOAD_START_EVENT = "loadstart"; + private static final String LOAD_STOP_EVENT = "loadstop"; + private static final String LOAD_ERROR_EVENT = "loaderror"; + private static final String CLOSE_BUTTON_CAPTION = "closebuttoncaption"; + private static final String CLEAR_ALL_CACHE = "clearcache"; + private static final String CLEAR_SESSION_CACHE = "clearsessioncache"; + + private Dialog dialog; + private AmazonWebView inAppWebView; + private EditText edittext; + private CallbackContext callbackContext; + private boolean showLocationBar = true; + private boolean openWindowHidden = false; + private String buttonLabel = "Done"; + private boolean clearAllCache= false; + private boolean clearSessionCache=false; + + /** + * Executes the request and returns PluginResult. + * + * @param action The action to execute. + * @param args JSONArry of arguments for the plugin. + * @param callbackId The callback id used when calling back into JavaScript. + * @return A PluginResult object with a status and message. + */ + public boolean execute(String action, CordovaArgs args, final CallbackContext callbackContext) throws JSONException { + if (action.equals("open")) { + this.callbackContext = callbackContext; + final String url = args.getString(0); + String t = args.optString(1); + if (t == null || t.equals("") || t.equals(NULL)) { + t = SELF; + } + final String target = t; + final HashMap features = parseFeature(args.optString(2)); + + Log.d(LOG_TAG, "target = " + target); + + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + String result = ""; + // SELF + if (SELF.equals(target)) { + Log.d(LOG_TAG, "in self"); + // load in webview + if (url.startsWith("file://") || url.startsWith("javascript:") + || Config.isUrlWhiteListed(url)) { + webView.loadUrl(url); + } + //Load the dialer + else if (url.startsWith(AmazonWebView.SCHEME_TEL)) + { + try { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse(url)); + cordova.getActivity().startActivity(intent); + } catch (android.content.ActivityNotFoundException e) { + LOG.e(LOG_TAG, "Error dialing " + url + ": " + e.toString()); + } + } + // load in InAppBrowser + else { + result = showWebPage(url, features); + } + } + // SYSTEM + else if (SYSTEM.equals(target)) { + Log.d(LOG_TAG, "in system"); + result = openExternal(url); + } + // BLANK - or anything else + else { + Log.d(LOG_TAG, "in blank"); + result = showWebPage(url, features); + } + + PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, result); + pluginResult.setKeepCallback(true); + callbackContext.sendPluginResult(pluginResult); + } + }); + } + else if (action.equals("close")) { + closeDialog(); + } + else if (action.equals("injectScriptCode")) { + String jsWrapper = null; + if (args.getBoolean(1)) { + jsWrapper = String.format("prompt(JSON.stringify([eval(%%s)]), 'gap-iab://%s')", callbackContext.getCallbackId()); + } + injectDeferredObject(args.getString(0), jsWrapper); + } + else if (action.equals("injectScriptFile")) { + String jsWrapper; + if (args.getBoolean(1)) { + jsWrapper = String.format("(function(d) { var c = d.createElement('script'); c.src = %%s; c.onload = function() { prompt('', 'gap-iab://%s'); }; d.body.appendChild(c); })(document)", callbackContext.getCallbackId()); + } else { + jsWrapper = "(function(d) { var c = d.createElement('script'); c.src = %s; d.body.appendChild(c); })(document)"; + } + injectDeferredObject(args.getString(0), jsWrapper); + } + else if (action.equals("injectStyleCode")) { + String jsWrapper; + if (args.getBoolean(1)) { + jsWrapper = String.format("(function(d) { var c = d.createElement('style'); c.innerHTML = %%s; d.body.appendChild(c); prompt('', 'gap-iab://%s');})(document)", callbackContext.getCallbackId()); + } else { + jsWrapper = "(function(d) { var c = d.createElement('style'); c.innerHTML = %s; d.body.appendChild(c); })(document)"; + } + injectDeferredObject(args.getString(0), jsWrapper); + } + else if (action.equals("injectStyleFile")) { + String jsWrapper; + if (args.getBoolean(1)) { + jsWrapper = String.format("(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %%s; d.head.appendChild(c); prompt('', 'gap-iab://%s');})(document)", callbackContext.getCallbackId()); + } else { + jsWrapper = "(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %s; d.head.appendChild(c); })(document)"; + } + injectDeferredObject(args.getString(0), jsWrapper); + } + else if (action.equals("show")) { + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + dialog.show(); + } + }); + PluginResult pluginResult = new PluginResult(PluginResult.Status.OK); + pluginResult.setKeepCallback(true); + this.callbackContext.sendPluginResult(pluginResult); + } + else { + return false; + } + return true; + } + + /** + * Called when the view navigates. + */ + @Override + public void onReset() { + closeDialog(); + } + + /** + * Called by AccelBroker when listener is to be shut down. + * Stop listener. + */ + public void onDestroy() { + closeDialog(); + } + + /** + * Inject an object (script or style) into the InAppBrowser AmazonWebView. + * + * This is a helper method for the inject{Script|Style}{Code|File} API calls, which + * provides a consistent method for injecting JavaScript code into the document. + * + * If a wrapper string is supplied, then the source string will be JSON-encoded (adding + * quotes) and wrapped using string formatting. (The wrapper string should have a single + * '%s' marker) + * + * @param source The source object (filename or script/style text) to inject into + * the document. + * @param jsWrapper A JavaScript string to wrap the source string in, so that the object + * is properly injected, or null if the source string is JavaScript text + * which should be executed directly. + */ + private void injectDeferredObject(String source, String jsWrapper) { + final String scriptToInject; + if (jsWrapper != null) { + org.json.JSONArray jsonEsc = new org.json.JSONArray(); + jsonEsc.put(source); + String jsonRepr = jsonEsc.toString(); + String jsonSourceString = jsonRepr.substring(1, jsonRepr.length()-1); + scriptToInject = String.format(jsWrapper, jsonSourceString); + } else { + scriptToInject = source; + } + final String finalScriptToInject = scriptToInject; + // This action will have the side-effect of blurring the currently focused element + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + inAppWebView.loadUrl("javascript:" + finalScriptToInject); + } + }); + } + + /** + * Put the list of features into a hash map + * + * @param optString + * @return + */ + private HashMap parseFeature(String optString) { + if (optString.equals(NULL)) { + return null; + } else { + HashMap map = new HashMap(); + StringTokenizer features = new StringTokenizer(optString, ","); + StringTokenizer option; + while(features.hasMoreElements()) { + option = new StringTokenizer(features.nextToken(), "="); + if (option.hasMoreElements()) { + String key = option.nextToken(); + if (key.equalsIgnoreCase(CLOSE_BUTTON_CAPTION)) { + this.buttonLabel = option.nextToken(); + } else { + Boolean value = option.nextToken().equals("no") ? Boolean.FALSE : Boolean.TRUE; + map.put(key, value); + } + } + } + return map; + } + } + + /** + * Display a new browser with the specified URL. + * + * @param url The url to load. + * @param usePhoneGap Load url in PhoneGap webview + * @return "" if ok, or error message. + */ + public String openExternal(String url) { + try { + Intent intent = null; + intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse(url)); + this.cordova.getActivity().startActivity(intent); + return ""; + } catch (android.content.ActivityNotFoundException e) { + Log.d(LOG_TAG, "InAppBrowser: Error loading url "+url+":"+ e.toString()); + return e.toString(); + } + } + + /** + * Closes the dialog + */ + public void closeDialog() { + this.cordova.getActivity().runOnUiThread(new Runnable() { + public void run() { + if (dialog != null) { + dialog.dismiss(); + } + } + }); + + } + + /** + * Checks to see if it is possible to go back one page in history, then does so. + */ + private void goBack() { + this.cordova.getActivity().runOnUiThread(new Runnable() { + public void run() { + if (InAppBrowser.this.inAppWebView.canGoBack()) { + InAppBrowser.this.inAppWebView.goBack(); + } + } + }); + } + + /** + * Checks to see if it is possible to go forward one page in history, then does so. + */ + private void goForward() { + this.cordova.getActivity().runOnUiThread(new Runnable() { + public void run() { + if (InAppBrowser.this.inAppWebView.canGoForward()) { + InAppBrowser.this.inAppWebView.goForward(); + } + } + }); + } + + /** + * Navigate to the new page + * + * @param url to load + */ + private void navigate(final String url) { + InputMethodManager imm = (InputMethodManager)this.cordova.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(edittext.getWindowToken(), 0); + + this.cordova.getActivity().runOnUiThread(new Runnable() { + public void run() { + if (!url.startsWith("http") && !url.startsWith("file:")) { + InAppBrowser.this.inAppWebView.loadUrl("http://" + url); + } else { + InAppBrowser.this.inAppWebView.loadUrl(url); + } + InAppBrowser.this.inAppWebView.requestFocus(); + } + }); + } + + + /** + * Should we show the location bar? + * + * @return boolean + */ + private boolean getShowLocationBar() { + return this.showLocationBar; + } + + /** + * Display a new browser with the specified URL. + * + * @param url The url to load. + * @param jsonObject + */ + public String showWebPage(final String url, HashMap features) { + // Determine if we should hide the location bar. + showLocationBar = true; + openWindowHidden = false; + if (features != null) { + Boolean show = features.get(LOCATION); + if (show != null) { + showLocationBar = show.booleanValue(); + } + Boolean hidden = features.get(HIDDEN); + if (hidden != null) { + openWindowHidden = hidden.booleanValue(); + } + Boolean cache = features.get(CLEAR_ALL_CACHE); + if (cache != null) { + clearAllCache = cache.booleanValue(); + } else { + cache = features.get(CLEAR_SESSION_CACHE); + if (cache != null) { + clearSessionCache = cache.booleanValue(); + } + } + } + + final CordovaWebView thatWebView = this.webView; + + // Create dialog in new thread + Runnable runnable = new Runnable() { + /** + * Convert our DIP units to Pixels + * + * @return int + */ + private int dpToPixels(int dipValue) { + int value = (int) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, + (float) dipValue, + cordova.getActivity().getResources().getDisplayMetrics() + ); + + return value; + } + + public void run() { + // Let's create the main dialog + dialog = new Dialog(cordova.getActivity(), android.R.style.Theme_NoTitleBar); + dialog.getWindow().getAttributes().windowAnimations = android.R.style.Animation_Dialog; + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); + dialog.setCancelable(true); + dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { + public void onDismiss(DialogInterface dialog) { + closeDialog(); + } + }); + + // Main container layout + LinearLayout main = new LinearLayout(cordova.getActivity()); + main.setOrientation(LinearLayout.VERTICAL); + + // Toolbar layout + RelativeLayout toolbar = new RelativeLayout(cordova.getActivity()); + //Please, no more black! + toolbar.setBackgroundColor(android.graphics.Color.LTGRAY); + toolbar.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, this.dpToPixels(44))); + toolbar.setPadding(this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2)); + toolbar.setHorizontalGravity(Gravity.LEFT); + toolbar.setVerticalGravity(Gravity.TOP); + + // Action Button Container layout + RelativeLayout actionButtonContainer = new RelativeLayout(cordova.getActivity()); + actionButtonContainer.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); + actionButtonContainer.setHorizontalGravity(Gravity.LEFT); + actionButtonContainer.setVerticalGravity(Gravity.CENTER_VERTICAL); + actionButtonContainer.setId(1); + + // Back button + Button back = new Button(cordova.getActivity()); + RelativeLayout.LayoutParams backLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); + backLayoutParams.addRule(RelativeLayout.ALIGN_LEFT); + back.setLayoutParams(backLayoutParams); + back.setContentDescription("Back Button"); + back.setId(2); + back.setText("<"); + back.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + goBack(); + } + }); + + // Forward button + Button forward = new Button(cordova.getActivity()); + RelativeLayout.LayoutParams forwardLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); + forwardLayoutParams.addRule(RelativeLayout.RIGHT_OF, 2); + forward.setLayoutParams(forwardLayoutParams); + forward.setContentDescription("Forward Button"); + forward.setId(3); + forward.setText(">"); + forward.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + goForward(); + } + }); + + // Edit Text Box + edittext = new EditText(cordova.getActivity()); + RelativeLayout.LayoutParams textLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); + textLayoutParams.addRule(RelativeLayout.RIGHT_OF, 1); + textLayoutParams.addRule(RelativeLayout.LEFT_OF, 5); + edittext.setLayoutParams(textLayoutParams); + edittext.setId(4); + edittext.setSingleLine(true); + edittext.setText(url); + edittext.setInputType(InputType.TYPE_TEXT_VARIATION_URI); + edittext.setImeOptions(EditorInfo.IME_ACTION_GO); + edittext.setInputType(InputType.TYPE_NULL); // Will not except input... Makes the text NON-EDITABLE + edittext.setOnKeyListener(new View.OnKeyListener() { + public boolean onKey(View v, int keyCode, KeyEvent event) { + // If the event is a key-down event on the "enter" button + if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { + navigate(edittext.getText().toString()); + return true; + } + return false; + } + }); + + // Close button + Button close = new Button(cordova.getActivity()); + RelativeLayout.LayoutParams closeLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); + closeLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); + close.setLayoutParams(closeLayoutParams); + forward.setContentDescription("Close Button"); + close.setId(5); + close.setText(buttonLabel); + close.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + closeDialog(); + } + }); + + // WebView + inAppWebView = new AmazonWebView(cordova.getActivity()); + + CordovaActivity app = (CordovaActivity) cordova.getActivity(); + cordova.getFactory().initializeWebView(inAppWebView, 0x00FF00, false, null); + + inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); + inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView)); + AmazonWebViewClient client = new InAppBrowserClient(thatWebView, edittext); + inAppWebView.setWebViewClient(client); + AmazonWebSettings settings = inAppWebView.getSettings(); + settings.setJavaScriptEnabled(true); + settings.setJavaScriptCanOpenWindowsAutomatically(true); + settings.setBuiltInZoomControls(true); + settings.setPluginState(com.amazon.android.webkit.AmazonWebSettings.PluginState.ON); + + //Toggle whether this is enabled or not! + Bundle appSettings = cordova.getActivity().getIntent().getExtras(); + boolean enableDatabase = appSettings == null ? true : appSettings.getBoolean("InAppBrowserStorageEnabled", true); + if (enableDatabase) { + String databasePath = cordova.getActivity().getApplicationContext().getDir("inAppBrowserDB", Context.MODE_PRIVATE).getPath(); + settings.setDatabasePath(databasePath); + settings.setDatabaseEnabled(true); + } + settings.setDomStorageEnabled(true); + + if (clearAllCache) { + AmazonCookieManager.getInstance().removeAllCookie(); + } else if (clearSessionCache) { + AmazonCookieManager.getInstance().removeSessionCookie(); + } + + inAppWebView.loadUrl(url); + inAppWebView.setId(6); + inAppWebView.getSettings().setLoadWithOverviewMode(true); + inAppWebView.getSettings().setUseWideViewPort(true); + inAppWebView.requestFocus(); + inAppWebView.requestFocusFromTouch(); + + // Add the back and forward buttons to our action button container layout + actionButtonContainer.addView(back); + actionButtonContainer.addView(forward); + + // Add the views to our toolbar + toolbar.addView(actionButtonContainer); + toolbar.addView(edittext); + toolbar.addView(close); + + // Don't add the toolbar if its been disabled + if (getShowLocationBar()) { + // Add our toolbar to our main view/layout + main.addView(toolbar); + } + + // Add our webview to our main view/layout + main.addView(inAppWebView); + + WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); + lp.copyFrom(dialog.getWindow().getAttributes()); + lp.width = WindowManager.LayoutParams.MATCH_PARENT; + lp.height = WindowManager.LayoutParams.MATCH_PARENT; + + dialog.setContentView(main); + dialog.show(); + dialog.getWindow().setAttributes(lp); + // the goal of openhidden is to load the url and not display it + // Show() needs to be called to cause the URL to be loaded + if(openWindowHidden) { + dialog.hide(); + } + } + }; + this.cordova.getActivity().runOnUiThread(runnable); + return ""; + } + + /** + * Create a new plugin success result and send it back to JavaScript + * + * @param obj a JSONObject contain event payload information + */ + private void sendUpdate(JSONObject obj, boolean keepCallback) { + sendUpdate(obj, keepCallback, PluginResult.Status.OK); + } + + /** + * Create a new plugin result and send it back to JavaScript + * + * @param obj a JSONObject contain event payload information + * @param status the status code to return to the JavaScript environment + */ + private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Status status) { + if (callbackContext != null) { + PluginResult result = new PluginResult(status, obj); + result.setKeepCallback(keepCallback); + callbackContext.sendPluginResult(result); + if (!keepCallback) { + callbackContext = null; + } + } + } + + + + /** + * The webview client receives notifications about appView + */ + public class InAppBrowserClient extends AmazonWebViewClient { + EditText edittext; + CordovaWebView webView; + + /** + * Constructor. + * + * @param mContext + * @param edittext + */ + public InAppBrowserClient(CordovaWebView webView, EditText mEditText) { + this.webView = webView; + this.edittext = mEditText; + } + + /** + * Notify the host application that a page has started loading. + * + * @param view The webview initiating the callback. + * @param url The url of the page. + */ + @Override + public void onPageStarted(AmazonWebView view, String url, Bitmap favicon) { + super.onPageStarted(view, url, favicon); + String newloc = ""; + if (url.startsWith("http:") || url.startsWith("https:") || url.startsWith("file:")) { + newloc = url; + } + // If dialing phone (tel:5551212) + else if (url.startsWith(AmazonWebView.SCHEME_TEL)) { + try { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse(url)); + cordova.getActivity().startActivity(intent); + } catch (android.content.ActivityNotFoundException e) { + LOG.e(LOG_TAG, "Error dialing " + url + ": " + e.toString()); + } + } + + else if (url.startsWith("geo:") || url.startsWith(AmazonWebView.SCHEME_MAILTO) || url.startsWith("market:")) { + try { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse(url)); + cordova.getActivity().startActivity(intent); + } catch (android.content.ActivityNotFoundException e) { + LOG.e(LOG_TAG, "Error with " + url + ": " + e.toString()); + } + } + // If sms:5551212?body=This is the message + else if (url.startsWith("sms:")) { + try { + Intent intent = new Intent(Intent.ACTION_VIEW); + + // Get address + String address = null; + int parmIndex = url.indexOf('?'); + if (parmIndex == -1) { + address = url.substring(4); + } + else { + address = url.substring(4, parmIndex); + + // If body, then set sms body + Uri uri = Uri.parse(url); + String query = uri.getQuery(); + if (query != null) { + if (query.startsWith("body=")) { + intent.putExtra("sms_body", query.substring(5)); + } + } + } + intent.setData(Uri.parse("sms:" + address)); + intent.putExtra("address", address); + intent.setType("vnd.android-dir/mms-sms"); + cordova.getActivity().startActivity(intent); + } catch (android.content.ActivityNotFoundException e) { + LOG.e(LOG_TAG, "Error sending sms " + url + ":" + e.toString()); + } + } + else { + newloc = "http://" + url; + } + + if (!newloc.equals(edittext.getText().toString())) { + edittext.setText(newloc); + } + + try { + JSONObject obj = new JSONObject(); + obj.put("type", LOAD_START_EVENT); + obj.put("url", newloc); + + sendUpdate(obj, true); + } catch (JSONException ex) { + Log.d(LOG_TAG, "Should never happen"); + } + } + + public void onPageFinished(AmazonWebView view, String url) { + super.onPageFinished(view, url); + + try { + JSONObject obj = new JSONObject(); + obj.put("type", LOAD_STOP_EVENT); + obj.put("url", url); + + sendUpdate(obj, true); + } catch (JSONException ex) { + Log.d(LOG_TAG, "Should never happen"); + } + } + + public void onReceivedError(AmazonWebView view, int errorCode, String description, String failingUrl) { + super.onReceivedError(view, errorCode, description, failingUrl); + + try { + JSONObject obj = new JSONObject(); + obj.put("type", LOAD_ERROR_EVENT); + obj.put("url", failingUrl); + obj.put("code", errorCode); + obj.put("message", description); + + sendUpdate(obj, true, PluginResult.Status.ERROR); + } catch (JSONException ex) { + Log.d(LOG_TAG, "Should never happen"); + } + + } + } +} diff --git a/src/amazon/InAppChromeClient.java b/src/amazon/InAppChromeClient.java new file mode 100644 index 0000000..7f2ddc3 --- /dev/null +++ b/src/amazon/InAppChromeClient.java @@ -0,0 +1,128 @@ +package org.apache.cordova.inappbrowser; + +import org.apache.cordova.CordovaWebView; +import org.apache.cordova.LOG; +import org.apache.cordova.PluginResult; +import org.json.JSONArray; +import org.json.JSONException; + +import com.amazon.android.webkit.AmazonWebChromeClient; +import com.amazon.android.webkit.AmazonGeolocationPermissions.Callback; +import com.amazon.android.webkit.AmazonJsPromptResult; +import com.amazon.android.webkit.AmazonWebStorage; +import com.amazon.android.webkit.AmazonWebView; +import com.amazon.android.webkit.AmazonWebViewClient; + +public class InAppChromeClient extends AmazonWebChromeClient { + + private CordovaWebView webView; + private String LOG_TAG = "InAppChromeClient"; + private long MAX_QUOTA = 100 * 1024 * 1024; + + public InAppChromeClient(CordovaWebView webView) { + super(); + this.webView = webView; + } + /** + * Handle database quota exceeded notification. + * + * @param url + * @param databaseIdentifier + * @param currentQuota + * @param estimatedSize + * @param totalUsedQuota + * @param quotaUpdater + */ + @Override + public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize, + long totalUsedQuota, AmazonWebStorage.QuotaUpdater quotaUpdater) + { + LOG.d(LOG_TAG, "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota); + + if (estimatedSize < MAX_QUOTA) + { + //increase for 1Mb + long newQuota = estimatedSize; + LOG.d(LOG_TAG, "calling quotaUpdater.updateQuota newQuota: %d", newQuota); + quotaUpdater.updateQuota(newQuota); + } + else + { + // Set the quota to whatever it is and force an error + // TODO: get docs on how to handle this properly + quotaUpdater.updateQuota(currentQuota); + } + } + + /** + * Instructs the client to show a prompt to ask the user to set the Geolocation permission state for the specified origin. + * + * @param origin + * @param callback + */ + @Override + public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) { + super.onGeolocationPermissionsShowPrompt(origin, callback); + callback.invoke(origin, true, false); + } + + /** + * Tell the client to display a prompt dialog to the user. + * If the client returns true, WebView will assume that the client will + * handle the prompt dialog and call the appropriate JsPromptResult method. + * + * The prompt bridge provided for the InAppBrowser is capable of executing any + * oustanding callback belonging to the InAppBrowser plugin. Care has been + * taken that other callbacks cannot be triggered, and that no other code + * execution is possible. + * + * To trigger the bridge, the prompt default value should be of the form: + * + * gap-iab:// + * + * where is the string id of the callback to trigger (something + * like "InAppBrowser0123456789") + * + * If present, the prompt message is expected to be a JSON-encoded value to + * pass to the callback. A JSON_EXCEPTION is returned if the JSON is invalid. + * + * @param view + * @param url + * @param message + * @param defaultValue + * @param result + */ + @Override + public boolean onJsPrompt(AmazonWebView view, String url, String message, String defaultValue, AmazonJsPromptResult result) { + // See if the prompt string uses the 'gap-iab' protocol. If so, the remainder should be the id of a callback to execute. + if (defaultValue != null && defaultValue.startsWith("gap")) { + if(defaultValue.startsWith("gap-iab://")) { + PluginResult scriptResult; + String scriptCallbackId = defaultValue.substring(10); + if (scriptCallbackId.startsWith("InAppBrowser")) { + if(message == null || message.length() == 0) { + scriptResult = new PluginResult(PluginResult.Status.OK, new JSONArray()); + } else { + try { + scriptResult = new PluginResult(PluginResult.Status.OK, new JSONArray(message)); + } catch(JSONException e) { + scriptResult = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage()); + } + } + this.webView.sendPluginResult(scriptResult, scriptCallbackId); + result.confirm(""); + return true; + } + } + else + { + // Anything else with a gap: prefix should get this message + LOG.w(LOG_TAG, "InAppBrowser does not support Cordova API calls: " + url + " " + defaultValue); + result.cancel(); + return true; + } + } + return false; + } + +} diff --git a/test/cordova-incl.js b/test/cordova-incl.js index dbcd1a6..bc1dd7a 100644 --- a/test/cordova-incl.js +++ b/test/cordova-incl.js @@ -20,7 +20,9 @@ */ var PLAT; -if (/Android/.exec(navigator.userAgent)) { +if (/cordova-amazon-fireos/.exec(navigator.userAgent)) { + PLAT = 'amazon-fireos'; +}else if (/Android/.exec(navigator.userAgent)) { PLAT = 'android'; } else if (/(iPad)|(iPhone)|(iPod)/.exec(navigator.userAgent)) { PLAT = 'ios'; @@ -61,7 +63,7 @@ if (!window._doNotWriteCordovaScript) { } function backHome() { - if (window.device && device.platform && device.platform.toLowerCase() == 'android') { + if (window.device && device.platform && (device.platform.toLowerCase() == 'android' || device.platform.toLowerCase() == 'amazon-fireos')) { navigator.app.backHistory(); } else { From 9768ec2ef0154aeba71a7de68b5e57feffc00836 Mon Sep 17 00:00:00 2001 From: Jesse MacFadyen Date: Mon, 2 Dec 2013 17:50:57 -0800 Subject: [PATCH 016/106] CB-3420 WP feature hidden=yes implemented --- src/wp/InAppBrowser.cs | 135 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 133 insertions(+), 2 deletions(-) diff --git a/src/wp/InAppBrowser.cs b/src/wp/InAppBrowser.cs index 46e1384..4b3d18d 100644 --- a/src/wp/InAppBrowser.cs +++ b/src/wp/InAppBrowser.cs @@ -36,12 +36,45 @@ namespace WPCordovaClassLib.Cordova.Commands private static ApplicationBarIconButton backButton; private static ApplicationBarIconButton fwdButton; + protected ApplicationBar AppBar; + + protected bool ShowLocation {get;set;} + protected bool StartHidden {get;set;} + public void open(string options) { + // reset defaults on ShowLocation + StartHidden features + ShowLocation = true; + StartHidden = false; + string[] args = JSON.JsonHelper.Deserialize(options); //BrowserOptions opts = JSON.JsonHelper.Deserialize(options); string urlLoc = args[0]; string target = args[1]; + string featString = args[2]; + + string[] features = featString.Split(','); + foreach (string str in features) + { + try + { + string[] split = str.Split('='); + switch (split[0]) + { + case "location": + ShowLocation = split[1].ToLower().StartsWith("yes"); + break; + case "hidden": + StartHidden = split[1].ToLower().StartsWith("yes"); + break; + } + } + catch(Exception) + { + // some sort of invalid param was passed, moving on ... + } + + } /* _self - opens in the Cordova WebView if url is in the white-list, else it opens in the InAppBrowser _blank - always open in the InAppBrowser @@ -59,10 +92,99 @@ namespace WPCordovaClassLib.Cordova.Commands ShowSystemBrowser(urlLoc); break; } - - } + public void show(string options) + { + string[] args = JSON.JsonHelper.Deserialize(options); + + + if (browser != null) + { + Deployment.Current.Dispatcher.BeginInvoke(() => + { + browser.Visibility = Visibility.Visible; + AppBar.IsVisible = true; + }); + } + } + + public void injectScriptCode(string options) + { + string[] args = JSON.JsonHelper.Deserialize(options); + + bool bCallback = false; + if (bool.TryParse(args[1], out bCallback)) { }; + + string callbackId = args[2]; + + if (browser != null) + { + Deployment.Current.Dispatcher.BeginInvoke(() => + { + var res = browser.InvokeScript("eval", new string[] { args[0] }); + + if (bCallback) + { + PluginResult result = new PluginResult(PluginResult.Status.OK, res.ToString()); + result.KeepCallback = false; + this.DispatchCommandResult(result); + } + + }); + } + } + + public void injectScriptFile(string options) + { + Debug.WriteLine("Error : Windows Phone org.apache.cordova.inappbrowser does not currently support executeScript"); + string[] args = JSON.JsonHelper.Deserialize(options); + // throw new NotImplementedException("Windows Phone does not currently support 'executeScript'"); + } + + public void injectStyleCode(string options) + { + Debug.WriteLine("Error : Windows Phone org.apache.cordova.inappbrowser does not currently support insertCSS"); + return; + + //string[] args = JSON.JsonHelper.Deserialize(options); + //bool bCallback = false; + //if (bool.TryParse(args[1], out bCallback)) { }; + + //string callbackId = args[2]; + + //if (browser != null) + //{ + //Deployment.Current.Dispatcher.BeginInvoke(() => + //{ + // if (bCallback) + // { + // string cssInsertString = "try{(function(doc){var c = ''; doc.head.innerHTML += c;})(document);}catch(ex){alert('oops : ' + ex.message);}"; + // //cssInsertString = cssInsertString.Replace("_VALUE_", args[0]); + // Debug.WriteLine("cssInsertString = " + cssInsertString); + // var res = browser.InvokeScript("eval", new string[] { cssInsertString }); + // if (bCallback) + // { + // PluginResult result = new PluginResult(PluginResult.Status.OK, res.ToString()); + // result.KeepCallback = false; + // this.DispatchCommandResult(result); + // } + // } + + //}); + //} + } + + public void injectStyleFile(string options) + { + Debug.WriteLine("Error : Windows Phone org.apache.cordova.inappbrowser does not currently support insertCSS"); + return; + + //string[] args = JSON.JsonHelper.Deserialize(options); + //throw new NotImplementedException("Windows Phone does not currently support 'insertCSS'"); + } + + private void ShowCordovaBrowser(string url) { Uri loc = new Uri(url, UriKind.RelativeOrAbsolute); @@ -127,6 +249,12 @@ namespace WPCordovaClassLib.Cordova.Commands browser.NavigationFailed += new System.Windows.Navigation.NavigationFailedEventHandler(browser_NavigationFailed); browser.Navigated += new EventHandler(browser_Navigated); browser.Navigate(loc); + + if (StartHidden) + { + browser.Visibility = Visibility.Collapsed; + } + //browser.IsGeolocationEnabled = opts.isGeolocationEnabled; grid.Children.Add(browser); } @@ -156,6 +284,9 @@ namespace WPCordovaClassLib.Cordova.Commands bar.Buttons.Add(closeBtn); page.ApplicationBar = bar; + bar.IsVisible = !StartHidden; + AppBar = bar; + } } From 65ee3d142fa04381c455bfab7514f326f083e553 Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Mon, 2 Dec 2013 20:51:57 -0500 Subject: [PATCH 017/106] Remove merge conflict tag --- plugin.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index e656ee7..8975a59 100644 --- a/plugin.xml +++ b/plugin.xml @@ -30,7 +30,6 @@ -<<<<<<< HEAD From 496ecc720f488d10fbdfec4459741c3318b3ce58 Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Wed, 4 Dec 2013 15:16:31 -0800 Subject: [PATCH 018/106] [CB-5565] Updated version and RELEASENOTES.md for release 0.2.5 --- RELEASENOTES.md | 8 +++++++- plugin.xml | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 5ad2e29..3f7957d 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -48,4 +48,10 @@ * CB-3747 Fix back button having different dismiss logic from the close button. * CB-5021 Expose closeDialog() as a public function and make it safe to call multiple times. * CB-5021 Make it safe to call close() multiple times ->>>>>>> dev + +### 0.2.5 (Dec 4, 2013) +* Remove merge conflict tag +* [CB-4724] fixed UriFormatException +* add ubuntu platform +* CB-3420 WP feature hidden=yes implemented +* Added amazon-fireos platform. Change to use amazon-fireos as the platform if user agent string contains 'cordova-amazon-fireos' diff --git a/plugin.xml b/plugin.xml index 8975a59..bb52218 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.2.5"> InAppBrowser Cordova InAppBrowser Plugin From ea239151d22db548efec3d508227910235c093d8 Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Wed, 4 Dec 2013 15:32:03 -0800 Subject: [PATCH 019/106] [CB-5565] Incremented plugin version on dev branch. --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index bb52218..1bf16a0 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.2.6-dev"> InAppBrowser Cordova InAppBrowser Plugin From f448ce88abae9a690f9242b88a7550b1a3530ffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fco=2E=20Javier=20Mart=C3=ADn=20Carrasco?= Date: Wed, 2 Oct 2013 11:00:46 +0200 Subject: [PATCH 020/106] CB-5591 Change window.escape to encodeURIComponent escape is for JS, encodeURIComponent is for URLs. This is a URL. --- src/ios/CDVInAppBrowser.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 4ef051f..3f158ca 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -235,7 +235,7 @@ NSString* jsWrapper = nil; if ((command.callbackId != nil) && ![command.callbackId isEqualToString:@"INVALID"]) { - jsWrapper = [NSString stringWithFormat:@"_cdvIframeBridge.src='gap-iab://%@/'+window.escape(JSON.stringify([eval(%%@)]));", command.callbackId]; + jsWrapper = [NSString stringWithFormat:@"_cdvIframeBridge.src='gap-iab://%@/'+encodeURIComponent(JSON.stringify([eval(%%@)]));", command.callbackId]; } [self injectDeferredObject:[command argumentAtIndex:0] withWrapper:jsWrapper]; } From 034b59931588e3bc5869ff7677e5307660b68feb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Fejfar?= Date: Fri, 8 Nov 2013 17:32:32 +0100 Subject: [PATCH 021/106] CB-5593 iOS: Make InAppBrowser localizable Wrapping all UI strings in NSLocalizedString macro --- src/ios/CDVInAppBrowser.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 3f158ca..9839ccc 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -487,17 +487,17 @@ self.addressLabel.numberOfLines = 1; self.addressLabel.opaque = NO; self.addressLabel.shadowOffset = CGSizeMake(0.0, -1.0); - self.addressLabel.text = @"Loading..."; + self.addressLabel.text = NSLocalizedString(@"Loading...", nil); self.addressLabel.textAlignment = UITextAlignmentLeft; self.addressLabel.textColor = [UIColor colorWithWhite:1.000 alpha:1.000]; self.addressLabel.userInteractionEnabled = NO; - NSString* frontArrowString = @"►"; // create arrow from Unicode char + NSString* frontArrowString = NSLocalizedString(@"►", nil); // create arrow from Unicode char self.forwardButton = [[UIBarButtonItem alloc] initWithTitle:frontArrowString style:UIBarButtonItemStylePlain target:self action:@selector(goForward:)]; self.forwardButton.enabled = YES; self.forwardButton.imageInsets = UIEdgeInsetsZero; - NSString* backArrowString = @"◄"; // create arrow from Unicode char + NSString* backArrowString = NSLocalizedString(@"◄", nil); // create arrow from Unicode char self.backButton = [[UIBarButtonItem alloc] initWithTitle:backArrowString style:UIBarButtonItemStylePlain target:self action:@selector(goBack:)]; self.backButton.enabled = YES; self.backButton.imageInsets = UIEdgeInsetsZero; @@ -713,7 +713,7 @@ { // loading url, start spinner, update back/forward - self.addressLabel.text = @"Loading..."; + self.addressLabel.text = NSLocalizedString(@"Loading...", nil); self.backButton.enabled = theWebView.canGoBack; self.forwardButton.enabled = theWebView.canGoForward; @@ -770,7 +770,7 @@ self.forwardButton.enabled = theWebView.canGoForward; [self.spinner stopAnimating]; - self.addressLabel.text = @"Load Error"; + self.addressLabel.text = NSLocalizedString(@"Load Error", nil); [self.navigationDelegate webView:theWebView didFailLoadWithError:error]; } From e819041fd411d728c635a122f404ba6184fea640 Mon Sep 17 00:00:00 2001 From: Dick van den Brink Date: Mon, 11 Nov 2013 18:32:39 +0100 Subject: [PATCH 022/106] Apply CB-5193 to InAppBrowser From pull request: https://github.com/apache/cordova-plugin-inappbrowser/pull/11 --- src/android/InAppChromeClient.java | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/android/InAppChromeClient.java b/src/android/InAppChromeClient.java index 2c240c6..f3fc741 100644 --- a/src/android/InAppChromeClient.java +++ b/src/android/InAppChromeClient.java @@ -38,20 +38,7 @@ public class InAppChromeClient extends WebChromeClient { long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater) { LOG.d(LOG_TAG, "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota); - - if (estimatedSize < MAX_QUOTA) - { - //increase for 1Mb - long newQuota = estimatedSize; - LOG.d(LOG_TAG, "calling quotaUpdater.updateQuota newQuota: %d", newQuota); - quotaUpdater.updateQuota(newQuota); - } - else - { - // Set the quota to whatever it is and force an error - // TODO: get docs on how to handle this properly - quotaUpdater.updateQuota(currentQuota); - } + quotaUpdater.updateQuota(MAX_QUOTA); } /** From 20611efe67ae0ed78db21d4224069d54f00c6fda Mon Sep 17 00:00:00 2001 From: Peter Somogyvari Date: Mon, 18 Nov 2013 15:00:25 +0000 Subject: [PATCH 023/106] CB-5595 Add toolbarposition=top option. The position of the toolbar is now configurable, it can be specified on the caller's side. The possible values are top and bottom and the key for the setting is toolbarposition. Also extended the logging of the web view's load errors, it now logs the error code too, not just the localized description of the error that occured. Added the browserOptions to the init method's parameters in order to make it conveniently accessible from the ViewController. --- src/ios/CDVInAppBrowser.h | 48 +++++++++++----------- src/ios/CDVInAppBrowser.m | 86 ++++++++++++++++++++++++--------------- 2 files changed, 79 insertions(+), 55 deletions(-) diff --git a/src/ios/CDVInAppBrowser.h b/src/ios/CDVInAppBrowser.h index 059edb0..b506b1f 100644 --- a/src/ios/CDVInAppBrowser.h +++ b/src/ios/CDVInAppBrowser.h @@ -38,11 +38,33 @@ @end +@interface CDVInAppBrowserOptions : NSObject {} + +@property (nonatomic, assign) BOOL location; +@property (nonatomic, assign) BOOL toolbar; +@property (nonatomic, copy) NSString* closebuttoncaption; +@property (nonatomic, copy) NSString* toolbarbarposition; + +@property (nonatomic, copy) NSString* presentationstyle; +@property (nonatomic, copy) NSString* transitionstyle; + +@property (nonatomic, assign) BOOL enableviewportscale; +@property (nonatomic, assign) BOOL mediaplaybackrequiresuseraction; +@property (nonatomic, assign) BOOL allowinlinemediaplayback; +@property (nonatomic, assign) BOOL keyboarddisplayrequiresuseraction; +@property (nonatomic, assign) BOOL suppressesincrementalrendering; +@property (nonatomic, assign) BOOL hidden; + ++ (CDVInAppBrowserOptions*)parseOptions:(NSString*)options; + +@end + @interface CDVInAppBrowserViewController : UIViewController { @private NSString* _userAgent; NSString* _prevUserAgent; NSInteger _userAgentLockToken; + CDVInAppBrowserOptions *_browserOptions; CDVWebViewDelegate* _webViewDelegate; } @@ -61,29 +83,9 @@ - (void)close; - (void)navigateTo:(NSURL*)url; - (void)showLocationBar:(BOOL)show; -- (void)showToolBar:(BOOL)show; +- (void)showToolBar:(BOOL)show : (NSString *) toolbarPosition; - (void)setCloseButtonTitle:(NSString*)title; -- (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent; +- (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent browserOptions: (CDVInAppBrowserOptions*) browserOptions; -@end - -@interface CDVInAppBrowserOptions : NSObject {} - -@property (nonatomic, assign) BOOL location; -@property (nonatomic, assign) BOOL toolbar; -@property (nonatomic, copy) NSString* closebuttoncaption; - -@property (nonatomic, copy) NSString* presentationstyle; -@property (nonatomic, copy) NSString* transitionstyle; - -@property (nonatomic, assign) BOOL enableviewportscale; -@property (nonatomic, assign) BOOL mediaplaybackrequiresuseraction; -@property (nonatomic, assign) BOOL allowinlinemediaplayback; -@property (nonatomic, assign) BOOL keyboarddisplayrequiresuseraction; -@property (nonatomic, assign) BOOL suppressesincrementalrendering; -@property (nonatomic, assign) BOOL hidden; - -+ (CDVInAppBrowserOptions*)parseOptions:(NSString*)options; - -@end +@end \ No newline at end of file diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 9839ccc..8b5e14d 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -26,6 +26,9 @@ #define kInAppBrowserTargetSystem @"_system" #define kInAppBrowserTargetBlank @"_blank" +#define kInAppBrowserToolbarBarPositionBottom @"bottom" +#define kInAppBrowserToolbarBarPositionTop @"top" + #define TOOLBAR_HEIGHT 44.0 #define LOCATIONBAR_HEIGHT 21.0 #define FOOTER_HEIGHT ((TOOLBAR_HEIGHT) + (LOCATIONBAR_HEIGHT)) @@ -106,9 +109,10 @@ - (void)openInInAppBrowser:(NSURL*)url withOptions:(NSString*)options { + CDVInAppBrowserOptions* browserOptions = [CDVInAppBrowserOptions parseOptions:options]; if (self.inAppBrowserViewController == nil) { NSString* originalUA = [CDVUserAgentUtil originalUserAgent]; - self.inAppBrowserViewController = [[CDVInAppBrowserViewController alloc] initWithUserAgent:originalUA prevUserAgent:[self.commandDelegate userAgent]]; + self.inAppBrowserViewController = [[CDVInAppBrowserViewController alloc] initWithUserAgent:originalUA prevUserAgent:[self.commandDelegate userAgent] browserOptions: browserOptions]; self.inAppBrowserViewController.navigationDelegate = self; if ([self.viewController conformsToProtocol:@protocol(CDVScreenOrientationDelegate)]) { @@ -118,9 +122,8 @@ _previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle; - CDVInAppBrowserOptions* browserOptions = [CDVInAppBrowserOptions parseOptions:options]; [self.inAppBrowserViewController showLocationBar:browserOptions.location]; - [self.inAppBrowserViewController showToolBar:browserOptions.toolbar]; + [self.inAppBrowserViewController showToolBar:browserOptions.toolbar :browserOptions.toolbarbarposition]; if (browserOptions.closebuttoncaption != nil) { [self.inAppBrowserViewController setCloseButtonTitle:browserOptions.closebuttoncaption]; } @@ -390,12 +393,13 @@ @synthesize currentURL; -- (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent +- (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent browserOptions: (CDVInAppBrowserOptions*) browserOptions { self = [super init]; if (self != nil) { _userAgent = userAgent; _prevUserAgent = prevUserAgent; + _browserOptions = browserOptions; _webViewDelegate = [[CDVWebViewDelegate alloc] initWithDelegate:self]; [self createViews]; } @@ -408,10 +412,10 @@ // We create the views in code for primarily for ease of upgrades and not requiring an external .xib to be included CGRect webViewBounds = self.view.bounds; - - webViewBounds.size.height -= FOOTER_HEIGHT; - + BOOL toolbarIsAtBottom = ![_browserOptions.toolbarbarposition isEqualToString:kInAppBrowserToolbarBarPositionTop]; + webViewBounds.size.height -= _browserOptions.location ? FOOTER_HEIGHT : TOOLBAR_HEIGHT; self.webView = [[UIWebView alloc] initWithFrame:webViewBounds]; + self.webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); [self.view addSubview:self.webView]; @@ -453,7 +457,10 @@ UIBarButtonItem* fixedSpaceButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil]; fixedSpaceButton.width = 20; - self.toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0.0, (self.view.bounds.size.height - TOOLBAR_HEIGHT), self.view.bounds.size.width, TOOLBAR_HEIGHT)]; + float toolbarY = toolbarIsAtBottom ? self.view.bounds.size.height - TOOLBAR_HEIGHT : 0.0; + CGRect toolbarFrame = CGRectMake(0.0, toolbarY, self.view.bounds.size.width, TOOLBAR_HEIGHT); + + self.toolbar = [[UIToolbar alloc] initWithFrame:toolbarFrame]; self.toolbar.alpha = 1.000; self.toolbar.autoresizesSubviews = YES; self.toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; @@ -468,7 +475,9 @@ self.toolbar.userInteractionEnabled = YES; CGFloat labelInset = 5.0; - self.addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(labelInset, (self.view.bounds.size.height - FOOTER_HEIGHT), self.view.bounds.size.width - labelInset, LOCATIONBAR_HEIGHT)]; + float locationBarY = toolbarIsAtBottom ? self.view.bounds.size.height - FOOTER_HEIGHT : self.view.bounds.size.height - LOCATIONBAR_HEIGHT; + + self.addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(labelInset, locationBarY, self.view.bounds.size.width - labelInset, LOCATIONBAR_HEIGHT)]; self.addressLabel.adjustsFontSizeToFitWidth = NO; self.addressLabel.alpha = 1.000; self.addressLabel.autoresizesSubviews = YES; @@ -510,6 +519,11 @@ [self.view addSubview:self.spinner]; } +- (void) setWebViewFrame : (CGRect) frame { + NSLog(@"Setting the WebView's frame to %@", NSStringFromCGRect(frame)); + [self.webView setFrame:frame]; +} + - (void)setCloseButtonTitle:(NSString*)title { // the advantage of using UIBarButtonSystemItemDone is the system will localize it for you automatically @@ -544,7 +558,7 @@ CGRect webViewBounds = self.view.bounds; webViewBounds.size.height -= FOOTER_HEIGHT; - self.webView.frame = webViewBounds; + [self setWebViewFrame:webViewBounds]; locationbarFrame.origin.y = webViewBounds.size.height; self.addressLabel.frame = locationbarFrame; @@ -553,7 +567,7 @@ CGRect webViewBounds = self.view.bounds; webViewBounds.size.height -= LOCATIONBAR_HEIGHT; - self.webView.frame = webViewBounds; + [self setWebViewFrame:webViewBounds]; locationbarFrame.origin.y = webViewBounds.size.height; self.addressLabel.frame = locationbarFrame; @@ -567,17 +581,15 @@ // webView take up whole height less toolBar height CGRect webViewBounds = self.view.bounds; webViewBounds.size.height -= TOOLBAR_HEIGHT; - self.webView.frame = webViewBounds; + [self setWebViewFrame:webViewBounds]; } else { // no toolBar, expand webView to screen dimensions - - CGRect webViewBounds = self.view.bounds; - self.webView.frame = webViewBounds; + [self setWebViewFrame:self.view.bounds]; } } } -- (void)showToolBar:(BOOL)show +- (void)showToolBar:(BOOL)show : (NSString *) toolbarPosition { CGRect toolbarFrame = self.toolbar.frame; CGRect locationbarFrame = self.addressLabel.frame; @@ -591,30 +603,31 @@ if (show) { self.toolbar.hidden = NO; - + CGRect webViewBounds = self.view.bounds; + if (locationbarVisible) { // locationBar at the bottom, move locationBar up // put toolBar at the bottom - - CGRect webViewBounds = self.view.bounds; webViewBounds.size.height -= FOOTER_HEIGHT; - self.webView.frame = webViewBounds; - locationbarFrame.origin.y = webViewBounds.size.height; self.addressLabel.frame = locationbarFrame; - - toolbarFrame.origin.y = (webViewBounds.size.height + LOCATIONBAR_HEIGHT); self.toolbar.frame = toolbarFrame; } else { // no locationBar, so put toolBar at the bottom - CGRect webViewBounds = self.view.bounds; webViewBounds.size.height -= TOOLBAR_HEIGHT; - self.webView.frame = webViewBounds; - - toolbarFrame.origin.y = webViewBounds.size.height; self.toolbar.frame = toolbarFrame; } + + if ([toolbarPosition isEqualToString:kInAppBrowserToolbarBarPositionTop]) { + toolbarFrame.origin.y = 0; + webViewBounds.origin.y += toolbarFrame.size.height; + [self setWebViewFrame:webViewBounds]; + } else { + toolbarFrame.origin.y = (webViewBounds.size.height + LOCATIONBAR_HEIGHT); + } + [self setWebViewFrame:webViewBounds]; + } else { self.toolbar.hidden = YES; @@ -625,16 +638,14 @@ // webView take up whole height less locationBar height CGRect webViewBounds = self.view.bounds; webViewBounds.size.height -= LOCATIONBAR_HEIGHT; - self.webView.frame = webViewBounds; + [self setWebViewFrame:webViewBounds]; // move locationBar down locationbarFrame.origin.y = webViewBounds.size.height; self.addressLabel.frame = locationbarFrame; } else { // no locationBar, expand webView to screen dimensions - - CGRect webViewBounds = self.view.bounds; - self.webView.frame = webViewBounds; + [self setWebViewFrame:self.view.bounds]; } } } @@ -703,10 +714,20 @@ if (IsAtLeastiOSVersion(@"7.0")) { [[UIApplication sharedApplication] setStatusBarStyle:[self preferredStatusBarStyle]]; } + [self rePositionViews]; [super viewWillAppear:animated]; } +- (void) rePositionViews { + if ([_browserOptions.toolbarbarposition isEqualToString:kInAppBrowserToolbarBarPositionTop]) { + [self.webView setFrame:CGRectMake(self.webView.frame.origin.x, TOOLBAR_HEIGHT, self.webView.frame.size.width, self.webView.frame.size.height)]; + + float offsetForStatusBar = IsAtLeastiOSVersion(@"7.0") ? 21.0 : 0.0; + [self.toolbar setFrame:CGRectMake(self.toolbar.frame.origin.x, self.toolbar.frame.origin.y + offsetForStatusBar, self.toolbar.frame.size.width, self.toolbar.frame.size.height)]; + } +} + #pragma mark UIWebViewDelegate - (void)webViewDidStartLoad:(UIWebView*)theWebView @@ -764,7 +785,7 @@ - (void)webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error { // log fail message, stop spinner, update back/forward - NSLog(@"webView:didFailLoadWithError - %@", [error localizedDescription]); + NSLog(@"webView:didFailLoadWithError - %i: %@", error.code, [error localizedDescription]); self.backButton.enabled = theWebView.canGoBack; self.forwardButton.enabled = theWebView.canGoForward; @@ -814,6 +835,7 @@ self.location = YES; self.toolbar = YES; self.closebuttoncaption = nil; + self.toolbarbarposition = kInAppBrowserToolbarBarPositionBottom; self.enableviewportscale = NO; self.mediaplaybackrequiresuseraction = NO; From 4aeaf81e1eb3baf474270c2830dacc800792c487 Mon Sep 17 00:00:00 2001 From: Peter Somogyvari Date: Mon, 18 Nov 2013 17:14:19 +0000 Subject: [PATCH 024/106] CB-5595 Fixed the positioning and autoresizing for certain rotation scenarios. The autoresizing masks are applied conditonally based on the browserOptions.toolbarposition flag to ensure that the toolbar is in its correct place. Also added a utility function to query the necessary offset for the status bar: the function takes care of the iOS version and orientation caused differences without hardcoding the value as 20 pixels. --- src/ios/CDVInAppBrowser.m | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 8b5e14d..153ba58 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -463,7 +463,7 @@ self.toolbar = [[UIToolbar alloc] initWithFrame:toolbarFrame]; self.toolbar.alpha = 1.000; self.toolbar.autoresizesSubviews = YES; - self.toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; + self.toolbar.autoresizingMask = toolbarIsAtBottom ? (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin) : UIViewAutoresizingFlexibleWidth; self.toolbar.barStyle = UIBarStyleBlackOpaque; self.toolbar.clearsContextBeforeDrawing = NO; self.toolbar.clipsToBounds = NO; @@ -719,12 +719,21 @@ [super viewWillAppear:animated]; } +// +// On iOS 7 the status bar is part of the view's dimensions, therefore it's height has to be taken into account. +// The height of it could be hardcoded as 20 pixels, but that would assume that the upcoming releases of iOS won't +// change that value. +// +- (float) getStatusBarOffset { + CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame]; + float statusBarOffset = IsAtLeastiOSVersion(@"7.0") ? MIN(statusBarFrame.size.width, statusBarFrame.size.height) : 0.0; + return statusBarOffset; +} + - (void) rePositionViews { if ([_browserOptions.toolbarbarposition isEqualToString:kInAppBrowserToolbarBarPositionTop]) { [self.webView setFrame:CGRectMake(self.webView.frame.origin.x, TOOLBAR_HEIGHT, self.webView.frame.size.width, self.webView.frame.size.height)]; - - float offsetForStatusBar = IsAtLeastiOSVersion(@"7.0") ? 21.0 : 0.0; - [self.toolbar setFrame:CGRectMake(self.toolbar.frame.origin.x, self.toolbar.frame.origin.y + offsetForStatusBar, self.toolbar.frame.size.width, self.toolbar.frame.size.height)]; + [self.toolbar setFrame:CGRectMake(self.toolbar.frame.origin.x, [self getStatusBarOffset], self.toolbar.frame.size.width, self.toolbar.frame.size.height)]; } } From 25d152b578a4fcca0ff8cb38d375b09f4fcb9ae9 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Fri, 13 Dec 2013 09:14:50 -0500 Subject: [PATCH 025/106] CB-5595 Rename "toolbarbarpostion" -> "toolbarposition" --- src/ios/CDVInAppBrowser.h | 2 +- src/ios/CDVInAppBrowser.m | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ios/CDVInAppBrowser.h b/src/ios/CDVInAppBrowser.h index b506b1f..885d522 100644 --- a/src/ios/CDVInAppBrowser.h +++ b/src/ios/CDVInAppBrowser.h @@ -43,7 +43,7 @@ @property (nonatomic, assign) BOOL location; @property (nonatomic, assign) BOOL toolbar; @property (nonatomic, copy) NSString* closebuttoncaption; -@property (nonatomic, copy) NSString* toolbarbarposition; +@property (nonatomic, copy) NSString* toolbarposition; @property (nonatomic, copy) NSString* presentationstyle; @property (nonatomic, copy) NSString* transitionstyle; diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 153ba58..8b8f46b 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -123,7 +123,7 @@ _previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle; [self.inAppBrowserViewController showLocationBar:browserOptions.location]; - [self.inAppBrowserViewController showToolBar:browserOptions.toolbar :browserOptions.toolbarbarposition]; + [self.inAppBrowserViewController showToolBar:browserOptions.toolbar :browserOptions.toolbarposition]; if (browserOptions.closebuttoncaption != nil) { [self.inAppBrowserViewController setCloseButtonTitle:browserOptions.closebuttoncaption]; } @@ -412,7 +412,7 @@ // We create the views in code for primarily for ease of upgrades and not requiring an external .xib to be included CGRect webViewBounds = self.view.bounds; - BOOL toolbarIsAtBottom = ![_browserOptions.toolbarbarposition isEqualToString:kInAppBrowserToolbarBarPositionTop]; + BOOL toolbarIsAtBottom = ![_browserOptions.toolbarposition isEqualToString:kInAppBrowserToolbarBarPositionTop]; webViewBounds.size.height -= _browserOptions.location ? FOOTER_HEIGHT : TOOLBAR_HEIGHT; self.webView = [[UIWebView alloc] initWithFrame:webViewBounds]; @@ -731,7 +731,7 @@ } - (void) rePositionViews { - if ([_browserOptions.toolbarbarposition isEqualToString:kInAppBrowserToolbarBarPositionTop]) { + if ([_browserOptions.toolbarposition isEqualToString:kInAppBrowserToolbarBarPositionTop]) { [self.webView setFrame:CGRectMake(self.webView.frame.origin.x, TOOLBAR_HEIGHT, self.webView.frame.size.width, self.webView.frame.size.height)]; [self.toolbar setFrame:CGRectMake(self.toolbar.frame.origin.x, [self getStatusBarOffset], self.toolbar.frame.size.width, self.toolbar.frame.size.height)]; } @@ -844,7 +844,7 @@ self.location = YES; self.toolbar = YES; self.closebuttoncaption = nil; - self.toolbarbarposition = kInAppBrowserToolbarBarPositionBottom; + self.toolbarposition = kInAppBrowserToolbarBarPositionBottom; self.enableviewportscale = NO; self.mediaplaybackrequiresuseraction = NO; From f75b30857b18a86f229c9d4baaf2f16afd028c7b Mon Sep 17 00:00:00 2001 From: ivan baktsheev Date: Sun, 10 Nov 2013 22:58:18 +0300 Subject: [PATCH 026/106] CB-5594 Add disallowoverscroll option. Similar to the main cordova webview --- src/ios/CDVInAppBrowser.h | 1 + src/ios/CDVInAppBrowser.m | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/ios/CDVInAppBrowser.h b/src/ios/CDVInAppBrowser.h index 885d522..581bcd0 100644 --- a/src/ios/CDVInAppBrowser.h +++ b/src/ios/CDVInAppBrowser.h @@ -54,6 +54,7 @@ @property (nonatomic, assign) BOOL keyboarddisplayrequiresuseraction; @property (nonatomic, assign) BOOL suppressesincrementalrendering; @property (nonatomic, assign) BOOL hidden; +@property (nonatomic, assign) BOOL disallowoverscroll; + (CDVInAppBrowserOptions*)parseOptions:(NSString*)options; diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 8b8f46b..60d2fb4 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -149,6 +149,18 @@ } self.inAppBrowserViewController.modalTransitionStyle = transitionStyle; + // prevent webView from bouncing + if (browserOptions.disallowoverscroll) { + if ([self.inAppBrowserViewController.webView respondsToSelector:@selector(scrollView)]) { + ((UIScrollView*)[self.inAppBrowserViewController.webView scrollView]).bounces = NO; + } else { + for (id subview in self.inAppBrowserViewController.webView.subviews) { + if ([[subview class] isSubclassOfClass:[UIScrollView class]]) { + ((UIScrollView*)subview).bounces = NO; + } + } + } + } // UIWebView options self.inAppBrowserViewController.webView.scalesPageToFit = browserOptions.enableviewportscale; @@ -852,6 +864,7 @@ self.keyboarddisplayrequiresuseraction = YES; self.suppressesincrementalrendering = NO; self.hidden = NO; + self.disallowoverscroll = NO; } return self; From 97c6f2ba8a112189a20e73b3502ee81bc455e8f3 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Tue, 17 Dec 2013 20:49:39 -0500 Subject: [PATCH 027/106] CB-5658 Delete stale snapshot of plugin docs --- docs/inappbrowser.md | 427 ------------------------------------------- docs/window.open.md | 100 ---------- 2 files changed, 527 deletions(-) delete mode 100644 docs/inappbrowser.md delete mode 100644 docs/window.open.md diff --git a/docs/inappbrowser.md b/docs/inappbrowser.md deleted file mode 100644 index 3ea6f4c..0000000 --- a/docs/inappbrowser.md +++ /dev/null @@ -1,427 +0,0 @@ ---- -license: Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---- - -InAppBrowser -============ - -> The `InAppBrowser` is a web browser that displays in the app when calling `window.open`. - - var ref = window.open('http://apache.org', '_blank', 'location=yes'); - -Description ------------ - -The object returned from a call to `window.open`. - -Methods ----------- - -- addEventListener -- removeEventListener -- close - -Permissions ------------ - -### Android - -#### app/res/xml/config.xml - - - -### iOS - -#### config.xml - - - -### Windows Phone 7 + 8 - -#### config.xml - - - -addEventListener -================ - -> Adds a listener for an event from the `InAppBrowser`. - - ref.addEventListener(eventname, callback); - -- __ref__: reference to the `InAppBrowser` window _(InAppBrowser)_ -- __eventname__: the event to listen for _(String)_ - - - __loadstart__: event fires when the `InAppBrowser` starts to load a URL. - - __loadstop__: event fires when the `InAppBrowser` finishes loading a URL. - - __loaderror__: event fires when the `InAppBrowser` encounters an error when loading a URL. - - __exit__: event fires when the `InAppBrowser` window is closed. - -- __callback__: the function that executes when the event fires. The function is passed an `InAppBrowserEvent` object as a parameter. - -Supported Platforms -------------------- - -- Android -- iOS -- Windows Phone 7 + 8 - -Quick Example -------------- - - var ref = window.open('http://apache.org', '_blank', 'location=yes'); - ref.addEventListener('loadstart', function() { alert(event.url); }); - -Full Example ------------- - - - - - InAppBrowser.addEventListener Example - - - - - - - - -removeEventListener -=================== - -> Removes a listener for an event from the `InAppBrowser`. - - ref.removeEventListener(eventname, callback); - -- __ref__: reference to the `InAppBrowser` window. _(InAppBrowser)_ -- __eventname__: the event to stop listening for. _(String)_ - - - __loadstart__: event fires when the `InAppBrowser` starts to load a URL. - - __loadstop__: event fires when the `InAppBrowser` finishes loading a URL. - - __loaderror__: event fires when the `InAppBrowser` encounters an error loading a URL. - - __exit__: event fires when the `InAppBrowser` window is closed. - -- __callback__: the function to execute when the event fires. -The function is passed an `InAppBrowserEvent` object. - -Supported Platforms -------------------- - -- Android -- iOS -- Windows Phone 7 + 8 - -Quick Example -------------- - - var ref = window.open('http://apache.org', '_blank', 'location=yes'); - var myCallback = function() { alert(event.url); } - ref.addEventListener('loadstart', myCallback); - ref.removeEventListener('loadstart', myCallback); - -Full Example ------------- - - - - - InAppBrowser.removeEventListener Example - - - - - - - - -close -===== - -> Closes the `InAppBrowser` window. - - ref.close(); - -- __ref__: reference to the `InAppBrowser` window _(InAppBrowser)_ - -Supported Platforms -------------------- - -- Android -- iOS -- Windows Phone 7 + 8 -- BlackBerry 10 - -Quick Example -------------- - - var ref = window.open('http://apache.org', '_blank', 'location=yes'); - ref.close(); - -Full Example ------------- - - - - - InAppBrowser.close Example - - - - - - - - -executeScript -============= - -> Injects JavaScript code into the `InAppBrowser` window - - ref.executeScript(details, callback); - -- __ref__: reference to the `InAppBrowser` window. _(InAppBrowser)_ -- __injectDetails__: details of the script to run, specifying either a `file` or `code` key. _(Object)_ - - __file__: URL of the script to inject. - - __code__: Text of the script to inject. -- __callback__: the function that executes after the JavaScript code is injected. - - If the injected script is of type `code`, the callback executes - with a single parameter, which is the return value of the - script, wrapped in an `Array`. For multi-line scripts, this is - the return value of the last statement, or the last expression - evaluated. - -Supported Platforms -------------------- - -- Android -- iOS - -Quick Example -------------- - - var ref = window.open('http://apache.org', '_blank', 'location=yes'); - ref.addEventListener('loadstop', function() { - ref.executeSript({file: "myscript.js"}); - }); - -Full Example ------------- - - - - - InAppBrowser.executeScript Example - - - - - - - - -insertCSS -========= - -> Injects CSS into the `InAppBrowser` window. - - ref.insertCSS(details, callback); - -- __ref__: reference to the `InAppBrowser` window _(InAppBrowser)_ -- __injectDetails__: details of the script to run, specifying either a `file` or `code` key. _(Object)_ - - __file__: URL of the stylesheet to inject. - - __code__: Text of the stylesheet to inject. -- __callback__: the function that executes after the CSS is injected. - -Supported Platforms -------------------- - -- Android -- iOS - -Quick Example -------------- - - var ref = window.open('http://apache.org', '_blank', 'location=yes'); - ref.addEventListener('loadstop', function() { - ref.insertCSS({file: "mystyles.css"}); - }); - -Full Example ------------- - - - - - InAppBrowser.executeScript Example - - - - - - - - -InAppBrowserEvent -================= - -The object that is passed to the callback function from an -`addEventListener` call on an `InAppBrowser` object. - -Properties ----------- - -- __type__: the eventname, either `loadstart`, `loadstop`, `loaderror`, or `exit`. _(String)_ -- __url__: the URL that was loaded. _(String)_ -- __code__: the error code, only in the case of `loaderror`. _(Number)_ -- __message__: the error message, only in the case of `loaderror`. _(String)_ diff --git a/docs/window.open.md b/docs/window.open.md deleted file mode 100644 index f64eee5..0000000 --- a/docs/window.open.md +++ /dev/null @@ -1,100 +0,0 @@ ---- -license: Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---- - -window.open -=========== - -Opens a URL in a new `InAppBrowser` instance, the current browser -instance, or the system browser. - - var ref = window.open(url, target, options); - -- __ref__: Reference to the `InAppBrowser` window. _(InAppBrowser)_ -- __url__: The URL to load _(String)_. Call `encodeURI()` on this if the URL contains Unicode characters. -- __target__: The target in which to load the URL, an optional parameter that defaults to `_self`. _(String)_ - - - `_self`: Opens in the Cordova WebView if the URL is in the white list, otherwise it opens in the `InAppBrowser`. - - `_blank`: Opens in the `InAppBrowser`. - - `_system`: Opens in the system's web browser. - -- __options__: Options for the `InAppBrowser`. Optional, defaulting to: `location=yes`. _(String)_ - - The `options` string must not contain any blank space, and each feature's name/value pairs must be separated by a comma. Feature names are case insensitive. All platforms support the value below: - - - __location__: Set to `yes` or `no` to turn the `InAppBrowser`'s location bar on or off. - - Android only - ------------ - - __closebuttoncaption__ - set to a string that will be the caption for the "Done" button. - - iOS only - -------- - - __closebuttoncaption__ - set to a string that will be the caption for the "Done" button. Note that you will have to localize this value yourself. - - __toolbar__ - set to 'yes' or 'no' to turn the toolbar on or off for the InAppBrowser (defaults to 'yes') - - __enableViewportScale__: Set to `yes` or `no` to prevent viewport scaling through a meta tag (defaults to `no`). - - __mediaPlaybackRequiresUserAction__: Set to `yes` or `no` to prevent HTML5 audio or video from autoplaying (defaults to `no`). - - __allowInlineMediaPlayback__: Set to `yes` or `no` to allow inline HTML5 media playback, displaying within the browser window rather than a device-specific playback interface. The HTML's `video` element must also include the `webkit-playsinline` attribute (defaults to `no`) - - __keyboardDisplayRequiresUserAction__: Set to `yes` or `no` to open the keyboard when form elements receive focus via JavaScript's `focus()` call (defaults to `yes`). - - __suppressesIncrementalRendering__: Set to `yes` or `no` to wait until all new view content is received before being rendered (defaults to `no`). - - __presentationstyle__: Set to `pagesheet`, `formsheet` or `fullscreen` to set the [presentation style](http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle) (defaults to `fullscreen`). - - __transitionstyle__: Set to `fliphorizontal`, `crossdissolve` or `coververtical` to set the [transition style](http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle) (defaults to `coververtical`). - -Supported Platforms -------------------- - -- Android -- iOS -- BlackBerry 10 -- Windows Phone 7 + 8 - -Quick Example -------------- - - var ref = window.open('http://apache.org', '_blank', 'location=yes'); - var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); - -Full Example ------------- - - - - - window.open Example - - - - - - - From aac2db29b56f599f6f380adf390bf62f9c2c3e22 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Wed, 18 Dec 2013 15:31:18 -0500 Subject: [PATCH 028/106] CB-5658 Add doc.index.md for InAppBrowser plugin --- README.md | 25 ++++- doc/index.md | 280 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 301 insertions(+), 4 deletions(-) create mode 100644 doc/index.md diff --git a/README.md b/README.md index 74c7dfa..2f47707 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,22 @@ -cordova-plugin-inappbrowser ------------------------------ -To install this plugin, follow the [Command-line Interface Guide](http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface). + + +# org.apache.cordova.inappbrowser + +Plugin documentation: [doc/index.md](doc/index.md) diff --git a/doc/index.md b/doc/index.md new file mode 100644 index 0000000..db8efd1 --- /dev/null +++ b/doc/index.md @@ -0,0 +1,280 @@ + + +# org.apache.cordova.inappbrowser + +This plugin provides a web browser view that displays when calling `window.open()`, or when opening a link formed as ``. + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + +__NOTE__: The InAppBrowser window behaves like a standard web browser, +and can't access Cordova APIs. + +## Installation + + cordova plugin add org.apache.cordova.inappbrowser + +## window.open + +Opens a URL in a new `InAppBrowser` instance, the current browser +instance, or the system browser. + + var ref = window.open(url, target, options); + +- __ref__: Reference to the `InAppBrowser` window. _(InAppBrowser)_ + +- __url__: The URL to load _(String)_. Call `encodeURI()` on this if the URL contains Unicode characters. + +- __target__: The target in which to load the URL, an optional parameter that defaults to `_self`. _(String)_ + + - `_self`: Opens in the Cordova WebView if the URL is in the white list, otherwise it opens in the `InAppBrowser`. + - `_blank`: Opens in the `InAppBrowser`. + - `_system`: Opens in the system's web browser. + +- __options__: Options for the `InAppBrowser`. Optional, defaulting to: `location=yes`. _(String)_ + + The `options` string must not contain any blank space, and each feature's name/value pairs must be separated by a comma. Feature names are case insensitive. All platforms support the value below: + + - __location__: Set to `yes` or `no` to turn the `InAppBrowser`'s location bar on or off. + + Android only: + + - __closebuttoncaption__: set to a string to use as the __Done__ button's caption. + - __hidden__: set to `yes` to create the browser and load the page, but not show it. The load event fires when loading is complete. Omit or set to `no` (default) to have the browser open and load normally. + - __clearcache__: set to `yes` to have the browser's cookie cache cleared before the new window is opened + - __clearsessioncache__: set to `yes` to have the session cookie cache cleared before the new window is opened + + iOS only: + + - __closebuttoncaption__: set to a string to use as the __Done__ button's caption. Note that you need to localize this value yourself. + - __disallowoverscroll__: Set to `yes` or `no` (default is `no`). Turns on/off the UIWebViewBounce property. + - __hidden__: set to `yes` to create the browser and load the page, but not show it. The load event fires when loading is complete. Omit or set to `no` (default) to have the browser open and load normally. + - __toolbar__: set to `yes` or `no` to turn the toolbar on or off for the InAppBrowser (defaults to `yes`) + - __enableViewportScale__: Set to `yes` or `no` to prevent viewport scaling through a meta tag (defaults to `no`). + - __mediaPlaybackRequiresUserAction__: Set to `yes` or `no` to prevent HTML5 audio or video from autoplaying (defaults to `no`). + - __allowInlineMediaPlayback__: Set to `yes` or `no` to allow in-line HTML5 media playback, displaying within the browser window rather than a device-specific playback interface. The HTML's `video` element must also include the `webkit-playsinline` attribute (defaults to `no`) + - __keyboardDisplayRequiresUserAction__: Set to `yes` or `no` to open the keyboard when form elements receive focus via JavaScript's `focus()` call (defaults to `yes`). + - __suppressesIncrementalRendering__: Set to `yes` or `no` to wait until all new view content is received before being rendered (defaults to `no`). + - __presentationstyle__: Set to `pagesheet`, `formsheet` or `fullscreen` to set the [presentation style](http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle) (defaults to `fullscreen`). + - __transitionstyle__: Set to `fliphorizontal`, `crossdissolve` or `coververtical` to set the [transition style](http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle) (defaults to `coververtical`). + - __toolbarposition__: Set to `top` or `bottom` (default is `bottom`). Causes the toolbar to be at the top or bottom of the window. + +### Supported Platforms + +- Amazon Fire OS +- Android +- BlackBerry 10 +- iOS +- Windows Phone 7 and 8 + +### Example + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); + +## InAppBrowser + +The object returned from a call to `window.open`. + +### Methods + +- addEventListener +- removeEventListener +- close +- show +- executeScript +- insertCSS + +## addEventListener + +> Adds a listener for an event from the `InAppBrowser`. + + ref.addEventListener(eventname, callback); + +- __ref__: reference to the `InAppBrowser` window _(InAppBrowser)_ + +- __eventname__: the event to listen for _(String)_ + + - __loadstart__: event fires when the `InAppBrowser` starts to load a URL. + - __loadstop__: event fires when the `InAppBrowser` finishes loading a URL. + - __loaderror__: event fires when the `InAppBrowser` encounters an error when loading a URL. + - __exit__: event fires when the `InAppBrowser` window is closed. + +- __callback__: the function that executes when the event fires. The function is passed an `InAppBrowserEvent` object as a parameter. + +### InAppBrowserEvent Properties + +- __type__: the eventname, either `loadstart`, `loadstop`, `loaderror`, or `exit`. _(String)_ + +- __url__: the URL that was loaded. _(String)_ + +- __code__: the error code, only in the case of `loaderror`. _(Number)_ + +- __message__: the error message, only in the case of `loaderror`. _(String)_ + + +### Supported Platforms + +- Amazon Fire OS +- Android +- BlackBerry 10 +- iOS +- Windows Phone 7 and 8 + +### Quick Example + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstart', function() { alert(event.url); }); + +## removeEventListener + +> Removes a listener for an event from the `InAppBrowser`. + + ref.removeEventListener(eventname, callback); + +- __ref__: reference to the `InAppBrowser` window. _(InAppBrowser)_ + +- __eventname__: the event to stop listening for. _(String)_ + + - __loadstart__: event fires when the `InAppBrowser` starts to load a URL. + - __loadstop__: event fires when the `InAppBrowser` finishes loading a URL. + - __loaderror__: event fires when the `InAppBrowser` encounters an error loading a URL. + - __exit__: event fires when the `InAppBrowser` window is closed. + +- __callback__: the function to execute when the event fires. +The function is passed an `InAppBrowserEvent` object. + +### Supported Platforms + +- Amazon Fire OS +- Android +- BlackBerry 10 +- iOS +- Windows Phone 7 and 8 + +### Quick Example + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var myCallback = function() { alert(event.url); } + ref.addEventListener('loadstart', myCallback); + ref.removeEventListener('loadstart', myCallback); + +## close + +> Closes the `InAppBrowser` window. + + ref.close(); + +- __ref__: reference to the `InAppBrowser` window _(InAppBrowser)_ + +### Supported Platforms + +- Amazon Fire OS +- Android +- BlackBerry 10 +- iOS +- Windows Phone 7 and 8 + +### Quick Example + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.close(); + +## show + +> Displays an InAppBrowser window that was opened hidden. Calling this has no effect if the InAppBrowser was already visible. + + ref.show(); + +- __ref__: reference to the InAppBrowser window (`InAppBrowser`) + +### Supported Platforms + +- Amazon Fire OS +- Android +- BlackBerry 10 +- iOS + +### Quick Example + + var ref = window.open('http://apache.org', '_blank', 'hidden=yes'); + // some time later... + ref.show(); + +## executeScript + +> Injects JavaScript code into the `InAppBrowser` window + + ref.executeScript(details, callback); + +- __ref__: reference to the `InAppBrowser` window. _(InAppBrowser)_ + +- __injectDetails__: details of the script to run, specifying either a `file` or `code` key. _(Object)_ + - __file__: URL of the script to inject. + - __code__: Text of the script to inject. + +- __callback__: the function that executes after the JavaScript code is injected. + - If the injected script is of type `code`, the callback executes + with a single parameter, which is the return value of the + script, wrapped in an `Array`. For multi-line scripts, this is + the return value of the last statement, or the last expression + evaluated. + +### Supported Platforms + +- Amazon Fire OS +- Android +- BlackBerry 10 +- iOS + +### Quick Example + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.executeScript({file: "myscript.js"}); + }); + +## insertCSS + +> Injects CSS into the `InAppBrowser` window. + + ref.insertCSS(details, callback); + +- __ref__: reference to the `InAppBrowser` window _(InAppBrowser)_ + +- __injectDetails__: details of the script to run, specifying either a `file` or `code` key. _(Object)_ + - __file__: URL of the stylesheet to inject. + - __code__: Text of the stylesheet to inject. + +- __callback__: the function that executes after the CSS is injected. + +### Supported Platforms + +- Amazon Fire OS +- Android +- BlackBerry 10 +- iOS + +### Quick Example + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.insertCSS({file: "mystyles.css"}); + }); + From 2bd006b71e446db17984c3da42fe37bb931fa08d Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Wed, 18 Dec 2013 21:11:02 -0500 Subject: [PATCH 029/106] CB-5658 Update license comment formatting of doc/index.md --- doc/index.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/doc/index.md b/doc/index.md index db8efd1..61f702c 100644 --- a/doc/index.md +++ b/doc/index.md @@ -1,20 +1,20 @@ # org.apache.cordova.inappbrowser From 176890f30599fc72d33eeb1f5daa1fa5e6358325 Mon Sep 17 00:00:00 2001 From: gianluca Date: Thu, 3 Oct 2013 14:11:12 +0200 Subject: [PATCH 030/106] CB-5592 Android - Add MIME type to Intent when opening file:/// URLs To avoid the "No Activity found to handle Intent..." error. --- src/android/InAppBrowser.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index da6b241..aa89446 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -300,7 +300,12 @@ public class InAppBrowser extends CordovaPlugin { try { Intent intent = null; intent = new Intent(Intent.ACTION_VIEW); - intent.setData(Uri.parse(url)); + Uri uri = Uri.parse(url); + if ("file".equals(uri.getScheme())) { + intent.setDataAndType(uri, webView.getResourceApi().getMimeType(uri)); + } else { + intent.setData(uri); + } this.cordova.getActivity().startActivity(intent); return ""; } catch (android.content.ActivityNotFoundException e) { From 6163f17aeb901d9ff6b3df68666b2efedcd0162e Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Fri, 20 Dec 2013 11:10:33 -0500 Subject: [PATCH 031/106] CB-5592 Add a comment explaining why we set MIME only for file: --- src/android/InAppBrowser.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index aa89446..34e96d9 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -300,6 +300,8 @@ public class InAppBrowser extends CordovaPlugin { try { Intent intent = null; intent = new Intent(Intent.ACTION_VIEW); + // Omitting the MIME type for file: URLs causes "No Activity found to handle Intent". + // Adding the MIME type to http: URLs causes them to not be handled by the downloader. Uri uri = Uri.parse(url); if ("file".equals(uri.getScheme())) { intent.setDataAndType(uri, webView.getResourceApi().getMimeType(uri)); From b0bdb1088b5eaa826fa652140747d18f828dd318 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 2 Jan 2014 12:24:02 -0500 Subject: [PATCH 032/106] CB-5719 Updated version and RELEASENOTES.md for release 0.3.0 --- RELEASENOTES.md | 9 +++++++++ plugin.xml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 3f7957d..ac7b46d 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -55,3 +55,12 @@ * add ubuntu platform * CB-3420 WP feature hidden=yes implemented * Added amazon-fireos platform. Change to use amazon-fireos as the platform if user agent string contains 'cordova-amazon-fireos' + +### 0.3.0 (Jan 02, 2014) +* CB-5592 Android: Add MIME type to Intent when opening file:/// URLs +* CB-5594 iOS: Add disallowoverscroll option. +* CB-5658 Add doc/index.md for InAppBrowser plugin +* CB-5595 Add toolbarposition=top option. +* Apply CB-5193 to InAppBrowser (Fix DB quota exception) +* CB-5593 iOS: Make InAppBrowser localizable +* CB-5591 Change window.escape to encodeURIComponent diff --git a/plugin.xml b/plugin.xml index 1bf16a0..12a5e77 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.3.0"> InAppBrowser Cordova InAppBrowser Plugin From 21a1638ccf7ad17fe663d6c511ce8b4d906dad32 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 2 Jan 2014 12:30:52 -0500 Subject: [PATCH 033/106] CB-5719 Incremented plugin version on dev branch. --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index 12a5e77..d16c756 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.3.1-dev"> InAppBrowser Cordova InAppBrowser Plugin From 57d14da151739fc2cfef3fcd3fc94f8c92c9af68 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Tue, 7 Jan 2014 10:52:38 -0500 Subject: [PATCH 034/106] CB-5733 Fix IAB.close() not working if called before show() animation is done Also attempts to fix some thread warnings by doing show/hide on separate event loop cycles. --- src/ios/CDVInAppBrowser.m | 58 +++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 60d2fb4..a660ac2 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -36,7 +36,7 @@ #pragma mark CDVInAppBrowser @interface CDVInAppBrowser () { - UIStatusBarStyle _previousStatusBarStyle; + NSInteger _previousStatusBarStyle; } @end @@ -46,7 +46,7 @@ { self = [super initWithWebView:theWebView]; if (self != nil) { - // your initialization here + _previousStatusBarStyle = -1; } return self; @@ -59,6 +59,10 @@ - (void)close:(CDVInvokedUrlCommand*)command { + if (self.inAppBrowserViewController == nil) { + NSLog(@"IAB.close() called but it was already closed."); + return; + } // Things are cleaned up in browserExit. [self.inAppBrowserViewController close]; } @@ -120,8 +124,6 @@ } } - _previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle; - [self.inAppBrowserViewController showLocationBar:browserOptions.location]; [self.inAppBrowserViewController showToolBar:browserOptions.toolbar :browserOptions.toolbarposition]; if (browserOptions.closebuttoncaption != nil) { @@ -171,30 +173,34 @@ self.inAppBrowserViewController.webView.suppressesIncrementalRendering = browserOptions.suppressesincrementalrendering; } - if (! browserOptions.hidden) { - - UINavigationController* nav = [[UINavigationController alloc] - initWithRootViewController:self.inAppBrowserViewController]; - nav.navigationBarHidden = YES; - - if (self.viewController.modalViewController != self.inAppBrowserViewController) { - [self.viewController presentModalViewController:nav animated:YES]; - } - } [self.inAppBrowserViewController navigateTo:url]; + if (!browserOptions.hidden) { + [self show:nil]; + } } - (void)show:(CDVInvokedUrlCommand*)command { - if ([self.inAppBrowserViewController isViewLoaded] && self.inAppBrowserViewController.view.window) + if (self.inAppBrowserViewController == nil) { + NSLog(@"Tried to show IAB after it was closed."); return; + } + if (_previousStatusBarStyle != -1) { + NSLog(@"Tried to show IAB while already shown"); + return; + } _previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle; UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.inAppBrowserViewController]; nav.navigationBarHidden = YES; - [self.viewController presentModalViewController:nav animated:YES]; + // Run later to avoid the "took a long time" log message. + dispatch_async(dispatch_get_main_queue(), ^{ + if (self.inAppBrowserViewController != nil) { + [self.viewController presentModalViewController:nav animated:YES]; + } + }); } - (void)openInCordovaWebView:(NSURL*)url withOptions:(NSString*)options @@ -391,6 +397,8 @@ // Don't recycle the ViewController since it may be consuming a lot of memory. // Also - this is required for the PDF/User-Agent bug work-around. self.inAppBrowserViewController = nil; + + _previousStatusBarStyle = -1; if (IsAtLeastiOSVersion(@"7.0")) { [[UIApplication sharedApplication] setStatusBarStyle:_previousStatusBarStyle]; @@ -682,18 +690,20 @@ - (void)close { [CDVUserAgentUtil releaseLock:&_userAgentLockToken]; - - if ([self respondsToSelector:@selector(presentingViewController)]) { - [[self presentingViewController] dismissViewControllerAnimated:YES completion:nil]; - } else { - [[self parentViewController] dismissModalViewControllerAnimated:YES]; - } - self.currentURL = nil; - + if ((self.navigationDelegate != nil) && [self.navigationDelegate respondsToSelector:@selector(browserExit)]) { [self.navigationDelegate browserExit]; } + + // Run later to avoid the "took a long time" log message. + dispatch_async(dispatch_get_main_queue(), ^{ + if ([self respondsToSelector:@selector(presentingViewController)]) { + [[self presentingViewController] dismissViewControllerAnimated:YES completion:nil]; + } else { + [[self parentViewController] dismissModalViewControllerAnimated:YES]; + } + }); } - (void)navigateTo:(NSURL*)url From 3f9af4fd88ebcb7b29487d26768e3f392d5d9285 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Tue, 7 Jan 2014 10:52:44 -0500 Subject: [PATCH 035/106] Remove _alive from InAppBrowser.js since it didn't catch the case where the browser is closed by the user. --- www/InAppBrowser.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/www/InAppBrowser.js b/www/InAppBrowser.js index 3fe9261..ebcfa24 100644 --- a/www/InAppBrowser.js +++ b/www/InAppBrowser.js @@ -31,7 +31,6 @@ function InAppBrowser() { 'loaderror' : channel.create('loaderror'), 'exit' : channel.create('exit') }; - this._alive = true; } InAppBrowser.prototype = { @@ -41,10 +40,7 @@ InAppBrowser.prototype = { } }, close: function (eventname) { - if (this._alive) { - this._alive = false; - exec(null, null, "InAppBrowser", "close", []); - } + exec(null, null, "InAppBrowser", "close", []); }, show: function (eventname) { exec(null, null, "InAppBrowser", "show", []); From 21fe13e809ed57dd715904e4fb41782efc64a3b5 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Wed, 8 Jan 2014 21:11:43 -0500 Subject: [PATCH 036/106] Delete stale test/ directory --- test/.DS_Store | Bin 6148 -> 0 bytes test/cordova-incl.js | 72 ---------- test/inappbrowser/index.html | 258 ---------------------------------- test/inappbrowser/inject.css | 21 --- test/inappbrowser/inject.html | 43 ------ test/inappbrowser/inject.js | 20 --- test/inappbrowser/local.html | 51 ------- test/inappbrowser/local.pdf | Bin 8568 -> 0 bytes test/index.html | 65 --------- test/main.js | 163 --------------------- test/master.css | 164 --------------------- 11 files changed, 857 deletions(-) delete mode 100644 test/.DS_Store delete mode 100644 test/cordova-incl.js delete mode 100644 test/inappbrowser/index.html delete mode 100644 test/inappbrowser/inject.css delete mode 100644 test/inappbrowser/inject.html delete mode 100644 test/inappbrowser/inject.js delete mode 100644 test/inappbrowser/local.html delete mode 100644 test/inappbrowser/local.pdf delete mode 100644 test/index.html delete mode 100644 test/main.js delete mode 100644 test/master.css diff --git a/test/.DS_Store b/test/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 0) { - if(parseInt(this.status) >= 400){ - cordovaPath = normalCordovaPath; - }else{ - cordovaPath = platformCordovaPath; - } - } - }; - xhr.send(null); - } - catch(e){ - cordovaPath = normalCordovaPath; - } // access denied! -} - -if (!window._doNotWriteCordovaScript) { - document.write(''); -} - -function backHome() { - if (window.device && device.platform && (device.platform.toLowerCase() == 'android' || device.platform.toLowerCase() == 'amazon-fireos')) { - navigator.app.backHistory(); - } - else { - window.history.go(-1); - } -} diff --git a/test/inappbrowser/index.html b/test/inappbrowser/index.html deleted file mode 100644 index dbc094d..0000000 --- a/test/inappbrowser/index.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - - - - - - Cordova Mobile Spec - - - - - - - - -

InAppBrowser

-
- Make sure http://www.google.com is white listed.
- Make sure http://www.apple.com is not in the white list.
In iOS, starred * tests will leave the app with no way to return.
-

User-Agent:

-
-
Back
-

Local URL

-
Default: CordovaWebView
-
Target=Self: CordovaWebView
-
Target=System: Error
-
Target=Blank: InAppBrowser
-
Target=Random: InAppBrowser
-
Target=Random, no location bar: InAppBrowser
-

White Listed URL

-
Default: CordovaWebView*
-
Target=Self: CordovaWebView*
-
Target=System: System Browser
-
Target=Blank: InAppBrowser
-
Target=Random: InAppBrowser
-
Target=Random, no location bar: InAppBrowser
-

Non White Listed URL

-
Default: InAppBrowser
-
Target=Self: InAppBrowser
-
Target=System: System
-
Target=Blank: InAppBrowser
-
Target=Random: InAppBrowser
-
Target=Random, no location bar: InAppBrowser
-

Page with redirect

-
http://google.com (should 301)
-
http://www.zhihu.com/answer/16714076 (should 302)
-

PDF URL

-
Remote URL
-
Local URL
-

INVALID URL

-
Invalid Scheme
-
Invalid Host
-
Missing File
-

CSS / JS Injection

-
Original Document
-
CSS File Injection
-
CSS File Injection (CB)
-
CSS Literal Injection
-
CSS Literal Injection (CB)
-
Script File Injection
-
Script File Injection (CB)
-
Script Literal Injection
-
Script Literal Injection (CB)
-

Open Hidden

-
google.com hidden
-
show hidden
-
close hidden
-
google.com not hidden
-

Back
- - diff --git a/test/inappbrowser/inject.css b/test/inappbrowser/inject.css deleted file mode 100644 index 3f6e41c..0000000 --- a/test/inappbrowser/inject.css +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. -*/ -#style-update-file { - display: block !important; -} diff --git a/test/inappbrowser/inject.html b/test/inappbrowser/inject.html deleted file mode 100644 index 0f1efdd..0000000 --- a/test/inappbrowser/inject.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - Cordova Mobile Spec - - - -

InAppBrowser - Script / Style Injection Test

- - - - - diff --git a/test/inappbrowser/inject.js b/test/inappbrowser/inject.js deleted file mode 100644 index 6f25493..0000000 --- a/test/inappbrowser/inject.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. -*/ -var d = document.getElementById("header") -d.innerHTML = "Script file successfully injected"; diff --git a/test/inappbrowser/local.html b/test/inappbrowser/local.html deleted file mode 100644 index d5edbf9..0000000 --- a/test/inappbrowser/local.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - Cordova Mobile Spec - - - - -

InAppBrowser - Local URL

-
- You have successfully loaded a local URL -
-
User-Agent =
-
- - - -

Back
- - - diff --git a/test/inappbrowser/local.pdf b/test/inappbrowser/local.pdf deleted file mode 100644 index b54f1b759a9ab7c60b05b209a84e1eb2cabe455a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8568 zcmb_?1yqz>7p_RjptJ}|3?(Qr1v*Vp-ziV%JZYn4VLWE!dp61z&*`=J#ryrYJ z0Kz~p(Am-sASnq1X`q~J@U}n^0;CHBDPbJ&C@kUA0f|Q`psbv&Q9x;F01l5uAsqpp zM2e4Or~|+>?>wa6U0JlK%;#Kr;p)nTnX+Kf2%@<8a$JV3G2+wVSbEJ2`gLLtLU=~- z2RdSO?EVm$JLedyP~uHi7#E5L8zXLPuJ^RTl1B7yT&;wMe{4C+Ae?b)_p zi2db=KcfdZ(T1R&77zji$)1GJi4Z>^NCD-Ju|g?hkzW5hv_S@%4p$6l*lY%^0bKpI7llFHGF&#JHbwfK>d&N}gK(b23c9rRyl|o1S z3zq3G=O&Iyx*nb3BFi#*^{C|Tu1@^@7KTn{bEB7Y;SCk)mA)N_+h@lB2RUn68>WwF z@=TtaPE=2ruWUBab%yw>KQx`Gj*6%fxX;%r)sP<8zu04Ry#FyBZL+iJ{7zh$>^xg< zQ)wpKoy(q0h1ysL?K2?eBNZYhzux&Q*xMRNosQ^6*NR@l-JXbR_qi+abmLdWwx~BQ zv}Gs-N^ZCsHjZVV6=o4gf7y4ae_!L~Mh(hF=OQo1GRsRcX8rJ&Ps~W-is^-0{aom| zcD#ANBwxYfKDye{N-Ovrj~aCwl;>6Laewx6lk?SL)eTY21?7_W&G$<_fBW^QttDjT zY)!#@BYZ4qAUkIuH!X60A~N_*Vdoe^&3wpWZx z#|)($u|B2}`?EU=ftCifo(JgeH>G%Ps<)-NU>}) zi#^O)z){f!V6&8@K2x?H{K3y@Jd3r@-R_Z{*9vmQ)lqJ#e+NVU+VKnUv%lzzm6rAo z?&E{5B3@-NQuaL#&FIn?7K4iid!fAzHc~=qdJ$-va>X1jvVdGFD)hwhrw&|DrAlqU z*qc7num0kU-8zP&A*z?x67x9HUU#WnO>d8B+d>D!h?Cw%()!{$6wq+3kaelv52418 zSaDXb_CPk=7i(`{vt9Er@32~7f5&BOzV3-s#mBf>((xzx!In1%(rJxrIJ1~=T}RT$ z!LrbYXD2&v>|HQk<@Gx*VeMg8&irm?x8zp33V#As%c{G&N6l#$`t{!=e9B3uEDS~< zesR|c&z)cdN>r7XmqX%E*1!`!(*>ITT5>|gzZmp4Q{(<`+((&>t9UyzQxpa0K9l^8dg5{69((5jn|qB4EOsaCP#A z{!J?=^u*fVv!~aD)r3`l56-_+^NBluyX~hNwUCa4g!W%t?0~c(#E;;slU;JBxmi$5 z1OgNkMnHfNVPO#<1Og@GXpkx);utGgCmRP8K`oFh&gvxd!{LPMlfzC1f>0P?B#(4a zL1Aoc36l^w5Tu7kIT`}R5I~U8PZ%Hqh5dw8fCv$SBzK$B$PkVcCftUaNY9@`!s7=) z+KF0($0`&Q2>JPx@%t`21%BOTzf$?1PZ~dm5Fi4K5GDxuAJ1j)jJ-Vd70YDY66(sU zW3@bTBx-Z^v&)zHDKK;~SMec%Ji&oH4-{f<0A-nAOqs5MVU(E)inJ7=ey|LxC7@>L zV8enuTX@|NQ!5Ie@{X3(MtU<5PHm$TxBM!P zQNh%x^TZ8u(=j_~aX^_xZA*9Lk1soEB!w~|Kk{aMYYRxaZO#_i8}7Wkl|1oInMnVk zf&Cuun6}h|16I@26@EHwMW~nYB}Q&fC@D^R;LF%BU5y{fW|Ih9Fg+?~RdKAU?655C zXi{p%bllE-I4L*Xk9;mIE!k-`b>e>FA3HCXQgXF#-K;l1)7Z=HN%Gi*>s*6BqddR= zx8e>W7PUN<^x;*Z-Nll}9on+I9S0>|)a^gC%glEhWh6j*{U*(Kk@q%qeV_1`w3HUP z25jhT$E$`Nuw7M!*nS9;m1?nzB(NYBorv^b4i14xheZcDVP&?gMgrF%kt5u1s4J~z zj*wdC*?12vcuMcveW+}(aD8H6H@^hQVER$F$+}6-8%k=k=4;8UMK*i>qF2np8AJcr z1Dcu{_uTs$C7UXrFWX!R-;t$mA&PvNLRaF9s2%*l*-i>l{>IAw95<7@sjcYsfjYwS zJhOY+Mk}JrOifuRaY}M=w{BC0B|imZDH%nx(%p1fIdz}KKE>pdmGyklCarShgoFv* zkRX-Mb}r8Ga}-W7S|DA5!HVj<1TmjEgT6#(2aiqObV_LhJ3YmQ*Tc#W%NglnQoEdn zIArG7(+?OA2RAKwohq*7^x$=pA#Ju0hmGALkFrff3}S?9+jv$UvXRQ=mZUhwR4HX- zm>~ApVE#M$z1y8qyFwAC|$_-1aCq zKQ)|w=8Qg<0QtjEK=h+%o8l-5S*ng8^7Kn$(X_I{%~N-8O!HWTMiX=0QsZ#d=gW)(lr|CaI=RpEK} z;NblLU!;dOANF}B+H~onuj7+td(-#zi}}H#We<1yIqE$O%wOq`$nM)^`M&9`6Axg; zn&ZDsuFgG4_U;ikom>?wutnou`yIu^=jKb%g-4GXF;$W7#y*`j_t)?{^YS(kf@o^Z z!Y5&FnsSH_1F6ZWOza|}h77Bwn}+#BqzMG983z-OJK z@ogbQx4%OYDP?%pcR@%V$@|;hlMD{`-!9Zbk%CM*RY{)H&(6N_KI?a;dV*&+a70mQ%5=SMcW8It_652~9u~Z99az)NHdS}&F6U9g zE`l?fVrbC*ibGIN@u57ER)+nB*ej}_A+<7y?3@rfaJVhGrIjW`ATj6}l~cez%{?oZ z%SU9#ob$}Ee3bW4!gSX9F{wybqfT!$UXDH38{*IcNd*FQRnRd?C25jsWzpu4p)R@X zpvt()2R}j`EfPu&mkTSBE0IS;ej##FN0oICeq!=qQUr7 zPgT-94!8vq@DZ%FO$Zx_;pS~OM$7z=`r)6#n+}tVZDvYh$xayRV6o7G$kz#Rz;D?J&bZiYnUKbp9cwWzf*dBV`+_&6i6yW9P zC6Y&6saBCVpW*fj_?^Q{DvH?|1urU1lzSa~X;Q-Wl>}1C!7`z#V7GAS@SEtZj>`_% zGdnIK6BFgr%Oj*gwu%E; zuU3{WpDz#Ez_u3yo1S%aWys-4`q*wgYu za573WhSMlmQB!bG+04mD9}(M}sHi^g4?~Y~xa$87`Xy3(7`x&CIgFoO7dGwpusPGw+{z1zC?p zwH@OBQ_|C50>4SZ}CFC)sgzCif8dKfx?4;%O;Uozeda&0O z3AKg2gm-u^4QCR+Pv~0!@I1CRVZCg4>*dB(efq{d$NOI}2t6b7CHD({;ni-*-dnN! z>R))(7|d33ZUo^ocpZ7vzJPjs@ugc+xz$~(LgMwl8!4P?q9Gvu8)N5Vq=RziYe^u4TL_}dq=2IM4*Z-VoIZ&(UjQ4pZhgfSHZs>*KYfo1u_>FwQ z0fH~nY>9A{xfbX7FV0P&JN7P{%#|yU%az%J85)gmY)TCc(n*EIUkS5#m7%JsGrc`J zN0Az#GoRt`IDz|CqjLh011A)rGVI{ws@@ZO|9+Wl)fk;mWJ5n`V^{#w$LkCmOw6{; z9uSiG5pu zKz^NhK=`*UXR65;{4@nec7gX}?_|cnZVo?n+a9D%+vX3xEvwe*w2S4gI51CEn$tIJ7LZN`+so}%scIJ9sGxPLd&ntyoGf3l z2nbBBzdT8LBAQZXm=xL+QFk@)k~w9Q;6R{@weBZ=8nXa#Wxl2XZBCZgij!CwNtd|c zpu$lIsP;VeKzC~U=3A0870J&isQWJ_CRn|E3zZNfPL9e(`SN9MYwUJpRi|-F-uqa6 z^-`MPw}r#w1Mr|sM2-yGo4qMoYu)DB6zS`d7kJXHc?K}G;yQS{bmEax%k(M1`_6TM zpz~=ke~E~BJ;t@l7xW(5mPCF)3x+ok|5B!FkA(Nl&LblIUw>m`X@#F*oMmY>^z5RH zP{YT3cvKub%u>Cpd=%7;ZmIA}pOzvk8)LYuEv@r>!nl~u?}|XT5cl<0U*fI5C-h;e zMiM7VpB<06mVgOgmTBIjcU`(wLU3T@GBd< z=%wsr5ulyw{+FwR4p(29Ya7XAmWu29#lCwu;L=2k8Qr76(++odW!^i(DSl6g?u!m{ z$2AMuT2-YuYT>+F>^)1muLDTM*o?wxg01>7?b0eeRvE(lK7m|-u$z*!h5!f7_tC{c z!m$$UjdDix=i+ZJB}KLiA;ME-~a@0CH87m(WO>DrlM5KSx`SZYAe{Tb|3c}mxd1BMjTG) z^~+Q(w(Z)?-&KzHJ=n3A`O#f^{7xe^MmogR$MB7#7iIhYGRPWIP+qlLopMq8n|sa5 zddzc+WA}B)5*u%)eImn{Mc;y6WUz(qM2R=e$>tl-2&5-G>{3^M#}A$Nh8((aR&if+1ma$0F^;fwPi>!@ z6bt&4^XcoGyj%C<^|-xY4s7gqEJ7YVmw0@&k=!n`ML9;qDL+tA@@fY2%5~!i3e)&7 zw`+y(ms6G{+RIHQhhM$2m1Bz36)$McL+SPSyO>_5ab&$ryZ*!V*>#ep$QlE)>;W^$ zZkd|HM$(|*w@q$}nuo9_W~|4QkmG1Xe^M#+SaAZclhfx1l=Fp2hkc(wD*ahX1Ov7U!S6bUsQ zBQ6P0!hgQb7RRB%Sj6~n9OT9wnX==Nx0cbQ|GGz$i>t4_^Qe~dh>G_aNVRESno^QQ zV2FbX!>+#1QU1rstI-5Tdh?6pbJBeWLs7z-`iL&M82Q4obBqzu>p4b_YV|#qZ{CH{ zNp%FiYa836bmmM}5=um*iyMTM=3DtFfH~gra%DlefB4%%Xg__tS9Dop=0^^N8w;E7 zB7>J@-oVFc4cI~}z1B4K70P+GPSm`kL#4Pv>bn|9R~N-LtJgV0{^ffJ_CXg5pUYR9GuDah zV_LbXBb;DtTTFO`KH4X}YARv09!W8lH47PKktX3E-q)10ns^^53`Q(^9z83W*d7-X zKk`}oaFpE?9(`n9D_ykpE$pJino&)%R86IHDfXZn(UKD!AD2Dw=+N*;G_?Lb+w9zg zCXT3`T3Wwgq>*}&9kvW!Z8NmKQ*#8(Gkh|eG;2O%yllQ`JiDa*ReN<{tI}JlcFb&i zb*r{APe4dV`cbDgX?_p7B>90?@Ie=YTlvCfyce^xQb~BHsz|-1$8$gm*Ik>3RX1+h zy^cIXs(Y^=qXpa7G)R(eOvecJA`ZV?|2A&|hzRCA>{tjYKC>-gMI@-(S4;v}xXO0! z=Iuo)?eE{6JKH|+ctv(EyxHS^pm&z%C`f+r_JPtwX*71BxC;$dZ;p%MxcB&(D&yhx zu-zK9i|y0g2jf(+_*7HQcwr6e@0`vWSWfLu9;>(7{`y0TPpD z3y;Mpw&loD1k%$}F4aD(<#*TkK7Q~qo4K}LY^VH+4Rqhjyx)qy`fbvM^0XI=e)Asl z-REY!dMlp0tWPbyW!q|F9@_R;-CdvKG5r)_BSKYRB+f#&*V zWQ=(Lf5~Fyj8DJng|O(aPZQKB6ODqDvP!3*t;5R#V7tg`FX`(qfU=DR47bGStM>-u zq;r6ic%?U1^VZ}yq%ORvRUe1c>3((JVUu!cun|zxf+KA9-~vM>LFUk-xzEKeUN4@2 zljEjR^Ai)wGrFIS7wtAntQQ=OOQ{;Q$(^&CH95XhLAAD>jHDHa=chm5biXgEeA zmH2w;jHC1hDzghq%e}oMKC7x=X0eeRk(A(q29@LeTJq^kru0UY`Xy~EAL8lC-RAqk z8oea9|5$$=(mC5%IE9f(=$wU^eIDz`pV>0o-`InjzWaXr-MG(1?N*XwaxP*p|9>fr z|7yRAfT92CPeOk6Ecpza@EE)U%KF-`f;ge_`?DC$N2nG9we^5TKnPd}Ap`~LxFNCl zJ3vBn@w89riT}OlSD~Fx*2x-+@&GDhF(`M`@A+Q^ZoZSIq@p$EFI#{07x@&#pLLFdY$?wrU6flCA2GL-SD=~ zSRkRudRi7I^h>SXtO)JrQ;P}n@`SE4p>7U@oOVI~9AliF6bQ{t0OV)i0Ho<`eKH3A z8mptcJe;wFPQa;pC#T5X)DZuTo~Wbym*#*c7KJ91z@bn8_&+b8sE7zm1c(OyiNO&k zrTdc?(CHTjhKdqm_IHfnsefT$g6sad4h$701oiKG!7x#RMSsU2q6mVI|A8Td3GVni z1{N0m7X}d(`L{ecp^W{Hy@bFLT=I8$1oi%1rCS*`wT+Y{r6rx7D=eDV^9B`K@W2WMTjL3r0eWVXbSxdHb~V8?M&zp zo!(`t3WOe!q%hbTEDQmo;YbM55^ODu5=NupXb}V$28W8mL@lKO|9i>LHU - - - - - - - - Cordova Mobile Spec - - - - - - -

Apache Cordova Tests

-
-

Platform:

-

Version:

-

UUID:

-

Name:

-

Model:

-

Width: , Height: - , Color Depth:

-

User-Agent:

-
- Automatic Test - Accelerometer - Audio Play/Record - Battery - Camera - Compass - Contacts - Events - Location - Lazy Loading of cordova-incl.js - Misc Content - Network - Notification - Splashscreen - Web SQL - Local Storage - Benchmarks - In App Browser - - diff --git a/test/main.js b/test/main.js deleted file mode 100644 index 66c1bd3..0000000 --- a/test/main.js +++ /dev/null @@ -1,163 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ - -var deviceInfo = function() { - document.getElementById("platform").innerHTML = device.platform; - document.getElementById("version").innerHTML = device.version; - document.getElementById("uuid").innerHTML = device.uuid; - document.getElementById("name").innerHTML = device.name; - document.getElementById("model").innerHTML = device.model; - document.getElementById("width").innerHTML = screen.width; - document.getElementById("height").innerHTML = screen.height; - document.getElementById("colorDepth").innerHTML = screen.colorDepth; -}; - -var getLocation = function() { - var suc = function(p) { - alert(p.coords.latitude + " " + p.coords.longitude); - }; - var locFail = function() { - }; - navigator.geolocation.getCurrentPosition(suc, locFail); -}; - -var beep = function() { - navigator.notification.beep(2); -}; - -var vibrate = function() { - navigator.notification.vibrate(0); -}; - -function roundNumber(num) { - var dec = 3; - var result = Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec); - return result; -} - -var accelerationWatch = null; - -function updateAcceleration(a) { - document.getElementById('x').innerHTML = roundNumber(a.x); - document.getElementById('y').innerHTML = roundNumber(a.y); - document.getElementById('z').innerHTML = roundNumber(a.z); -} - -var toggleAccel = function() { - if (accelerationWatch !== null) { - navigator.accelerometer.clearWatch(accelerationWatch); - updateAcceleration({ - x : "", - y : "", - z : "" - }); - accelerationWatch = null; - } else { - var options = {}; - options.frequency = 1000; - accelerationWatch = navigator.accelerometer.watchAcceleration( - updateAcceleration, function(ex) { - alert("accel fail (" + ex.name + ": " + ex.message + ")"); - }, options); - } -}; - -var preventBehavior = function(e) { - e.preventDefault(); -}; - -function dump_pic(data) { - var viewport = document.getElementById('viewport'); - console.log(data); - viewport.style.display = ""; - viewport.style.position = "absolute"; - viewport.style.top = "10px"; - viewport.style.left = "10px"; - document.getElementById("test_img").src = "data:image/jpeg;base64," + data; -} - -function fail(msg) { - alert(msg); -} - -function show_pic() { - navigator.camera.getPicture(dump_pic, fail, { - quality : 50 - }); -} - -function close() { - var viewport = document.getElementById('viewport'); - viewport.style.position = "relative"; - viewport.style.display = "none"; -} - -// This is just to do this. -function readFile() { - navigator.file.read('/sdcard/cordova.txt', fail, fail); -} - -function writeFile() { - navigator.file.write('foo.txt', "This is a test of writing to a file", - fail, fail); -} - -function contacts_success(contacts) { - alert(contacts.length - + ' contacts returned.' - + (contacts[2] && contacts[2].name ? (' Third contact is ' + contacts[2].name.formatted) - : '')); -} - -function get_contacts() { - var obj = new ContactFindOptions(); - obj.filter = ""; - obj.multiple = true; - obj.limit = 5; - navigator.service.contacts.find( - [ "displayName", "name" ], contacts_success, - fail, obj); -} - -var networkReachableCallback = function(reachability) { - // There is no consistency on the format of reachability - var networkState = reachability.code || reachability; - - var currentState = {}; - currentState[NetworkStatus.NOT_REACHABLE] = 'No network connection'; - currentState[NetworkStatus.REACHABLE_VIA_CARRIER_DATA_NETWORK] = 'Carrier data connection'; - currentState[NetworkStatus.REACHABLE_VIA_WIFI_NETWORK] = 'WiFi connection'; - - confirm("Connection type:\n" + currentState[networkState]); -}; - -function check_network() { - navigator.network.isReachable("www.mobiledevelopersolutions.com", - networkReachableCallback, {}); -} - -function init() { - // the next line makes it impossible to see Contacts on the HTC Evo since it - // doesn't have a scroll button - // document.addEventListener("touchmove", preventBehavior, false); - document.addEventListener("deviceready", deviceInfo, true); - document.getElementById("user-agent").textContent = navigator.userAgent; -} diff --git a/test/master.css b/test/master.css deleted file mode 100644 index e93c937..0000000 --- a/test/master.css +++ /dev/null @@ -1,164 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ - - body { - background:#222 none repeat scroll 0 0; - color:#666; - font-family:Helvetica; - font-size:72%; - line-height:1.5em; - margin:0; - border-top:1px solid #393939; - } - - #info{ - background:#ffa; - border: 1px solid #ffd324; - -webkit-border-radius: 5px; - border-radius: 5px; - clear:both; - margin:15px 6px 0; - min-width:295px; - max-width:97%; - padding:4px 0px 2px 10px; - word-wrap:break-word; - margin-bottom:10px; - display:inline-block; - min-height: 160px; - max-height: 300px; - overflow: auto; - -webkit-overflow-scrolling: touch; - } - - #info > h4{ - font-size:.95em; - margin:5px 0; - } - - #stage.theme{ - padding-top:3px; - } - - /* Definition List */ - #stage.theme > dl{ - padding-top:10px; - clear:both; - margin:0; - list-style-type:none; - padding-left:10px; - overflow:auto; - } - - #stage.theme > dl > dt{ - font-weight:bold; - float:left; - margin-left:5px; - } - - #stage.theme > dl > dd{ - width:45px; - float:left; - color:#a87; - font-weight:bold; - } - - /* Content Styling */ - #stage.theme > h1, #stage.theme > h2, #stage.theme > p{ - margin:1em 0 .5em 13px; - } - - #stage.theme > h1{ - color:#eee; - font-size:1.6em; - text-align:center; - margin:0; - margin-top:15px; - padding:0; - } - - #stage.theme > h2{ - clear:both; - margin:0; - padding:3px; - font-size:1em; - text-align:center; - } - - /* Stage Buttons */ - #stage.theme .btn{ - border: 1px solid #555; - -webkit-border-radius: 5px; - border-radius: 5px; - text-align:center; - display:inline-block; - background:#444; - width:150px; - color:#9ab; - font-size:1.1em; - text-decoration:none; - padding:1.2em 0; - margin:3px 0px 3px 5px; - } - - #stage.theme .large{ - width:308px; - padding:1.2em 0; - } - - #stage.theme .wide{ - width:100%; - padding:1.2em 0; - } - - #stage.theme .backBtn{ - border: 1px solid #555; - -webkit-border-radius: 5px; - border-radius: 5px; - text-align:center; - display:block; - float:right; - background:#666; - width:75px; - color:#9ab; - font-size:1.1em; - text-decoration:none; - padding:1.2em 0; - margin:3px 5px 3px 5px; - } - - #stage.theme .input{ - border: 1px solid #555; - -webkit-border-radius: 5px; - border-radius: 5px; - text-align:center; - display:block; - float:light; - background:#888; - color:#9cd; - font-size:1.1em; - text-decoration:none; - padding:1.2em 0; - margin:3px 0px 3px 5px; - } - - #stage.theme .numeric{ - width:100%; - } From 255c5269c37430c3bddfbbf5f116f57c5c174507 Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Mon, 13 Jan 2014 14:32:57 -0500 Subject: [PATCH 037/106] CB-5756: Android: Use WebView.evaluateJavascript for script injection on Android 4.4+ --- src/android/InAppBrowser.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 34e96d9..1c6a859 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -251,11 +251,16 @@ public class InAppBrowser extends CordovaPlugin { scriptToInject = source; } final String finalScriptToInject = scriptToInject; - // This action will have the side-effect of blurring the currently focused element this.cordova.getActivity().runOnUiThread(new Runnable() { + @SuppressLint("NewApi") @Override public void run() { - inAppWebView.loadUrl("javascript:" + finalScriptToInject); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { + // This action will have the side-effect of blurring the currently focused element + inAppWebView.loadUrl("javascript:" + finalScriptToInject); + } else { + inAppWebView.evaluateJavascript(finalScriptToInject, null); + } } }); } From 9795b2e9dc540be98c6897a590e707083c570873 Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Mon, 13 Jan 2014 15:09:38 -0500 Subject: [PATCH 038/106] CB-5756: Add missing import --- src/android/InAppBrowser.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 1c6a859..450b68d 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -25,6 +25,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.text.InputType; import android.util.Log; From 2136cad49a0ed98eece13008e9846a0d15b675c2 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Tue, 3 Dec 2013 10:52:48 -0800 Subject: [PATCH 039/106] Adding drawables to the inAppBrowser. This doesn't look quite right, but it's a HUGE improvement over the previous settings --- plugin.xml | 17 +++++++++++++++++ .../drawable-hdpi/ic_action_next_item.png | Bin 0 -> 593 bytes .../drawable-hdpi/ic_action_previous_item.png | Bin 0 -> 599 bytes res/android/drawable-hdpi/ic_action_remove.png | Bin 0 -> 438 bytes .../drawable-mdpi/ic_action_next_item.png | Bin 0 -> 427 bytes .../drawable-mdpi/ic_action_previous_item.png | Bin 0 -> 438 bytes res/android/drawable-mdpi/ic_action_remove.png | Bin 0 -> 328 bytes .../drawable-xhdpi/ic_action_next_item.png | Bin 0 -> 727 bytes .../drawable-xhdpi/ic_action_previous_item.png | Bin 0 -> 744 bytes .../drawable-xhdpi/ic_action_remove.png | Bin 0 -> 536 bytes .../drawable-xxhdpi/ic_action_next_item.png | Bin 0 -> 1021 bytes .../ic_action_previous_item.png | Bin 0 -> 1038 bytes .../drawable-xxhdpi/ic_action_remove.png | Bin 0 -> 681 bytes 13 files changed, 17 insertions(+) create mode 100644 res/android/drawable-hdpi/ic_action_next_item.png create mode 100644 res/android/drawable-hdpi/ic_action_previous_item.png create mode 100644 res/android/drawable-hdpi/ic_action_remove.png create mode 100644 res/android/drawable-mdpi/ic_action_next_item.png create mode 100644 res/android/drawable-mdpi/ic_action_previous_item.png create mode 100644 res/android/drawable-mdpi/ic_action_remove.png create mode 100644 res/android/drawable-xhdpi/ic_action_next_item.png create mode 100644 res/android/drawable-xhdpi/ic_action_previous_item.png create mode 100644 res/android/drawable-xhdpi/ic_action_remove.png create mode 100644 res/android/drawable-xxhdpi/ic_action_next_item.png create mode 100644 res/android/drawable-xxhdpi/ic_action_previous_item.png create mode 100644 res/android/drawable-xxhdpi/ic_action_remove.png diff --git a/plugin.xml b/plugin.xml index d16c756..9510e4d 100644 --- a/plugin.xml +++ b/plugin.xml @@ -29,6 +29,23 @@ + + + + + + + + + + + + + + + + +
diff --git a/res/android/drawable-hdpi/ic_action_next_item.png b/res/android/drawable-hdpi/ic_action_next_item.png new file mode 100644 index 0000000000000000000000000000000000000000..fa469d8896a59934fbf36aebe69bbb8caec2a8b2 GIT binary patch literal 593 zcmV-X0@2ew#Qp~KZ0)f7AEsw$G6WMfh>{dU&BP{V_`c+kTrSs|-ZgLGzR9J{ zy{!4Zy}Qr-2m&uJFE6kEtgfvOjmP6j9LKw&D0Xco(6L}V!s7|;5^az6lBQ{S5*2{? zJ|53#L+(1GL{N!0RN~l10%617)4$)>`UYGP`4yn?j(__Huh&|rkN$JSH{vHTOn$>G zjroyY3G^Qj{}fLlnEZm-NSOyw0vcYoc)is^J==Kgx}pOoQH9rt zCcWqc6ufqLpQLJN3$IQS;3Tpdyk>}(q7&dGHZV&=sb@%H+hmOhgA-RP31AVM8io)l z0d{lI3BddV9yf;20_HQ(6@Ym%es2h^V16xn2=U%$Y6z`iekpnmuzAzAA&2>e=t-;` z@*~|m+FUe+*!;|JPNt3BD{u5fV{}r1%Xw2=I!}NuwrX&hyMje%$vhdqGo8?E;nG8b)mmC}IAq^-?d)0?>iAL56M&OH;S)f;MS6moTS;^pP# f<>ghSUjYUH07Aer2Yy7P00000NkvXXu0mjfn)D0> literal 0 HcmV?d00001 diff --git a/res/android/drawable-hdpi/ic_action_previous_item.png b/res/android/drawable-hdpi/ic_action_previous_item.png new file mode 100644 index 0000000000000000000000000000000000000000..e861ecce9272c9c8192ff3935dc3445b3f8edd85 GIT binary patch literal 599 zcmV-d0;v6oP)t91EdOD4Sj+@^zv0XTmRam(r!l+aCYZn=AYlfBU}9$P%RX`G3S#ZobXi~09O)yy z_h@xNFv?|&XZIb8t!Dh@ekK#%6En0)S$V{i% zY%aFj?ZY9#DlC*E@g#g;pq^aCrI-PTZ=ZYgT*a&S z#TG=aPQ>d5{Cm&_O7VJ;d|zah(XowJpT*q75U)EvZiYPrrFdQNsg2^5YNUH4);{@5 laDBZV5fKp)@xSpUzyOzByV literal 0 HcmV?d00001 diff --git a/res/android/drawable-hdpi/ic_action_remove.png b/res/android/drawable-hdpi/ic_action_remove.png new file mode 100644 index 0000000000000000000000000000000000000000..f889617e4471d6a0c65dd81a060bea482276b322 GIT binary patch literal 438 zcmV;n0ZIOeP)uR$+`ZL}CL9iu4pv&~TPqL?R?{{9XWYPqIRgeD^;8#3vi0QmIrbmFkC- z=lNP%LWrBV*rEMwV3MsoHqsVpnjWjFdZ5h9V<&ATapw~E1PAb=v+=Jp6hzH@=Ksnh z?p@-Z`}Cg%jQ{`u07*qoM6N<$g0AVdX8-^I literal 0 HcmV?d00001 diff --git a/res/android/drawable-mdpi/ic_action_next_item.png b/res/android/drawable-mdpi/ic_action_next_item.png new file mode 100644 index 0000000000000000000000000000000000000000..47365a300110db23c24d8471b4412cff3299335e GIT binary patch literal 427 zcmV;c0aX5pP)}4 zNQyzD&z|KhmJh*V!SWC28k$rgFbJCTOw9>SV0e#=m{d{d4v_RE6S|M4@9pf)?AB@( zD!dzlAQ+YTy?O!R7Jg<39}z}Tv@F9wqrkgk5hq4vW#Z%37t=J|d!9GIV_T>J#tHae zs|*lx#8HhW$b@f_0m;G{vp(Q)h-gX-!EN#1zjFg(;tztmoQbZOIJ;hgD^LMkhP9%& z3{#T~s7xf7HPhY~s)O+-_}IjNm^e^Wm8VZr!UUxt|dS5ABh@z}BtY}8#KEK=()eJQO_;pw;tFaVN+ VbL}20dqe;L002ovPDHLkV1lYyvRnWF literal 0 HcmV?d00001 diff --git a/res/android/drawable-mdpi/ic_action_previous_item.png b/res/android/drawable-mdpi/ic_action_previous_item.png new file mode 100644 index 0000000000000000000000000000000000000000..4ad2df42755874f331733cfab5ad0931d5baf0a1 GIT binary patch literal 438 zcmV;n0ZIOeP)F6XU^oF|V`EEF^)OP= z@&q6Sa=>FC?mK(->^EZcF;UUyFyG4pu`{uHnW$j70gy^S5_$~u{bss20BAYLxADl9 zgMyzFGngo_To_0d0WlX;2o&cFiH&=T900T&WN9Xv<)DQ3m{haK4S`H(VuOKIN}9B4HXgw@Cj>q2Ew4lGVMbE8VbLGzP<|0lB`f{0u;Ljl>0<;2S6S19b_TMVkAc>0>#dN z97vaJ2rYgWA_>VtD=6BB08&W203|{o(*P>O59Bif#c$EAAcEEf$C26udk3UcBd1Y1 g3P!PbXFRCwBAU>F6XU=$26V8kbBY;0@^ zq{4u>@9f#Lk4Z5Ys8<$96#?-opx)!S)G-k-2V^-H$RMbJq*~4eHG_d%2lN5)H&Psd zX8AX$88`tmKFR0LpMR2)lDYX-@nh*(FEV>wX{AjT2oT23$* zkPyFQSx&M8a5#d2T+4}$0s_&&O0MO^WJ8(*W-3I%Z(_12RUCjL5gsSDoS?`7xUw3l zg%w#2Ae7H3aRf7^mQ(5oW@=bYi6aPQLy}84s2Y@7l#+5_6*+|rnj=YcL aAiw|+C&DJQP0oz~0000YQCYi7Ht0k1EPi|MH~WyXp>^jAd0~7hD?*o|7+zUSOmJ?LZ_^s!$gZ3u%7L@{I=7VP% z_a!2<(cVB@qEY}B;TUmjD@L`X^1Yi-;U)bXkac?RG$k<~ew|5Zb_7R-fV{idjgha>@ws{Ht;KCkj zQFSm8?6Kj>9;+mPy8VE^q9>%u-?;9XQRxD|Aiv-xvsxRx6znc_IpYTx zfWH#Qg58aMlJ_bA+ufNEGInWqK?Pv)KiS=j%2b%`t|x@t`LMen0`RADX~rk7pQv06 zWlo5c+MO@257h$(g5A+%H&VMCX1nVMc6aOB?z{=WIWqa27|$1Fc=Jme~K>w1^{LC0JpuQ^5_5n002ov JPDHLkV1f=sN^1ZB literal 0 HcmV?d00001 diff --git a/res/android/drawable-xhdpi/ic_action_previous_item.png b/res/android/drawable-xhdpi/ic_action_previous_item.png new file mode 100644 index 0000000000000000000000000000000000000000..ed8ac91dec4b072dc40804c4b4178b065f7ed708 GIT binary patch literal 744 zcmVP)0=8N@8J`wu9@%$5uRVrBx8ftW!IF~j%BBb>Mv#M(Z}`;z8v z>q~mycWuAdYfB}CLZMJ76bgkxAqlNkt4qaoJ9|ROcW^o9p9_@XY&P4tXlq{}`3#qf z++S6c<1|elR;$%})B=Ef9ha+ustQU55vIEqArVHtZwa}_Fj()p-9!laGA@@WWkbjU z!sO<7JdXAU71YH0fFF zu}1R+4Vfqf$l2o(x2L9_;L{$1Y>txc{lXr-h!AXdnC+1!y(2?N!-qWv-5#e@*pefB z+2hp3xd0IYlKW(J^?H-V`$EC#{tFG)(%n=#3M_NLk z8A7Tq<^xe@gjj?kd!*svWUE}@34V@t9P5IwAq?PUsz((uHG(SFn?P~L$y-sCAB98M`&=jFYBD)$Dt=Dzu!75(wV*}TUW0~lD*P>x|&Qd7_P_ms8#d44)Bd2C{&(UWzlACh z2h+J7JT|oGD;)@GGOaOW6cZBo;L18>N<)*r-hvhul|7veGMpI|#*EiJJ~Wt%evs#k z`(T)NVD|L*hR@nt*!TS8@Q~!>{+{sRLemKr5utrj6SlHuxN0~$If#cv2)meV+a%%C zt)<5#^dMHnC&XAtwAM4=^N6;oJNO3DF++P6=euvz@Yh2KA?RyjT2C~1{B@8Z!OR?g=u^>1hj z_@^A1Ecxr>f}d?`p480di?4S%CphygyLXa^10xFBaPo&p0z-;&MeJ|;OL4%cX7F_N Kb6Mw<&;$S^P}b@I literal 0 HcmV?d00001 diff --git a/res/android/drawable-xxhdpi/ic_action_next_item.png b/res/android/drawable-xxhdpi/ic_action_next_item.png new file mode 100644 index 0000000000000000000000000000000000000000..51479d8ddfdeccaf4af263b3420af6d536cab5ab GIT binary patch literal 1021 zcmVAgR7s3xqaChTCq{={$6$9pJ`w$`@*0PUS8yqfTW{_#D)Lv`px@2`t;Arl^M+khT`w(Vfi?T|Mb^%iv_Rq4U1O zfOIC@a@?e^XMrZPbBL#^h9X!@67>gteHBogO**6UmzLwHy0IW`R!G#{y&;LRXM`)O zCKMVkO2&U;;^`1IU_bGc#jS@ts9BAth4Sm0M#j^(r~&EY>6LWKA;S>dAMEJ74Gc(Y z!YU%3wk*Zds)dV`c)F&quOs5A2@|STsw%&fiHxT&EyUBp8A9UeJR+WsPy^D}glmqR zB5)Z;+T*D?1H5MhZiC zVZRAHMcoVw(*}4Z#Ezb-nPFkx05M@hqTWiMP)5xu8p6)P05M@56Hocj5Kpr)z>BA$ zGc1}Ko)HR{AEstl_fJn3par{*9*JP#6~f&!WE2MH{@} zPu)8K%QavW5jQ_;U2Rzyz554|S^pCr#L|i1kBOTavVJxONZbsae#o8e7()^1#BW8$ z&8eoiY1#mZo5Kk4$J*kiSpy_)mM!M?nOPBEy#d}H62}qZo7&t%dkyGE#?84iMxprb zA4J5>mG-!4$^eO*F+=ALh(D1adT`TZkjMa;^z5t5nq)7Ug8Ojn^Q}1Q?&vA zAU+Q*XR%|7mKtDcCPP*RSe(g_jR96?GUQYPc9Ld7%9&3*4{^}Rxw11#*&abG`bQE! z%e_N2>>0-kEH2&S>%BgZ_-mIbnzk(CMR#@g_wFbhH@~`!sc5?(ZxC)y;?Ep7hzT92 r000000000000000004ko_$|Nymn?!0<{Ma600000NkvXXu0mjfBNxJV literal 0 HcmV?d00001 diff --git a/res/android/drawable-xxhdpi/ic_action_previous_item.png b/res/android/drawable-xxhdpi/ic_action_previous_item.png new file mode 100644 index 0000000000000000000000000000000000000000..bc8ff1241ade1ac7ad40427f4843b84fac947e62 GIT binary patch literal 1038 zcmV+p1o8WcP)mo zA`K~MkRSyq+|VX1EpADX!ubtpX-R2X{)3w|G(jRoT+p~M5_UmDVHa*Pqf8=#jI$FR zx|!vD(&-T1laBYiw{P!uE(8Do000000000000000fJA6En+=QS_547@@6xVYsZ?Gr zm&=)@b9;6G;5yEkAX@suJD;TiC?rQeVpkoe~${><9%@Z1CX%D6eP_#-l>|NT7R)*_qFEX2)Z z3?T74%D6eQ{ChHI;>$@{R;^sR=)*pDC&SwV2=Nay) zB5sa6#7!3lNZjlz4jFifo8}FWxY<|6P1oX^F+jPJff;*?o7Q_kH#l0!kdy(ka5gq> z&b`J>lLkoK>?q>qFeFBb3$tKAEHaSB4yM|O>Vm=-=W@XW7fwVD!p9biEK;}xjpZ62 zLt7q8q6g&I3m&*&f(PFoyy8#?wos z2`=KPn?h|dVXcU#JX@YvkEgCGOTo}PAv_Ple<6<}HMg*P=mGnQr>{fY zL;SMkIfCaWV#A=jh22IE$UmO)E$kCTGFlY*W|X81*f2p8PwUp=sr&Z@Nj$v`zaHkq z#M71}qk9;Tp9we0Ti7)#@idubDPC7tB=yQNiKi@XIik6V6&5Kj%o+tpD=d;TK#Dc^ z7Iw_t(7VWXxCH%2JpI=Si{I}Kn!|wo#nW9YEcg=jnZz&rnL*NT&fT%Xf(P9%R_e-< ze|Iz^H3&S|PExBc@MJ;*DgXcg00000000000001>2!0AM0Ol)zPaPAXwEzGB07*qo IM6N<$f+VNg^Z)<= literal 0 HcmV?d00001 diff --git a/res/android/drawable-xxhdpi/ic_action_remove.png b/res/android/drawable-xxhdpi/ic_action_remove.png new file mode 100644 index 0000000000000000000000000000000000000000..331c545b8cb07a97ee63cb4f1256d1dba5557a82 GIT binary patch literal 681 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGok|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+n7ln*978H@y_sX^mF+0u=KlZOu|s+fxN=%TuH_vu-63%O z0bh(`mh@(>)(|r>v-Oq66AmapP&R+I|NHM}^O&8P#J-=iwAdNbrpXGl5g7zooZfe! zXy=~Q^508s)?R;|&#w7(p8l)j$+D}f&aa<&y-Vlf4wmJ z{m;$!KDWm<)IWJYp?`yVy?a)Rgy+7R7WpU3-7WlQo&Q_^@0!|=9dkD{|8ah%BK}}y zUwJzR`>Fc-=T0VbW}WtqPP|eM_FyzT{_JE!R zD)mzsyaca2=@)ZQY+Cdukl9DlG4$UH#$_D~bm}KDB)bJnw~uTvRI)fR-^3w}Mf~Sv z_7fcsRN|EmXe#eGIi0hhi=*$;Ql>v@O{@PLixhm)QT}Dxr&MO1o`9IAr*$3O_1veg z`?Qpqrz1f--tK_DQpAbv90e{c(m#7YGyP$o^P)53LpC?loVb0lEiVH0g|-+>zh76d zzw5&@{nHH0@veKsKFU^vF}CfCD89*-Dfr;V_F3ly55?}QZh7Ijuejxf>%Q!k7oPi) zTVD9?i*9)lxG%WnMd&{7mKTxxoLgSR?yG8<(OmPC!%+O^D#0YbPom04?mSuT+F^Mr zylcW%?L%qnpM8_#v%0PH_*W!j7~dy$w}_iMj&Eb;mhJQVTeVv6|AD73EMLFabmp+t zH{}!WBYrC$Dt@-J@Me4I8>JZ0$#0vg1>-jHzhy>_Y6gY|m493Y3}5QcuZR|#@EIiM M>FVdQ&MBb@07pA8tN;K2 literal 0 HcmV?d00001 From 43f8935541a3cbd85aa1d214e1fa511be90d8a07 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Tue, 14 Jan 2014 15:47:01 -0800 Subject: [PATCH 040/106] Adding the buttons --- plugin.xml | 28 +++++++++--------- src/android/InAppBrowser.java | 18 +++++++++-- .../drawable-hdpi/ic_action_next_item.png | Bin .../drawable-hdpi/ic_action_previous_item.png | Bin .../res}/drawable-hdpi/ic_action_remove.png | Bin .../drawable-mdpi/ic_action_next_item.png | Bin .../drawable-mdpi/ic_action_previous_item.png | Bin .../res}/drawable-mdpi/ic_action_remove.png | Bin .../drawable-xhdpi/ic_action_next_item.png | Bin .../ic_action_previous_item.png | Bin .../res}/drawable-xhdpi/ic_action_remove.png | Bin .../drawable-xxhdpi/ic_action_next_item.png | Bin .../ic_action_previous_item.png | Bin .../res}/drawable-xxhdpi/ic_action_remove.png | Bin 14 files changed, 30 insertions(+), 16 deletions(-) rename {res/android => src/android/res}/drawable-hdpi/ic_action_next_item.png (100%) rename {res/android => src/android/res}/drawable-hdpi/ic_action_previous_item.png (100%) rename {res/android => src/android/res}/drawable-hdpi/ic_action_remove.png (100%) rename {res/android => src/android/res}/drawable-mdpi/ic_action_next_item.png (100%) rename {res/android => src/android/res}/drawable-mdpi/ic_action_previous_item.png (100%) rename {res/android => src/android/res}/drawable-mdpi/ic_action_remove.png (100%) rename {res/android => src/android/res}/drawable-xhdpi/ic_action_next_item.png (100%) rename {res/android => src/android/res}/drawable-xhdpi/ic_action_previous_item.png (100%) rename {res/android => src/android/res}/drawable-xhdpi/ic_action_remove.png (100%) rename {res/android => src/android/res}/drawable-xxhdpi/ic_action_next_item.png (100%) rename {res/android => src/android/res}/drawable-xxhdpi/ic_action_previous_item.png (100%) rename {res/android => src/android/res}/drawable-xxhdpi/ic_action_remove.png (100%) diff --git a/plugin.xml b/plugin.xml index 9510e4d..0df644e 100644 --- a/plugin.xml +++ b/plugin.xml @@ -19,7 +19,7 @@
- + @@ -30,21 +30,21 @@ - - - - - + + + + + - - - - + + + + - - - - + + + + diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 450b68d..394e62b 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -23,7 +23,9 @@ import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.content.res.Resources; import android.graphics.Bitmap; +import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -483,7 +485,13 @@ public class InAppBrowser extends CordovaPlugin { back.setLayoutParams(backLayoutParams); back.setContentDescription("Back Button"); back.setId(2); + /* back.setText("<"); + */ + Resources activityRes = cordova.getActivity().getResources(); + int backResId = activityRes.getIdentifier("ic_action_previous_item", "drawable", cordova.getActivity().getPackageName()); + Drawable backIcon = activityRes.getDrawable(backResId); + back.setBackground(backIcon); back.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { goBack(); @@ -497,7 +505,10 @@ public class InAppBrowser extends CordovaPlugin { forward.setLayoutParams(forwardLayoutParams); forward.setContentDescription("Forward Button"); forward.setId(3); - forward.setText(">"); + //forward.setText(">"); + int fwdResId = activityRes.getIdentifier("ic_action_next_item", "drawable", cordova.getActivity().getPackageName()); + Drawable fwdIcon = activityRes.getDrawable(fwdResId); + forward.setBackground(fwdIcon); forward.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { goForward(); @@ -534,7 +545,10 @@ public class InAppBrowser extends CordovaPlugin { close.setLayoutParams(closeLayoutParams); forward.setContentDescription("Close Button"); close.setId(5); - close.setText(buttonLabel); + //close.setText(buttonLabel); + int closeResId = activityRes.getIdentifier("ic_action_remove", "drawable", cordova.getActivity().getPackageName()); + Drawable closeIcon = activityRes.getDrawable(closeResId); + close.setBackground(closeIcon); close.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { closeDialog(); diff --git a/res/android/drawable-hdpi/ic_action_next_item.png b/src/android/res/drawable-hdpi/ic_action_next_item.png similarity index 100% rename from res/android/drawable-hdpi/ic_action_next_item.png rename to src/android/res/drawable-hdpi/ic_action_next_item.png diff --git a/res/android/drawable-hdpi/ic_action_previous_item.png b/src/android/res/drawable-hdpi/ic_action_previous_item.png similarity index 100% rename from res/android/drawable-hdpi/ic_action_previous_item.png rename to src/android/res/drawable-hdpi/ic_action_previous_item.png diff --git a/res/android/drawable-hdpi/ic_action_remove.png b/src/android/res/drawable-hdpi/ic_action_remove.png similarity index 100% rename from res/android/drawable-hdpi/ic_action_remove.png rename to src/android/res/drawable-hdpi/ic_action_remove.png diff --git a/res/android/drawable-mdpi/ic_action_next_item.png b/src/android/res/drawable-mdpi/ic_action_next_item.png similarity index 100% rename from res/android/drawable-mdpi/ic_action_next_item.png rename to src/android/res/drawable-mdpi/ic_action_next_item.png diff --git a/res/android/drawable-mdpi/ic_action_previous_item.png b/src/android/res/drawable-mdpi/ic_action_previous_item.png similarity index 100% rename from res/android/drawable-mdpi/ic_action_previous_item.png rename to src/android/res/drawable-mdpi/ic_action_previous_item.png diff --git a/res/android/drawable-mdpi/ic_action_remove.png b/src/android/res/drawable-mdpi/ic_action_remove.png similarity index 100% rename from res/android/drawable-mdpi/ic_action_remove.png rename to src/android/res/drawable-mdpi/ic_action_remove.png diff --git a/res/android/drawable-xhdpi/ic_action_next_item.png b/src/android/res/drawable-xhdpi/ic_action_next_item.png similarity index 100% rename from res/android/drawable-xhdpi/ic_action_next_item.png rename to src/android/res/drawable-xhdpi/ic_action_next_item.png diff --git a/res/android/drawable-xhdpi/ic_action_previous_item.png b/src/android/res/drawable-xhdpi/ic_action_previous_item.png similarity index 100% rename from res/android/drawable-xhdpi/ic_action_previous_item.png rename to src/android/res/drawable-xhdpi/ic_action_previous_item.png diff --git a/res/android/drawable-xhdpi/ic_action_remove.png b/src/android/res/drawable-xhdpi/ic_action_remove.png similarity index 100% rename from res/android/drawable-xhdpi/ic_action_remove.png rename to src/android/res/drawable-xhdpi/ic_action_remove.png diff --git a/res/android/drawable-xxhdpi/ic_action_next_item.png b/src/android/res/drawable-xxhdpi/ic_action_next_item.png similarity index 100% rename from res/android/drawable-xxhdpi/ic_action_next_item.png rename to src/android/res/drawable-xxhdpi/ic_action_next_item.png diff --git a/res/android/drawable-xxhdpi/ic_action_previous_item.png b/src/android/res/drawable-xxhdpi/ic_action_previous_item.png similarity index 100% rename from res/android/drawable-xxhdpi/ic_action_previous_item.png rename to src/android/res/drawable-xxhdpi/ic_action_previous_item.png diff --git a/res/android/drawable-xxhdpi/ic_action_remove.png b/src/android/res/drawable-xxhdpi/ic_action_remove.png similarity index 100% rename from res/android/drawable-xxhdpi/ic_action_remove.png rename to src/android/res/drawable-xxhdpi/ic_action_remove.png From bc554fdf954c9ff1c9eac5b5cc6d85f091fc9325 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Wed, 15 Jan 2014 14:28:03 -0800 Subject: [PATCH 041/106] Adding CC-A-2.5 Notice for Assets, modifying plugins to use resources --- NOTICE | 1 + plugin.xml | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 NOTICE diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..4d37500 --- /dev/null +++ b/NOTICE @@ -0,0 +1 @@ +Icons used in ths plugin are reproduced from work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License. diff --git a/plugin.xml b/plugin.xml index 0df644e..9736604 100644 --- a/plugin.xml +++ b/plugin.xml @@ -31,20 +31,20 @@ - - - - + + + + - - - - + + + + - - - - + + + + From 9206d82df4996e169ea0967469c797ecfca9f5f1 Mon Sep 17 00:00:00 2001 From: Maxim Ermilov Date: Wed, 16 Oct 2013 21:13:03 +0400 Subject: [PATCH 042/106] add ubuntu platform --- plugin.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugin.xml b/plugin.xml index 9736604..433bf2f 100644 --- a/plugin.xml +++ b/plugin.xml @@ -60,6 +60,15 @@ + + + + + + + + + From 736c8ddec07314e5ff2fdafd7544e4b362c57af0 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Thu, 16 Jan 2014 11:34:47 -0800 Subject: [PATCH 043/106] WTF? ubuntu got automerged twice --- plugin.xml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/plugin.xml b/plugin.xml index 433bf2f..9736604 100644 --- a/plugin.xml +++ b/plugin.xml @@ -60,15 +60,6 @@ - - - - - - - - - From 0ce0eed585309ee2a9933bd93a58a56f60bf7fc2 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Thu, 16 Jan 2014 13:55:53 -0800 Subject: [PATCH 044/106] Didn't test on ICS or lower, getDrawable isn't supported until Jellybean --- src/android/InAppBrowser.java | 37 ++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 394e62b..4efd99b 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -27,7 +27,6 @@ import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.net.Uri; -import android.os.Build; import android.os.Bundle; import android.text.InputType; import android.util.Log; @@ -254,16 +253,11 @@ public class InAppBrowser extends CordovaPlugin { scriptToInject = source; } final String finalScriptToInject = scriptToInject; + // This action will have the side-effect of blurring the currently focused element this.cordova.getActivity().runOnUiThread(new Runnable() { - @SuppressLint("NewApi") @Override public void run() { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { - // This action will have the side-effect of blurring the currently focused element - inAppWebView.loadUrl("javascript:" + finalScriptToInject); - } else { - inAppWebView.evaluateJavascript(finalScriptToInject, null); - } + inAppWebView.loadUrl("javascript:" + finalScriptToInject); } }); } @@ -491,7 +485,14 @@ public class InAppBrowser extends CordovaPlugin { Resources activityRes = cordova.getActivity().getResources(); int backResId = activityRes.getIdentifier("ic_action_previous_item", "drawable", cordova.getActivity().getPackageName()); Drawable backIcon = activityRes.getDrawable(backResId); - back.setBackground(backIcon); + if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) + { + back.setBackgroundDrawable(backIcon); + } + else + { + back.setBackground(backIcon); + } back.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { goBack(); @@ -508,7 +509,14 @@ public class InAppBrowser extends CordovaPlugin { //forward.setText(">"); int fwdResId = activityRes.getIdentifier("ic_action_next_item", "drawable", cordova.getActivity().getPackageName()); Drawable fwdIcon = activityRes.getDrawable(fwdResId); - forward.setBackground(fwdIcon); + if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) + { + forward.setBackgroundDrawable(fwdIcon); + } + else + { + forward.setBackground(fwdIcon); + } forward.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { goForward(); @@ -548,7 +556,14 @@ public class InAppBrowser extends CordovaPlugin { //close.setText(buttonLabel); int closeResId = activityRes.getIdentifier("ic_action_remove", "drawable", cordova.getActivity().getPackageName()); Drawable closeIcon = activityRes.getDrawable(closeResId); - close.setBackground(closeIcon); + if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) + { + close.setBackgroundDrawable(closeIcon); + } + else + { + close.setBackground(closeIcon); + } close.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { closeDialog(); From e807bc3dc0f684212e43610a18f61e837a685c38 Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Mon, 13 Jan 2014 14:32:57 -0500 Subject: [PATCH 045/106] CB-5756: Android: Use WebView.evaluateJavascript for script injection on Android 4.4+ --- src/android/InAppBrowser.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 4efd99b..1a77c57 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -253,11 +253,16 @@ public class InAppBrowser extends CordovaPlugin { scriptToInject = source; } final String finalScriptToInject = scriptToInject; - // This action will have the side-effect of blurring the currently focused element this.cordova.getActivity().runOnUiThread(new Runnable() { + @SuppressLint("NewApi") @Override public void run() { - inAppWebView.loadUrl("javascript:" + finalScriptToInject); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { + // This action will have the side-effect of blurring the currently focused element + inAppWebView.loadUrl("javascript:" + finalScriptToInject); + } else { + inAppWebView.evaluateJavascript(finalScriptToInject, null); + } } }); } From 985d94ee00d8c15b68b24c2b9c3b7c5c9b0999c3 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Sun, 19 Jan 2014 21:56:59 -0500 Subject: [PATCH 046/106] Add missing import for previous commit --- src/android/InAppBrowser.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 1a77c57..16ecd70 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -27,6 +27,7 @@ import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.text.InputType; import android.util.Log; From b62b9edde3a2656bb7016e64080428fecdb29d1e Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Wed, 5 Feb 2014 17:53:59 -0800 Subject: [PATCH 047/106] CB-5980 Updated version and RELEASENOTES.md for release 0.3.1 --- RELEASENOTES.md | 9 +++++++++ plugin.xml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index ac7b46d..2b95181 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -64,3 +64,12 @@ * Apply CB-5193 to InAppBrowser (Fix DB quota exception) * CB-5593 iOS: Make InAppBrowser localizable * CB-5591 Change window.escape to encodeURIComponent + +### 0.3.1 (Feb 05, 2014) +* CB-5756: Android: Use WebView.evaluateJavascript for script injection on Android 4.4+ +* Didn't test on ICS or lower, getDrawable isn't supported until Jellybean +* add ubuntu platform +* Adding drawables to the inAppBrowser. This doesn't look quite right, but it's a HUGE improvement over the previous settings +* CB-5756: Android: Use WebView.evaluateJavascript for script injection on Android 4.4+ +* Remove alive from InAppBrowser.js since it didn't catch the case where the browser is closed by the user. +* CB-5733 Fix IAB.close() not working if called before show() animation is done diff --git a/plugin.xml b/plugin.xml index 9736604..0878073 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.3.1"> InAppBrowser Cordova InAppBrowser Plugin From 24e6a1feeb521b53a2f773b8ebff61bed1ecc6ce Mon Sep 17 00:00:00 2001 From: Sidney Bofah Date: Mon, 27 Jan 2014 00:11:21 +0100 Subject: [PATCH 048/106] Removed some iOS6 Deprecations --- src/ios/CDVInAppBrowser.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index a660ac2..213cb73 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -510,14 +510,14 @@ self.addressLabel.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); self.addressLabel.enabled = YES; self.addressLabel.hidden = NO; - self.addressLabel.lineBreakMode = UILineBreakModeTailTruncation; - self.addressLabel.minimumFontSize = 10.000; + self.addressLabel.lineBreakMode = NSLineBreakByTruncatingTail; + self.addressLabel.minimumScaleFactor = 10.000; self.addressLabel.multipleTouchEnabled = NO; self.addressLabel.numberOfLines = 1; self.addressLabel.opaque = NO; self.addressLabel.shadowOffset = CGSizeMake(0.0, -1.0); self.addressLabel.text = NSLocalizedString(@"Loading...", nil); - self.addressLabel.textAlignment = UITextAlignmentLeft; + self.addressLabel.textAlignment = NSTextAlignmentLeft; self.addressLabel.textColor = [UIColor colorWithWhite:1.000 alpha:1.000]; self.addressLabel.userInteractionEnabled = NO; From 4c07917c0acd8220870ed3686ec3956657d638c9 Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Wed, 5 Feb 2014 17:53:59 -0800 Subject: [PATCH 049/106] CB-5980 Updated version and RELEASENOTES.md for release 0.3.1 --- RELEASENOTES.md | 9 +++++++++ plugin.xml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index ac7b46d..2b95181 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -64,3 +64,12 @@ * Apply CB-5193 to InAppBrowser (Fix DB quota exception) * CB-5593 iOS: Make InAppBrowser localizable * CB-5591 Change window.escape to encodeURIComponent + +### 0.3.1 (Feb 05, 2014) +* CB-5756: Android: Use WebView.evaluateJavascript for script injection on Android 4.4+ +* Didn't test on ICS or lower, getDrawable isn't supported until Jellybean +* add ubuntu platform +* Adding drawables to the inAppBrowser. This doesn't look quite right, but it's a HUGE improvement over the previous settings +* CB-5756: Android: Use WebView.evaluateJavascript for script injection on Android 4.4+ +* Remove alive from InAppBrowser.js since it didn't catch the case where the browser is closed by the user. +* CB-5733 Fix IAB.close() not working if called before show() animation is done diff --git a/plugin.xml b/plugin.xml index 9736604..0878073 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.3.1"> InAppBrowser Cordova InAppBrowser Plugin From cd31b3a64dcfe3aa629a56539d5e162dad5251fc Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Wed, 5 Feb 2014 18:13:30 -0800 Subject: [PATCH 050/106] CB-5980 Incremented plugin version on dev branch. --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index 0878073..9ff4add 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.3.2-dev"> InAppBrowser Cordova InAppBrowser Plugin From 39e64c988afb38a081fae7e3d71d18424a3cfbf4 Mon Sep 17 00:00:00 2001 From: Bryan Higgins Date: Thu, 13 Feb 2014 15:00:18 -0500 Subject: [PATCH 051/106] CB-6035 - Move js-module so it is not loaded on unsupported platforms BlackBerry 10 has a native implementation which does not require the plugin. --- plugin.xml | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/plugin.xml b/plugin.xml index 9ff4add..57396a7 100644 --- a/plugin.xml +++ b/plugin.xml @@ -14,13 +14,12 @@ - - - - - + + + + @@ -50,6 +49,9 @@ + + + @@ -62,6 +64,9 @@ + + + @@ -69,7 +74,10 @@ - + + + + @@ -82,15 +90,11 @@ - - + + + @@ -102,6 +106,9 @@ + + + @@ -113,6 +120,9 @@ + + + From 26702cb0720c5c394b407c23570136c53171fa55 Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Wed, 19 Feb 2014 00:26:19 -0500 Subject: [PATCH 052/106] Validate that callbackId is correctly formed --- src/ios/CDVInAppBrowser.h | 1 + src/ios/CDVInAppBrowser.m | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/ios/CDVInAppBrowser.h b/src/ios/CDVInAppBrowser.h index 581bcd0..8e2ab12 100644 --- a/src/ios/CDVInAppBrowser.h +++ b/src/ios/CDVInAppBrowser.h @@ -30,6 +30,7 @@ @property (nonatomic, retain) CDVInAppBrowserViewController* inAppBrowserViewController; @property (nonatomic, copy) NSString* callbackId; +@property (nonatomic, copy) NSRegularExpression *callbackIdPattern; - (void)open:(CDVInvokedUrlCommand*)command; - (void)close:(CDVInvokedUrlCommand*)command; diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 213cb73..88b737c 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -47,6 +47,7 @@ self = [super initWithWebView:theWebView]; if (self != nil) { _previousStatusBarStyle = -1; + _callbackIdPattern = nil; } return self; @@ -297,6 +298,23 @@ [self injectDeferredObject:[command argumentAtIndex:0] withWrapper:jsWrapper]; } +- (BOOL)isValidCallbackId:(NSString *)callbackId +{ + NSError *err = nil; + // Initialize on first use + if (self.callbackIdPattern == nil) { + self.callbackIdPattern = [NSRegularExpression regularExpressionWithPattern:@"^InAppBrowser[0-9]{1,10}$" options:0 error:&err]; + if (err != nil) { + // Couldn't initialize Regex; No is safer than Yes. + return NO; + } + } + if ([self.callbackIdPattern firstMatchInString:callbackId options:0 range:NSMakeRange(0, [callbackId length])]) { + return YES; + } + return NO; +} + /** * The iframe bridge provided for the InAppBrowser is capable of executing any oustanding callback belonging * to the InAppBrowser plugin. Care has been taken that other callbacks cannot be triggered, and that no @@ -323,7 +341,7 @@ NSString* scriptCallbackId = [url host]; CDVPluginResult* pluginResult = nil; - if ([scriptCallbackId hasPrefix:@"InAppBrowser"]) { + if ([self isValidCallbackId:scriptCallbackId]) { NSString* scriptResult = [url path]; NSError* __autoreleasing error = nil; From dbf54d2d09cf7d47745ed48428a80b4f0554edef Mon Sep 17 00:00:00 2001 From: ldeluca Date: Wed, 26 Feb 2014 09:36:16 -0500 Subject: [PATCH 053/106] Lisa testing pulling in plugins for plugin: cordova-plugin-inappbrowser --- doc/es/index.md | 292 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 292 insertions(+) create mode 100644 doc/es/index.md diff --git a/doc/es/index.md b/doc/es/index.md new file mode 100644 index 0000000..641ae0a --- /dev/null +++ b/doc/es/index.md @@ -0,0 +1,292 @@ + + +# org.apache.cordova.inappbrowser + +Este plugin proporciona una vista de navegador web que se muestra cuando se llama a `window.open()` , o cuando abre un enlace formado como``. + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + + +**Nota**: InAppBrowser la ventana se comporta como un navegador web estándar y no pueden acceder a Cordova APIs. + +## Instalación + + cordova plugin add org.apache.cordova.inappbrowser + + +## window.open + +Se abre una dirección URL en una nueva `InAppBrowser` ejemplo, la instancia actual del navegador o el navegador del sistema. + + var ref = window.open(url, target, options); + + +* **ref**: referencia a la `InAppBrowser` ventana. *(InAppBrowser)* + +* **URL**: el URL para cargar *(String)*. Llame a `encodeURI()` en este si la URL contiene caracteres Unicode. + +* **objetivo**: el objetivo en el que se carga la URL, un parámetro opcional que por defecto es `_self` . *(String)* + + * `_self`: Se abre en el Cordova WebView si la URL está en la lista blanca, de lo contrario se abre en el`InAppBrowser`. + * `_blank`: Se abre en el`InAppBrowser`. + * `_system`: Se abre en el navegador web del sistema. + +* **Opciones**: opciones para el `InAppBrowser` . Opcional, contumaz a: `location=yes` . *(String)* + + La `options` cadena no debe contener ningún espacio en blanco, y pares nombre/valor de cada característica deben estar separados por una coma. Los nombres de función son minúsculas. Todas las plataformas admiten el valor siguiente: + + * **Ubicación**: A `yes` o `no` para activar el `InAppBrowser` de barra de ubicación activado o desactivado. + + Android sólo: + + * **closebuttoncaption**: establecer una cadena para usar como título del botón **hecho** . + * **oculta**: a `yes` para crear el navegador y cargar la página, pero no lo demuestra. El evento load se desencadena cuando termine la carga. Omitir o a `no` (por defecto) para que el navegador abra y carga normalmente. + * **clearcache**: a `yes` para que el navegador es caché de galleta despejado antes de que se abra la nueva ventana + * **clearsessioncache**: a `yes` que la caché de cookie de sesión despejado antes de que se abra la nueva ventana + + Sólo iOS: + + * **closebuttoncaption**: establecer una cadena para usar como título del botón **hecho** . Tenga en cuenta que necesitas localizar este valor por sí mismo. + * **disallowoverscroll**: A `yes` o `no` (valor por defecto es `no` ). Activa/desactiva la propiedad UIWebViewBounce. + * **oculta**: a `yes` para crear el navegador y cargar la página, pero no lo demuestra. El evento load se desencadena cuando termine la carga. Omitir o a `no` (por defecto) para que el navegador abra y carga normalmente. + * **barra de herramientas**: a `yes` o `no` para activar la barra de herramientas on u off para el InAppBrowser (por defecto`yes`) + * **enableViewportScale**: A `yes` o `no` para evitar la vista escala a través de una etiqueta meta (por defecto`no`). + * **mediaPlaybackRequiresUserAction**: A `yes` o `no` para evitar HTML5 audio o vídeo de reproducción automática (por defecto`no`). + * **allowInlineMediaPlayback**: A `yes` o `no` para permitir la reproducción de los medios de comunicación en línea HTML5, mostrando en la ventana del navegador en lugar de una interfaz específica del dispositivo de reproducción. El código de HTML `video` elemento también debe incluir la `webkit-playsinline` atributo (por defecto`no`) + * **keyboardDisplayRequiresUserAction**: A `yes` o `no` para abrir el teclado cuando elementos de formulario reciben el foco mediante JavaScript `focus()` llamada (por defecto`yes`). + * **suppressesIncrementalRendering**: A `yes` o `no` que esperar a que todo el contenido nuevo vista es recibido antes de ser prestados (por defecto`no`). + * **presentationstyle**: A `pagesheet` , `formsheet` o `fullscreen` para establecer el [estilo de la presentación][1] (por defecto`fullscreen`). + * **transitionstyle**: A `fliphorizontal` , `crossdissolve` o `coververtical` para establecer el [estilo de transición][2] (por defecto`coververtical`). + * **toolbarposition**: A `top` o `bottom` (valor por defecto es `bottom` ). Hace que la barra de herramientas en la parte superior o inferior de la ventana. + + [1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* BlackBerry 10 +* iOS +* Windows Phone 7 y 8 + +### Ejemplo + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); + + +## InAppBrowser + +El objeto devuelto desde una llamada a`window.open`. + +### Métodos + +* addEventListener +* removeEventListener +* close +* show +* executeScript +* insertCSS + +## addEventListener + +> Añade un detector para un evento de la`InAppBrowser`. + + ref.addEventListener(eventname, callback); + + +* **ref**: referencia a la `InAppBrowser` ventana *(InAppBrowser)* + +* **eventName**: el evento para escuchar *(String)* + + * **loadstart**: evento desencadena cuando el `InAppBrowser` comienza a cargar una dirección URL. + * **loadstop**: evento desencadena cuando el `InAppBrowser` termina cargando una dirección URL. + * **loaderror**: evento desencadena cuando el `InAppBrowser` encuentra un error al cargar una dirección URL. + * **salida**: evento desencadena cuando el `InAppBrowser` se cierra la ventana. + +* **devolución de llamada**: la función que se ejecuta cuando se desencadene el evento. La función se pasa un `InAppBrowserEvent` objeto como parámetro. + +### InAppBrowserEvent Properties + +* **tipo**: eventname, ya sea `loadstart` , `loadstop` , `loaderror` , o `exit` . *(String)* + +* **URL**: la URL que se cargó. *(String)* + +* **código**: el código de error, sólo en el caso de `loaderror` . *(Número)* + +* **mensaje**: el mensaje de error, sólo en el caso de `loaderror` . *(String)* + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* BlackBerry 10 +* iOS +* Windows Phone 7 y 8 + +### Ejemplo rápido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstart', function() { alert(event.url); }); + + +## removeEventListener + +> Elimina un detector para un evento de la`InAppBrowser`. + + ref.removeEventListener(eventname, callback); + + +* **ref**: referencia a la `InAppBrowser` ventana. *(InAppBrowser)* + +* **eventName**: dejar de escuchar para el evento. *(String)* + + * **loadstart**: evento desencadena cuando el `InAppBrowser` comienza a cargar una dirección URL. + * **loadstop**: evento desencadena cuando el `InAppBrowser` termina cargando una dirección URL. + * **loaderror**: evento desencadena cuando el `InAppBrowser` se encuentra con un error al cargar una dirección URL. + * **salida**: evento desencadena cuando el `InAppBrowser` se cierra la ventana. + +* **devolución de llamada**: la función a ejecutar cuando se desencadene el evento. La función se pasa un `InAppBrowserEvent` objeto. + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* BlackBerry 10 +* iOS +* Windows Phone 7 y 8 + +### Ejemplo rápido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var myCallback = function() { alert(event.url); } + ref.addEventListener('loadstart', myCallback); + ref.removeEventListener('loadstart', myCallback); + + +## close + +> Se cierra el `InAppBrowser` ventana. + + Ref.Close(); + + +* **ref**: referencia a la `InAppBrowser` ventana *(InAppBrowser)* + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* BlackBerry 10 +* iOS +* Windows Phone 7 y 8 + +### Ejemplo rápido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.close(); + + +## show + +> Muestra una ventana InAppBrowser que abrió sus puertas ocultada. Esto no tiene efecto si el InAppBrowser ya era visible. + + ref.show(); + + +* **ref**: referencia a la (ventana) InAppBrowser`InAppBrowser`) + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* BlackBerry 10 +* iOS + +### Ejemplo rápido + + var ref = window.open('http://apache.org', '_blank', 'hidden=yes'); + // some time later... + ref.show(); + + +## executeScript + +> Inyecta código JavaScript en la `InAppBrowser` ventana + + ref.executeScript(details, callback); + + +* **ref**: referencia a la `InAppBrowser` ventana. *(InAppBrowser)* + +* **injectDetails**: detalles de la secuencia de comandos para ejecutar, o especificar un `file` o `code` clave. *(Objeto)* + + * **archivo**: URL de la secuencia de comandos para inyectar. + * **código**: texto de la escritura para inyectar. + +* **devolución de llamada**: la función que se ejecuta después de inyecta el código JavaScript. + + * Si el script inyectado es de tipo `code` , la devolución de llamada se ejecuta con un solo parámetro, que es el valor devuelto por el guión, envuelto en un `Array` . Para los scripts de varias líneas, este es el valor devuelto de la última declaración, o la última expresión evaluada. + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* BlackBerry 10 +* iOS + +### Ejemplo rápido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.executeScript({file: "myscript.js"}); + }); + + +## insertCSS + +> Inyecta CSS en la `InAppBrowser` ventana. + + ref.insertCSS(details, callback); + + +* **ref**: referencia a la `InAppBrowser` ventana *(InAppBrowser)* + +* **injectDetails**: detalles de la secuencia de comandos para ejecutar, o especificar un `file` o `code` clave. *(Objeto)* + + * **archivo**: URL de la hoja de estilos para inyectar. + * **código**: texto de la hoja de estilos para inyectar. + +* **devolución de llamada**: la función que se ejecuta después de inyectar el CSS. + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* BlackBerry 10 +* iOS + +### Ejemplo rápido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.insertCSS({file: "mystyles.css"}); + }); \ No newline at end of file From 4a3c134be10a914c41e6064cc706ca6a346d6fc9 Mon Sep 17 00:00:00 2001 From: ldeluca Date: Thu, 27 Feb 2014 11:14:55 -0500 Subject: [PATCH 054/106] Lisa testing pulling in plugins for plugin: cordova-plugin-inappbrowser --- doc/fr/index.md | 292 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 292 insertions(+) create mode 100644 doc/fr/index.md diff --git a/doc/fr/index.md b/doc/fr/index.md new file mode 100644 index 0000000..7ec630a --- /dev/null +++ b/doc/fr/index.md @@ -0,0 +1,292 @@ + + +# org.apache.cordova.inappbrowser + +Ce plugin vous offre une vue de navigateur web qui s'affiche lorsque vous appelez `window.open()` , ou quand un lien d'ouverture formé comme``. + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + + +**Remarque**: InAppBrowser la fenêtre se comporte comme un navigateur web standard et ne peut pas accéder aux APIs Cordova. + +## Installation + + cordova plugin add org.apache.cordova.inappbrowser + + +## window.open + +Ouvre une URL dans une nouvelle instance de la classe `InAppBrowser`, une instance déjà existante ou dans le navigateur système. + + var ref = window.open(url, target, options); + + +* **ref** : référence à la fenêtre `InAppBrowser`. *(InAppBrowser)* + +* **url** : l'URL à charger *(String)*. À encoder au préalable via `encodeURI()` si celle-ci contient des caractères Unicode. + +* **target** : la cible du chargement de l'URL, ce paramètre est optionnel, sa valeur par défaut est `_self`. *(String)* + + * `_self` : dirige le chargement vers la WebView Cordova si l'URL figure dans la liste blanche, sinon dans une fenêtre `InAppBrowser`. + * `_blank` : dirige le chargement vers une fenêtre `InAppBrowser`. + * `_system` : dirige le chargement vers le navigateur Web du système. + +* **options** : permet de personnaliser la fenêtre `InAppBrowser`. Paramètre facultatif dont la valeur par défaut est `location=yes`. *(String)* + + La chaîne `options` ne doit contenir aucun caractère vide, chaque paire nom/valeur représentant une fonctionnalité doit être séparée de la précédente par une virgule. Les noms de fonctionnalités sont sensibles à la casse. Toutes les plates-formes prennent en charge la valeur ci-dessous : + + * **location** : régler à `yes` ou `no` afin d'afficher ou masquer la barre d'adresse de la fenêtre `InAppBrowser`. + + Android uniquement : + + * **closebuttoncaption**: affectez une chaîne à utiliser comme la **fait** légende du bouton. + * **caché**: la valeur `yes` pour créer le navigateur et charger la page, mais ne pas le montrer. L'événement load est déclenché lorsque le chargement est terminé. Omettre ou la valeur `no` (par défaut) pour que le navigateur ouvrir et charger normalement. + * **ClearCache**: la valeur `yes` pour que le navigateur du cache de cookie effacé, avant l'ouverture de la nouvelle fenêtre + * **clearsessioncache**: la valeur `yes` pour avoir le cache de cookie de session autorisé avant l'ouverture de la nouvelle fenêtre + + iOS uniquement : + + * **closebuttoncaption**: affectez une chaîne à utiliser comme la **fait** légende du bouton. Notez que vous devrez localiser cette valeur vous-même. + * **disallowoverscroll**: la valeur `yes` ou `no` (valeur par défaut est `no` ). Active/désactive la propriété UIWebViewBounce. + * **caché**: la valeur `yes` pour créer le navigateur et charger la page, mais ne pas le montrer. L'événement load est déclenché lorsque le chargement est terminé. Omettre ou la valeur `no` (par défaut) pour que le navigateur ouvrir et charger normalement. + * **barre d'outils**: la valeur `yes` ou `no` pour activer la barre d'outils ou désactiver pour le InAppBrowser (par défaut,`yes`) + * **enableViewportScale** : selon si la valeur est `yes` ou `no`, une balise meta est injectée avec pour but de permettre ou empêcher l'utilisateur de zoomer dans le viewport (`no` par défaut). + * **mediaPlaybackRequiresUserAction** : selon si la valeur est `yes` ou `no`, la lecture automatique de contenus HTML5 audio ou vidéo (c'est à dire sans action préalable de l'utilisateur) est désactivée ou activée (`no` par défaut). + * **allowInlineMediaPlayback**: la valeur `yes` ou `no` pour permettre la lecture du média en ligne HTML5, affichage dans la fenêtre du navigateur plutôt que d'une interface de lecture spécifique au périphérique. L'élément HTML `video` doit également comporter l'attribut `webkit-playsinline` (`no` par défaut) + * **keyboardDisplayRequiresUserAction** : régler sur `yes` ou `no` pour interdire ou autoriser l'ouverture du clavier lorsque des éléments de formulaire reçoivent le focus par l'intermédiaire d'un appel à la méthode JavaScript `focus()` (`yes` par défaut). + * **suppressesIncrementalRendering** : selon si la valeur est `yes` ou `no`, le rendu de la vue attendra ou non que tout nouveau contenu soit reçu (`no` par défaut). + * **presentationstyle** : régler sur `pagesheet`, `formsheet` ou `fullscreen` afin d'obtenir le [style de présentation][1] de fenêtre souhaité (`fullscreen` par défaut). + * **transitionstyle**: régler la valeur à `fliphorizontal`, `crossdissolve` ou `coververtical` afin de définir le [style de transition][2] de fenêtre souhaité (`coververtical` par défaut). + * **toolbarposition**: la valeur `top` ou `bottom` (valeur par défaut est `bottom` ). Causes de la barre d'outils être en haut ou en bas de la fenêtre. + + [1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* BlackBerry 10 +* iOS +* Windows Phone 7 et 8 + +### Exemple + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); + + +## InAppBrowser + +L'objet retourné par un appel à `window.open`. + +### Méthodes + +* addEventListener +* removeEventListener +* close +* show +* executeScript +* insertCSS + +## addEventListener + +> Ajoute un écouteur pour un évènement de la fenêtre `InAppBrowser`. + + ref.addEventListener(eventname, callback); + + +* **ref** : référence à la fenêtre `InAppBrowser`. *(InAppBrowser)* + +* **eventname** : l'évènement à écouter *(String)* + + * **loadstart** : évènement déclenché lorsque le chargement d'une URL débute dans la fenêtre `InAppBrowser`. + * **loadstop** : évènement déclenché lorsque la fenêtre `InAppBrowser` finit de charger une URL. + * **loaderror** : évènement déclenché si la fenêtre `InAppBrowser` rencontre une erreur lors du chargement d'une URL. + * **exit** : évènement déclenché lorsque la fenêtre `InAppBrowser` est fermée. + +* **callback** : la fonction à exécuter lorsque l'évènement se déclenche. Un objet `InAppBrowserEvent` lui est transmis comme paramètre. + +### InAppBrowserEvent Properties + +* **type** : le nom de l'évènement, soit `loadstart`, `loadstop`, `loaderror` ou `exit`. *(String)* + +* **url** : l'URL ayant été chargée. *(String)* + +* **code** : le code d'erreur, seulement pour `loaderror`. *(Number)* + +* **message** : un message d'erreur, seulement pour `loaderror`. *(String)* + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* BlackBerry 10 +* iOS +* Windows Phone 7 et 8 + +### Petit exemple + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstart', function() { alert(event.url); }); + + +## removeEventListener + +> Supprime un écouteur pour un évènement de la fenêtre `InAppBrowser`. + + ref.removeEventListener(eventname, callback); + + +* **ref** : référence à la fenêtre `InAppBrowser`. *(InAppBrowser)* + +* **eventname** : l'évènement pour lequel arrêter l'écoute. *(String)* + + * **loadstart**: événement déclenche quand le `InAppBrowser` commence à charger une URL. + * **loadstop**: événement déclenche lorsque la `InAppBrowser` finit de charger une URL. + * **loaderror** : évènement déclenché si la fenêtre `InAppBrowser` rencontre une erreur lors du chargement d'une URL. + * **sortie**: événement déclenche quand le `InAppBrowser` fenêtre est fermée. + +* **callback** : la fonction à exécuter lorsque l'évènement se déclenche. Un objet `InAppBrowserEvent` lui est transmis comme paramètre. + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* BlackBerry 10 +* iOS +* Windows Phone 7 et 8 + +### Petit exemple + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var myCallback = function() { alert(event.url); } + ref.addEventListener('loadstart', myCallback); + ref.removeEventListener('loadstart', myCallback); + + +## close + +> Ferme la fenêtre `InAppBrowser`. + + ref.close(); + + +* **Réf**: référence à la `InAppBrowser` fenêtre *(InAppBrowser)* + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* BlackBerry 10 +* iOS +* Windows Phone 7 et 8 + +### Petit exemple + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.close(); + + +## show + +> Affiche une fenêtre InAppBrowser qui a été ouverte cachée. Appeler cette méthode n'a aucun effet si la fenêtre en question est déjà visible. + + ref.show(); + + +* **Réf**: référence à la fenêtre () InAppBrowser`InAppBrowser`) + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* BlackBerry 10 +* iOS + +### Petit exemple + + var ref = window.open('http://apache.org', '_blank', 'hidden=yes'); + // some time later... + ref.show(); + + +## executeScript + +> Injecte du code JavaScript dans la fenêtre `InAppBrowser` + + ref.executeScript(details, callback); + + +* **Réf**: référence à la `InAppBrowser` fenêtre. *(InAppBrowser)* + +* **injectDetails** : détails du script à exécuter, requérant une propriété `file` ou `code`. *(Object)* + + * **file** : URL du script à injecter. + * **code** : texte du script à injecter. + +* **callback** : une fonction exécutée après l'injection du code JavaScript. + + * Si le script injecté est de type `code`, un seul paramètre est transmis à la fonction callback, correspondant à la valeur de retour du script enveloppée dans un `Array`. Pour les scripts multilignes, il s'agit de la valeur renvoyée par la dernière instruction ou la dernière expression évaluée. + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* BlackBerry 10 +* iOS + +### Petit exemple + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.executeScript({file: "myscript.js"}); + }); + + +## insertCSS + +> Injecte des règles CSS dans la fenêtre `InAppBrowser`. + + ref.insertCSS(details, callback); + + +* **Réf**: référence à la `InAppBrowser` fenêtre *(InAppBrowser)* + +* **injectDetails**: Détails du script à exécuter, spécifiant soit un `file` ou `code` clés. *(Objet)* + + * **file** : URL de la feuille de style à injecter. + * **code** : contenu de la feuille de style à injecter. + +* **callback** : une fonction exécutée après l'injection du fichier CSS. + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* BlackBerry 10 +* iOS + +### Petit exemple + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.insertCSS({file: "mystyles.css"}); + }); \ No newline at end of file From 77085aa5477fd91d89a8c92ffedddc04463ba0e2 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 27 Feb 2014 11:56:29 -0500 Subject: [PATCH 055/106] CB-6114 Updated version and RELEASENOTES.md for release 0.3.2 --- RELEASENOTES.md | 5 +++++ plugin.xml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 2b95181..293e125 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -73,3 +73,8 @@ * CB-5756: Android: Use WebView.evaluateJavascript for script injection on Android 4.4+ * Remove alive from InAppBrowser.js since it didn't catch the case where the browser is closed by the user. * CB-5733 Fix IAB.close() not working if called before show() animation is done + +### 0.3.2 (Feb 26, 2014) +* Validate that callbackId is correctly formed +* CB-6035 Move js-module so it is not loaded on unsupported platforms +* Removed some iOS6 Deprecations diff --git a/plugin.xml b/plugin.xml index 57396a7..77adc5c 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.3.2"> InAppBrowser Cordova InAppBrowser Plugin From 942d17981ee40463605b1f9c233806e7be3f0518 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 27 Feb 2014 12:29:15 -0500 Subject: [PATCH 056/106] CB-6114 Incremented plugin version on dev branch. --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index 77adc5c..aeb8dbd 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.3.3-dev"> InAppBrowser Cordova InAppBrowser Plugin From a5201cc1e3adc11d47f5feba873231f677431b9b Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 27 Feb 2014 15:36:31 -0500 Subject: [PATCH 057/106] Add NOTICE file --- NOTICE | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NOTICE b/NOTICE index 4d37500..8ec56a5 100644 --- a/NOTICE +++ b/NOTICE @@ -1 +1,5 @@ -Icons used in ths plugin are reproduced from work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License. +Apache Cordova +Copyright 2012 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). From 4d3c7b17d27144aab650abd0f17981d5a2ca8a71 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 27 Feb 2014 15:45:10 -0500 Subject: [PATCH 058/106] Add NOTICE file --- NOTICE | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NOTICE b/NOTICE index 4d37500..8ec56a5 100644 --- a/NOTICE +++ b/NOTICE @@ -1 +1,5 @@ -Icons used in ths plugin are reproduced from work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License. +Apache Cordova +Copyright 2012 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). From 6f373f7ed9993b81f5b735e3ee347e516585a916 Mon Sep 17 00:00:00 2001 From: Oliver Moran Date: Fri, 28 Feb 2014 19:58:14 +0000 Subject: [PATCH 059/106] fix for CB-5534 Signed-off-by: Joe Bowser --- src/android/InAppBrowser.java | 29 ++++++++++------ src/android/InAppBrowserDialog.java | 54 +++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 11 deletions(-) create mode 100644 src/android/InAppBrowserDialog.java diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 16ecd70..796036f 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -19,9 +19,8 @@ package org.apache.cordova.inappbrowser; import android.annotation.SuppressLint; -import android.app.Dialog; +import org.apache.cordova.inappbrowser.InAppBrowserDialog; import android.content.Context; -import android.content.DialogInterface; import android.content.Intent; import android.content.res.Resources; import android.graphics.Bitmap; @@ -80,7 +79,7 @@ public class InAppBrowser extends CordovaPlugin { private static final String CLEAR_ALL_CACHE = "clearcache"; private static final String CLEAR_SESSION_CACHE = "clearsessioncache"; - private Dialog dialog; + private InAppBrowserDialog dialog; private WebView inAppWebView; private EditText edittext; private CallbackContext callbackContext; @@ -337,12 +336,21 @@ public class InAppBrowser extends CordovaPlugin { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { - childView.loadUrl("about:blank"); + childView.setWebViewClient(new WebViewClient() { + // NB: wait for about:blank before dismissing + public void onPageFinished(WebView view, String url) { if (dialog != null) { dialog.dismiss(); } } }); + // NB: From SDK 19: "If you call methods on WebView from any thread + // other than your app's UI thread, it can cause unexpected results." + // http://developer.android.com/guide/webapps/migrating.html#Threads + childView.loadUrl("about:blank"); + } + }); + try { JSONObject obj = new JSONObject(); obj.put("type", EXIT_EVENT); @@ -350,7 +358,6 @@ public class InAppBrowser extends CordovaPlugin { } catch (JSONException ex) { Log.d(LOG_TAG, "Should never happen"); } - } /** @@ -398,6 +405,10 @@ public class InAppBrowser extends CordovaPlugin { return this.showLocationBar; } + private InAppBrowser getInAppBrowser(){ + return this; + } + /** * Display a new browser with the specified URL. * @@ -448,15 +459,11 @@ public class InAppBrowser extends CordovaPlugin { public void run() { // Let's create the main dialog - dialog = new Dialog(cordova.getActivity(), android.R.style.Theme_NoTitleBar); + dialog = new InAppBrowserDialog(cordova.getActivity(), android.R.style.Theme_NoTitleBar); dialog.getWindow().getAttributes().windowAnimations = android.R.style.Animation_Dialog; dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCancelable(true); - dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { - public void onDismiss(DialogInterface dialog) { - closeDialog(); - } - }); + dialog.setInAppBroswer(getInAppBrowser()); // Main container layout LinearLayout main = new LinearLayout(cordova.getActivity()); diff --git a/src/android/InAppBrowserDialog.java b/src/android/InAppBrowserDialog.java new file mode 100644 index 0000000..124e211 --- /dev/null +++ b/src/android/InAppBrowserDialog.java @@ -0,0 +1,54 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ +package org.apache.cordova.inappbrowser; + +import android.app.AlertDialog; +import android.app.Dialog; +import android.content.Context; +import android.util.Log; + +import org.json.JSONException; +import org.json.JSONObject; + +/** + * Created by Oliver on 22/11/2013. + */ +public class InAppBrowserDialog extends Dialog { + Context context; + InAppBrowser inAppBrowser = null; + + public InAppBrowserDialog(Context context, int theme) { + super(context, theme); + this.context = context; + } + + public void setInAppBroswer(InAppBrowser browser) { + this.inAppBrowser = browser; + } + + public void onBackPressed () { + if (this.inAppBrowser == null) { + this.dismiss(); + } else { + // better to go through the in inAppBrowser + // because it does a clean up + this.inAppBrowser.closeDialog(); + } + } +} From 497a23efc77cf0262497071cdc5c30fb94e01d99 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Fri, 28 Feb 2014 14:03:57 -0800 Subject: [PATCH 060/106] CB-5534: Updating the plugin.xml with the new Dialog class --- plugin.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin.xml b/plugin.xml index aeb8dbd..e4b31aa 100644 --- a/plugin.xml +++ b/plugin.xml @@ -27,6 +27,7 @@ + From d0dd10103c9e2ff7833e008188c26a6505ea6b96 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Wed, 5 Mar 2014 12:33:31 -0500 Subject: [PATCH 061/106] CB-6172 Fix inappbrowser install failure on case-sensitive filesystems. --- www/{InAppBrowser.js => inappbrowser.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename www/{InAppBrowser.js => inappbrowser.js} (100%) diff --git a/www/InAppBrowser.js b/www/inappbrowser.js similarity index 100% rename from www/InAppBrowser.js rename to www/inappbrowser.js From a5dedae6310f8c211596455cbd5f4214b0c8c508 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Wed, 5 Mar 2014 14:37:10 -0500 Subject: [PATCH 062/106] Updated version and RELEASENOTES.md for release 0.3.3 --- RELEASENOTES.md | 4 ++++ plugin.xml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 293e125..2d40026 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -78,3 +78,7 @@ * Validate that callbackId is correctly formed * CB-6035 Move js-module so it is not loaded on unsupported platforms * Removed some iOS6 Deprecations + +### 0.3.3 (Mar 5, 2014) +* CB-6172 Fix broken install on case-sensitive file-systems + diff --git a/plugin.xml b/plugin.xml index e4b31aa..932ff83 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.3.3"> InAppBrowser Cordova InAppBrowser Plugin From 5680f18bb4d28e6d6bc1a621e6588a010080c964 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Wed, 5 Mar 2014 14:38:13 -0500 Subject: [PATCH 063/106] Incremented plugin version on dev branch. --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index 932ff83..d0046fa 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.3.4-dev"> InAppBrowser Cordova InAppBrowser Plugin From 7dbad601f0321095bfe06bdd91b5576dfe55e433 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 6 Mar 2014 20:48:00 -0500 Subject: [PATCH 064/106] Tweak RELEASENOTES.md (missed a bug fix in last release) --- RELEASENOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 2d40026..364f4e9 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -80,5 +80,6 @@ * Removed some iOS6 Deprecations ### 0.3.3 (Mar 5, 2014) +* CB-5534 Fix video/audio does not stop playing when browser is closed * CB-6172 Fix broken install on case-sensitive file-systems From e282cc9e387e405a9103b2afa2b1a7a2b6232833 Mon Sep 17 00:00:00 2001 From: Bryan Higgins Date: Tue, 11 Mar 2014 12:22:17 -0400 Subject: [PATCH 065/106] CB-6218 Update docs for BB10 --- doc/index.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/doc/index.md b/doc/index.md index 61f702c..e82b29b 100644 --- a/doc/index.md +++ b/doc/index.md @@ -133,7 +133,6 @@ The object returned from a call to `window.open`. - Amazon Fire OS - Android -- BlackBerry 10 - iOS - Windows Phone 7 and 8 @@ -164,7 +163,6 @@ The function is passed an `InAppBrowserEvent` object. - Amazon Fire OS - Android -- BlackBerry 10 - iOS - Windows Phone 7 and 8 @@ -187,7 +185,6 @@ The function is passed an `InAppBrowserEvent` object. - Amazon Fire OS - Android -- BlackBerry 10 - iOS - Windows Phone 7 and 8 @@ -208,7 +205,6 @@ The function is passed an `InAppBrowserEvent` object. - Amazon Fire OS - Android -- BlackBerry 10 - iOS ### Quick Example @@ -240,7 +236,6 @@ The function is passed an `InAppBrowserEvent` object. - Amazon Fire OS - Android -- BlackBerry 10 - iOS ### Quick Example @@ -268,7 +263,6 @@ The function is passed an `InAppBrowserEvent` object. - Amazon Fire OS - Android -- BlackBerry 10 - iOS ### Quick Example From aa9a5db9413ebaf3fec60e41b24591c64953b12a Mon Sep 17 00:00:00 2001 From: Bryan Higgins Date: Tue, 11 Mar 2014 12:22:17 -0400 Subject: [PATCH 066/106] CB-6218 Update docs for BB10 --- doc/index.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/doc/index.md b/doc/index.md index 61f702c..e82b29b 100644 --- a/doc/index.md +++ b/doc/index.md @@ -133,7 +133,6 @@ The object returned from a call to `window.open`. - Amazon Fire OS - Android -- BlackBerry 10 - iOS - Windows Phone 7 and 8 @@ -164,7 +163,6 @@ The function is passed an `InAppBrowserEvent` object. - Amazon Fire OS - Android -- BlackBerry 10 - iOS - Windows Phone 7 and 8 @@ -187,7 +185,6 @@ The function is passed an `InAppBrowserEvent` object. - Amazon Fire OS - Android -- BlackBerry 10 - iOS - Windows Phone 7 and 8 @@ -208,7 +205,6 @@ The function is passed an `InAppBrowserEvent` object. - Amazon Fire OS - Android -- BlackBerry 10 - iOS ### Quick Example @@ -240,7 +236,6 @@ The function is passed an `InAppBrowserEvent` object. - Amazon Fire OS - Android -- BlackBerry 10 - iOS ### Quick Example @@ -268,7 +263,6 @@ The function is passed an `InAppBrowserEvent` object. - Amazon Fire OS - Android -- BlackBerry 10 - iOS ### Quick Example From fceea502a3f7f3308247a4bb2841b60a5d902c12 Mon Sep 17 00:00:00 2001 From: James Jong Date: Wed, 12 Mar 2014 13:35:17 -0400 Subject: [PATCH 067/106] CB-6212 iOS: fix warnings compiled under arm64 64-bit --- src/ios/CDVInAppBrowser.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 88b737c..2b0dc41 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -395,7 +395,7 @@ if (self.callbackId != nil) { NSString* url = [self.inAppBrowserViewController.currentURL absoluteString]; CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR - messageAsDictionary:@{@"type":@"loaderror", @"url":url, @"code": [NSNumber numberWithInt:error.code], @"message": error.localizedDescription}]; + messageAsDictionary:@{@"type":@"loaderror", @"url":url, @"code": [NSNumber numberWithInteger:error.code], @"message": error.localizedDescription}]; [pluginResult setKeepCallback:[NSNumber numberWithBool:YES]]; [self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId]; @@ -834,7 +834,7 @@ - (void)webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error { // log fail message, stop spinner, update back/forward - NSLog(@"webView:didFailLoadWithError - %i: %@", error.code, [error localizedDescription]); + NSLog(@"webView:didFailLoadWithError - %ld: %@", (long)error.code, [error localizedDescription]); self.backButton.enabled = theWebView.canGoBack; self.forwardButton.enabled = theWebView.canGoForward; From 749d55c67688404399ad2902c50ebd6e4b584460 Mon Sep 17 00:00:00 2001 From: Jesse MacFadyen Date: Wed, 19 Mar 2014 22:26:01 -0700 Subject: [PATCH 068/106] CB-6253 Add Network Capability to WMAppManifest.xml --- plugin.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugin.xml b/plugin.xml index d0046fa..13adc8d 100644 --- a/plugin.xml +++ b/plugin.xml @@ -93,6 +93,10 @@ + + + + @@ -107,6 +111,10 @@ + + + + From 9399ed39559d94c51567b226a8bf2cfb390de15c Mon Sep 17 00:00:00 2001 From: Rocco Georgi Date: Sun, 23 Mar 2014 00:04:24 +0100 Subject: [PATCH 069/106] Doc update: event name and example param (closes #31) --- doc/index.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/index.md b/doc/index.md index e82b29b..5201927 100644 --- a/doc/index.md +++ b/doc/index.md @@ -56,7 +56,7 @@ instance, or the system browser. Android only: - __closebuttoncaption__: set to a string to use as the __Done__ button's caption. - - __hidden__: set to `yes` to create the browser and load the page, but not show it. The load event fires when loading is complete. Omit or set to `no` (default) to have the browser open and load normally. + - __hidden__: set to `yes` to create the browser and load the page, but not show it. The loadstop event fires when loading is complete. Omit or set to `no` (default) to have the browser open and load normally. - __clearcache__: set to `yes` to have the browser's cookie cache cleared before the new window is opened - __clearsessioncache__: set to `yes` to have the session cookie cache cleared before the new window is opened @@ -64,7 +64,7 @@ instance, or the system browser. - __closebuttoncaption__: set to a string to use as the __Done__ button's caption. Note that you need to localize this value yourself. - __disallowoverscroll__: Set to `yes` or `no` (default is `no`). Turns on/off the UIWebViewBounce property. - - __hidden__: set to `yes` to create the browser and load the page, but not show it. The load event fires when loading is complete. Omit or set to `no` (default) to have the browser open and load normally. + - __hidden__: set to `yes` to create the browser and load the page, but not show it. The loadstop event fires when loading is complete. Omit or set to `no` (default) to have the browser open and load normally. - __toolbar__: set to `yes` or `no` to turn the toolbar on or off for the InAppBrowser (defaults to `yes`) - __enableViewportScale__: Set to `yes` or `no` to prevent viewport scaling through a meta tag (defaults to `no`). - __mediaPlaybackRequiresUserAction__: Set to `yes` or `no` to prevent HTML5 audio or video from autoplaying (defaults to `no`). @@ -139,7 +139,7 @@ The object returned from a call to `window.open`. ### Quick Example var ref = window.open('http://apache.org', '_blank', 'location=yes'); - ref.addEventListener('loadstart', function() { alert(event.url); }); + ref.addEventListener('loadstart', function(event) { alert(event.url); }); ## removeEventListener @@ -169,7 +169,7 @@ The function is passed an `InAppBrowserEvent` object. ### Quick Example var ref = window.open('http://apache.org', '_blank', 'location=yes'); - var myCallback = function() { alert(event.url); } + var myCallback = function(event) { alert(event.url); } ref.addEventListener('loadstart', myCallback); ref.removeEventListener('loadstart', myCallback); From bdf4ade2bb1e5805ebd632f264fcdd09109cc5d1 Mon Sep 17 00:00:00 2001 From: Nadya Atanasova Date: Wed, 26 Mar 2014 15:51:49 +0200 Subject: [PATCH 070/106] Add necessary capability so the plugin works on its own --- plugin.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugin.xml b/plugin.xml index 932ff83..d2ec6f5 100644 --- a/plugin.xml +++ b/plugin.xml @@ -102,6 +102,10 @@ + + + + @@ -116,6 +120,10 @@ + + + + From 22c7a0e51e560b35e46e94dea667a5fb0ef5a270 Mon Sep 17 00:00:00 2001 From: mbradshawabs Date: Wed, 2 Apr 2014 09:19:05 -0500 Subject: [PATCH 071/106] CB-6389 CB-3617: Add clearcache and clearsessioncache options to iOS (like Android) --- src/ios/CDVInAppBrowser.h | 2 ++ src/ios/CDVInAppBrowser.m | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/ios/CDVInAppBrowser.h b/src/ios/CDVInAppBrowser.h index 8e2ab12..e643962 100644 --- a/src/ios/CDVInAppBrowser.h +++ b/src/ios/CDVInAppBrowser.h @@ -45,6 +45,8 @@ @property (nonatomic, assign) BOOL toolbar; @property (nonatomic, copy) NSString* closebuttoncaption; @property (nonatomic, copy) NSString* toolbarposition; +@property (nonatomic, assign) BOOL clearcache; +@property (nonatomic, assign) BOOL clearsessioncache; @property (nonatomic, copy) NSString* presentationstyle; @property (nonatomic, copy) NSString* transitionstyle; diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 2b0dc41..6625545 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -115,6 +115,29 @@ - (void)openInInAppBrowser:(NSURL*)url withOptions:(NSString*)options { CDVInAppBrowserOptions* browserOptions = [CDVInAppBrowserOptions parseOptions:options]; + + if (browserOptions.clearcache) { + NSHTTPCookie *cookie; + NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; + for (cookie in [storage cookies]) + { + if (![cookie.domain isEqual: @".^filecookies^"]) { + [storage deleteCookie:cookie]; + } + } + } + + if (browserOptions.clearsessioncache) { + NSHTTPCookie *cookie; + NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; + for (cookie in [storage cookies]) + { + if (![cookie.domain isEqual: @".^filecookies^"] && cookie.isSessionOnly) { + [storage deleteCookie:cookie]; + } + } + } + if (self.inAppBrowserViewController == nil) { NSString* originalUA = [CDVUserAgentUtil originalUserAgent]; self.inAppBrowserViewController = [[CDVInAppBrowserViewController alloc] initWithUserAgent:originalUA prevUserAgent:[self.commandDelegate userAgent] browserOptions: browserOptions]; @@ -885,6 +908,8 @@ self.toolbar = YES; self.closebuttoncaption = nil; self.toolbarposition = kInAppBrowserToolbarBarPositionBottom; + self.clearcache = NO; + self.clearsessioncache = NO; self.enableviewportscale = NO; self.mediaplaybackrequiresuseraction = NO; From 51879d8e2f2a9b9209022774ada265164abdc620 Mon Sep 17 00:00:00 2001 From: Piotr Zalewa Date: Fri, 4 Apr 2014 12:16:01 +0200 Subject: [PATCH 072/106] CB-6396 [Firefox OS] Adding basic support --- doc/index.md | 11 +++ plugin.xml | 9 +++ src/firefoxos/InAppBrowserProxy.js | 108 +++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 src/firefoxos/InAppBrowserProxy.js diff --git a/doc/index.md b/doc/index.md index 5201927..ebc4734 100644 --- a/doc/index.md +++ b/doc/index.md @@ -30,6 +30,17 @@ and can't access Cordova APIs. cordova plugin add org.apache.cordova.inappbrowser +### Firefox OS + +Create __www/manifest.webapp__ as described in +[Manifest Docs](https://developer.mozilla.org/en-US/Apps/Developing/Manifest). +Add relevant permisions. + + "permissions": { + "browser": {} + } + + ## window.open Opens a URL in a new `InAppBrowser` instance, the current browser diff --git a/plugin.xml b/plugin.xml index 13adc8d..0d52960 100644 --- a/plugin.xml +++ b/plugin.xml @@ -137,5 +137,14 @@ + + + + + + + + + diff --git a/src/firefoxos/InAppBrowserProxy.js b/src/firefoxos/InAppBrowserProxy.js new file mode 100644 index 0000000..fc2388b --- /dev/null +++ b/src/firefoxos/InAppBrowserProxy.js @@ -0,0 +1,108 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +// https://developer.mozilla.org/en-US/docs/WebAPI/Browser + +var cordova = require('cordova'), + channel = require('cordova/channel'), + modulemapper = require('cordova/modulemapper'); + +var origOpenFunc = modulemapper.getOriginalSymbol(window, 'window.open'); +var browserWrap; + +var IABExecs = { + + close: function (win, lose) { + if (browserWrap) { + browserWrap.parentNode.removeChild(browserWrap); + browserWrap = null; + } + }, + + /* + * Reveal browser if opened hidden + */ + show: function (win, lose) { + console.error('[FirefoxOS] show not implemented'); + }, + + open: function (win, lose, args) { + var strUrl = args[0], + target = args[1], + features = args[2], + url, + elem; + + if (target === '_system') { + origOpenFunc.apply(window, [strUrl, '_blank']); + } else if (target === '_blank') { + var browserElem = document.createElement('iframe'); + browserElem.setAttribute('mozbrowser', true); + // make this loaded in its own child process + browserElem.setAttribute('remote', true); + browserElem.setAttribute('src', strUrl); + if (browserWrap) { + document.body.removeChild(browserWrap); + } + browserWrap = document.createElement('div'); + browserWrap.style.position = 'absolute'; + browserWrap.style.backgroundColor = 'rgba(0,0,0,0.75)'; + browserWrap.style.color = 'rgba(235,235,235,1.0)'; + browserWrap.style.width = window.innerWidth + 'px'; + browserWrap.style.height = window.innerHeight + 'px'; + browserWrap.style.padding = '10px,0,0,0'; + browserElem.style.position = 'absolute'; + browserElem.style.top = '60px'; + browserElem.style.left = '0px'; + browserElem.style.height = (window.innerHeight - 60) + 'px'; + browserElem.style.width = browserWrap.style.width; + + browserWrap.addEventListener('click', function () { + setTimeout(function () { + IAB.close(); + }, 0); + }, false); + var p = document.createElement('p'); + p.appendChild(document.createTextNode('close')); + // TODO: make all buttons - ← → × + p.style.paddingTop = '10px'; + p.style.textAlign = 'center'; + browserWrap.appendChild(p); + browserWrap.appendChild(browserElem); + document.body.appendChild(browserWrap); + // assign browser element to browserWrap for future + // reference + browserWrap.browser = browserElem; + } else { + window.location = strUrl; + } + }, + injectScriptCode: function (code, bCB) { + console.error('[FirefoxOS] injectScriptCode not implemented'); + }, + injectScriptFile: function (file, bCB) { + console.error('[FirefoxOS] injectScriptFile not implemented'); + } +}; + +module.exports = IABExecs; + +require('cordova/firefoxos/commandProxy').add('InAppBrowser', module.exports); From 04de070dcd613db5a4d012b91831f730ca506e2b Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Mon, 7 Apr 2014 10:08:20 -0600 Subject: [PATCH 073/106] CB-3617: Document clearcache and clearsessioncache for ios --- doc/index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/index.md b/doc/index.md index 5201927..1db39db 100644 --- a/doc/index.md +++ b/doc/index.md @@ -65,6 +65,8 @@ instance, or the system browser. - __closebuttoncaption__: set to a string to use as the __Done__ button's caption. Note that you need to localize this value yourself. - __disallowoverscroll__: Set to `yes` or `no` (default is `no`). Turns on/off the UIWebViewBounce property. - __hidden__: set to `yes` to create the browser and load the page, but not show it. The loadstop event fires when loading is complete. Omit or set to `no` (default) to have the browser open and load normally. + - __clearcache__: set to `yes` to have the browser's cookie cache cleared before the new window is opened + - __clearsessioncache__: set to `yes` to have the session cookie cache cleared before the new window is opened - __toolbar__: set to `yes` or `no` to turn the toolbar on or off for the InAppBrowser (defaults to `yes`) - __enableViewportScale__: Set to `yes` or `no` to prevent viewport scaling through a meta tag (defaults to `no`). - __mediaPlaybackRequiresUserAction__: Set to `yes` or `no` to prevent HTML5 audio or video from autoplaying (defaults to `no`). From 25f306d11eb090805417a94e5feeb594e50959c0 Mon Sep 17 00:00:00 2001 From: Jesse MacFadyen Date: Tue, 8 Apr 2014 16:29:32 -0700 Subject: [PATCH 074/106] CB-6422 [windows8] use cordova/exec/proxy --- www/windows8/InAppBrowserProxy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/windows8/InAppBrowserProxy.js b/www/windows8/InAppBrowserProxy.js index d173778..944284e 100644 --- a/www/windows8/InAppBrowserProxy.js +++ b/www/windows8/InAppBrowserProxy.js @@ -108,4 +108,4 @@ var IAB = { module.exports = IAB; -require("cordova/windows8/commandProxy").add("InAppBrowser", module.exports); +require("cordova/exec/proxy").add("InAppBrowser", module.exports); From 88f330abd804365170c20ef26fd705e4eb378d45 Mon Sep 17 00:00:00 2001 From: Piotr Zalewa Date: Wed, 9 Apr 2014 15:16:52 +0200 Subject: [PATCH 075/106] refactoring fixed --- src/firefoxos/InAppBrowserProxy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/firefoxos/InAppBrowserProxy.js b/src/firefoxos/InAppBrowserProxy.js index fc2388b..8ee3736 100644 --- a/src/firefoxos/InAppBrowserProxy.js +++ b/src/firefoxos/InAppBrowserProxy.js @@ -77,7 +77,7 @@ var IABExecs = { browserWrap.addEventListener('click', function () { setTimeout(function () { - IAB.close(); + IABExecs.close(); }, 0); }, false); var p = document.createElement('p'); From bddf86c3cefd9d787876d15e771beb499e43eb2f Mon Sep 17 00:00:00 2001 From: Jesse MacFadyen Date: Wed, 9 Apr 2014 12:26:47 -0700 Subject: [PATCH 076/106] CB-6402 [WP8] pass empty string instead of null for [optional] windowFeatures string --- www/inappbrowser.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/www/inappbrowser.js b/www/inappbrowser.js index ebcfa24..3535b6f 100644 --- a/www/inappbrowser.js +++ b/www/inappbrowser.js @@ -90,6 +90,8 @@ module.exports = function(strUrl, strWindowName, strWindowFeatures) { iab._eventHandler(eventname); }; + strWindowFeatures = strWindowFeatures || ""; + exec(cb, cb, "InAppBrowser", "open", [strUrl, strWindowName, strWindowFeatures]); return iab; }; From 2fc9f3da1fc683442a4c41811e826476d2ca9dd6 Mon Sep 17 00:00:00 2001 From: Nadya Atanasova Date: Fri, 11 Apr 2014 17:57:45 +0300 Subject: [PATCH 077/106] Make InAppBrowser work with embedded files, using system behavior The plugin is changed to work with embedded files, using the system behavior. If one needs the system behavior, they need to pass "_system" as target when using the plugin. As the InAppBrowser for WP8 does not handle by itself the embedded pdf files, system behavior is called. The plugin also is tested and working for wp7 --- src/wp/InAppBrowser.cs | 106 +++++++++++++++++++++++++++++------------ 1 file changed, 75 insertions(+), 31 deletions(-) diff --git a/src/wp/InAppBrowser.cs b/src/wp/InAppBrowser.cs index 454464d..ae88b51 100644 --- a/src/wp/InAppBrowser.cs +++ b/src/wp/InAppBrowser.cs @@ -1,21 +1,24 @@ using System; -using System.Net; +using System.Diagnostics; +using System.IO; +using System.Runtime.Serialization; using System.Windows; using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Ink; -using System.Windows.Input; using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Shapes; using Microsoft.Phone.Controls; -using System.Diagnostics; -using System.Runtime.Serialization; -using WPCordovaClassLib.Cordova; -using WPCordovaClassLib.Cordova.Commands; -using WPCordovaClassLib.Cordova.JSON; using Microsoft.Phone.Shell; + +#if WP8 +using System.Threading.Tasks; +using Windows.ApplicationModel; +using Windows.Storage; +using Windows.System; + +//Use alias in case Cordova File Plugin is enabled. Then the File class will be declared in both and error will occur. +using IOFile = System.IO.File; +#else using Microsoft.Phone.Tasks; +#endif namespace WPCordovaClassLib.Cordova.Commands { @@ -53,27 +56,29 @@ namespace WPCordovaClassLib.Cordova.Commands string target = args[1]; string featString = args[2]; - string[] features = featString.Split(','); - foreach (string str in features) + if (!string.IsNullOrEmpty(featString)) { - try + string[] features = featString.Split(','); + foreach (string str in features) { - string[] split = str.Split('='); - switch (split[0]) + try { - case "location": - ShowLocation = split[1].ToLower().StartsWith("yes"); - break; - case "hidden": - StartHidden = split[1].ToLower().StartsWith("yes"); - break; + string[] split = str.Split('='); + switch (split[0]) + { + case "location": + ShowLocation = split[1].StartsWith("yes", StringComparison.OrdinalIgnoreCase); + break; + case "hidden": + StartHidden = split[1].StartsWith("yes", StringComparison.OrdinalIgnoreCase); + break; + } + } + catch (Exception) + { + // some sort of invalid param was passed, moving on ... } } - catch(Exception) - { - // some sort of invalid param was passed, moving on ... - } - } /* _self - opens in the Cordova WebView if url is in the white-list, else it opens in the InAppBrowser @@ -184,7 +189,6 @@ namespace WPCordovaClassLib.Cordova.Commands //throw new NotImplementedException("Windows Phone does not currently support 'insertCSS'"); } - private void ShowCordovaBrowser(string url) { Uri loc = new Uri(url, UriKind.RelativeOrAbsolute); @@ -208,13 +212,53 @@ namespace WPCordovaClassLib.Cordova.Commands }); } +#if WP8 + private async void ShowSystemBrowser(string url) + { + var pathUri = new Uri(url, UriKind.Absolute); + if (pathUri.Scheme == Uri.UriSchemeHttp || pathUri.Scheme == Uri.UriSchemeHttps) + { + Launcher.LaunchUriAsync(pathUri); + return; + } + + var file = await GetFile(pathUri.AbsolutePath.Replace('/', Path.DirectorySeparatorChar)); + if (file != null) + { + Launcher.LaunchFileAsync(file); + } + else + { + Debug.WriteLine("File not found."); + } + } + + private async Task GetFile(string fileName) + { + //first try to get the file from the isolated storage + var localFolder = ApplicationData.Current.LocalFolder; + if (IOFile.Exists(Path.Combine(localFolder.Path, fileName))) + { + return await localFolder.GetFileAsync(fileName); + } + + //if file is not found try to get it from the xap + var filePath = Path.Combine(Package.Current.InstalledLocation.Path, fileName); + if (IOFile.Exists(filePath)) + { + return await StorageFile.GetFileFromPathAsync(filePath); + } + + return null; + } +#else private void ShowSystemBrowser(string url) { WebBrowserTask webBrowserTask = new WebBrowserTask(); webBrowserTask.Uri = new Uri(url, UriKind.Absolute); webBrowserTask.Show(); } - +#endif private void ShowInAppBrowser(string url) { @@ -326,7 +370,7 @@ namespace WPCordovaClassLib.Cordova.Commands { #if WP8 browser.GoBack(); -#else +#else browser.InvokeScript("execScript", "history.back();"); #endif } @@ -405,4 +449,4 @@ namespace WPCordovaClassLib.Cordova.Commands } } -} +} \ No newline at end of file From 34c29dc2ecf66dcde5fc96f1f85295d7332bde14 Mon Sep 17 00:00:00 2001 From: Jesse MacFadyen Date: Mon, 14 Apr 2014 17:01:35 -0700 Subject: [PATCH 078/106] await async calls, resolve warnings --- src/wp/InAppBrowser.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp/InAppBrowser.cs b/src/wp/InAppBrowser.cs index ae88b51..7239c8a 100644 --- a/src/wp/InAppBrowser.cs +++ b/src/wp/InAppBrowser.cs @@ -218,14 +218,14 @@ namespace WPCordovaClassLib.Cordova.Commands var pathUri = new Uri(url, UriKind.Absolute); if (pathUri.Scheme == Uri.UriSchemeHttp || pathUri.Scheme == Uri.UriSchemeHttps) { - Launcher.LaunchUriAsync(pathUri); + await Launcher.LaunchUriAsync(pathUri); return; } var file = await GetFile(pathUri.AbsolutePath.Replace('/', Path.DirectorySeparatorChar)); if (file != null) { - Launcher.LaunchFileAsync(file); + await Launcher.LaunchFileAsync(file); } else { From 1c32236353d8fc118a8449464ba7cd8f93a5eee2 Mon Sep 17 00:00:00 2001 From: Jesse MacFadyen Date: Mon, 14 Apr 2014 17:11:36 -0700 Subject: [PATCH 079/106] CB-3324 Add support for back-button inappbrowser [WP8] if there is no history -> InAppBrowser is closed --- src/wp/InAppBrowser.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/wp/InAppBrowser.cs b/src/wp/InAppBrowser.cs index 7239c8a..4026a95 100644 --- a/src/wp/InAppBrowser.cs +++ b/src/wp/InAppBrowser.cs @@ -331,6 +331,8 @@ namespace WPCordovaClassLib.Cordova.Commands bar.IsVisible = !StartHidden; AppBar = bar; + page.BackKeyPress += page_BackKeyPress; + } } @@ -338,6 +340,23 @@ namespace WPCordovaClassLib.Cordova.Commands }); } + void page_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e) + { +#if WP8 + if (browser.CanGoBack) + { + browser.GoBack(); + } + else + { + close(); + } + e.Cancel = true; +#else + browser.InvokeScript("execScript", "history.back();"); +#endif + } + void browser_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e) { @@ -405,8 +424,10 @@ namespace WPCordovaClassLib.Cordova.Commands grid.Children.Remove(browser); } page.ApplicationBar = null; + page.BackKeyPress -= page_BackKeyPress; } } + browser = null; string message = "{\"type\":\"exit\"}"; PluginResult result = new PluginResult(PluginResult.Status.OK, message); From 932f078e2dfd31a8208b9a3c0d53852289f94826 Mon Sep 17 00:00:00 2001 From: Robin North Date: Wed, 9 Apr 2014 16:48:00 +0100 Subject: [PATCH 080/106] CB-6360: Fix for crash on iOS < 6.0 (closes #37) --- src/ios/CDVInAppBrowser.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 6625545..68675c5 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -552,7 +552,11 @@ self.addressLabel.enabled = YES; self.addressLabel.hidden = NO; self.addressLabel.lineBreakMode = NSLineBreakByTruncatingTail; - self.addressLabel.minimumScaleFactor = 10.000; + if (IsAtLeastiOSVersion(@"6.0")) { + self.addressLabel.minimumScaleFactor = 10.0/[UIFont labelFontSize]; + } else { + self.addressLabel.minimumFontSize = 10.000; + } self.addressLabel.multipleTouchEnabled = NO; self.addressLabel.numberOfLines = 1; self.addressLabel.opaque = NO; From c5061ec333fae8e214a867443bc53833bba0d3c6 Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Wed, 16 Apr 2014 16:19:05 -0400 Subject: [PATCH 081/106] CB-6460: Update license headers --- plugin.xml | 18 ++++++++++++++++++ src/amazon/InAppChromeClient.java | 18 ++++++++++++++++++ src/android/InAppChromeClient.java | 18 ++++++++++++++++++ src/blackberry10/README.md | 18 ++++++++++++++++++ src/wp/InAppBrowser.cs | 16 +++++++++++++++- 5 files changed, 87 insertions(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index 13adc8d..9eea784 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,4 +1,22 @@ + # BlackBerry 10 In-App-Browser Plugin The in app browser functionality is entirely contained within common js. There is no native implementation required. diff --git a/src/wp/InAppBrowser.cs b/src/wp/InAppBrowser.cs index 4026a95..cbd5d26 100644 --- a/src/wp/InAppBrowser.cs +++ b/src/wp/InAppBrowser.cs @@ -1,4 +1,18 @@ -using System; +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +using System; using System.Diagnostics; using System.IO; using System.Runtime.Serialization; From 1c98bc5b3f1757e1ed6c7686aa055715f9bf9372 Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Thu, 17 Apr 2014 10:53:20 -0400 Subject: [PATCH 082/106] CB-6452 Updated version and RELEASENOTES.md for release 0.4.0 --- RELEASENOTES.md | 14 ++++++++++++++ plugin.xml | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 364f4e9..3d6cd70 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -83,3 +83,17 @@ * CB-5534 Fix video/audio does not stop playing when browser is closed * CB-6172 Fix broken install on case-sensitive file-systems + +### 0.4.0 (Apr 17, 2014) +* CB-6360: [ios] Fix for crash on iOS < 6.0 (closes #37) +* CB-3324: [WP8] Add support for back-button inappbrowser [WP8] if there is no history -> InAppBrowser is closed +* [WP] await async calls, resolve warnings +* [WP] Make InAppBrowser work with embedded files, using system behavior +* CB-6402: [WP8] pass empty string instead of null for [optional] windowFeatures string +* CB-6422: [windows8] use cordova/exec/proxy +* CB-6389 CB-3617: Add clearcache and clearsessioncache options to iOS (like Android) +* Doc update: event name and example param (closes #31) +* CB-6253: [WP] Add Network Capability to WMAppManifest.xml +* CB-6212: [iOS] fix warnings compiled under arm64 64-bit +* CB-6218: Update docs for BB10 +* CB-6460: Update license headers diff --git a/plugin.xml b/plugin.xml index 9eea784..c9e0169 100644 --- a/plugin.xml +++ b/plugin.xml @@ -20,7 +20,7 @@ + version="0.4.0"> InAppBrowser Cordova InAppBrowser Plugin From 11f833b46d1318eee6b073d6ff2ec380fcb1ab89 Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Thu, 17 Apr 2014 11:16:03 -0400 Subject: [PATCH 083/106] CB-6452 Incremented plugin version on dev branch. --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index c9e0169..70d9fea 100644 --- a/plugin.xml +++ b/plugin.xml @@ -20,7 +20,7 @@ + version="0.4.1-dev"> InAppBrowser Cordova InAppBrowser Plugin From b9f8fcd8a93f802dcf85f620f70a6dcd23b0f9c7 Mon Sep 17 00:00:00 2001 From: Shazron Abdullah Date: Thu, 17 Apr 2014 16:32:34 -0700 Subject: [PATCH 084/106] CB-5649 - InAppBrowser overrides App's orientation --- src/ios/CDVInAppBrowser.h | 8 +++++++- src/ios/CDVInAppBrowser.m | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/ios/CDVInAppBrowser.h b/src/ios/CDVInAppBrowser.h index e643962..0ba07f1 100644 --- a/src/ios/CDVInAppBrowser.h +++ b/src/ios/CDVInAppBrowser.h @@ -63,7 +63,7 @@ @end -@interface CDVInAppBrowserViewController : UIViewController { +@interface CDVInAppBrowserViewController : UIViewController { @private NSString* _userAgent; NSString* _prevUserAgent; @@ -92,4 +92,10 @@ - (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent browserOptions: (CDVInAppBrowserOptions*) browserOptions; +@end + +@interface CDVInAppBrowserNavigationController : UINavigationController + +@property (nonatomic, weak) id orientationDelegate; + @end \ No newline at end of file diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 68675c5..aed735c 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -216,8 +216,9 @@ _previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle; - UINavigationController* nav = [[UINavigationController alloc] + CDVInAppBrowserNavigationController* nav = [[CDVInAppBrowserNavigationController alloc] initWithRootViewController:self.inAppBrowserViewController]; + nav.orientationDelegate = self.inAppBrowserViewController; nav.navigationBarHidden = YES; // Run later to avoid the "took a long time" log message. dispatch_async(dispatch_get_main_queue(), ^{ @@ -964,4 +965,37 @@ return obj; } +@end + +@implementation CDVInAppBrowserNavigationController : UINavigationController + +#pragma mark CDVScreenOrientationDelegate + +- (BOOL)shouldAutorotate +{ + if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(shouldAutorotate)]) { + return [self.orientationDelegate shouldAutorotate]; + } + return YES; +} + +- (NSUInteger)supportedInterfaceOrientations +{ + if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(supportedInterfaceOrientations)]) { + return [self.orientationDelegate supportedInterfaceOrientations]; + } + + return 1 << UIInterfaceOrientationPortrait; +} + +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(shouldAutorotateToInterfaceOrientation:)]) { + return [self.orientationDelegate shouldAutorotateToInterfaceOrientation:interfaceOrientation]; + } + + return YES; +} + + @end From c25bc30d7d1715b0cb945051cdf1866c6436f61f Mon Sep 17 00:00:00 2001 From: Shazron Abdullah Date: Thu, 17 Apr 2014 16:52:21 -0700 Subject: [PATCH 085/106] CB-6360 - improvement: feature detection instead of iOS version detection --- src/ios/CDVInAppBrowser.m | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index aed735c..5253688 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -553,11 +553,14 @@ self.addressLabel.enabled = YES; self.addressLabel.hidden = NO; self.addressLabel.lineBreakMode = NSLineBreakByTruncatingTail; - if (IsAtLeastiOSVersion(@"6.0")) { - self.addressLabel.minimumScaleFactor = 10.0/[UIFont labelFontSize]; - } else { - self.addressLabel.minimumFontSize = 10.000; + + if ([self.addressLabel respondsToSelector:NSSelectorFromString(@"setMinimumScaleFactor:")]) { + [self.addressLabel setValue:@(10.0/[UIFont labelFontSize]) forKey:@"minimumScaleFactor"]; + } else + if ([self.addressLabel respondsToSelector:NSSelectorFromString(@"setMinimumFontSize:")]) { + [self.addressLabel setValue:@(10.0) forKey:@"minimumFontSize"]; } + self.addressLabel.multipleTouchEnabled = NO; self.addressLabel.numberOfLines = 1; self.addressLabel.opaque = NO; From 40778ba23985019da58708b80e6d0016c8e0c4c1 Mon Sep 17 00:00:00 2001 From: Shazron Abdullah Date: Thu, 17 Apr 2014 17:02:59 -0700 Subject: [PATCH 086/106] Fixed use of iOS 6 deprecated methods --- src/ios/CDVInAppBrowser.m | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 5253688..8037a91 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -223,7 +223,7 @@ // Run later to avoid the "took a long time" log message. dispatch_async(dispatch_get_main_queue(), ^{ if (self.inAppBrowserViewController != nil) { - [self.viewController presentModalViewController:nav animated:YES]; + [self.viewController presentViewController:nav animated:YES completion:nil]; } }); } @@ -489,7 +489,6 @@ self.webView.clearsContextBeforeDrawing = YES; self.webView.clipsToBounds = YES; self.webView.contentMode = UIViewContentModeScaleToFill; - self.webView.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); self.webView.multipleTouchEnabled = YES; self.webView.opaque = YES; self.webView.scalesPageToFit = NO; @@ -502,7 +501,6 @@ self.spinner.clearsContextBeforeDrawing = NO; self.spinner.clipsToBounds = NO; self.spinner.contentMode = UIViewContentModeScaleToFill; - self.spinner.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); self.spinner.frame = CGRectMake(454.0, 231.0, 20.0, 20.0); self.spinner.hidden = YES; self.spinner.hidesWhenStopped = YES; @@ -530,7 +528,6 @@ self.toolbar.clearsContextBeforeDrawing = NO; self.toolbar.clipsToBounds = NO; self.toolbar.contentMode = UIViewContentModeScaleToFill; - self.toolbar.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); self.toolbar.hidden = NO; self.toolbar.multipleTouchEnabled = NO; self.toolbar.opaque = NO; @@ -549,15 +546,13 @@ self.addressLabel.clearsContextBeforeDrawing = YES; self.addressLabel.clipsToBounds = YES; self.addressLabel.contentMode = UIViewContentModeScaleToFill; - self.addressLabel.contentStretch = CGRectFromString(@"{{0, 0}, {1, 1}}"); self.addressLabel.enabled = YES; self.addressLabel.hidden = NO; self.addressLabel.lineBreakMode = NSLineBreakByTruncatingTail; if ([self.addressLabel respondsToSelector:NSSelectorFromString(@"setMinimumScaleFactor:")]) { [self.addressLabel setValue:@(10.0/[UIFont labelFontSize]) forKey:@"minimumScaleFactor"]; - } else - if ([self.addressLabel respondsToSelector:NSSelectorFromString(@"setMinimumFontSize:")]) { + } else if ([self.addressLabel respondsToSelector:NSSelectorFromString(@"setMinimumFontSize:")]) { [self.addressLabel setValue:@(10.0) forKey:@"minimumFontSize"]; } @@ -750,7 +745,7 @@ if ([self respondsToSelector:@selector(presentingViewController)]) { [[self presentingViewController] dismissViewControllerAnimated:YES completion:nil]; } else { - [[self parentViewController] dismissModalViewControllerAnimated:YES]; + [[self parentViewController] dismissViewControllerAnimated:YES completion:nil]; } }); } From 8f2ad211ad60a10d7234124ff3c815e6a3b70ff1 Mon Sep 17 00:00:00 2001 From: sgrebnov Date: Fri, 18 Apr 2014 10:47:20 -0700 Subject: [PATCH 087/106] CB-6474 InAppBrowser. Add data urls support to WP8 --- src/wp/InAppBrowser.cs | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/wp/InAppBrowser.cs b/src/wp/InAppBrowser.cs index 454464d..844ae16 100644 --- a/src/wp/InAppBrowser.cs +++ b/src/wp/InAppBrowser.cs @@ -200,7 +200,7 @@ namespace WPCordovaClassLib.Cordova.Commands if (cView != null) { WebBrowser br = cView.Browser; - br.Navigate(loc); + br.Navigate2(loc); } } @@ -225,7 +225,7 @@ namespace WPCordovaClassLib.Cordova.Commands if (browser != null) { //browser.IsGeolocationEnabled = opts.isGeolocationEnabled; - browser.Navigate(loc); + browser.Navigate2(loc); } else { @@ -248,7 +248,7 @@ namespace WPCordovaClassLib.Cordova.Commands browser.Navigating += new EventHandler(browser_Navigating); browser.NavigationFailed += new System.Windows.Navigation.NavigationFailedEventHandler(browser_NavigationFailed); browser.Navigated += new EventHandler(browser_Navigated); - browser.Navigate(loc); + browser.Navigate2(loc); if (StartHidden) { @@ -405,4 +405,29 @@ namespace WPCordovaClassLib.Cordova.Commands } } + + internal static class WebBrowserExtensions + { + /// + /// Improved method to initiate request to the provided URI. Supports 'data:text/html' urls. + /// + /// The browser instance + /// The requested uri + internal static void Navigate2(this WebBrowser browser, Uri uri) + { + // IE10 does not support data uri so we use NavigateToString method instead + if (uri.Scheme == "data") + { + // we should remove the scheme identifier and unescape the uri + string uriString = Uri.UnescapeDataString(uri.AbsoluteUri); + // format is 'data:text/html, ...' + string html = new System.Text.RegularExpressions.Regex("^data:text/html,").Replace(uriString, ""); + browser.NavigateToString(html); + } + else + { + browser.Navigate(uri); + } + } + } } From ab7494faa059a8e90fb8f88c5c5ef40e8a154478 Mon Sep 17 00:00:00 2001 From: sgrebnov Date: Mon, 21 Apr 2014 15:28:03 -0700 Subject: [PATCH 088/106] CB-6482 InAppBrowser calls incorrect callback on WP8 --- src/wp/InAppBrowser.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/wp/InAppBrowser.cs b/src/wp/InAppBrowser.cs index 454464d..9d49165 100644 --- a/src/wp/InAppBrowser.cs +++ b/src/wp/InAppBrowser.cs @@ -41,6 +41,8 @@ namespace WPCordovaClassLib.Cordova.Commands protected bool ShowLocation {get;set;} protected bool StartHidden {get;set;} + protected string NavigationCallbackId { get; set; } + public void open(string options) { // reset defaults on ShowLocation + StartHidden features @@ -52,6 +54,7 @@ namespace WPCordovaClassLib.Cordova.Commands string urlLoc = args[0]; string target = args[1]; string featString = args[2]; + this.NavigationCallbackId = args[3]; string[] features = featString.Split(','); foreach (string str in features) @@ -367,7 +370,7 @@ namespace WPCordovaClassLib.Cordova.Commands string message = "{\"type\":\"exit\"}"; PluginResult result = new PluginResult(PluginResult.Status.OK, message); result.KeepCallback = false; - this.DispatchCommandResult(result); + this.DispatchCommandResult(result, NavigationCallbackId); }); } } @@ -385,7 +388,7 @@ namespace WPCordovaClassLib.Cordova.Commands string message = "{\"type\":\"loadstop\", \"url\":\"" + e.Uri.OriginalString + "\"}"; PluginResult result = new PluginResult(PluginResult.Status.OK, message); result.KeepCallback = true; - this.DispatchCommandResult(result); + this.DispatchCommandResult(result, NavigationCallbackId); } void browser_NavigationFailed(object sender, System.Windows.Navigation.NavigationFailedEventArgs e) @@ -393,7 +396,7 @@ namespace WPCordovaClassLib.Cordova.Commands string message = "{\"type\":\"error\",\"url\":\"" + e.Uri.OriginalString + "\"}"; PluginResult result = new PluginResult(PluginResult.Status.ERROR, message); result.KeepCallback = true; - this.DispatchCommandResult(result); + this.DispatchCommandResult(result, NavigationCallbackId); } void browser_Navigating(object sender, NavigatingEventArgs e) @@ -401,7 +404,7 @@ namespace WPCordovaClassLib.Cordova.Commands string message = "{\"type\":\"loadstart\",\"url\":\"" + e.Uri.OriginalString + "\"}"; PluginResult result = new PluginResult(PluginResult.Status.OK, message); result.KeepCallback = true; - this.DispatchCommandResult(result); + this.DispatchCommandResult(result, NavigationCallbackId); } } From 282fdb7a400176c8b89fa85a5a7148f7d229b021 Mon Sep 17 00:00:00 2001 From: Piotr Zalewa Date: Thu, 24 Apr 2014 10:51:06 -0400 Subject: [PATCH 089/106] not forcing the look of the inAppBrowserWrap and buttons --- doc/index.md | 19 +++++++++++++++++++ src/firefoxos/InAppBrowserProxy.js | 5 +---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/doc/index.md b/doc/index.md index ebc4734..8696c93 100644 --- a/doc/index.md +++ b/doc/index.md @@ -91,6 +91,7 @@ instance, or the system browser. - Amazon Fire OS - Android - BlackBerry 10 +- Firefox OS - iOS - Windows Phone 7 and 8 @@ -99,6 +100,23 @@ instance, or the system browser. var ref = window.open('http://apache.org', '_blank', 'location=yes'); var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); +### Firefox OS Quirks + +As plugin doesn't enforce any design there is a need to add some CSS rules if +opened with `target` `'_blank'`. The rules might look like these + +``` css +.inappbrowser-wrap { + background-color: rgba(0,0,0,0.75); + color: rgba(235,235,235,1.0); +} +.inappbrowser-wrap p { + padding-top: 10px; + text-align: center; +} +``` + + ## InAppBrowser The object returned from a call to `window.open`. @@ -196,6 +214,7 @@ The function is passed an `InAppBrowserEvent` object. - Amazon Fire OS - Android +- Firefox OS - iOS - Windows Phone 7 and 8 diff --git a/src/firefoxos/InAppBrowserProxy.js b/src/firefoxos/InAppBrowserProxy.js index 8ee3736..85ea5b9 100644 --- a/src/firefoxos/InAppBrowserProxy.js +++ b/src/firefoxos/InAppBrowserProxy.js @@ -63,9 +63,8 @@ var IABExecs = { document.body.removeChild(browserWrap); } browserWrap = document.createElement('div'); + browserWrap.classList.add('inappbrowser-wrap'); browserWrap.style.position = 'absolute'; - browserWrap.style.backgroundColor = 'rgba(0,0,0,0.75)'; - browserWrap.style.color = 'rgba(235,235,235,1.0)'; browserWrap.style.width = window.innerWidth + 'px'; browserWrap.style.height = window.innerHeight + 'px'; browserWrap.style.padding = '10px,0,0,0'; @@ -83,8 +82,6 @@ var IABExecs = { var p = document.createElement('p'); p.appendChild(document.createTextNode('close')); // TODO: make all buttons - ← → × - p.style.paddingTop = '10px'; - p.style.textAlign = 'center'; browserWrap.appendChild(p); browserWrap.appendChild(browserElem); document.body.appendChild(browserWrap); From 7b24dcb3ddf86bb3dd4423ed7d0904aa786abe03 Mon Sep 17 00:00:00 2001 From: Piotr Zalewa Date: Thu, 24 Apr 2014 14:14:41 -0400 Subject: [PATCH 090/106] back/forward buttons added, iframe has no border --- src/firefoxos/InAppBrowserProxy.js | 97 +++++++++++++++++++++++++----- 1 file changed, 82 insertions(+), 15 deletions(-) diff --git a/src/firefoxos/InAppBrowserProxy.js b/src/firefoxos/InAppBrowserProxy.js index 85ea5b9..1427ea0 100644 --- a/src/firefoxos/InAppBrowserProxy.js +++ b/src/firefoxos/InAppBrowserProxy.js @@ -47,10 +47,35 @@ var IABExecs = { open: function (win, lose, args) { var strUrl = args[0], target = args[1], - features = args[2], + features_string = args[2], + features = {}, url, elem; + var features_list = features_string.split(','); + features_list.forEach(function(feature) { + var tup = feature.split('='); + if (tup[1] == 'yes') { + tup[1] = true; + } else if (tup[1] == 'no') { + tup[1] = false; + } else { + var number = parseInt(tup[1]); + if (!isNaN(number)) { + tup[1] = number; + } + } + features[tup[0]] = tup[1]; + }); + + function updateIframeSizeNoLocation() { + console.log('hey'); + browserWrap.style.width = window.innerWidth + 'px'; + browserWrap.style.height = window.innerHeight + 'px'; + browserWrap.browser.style.height = (window.innerHeight - 60) + 'px'; + browserWrap.browser.style.width = browserWrap.style.width; + } + if (target === '_system') { origOpenFunc.apply(window, [strUrl, '_blank']); } else if (target === '_blank') { @@ -63,31 +88,73 @@ var IABExecs = { document.body.removeChild(browserWrap); } browserWrap = document.createElement('div'); - browserWrap.classList.add('inappbrowser-wrap'); + // assign browser element to browserWrap for future reference + browserWrap.browser = browserElem; + + browserWrap.classList.add('inAppBrowserWrap'); browserWrap.style.position = 'absolute'; - browserWrap.style.width = window.innerWidth + 'px'; - browserWrap.style.height = window.innerHeight + 'px'; - browserWrap.style.padding = '10px,0,0,0'; browserElem.style.position = 'absolute'; + browserElem.style.border = 0; browserElem.style.top = '60px'; browserElem.style.left = '0px'; - browserElem.style.height = (window.innerHeight - 60) + 'px'; - browserElem.style.width = browserWrap.style.width; + updateIframeSizeNoLocation(); - browserWrap.addEventListener('click', function () { + var menu = document.createElement('menu'); + menu.setAttribute('type', 'toolbar'); + var close = document.createElement('li'); + var back = document.createElement('li'); + var forward = document.createElement('li'); + + close.appendChild(document.createTextNode('×')); + back.appendChild(document.createTextNode('<')); + forward.appendChild(document.createTextNode('>')); + + close.classList.add('inAppBrowserClose'); + back.classList.add('inAppBrowserBack'); + forward.classList.add('inAppBrowserForward'); + + function checkForwardBackward() { + var backReq = browserElem.getCanGoBack(); + backReq.onsuccess = function() { + if (this.result) { + back.classList.remove('disabled'); + } else { + back.classList.add('disabled'); + } + } + var forwardReq = browserElem.getCanGoForward(); + forwardReq.onsuccess = function() { + if (this.result) { + forward.classList.remove('disabled'); + } else { + forward.classList.add('disabled'); + } + } + }; + + browserElem.addEventListener('mozbrowserloadend', checkForwardBackward); + + close.addEventListener('click', function () { setTimeout(function () { IABExecs.close(); }, 0); }, false); - var p = document.createElement('p'); - p.appendChild(document.createTextNode('close')); - // TODO: make all buttons - ← → × - browserWrap.appendChild(p); + + back.addEventListener('click', function () { + browserElem.goBack(); + }, false); + + forward.addEventListener('click', function () { + browserElem.goForward(); + }, false); + + menu.appendChild(back); + menu.appendChild(forward); + menu.appendChild(close); + + browserWrap.appendChild(menu); browserWrap.appendChild(browserElem); document.body.appendChild(browserWrap); - // assign browser element to browserWrap for future - // reference - browserWrap.browser = browserElem; } else { window.location = strUrl; } From a6cd0a16ba034cda28c93dafa01c45929bef8eb1 Mon Sep 17 00:00:00 2001 From: Piotr Zalewa Date: Thu, 24 Apr 2014 15:01:09 -0400 Subject: [PATCH 091/106] console.log removed --- src/firefoxos/InAppBrowserProxy.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/firefoxos/InAppBrowserProxy.js b/src/firefoxos/InAppBrowserProxy.js index 1427ea0..f05689d 100644 --- a/src/firefoxos/InAppBrowserProxy.js +++ b/src/firefoxos/InAppBrowserProxy.js @@ -69,7 +69,6 @@ var IABExecs = { }); function updateIframeSizeNoLocation() { - console.log('hey'); browserWrap.style.width = window.innerWidth + 'px'; browserWrap.style.height = window.innerHeight + 'px'; browserWrap.browser.style.height = (window.innerHeight - 60) + 'px'; From 527046261134c15007a6c3268e0789d1edce5cbc Mon Sep 17 00:00:00 2001 From: Piotr Zalewa Date: Thu, 24 Apr 2014 15:03:33 -0400 Subject: [PATCH 092/106] doc updated --- doc/index.md | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/doc/index.md b/doc/index.md index 8696c93..1f4f3ba 100644 --- a/doc/index.md +++ b/doc/index.md @@ -106,13 +106,29 @@ As plugin doesn't enforce any design there is a need to add some CSS rules if opened with `target` `'_blank'`. The rules might look like these ``` css -.inappbrowser-wrap { - background-color: rgba(0,0,0,0.75); - color: rgba(235,235,235,1.0); +.inAppBrowserWrap { + background-color: rgba(0,0,0,0.75); + color: rgba(235,235,235,1.0); } -.inappbrowser-wrap p { - padding-top: 10px; - text-align: center; +.inAppBrowserWrap menu { + overflow: auto; + list-style-type: none; + padding-left: 0; +} +.inAppBrowserWrap menu li { + font-size: 25px; + height: 25px; + float: left; + margin-right: 0px; + margin: 0 10px; + padding: 3px 10px; + text-decoration: none; + color: #ccc; + display: block; + background: rgba(30,30,30,0.50); +} +.inAppBrowserWrap menu li.disabled { + color: #777; } ``` From abf757edffe32495d6bf1cccba3f6cd8d388f05f Mon Sep 17 00:00:00 2001 From: Marcel Kinard Date: Wed, 30 Apr 2014 09:30:38 -0400 Subject: [PATCH 093/106] CB-6491 add CONTRIBUTING.md --- CONTRIBUTING.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..1594d12 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,16 @@ +# Contributing to Apache Cordova + +Anyone can contribute to Cordova. And we need your contributions. + +There are multiple ways to contribute: report bugs, improve the docs, and +contribute code. + +For instructions on this, start with the +[contribution overview](http://cordova.apache.org/#contribute). + +The details are explained there, but the important items are: + - Sign and submit an Apache ICLA (Contributor License Agreement). + - Have a Jira issue open that corresponds to your contribution. + - Run the tests so your patch doesn't break existing functionality. + +We look forward to your contributions! From 687ce6047018df1bede0e9273424e52b0493be73 Mon Sep 17 00:00:00 2001 From: ldeluca Date: Tue, 27 May 2014 17:49:43 -0400 Subject: [PATCH 094/106] Lisa testing pulling in plugins for plugin: cordova-plugin-inappbrowser --- doc/ja/index.md | 299 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 299 insertions(+) create mode 100644 doc/ja/index.md diff --git a/doc/ja/index.md b/doc/ja/index.md new file mode 100644 index 0000000..fb5bf47 --- /dev/null +++ b/doc/ja/index.md @@ -0,0 +1,299 @@ + + +# org.apache.cordova.inappbrowser + +This plugin provides a web browser view that displays when calling `window.open()`, or when opening a link formed as ``. + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + + +**注**: ウィンドウの動作、InAppBrowser 標準的な web ブラウザーのようとコルドバの Api にアクセスできません。 + +## インストール + + cordova plugin add org.apache.cordova.inappbrowser + + +### Firefox の OS + +[マニフェストのドキュメント][1]で説明されているように、 **www/manifest.webapp**を作成します。関連する権限を追加します。 + + [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest + + "permissions": { + "browser": {} + } + + +## window.open + +新しい URL を開き `InAppBrowser` インスタンス、現在のブラウザー インスタンスまたはシステムのブラウザー。 + + var ref = window.open url、ターゲット (オプション); + + +* **ref**: への参照を `InAppBrowser` ウィンドウ。*(InAppBrowser)* + +* **url**: *(文字列)*をロードする URL。電話 `encodeURI()` 場合は、この上の URL は Unicode 文字を含みます。 + +* **ターゲット**: ターゲット URL は、既定値は、省略可能なパラメーターをロードするを `_self` 。*(文字列)* + + * `_self`: コルドバ WebView URL がホワイト リストにある場合で開きます、それ以外の場合で開きます、`InAppBrowser`. + * `_blank`: で開きます、`InAppBrowser`. + * `_system`: システムの web ブラウザーで開きます。 + +* **オプション**: おぷしょん、 `InAppBrowser` 。省略可能にする: `location=yes` 。*(文字列)* + + `options`文字列にはする必要があります任意の空白スペースが含まれていないと、各機能の名前と値のペアをコンマで区切る必要があります。 機能名では大文字小文字を区別します。 以下の値をサポートするプラットフォーム。 + + * **場所**: に設定 `yes` または `no` を有効にする、 `InAppBrowser` の場所バー オンまたはオフにします。 + + アンドロイドのみ: + + * **closebuttoncaption**: [**完了**] ボタンのキャプションとして使用する文字列に設定します。 + * **非表示**: 設定 `yes` ブラウザーを作成して、ページの読み込みが表示されません。 Loadstop イベントは、読み込みが完了すると発生します。 省略するか設定 `no` (既定値) を開くし、通常負荷ブラウザーを持っています。 + * **clearcache**: に設定されている `yes` 、ブラウザーのクッキー キャッシュ クリア新しいウィンドウが開く前に + * **clearsessioncache**: に設定されている `yes` はセッション cookie のキャッシュをオフに新しいウィンドウを開く前に + + iOS のみ: + + * **closebuttoncaption**: [**完了**] ボタンのキャプションとして使用する文字列に設定します。自分でこの値をローカライズする必要があることに注意してください。 + * **disallowoverscroll**: Set to `yes` or `no` (default is `no`). Turns on/off the UIWebViewBounce property. + * **非表示**: 設定 `yes` ブラウザーを作成して、ページの読み込みが表示されません。 Loadstop イベントは、読み込みが完了すると発生します。 省略するか設定 `no` (既定値) を開くし、通常負荷ブラウザーを持っています。 + * **clearcache**: に設定されている `yes` 、ブラウザーのクッキー キャッシュ クリア新しいウィンドウが開く前に + * **clearsessioncache**: に設定されている `yes` はセッション cookie のキャッシュをオフに新しいウィンドウを開く前に + * **toolbar**: set to `yes` or `no` to turn the toolbar on or off for the InAppBrowser (defaults to `yes`) + * **enableViewportScale**: Set to `yes` or `no` to prevent viewport scaling through a meta tag (defaults to `no`). + * **mediaPlaybackRequiresUserAction**: Set to `yes` or `no` to prevent HTML5 audio or video from autoplaying (defaults to `no`). + * **allowInlineMediaPlayback**: Set to `yes` or `no` to allow in-line HTML5 media playback, displaying within the browser window rather than a device-specific playback interface. The HTML's `video` element must also include the `webkit-playsinline` attribute (defaults to `no`) + * **keyboardDisplayRequiresUserAction**: Set to `yes` or `no` to open the keyboard when form elements receive focus via JavaScript's `focus()` call (defaults to `yes`). + * **suppressesIncrementalRendering**: Set to `yes` or `no` to wait until all new view content is received before being rendered (defaults to `no`). + * **presentationstyle**: Set to `pagesheet`, `formsheet` or `fullscreen` to set the [presentation style][2] (defaults to `fullscreen`). + * **transitionstyle**: Set to `fliphorizontal`, `crossdissolve` or `coververtical` to set the [transition style][3] (defaults to `coververtical`). + * **toolbarposition**: Set to `top` or `bottom` (default is `bottom`). Causes the toolbar to be at the top or bottom of the window. + + [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* ブラックベリー 10 +* iOS +* Windows Phone 7 と 8 + +### 例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); + + +## InAppBrowser + +The object returned from a call to `window.open`. + +### メソッド + +* addEventListener +* removeEventListener +* close +* show +* executeScript +* insertCSS + +## addEventListener + +> イベントのリスナーを追加します、`InAppBrowser`. + + ref.addEventListener(eventname, callback); + + +* **ref**: への参照を `InAppBrowser` ウィンドウ*(InAppBrowser)* + +* **eventname**: *(文字列)*をリッスンするイベント + + * ****: イベントが発生するとき、 `InAppBrowser` の URL の読み込みが開始します。 + * **loadstop**: イベントが発生するとき、 `InAppBrowser` URL の読み込みが完了します。 + * **loaderror**: イベントが発生するとき、 `InAppBrowser` URL の読み込みでエラーが発生します。 + * **終了**: イベントが発生するとき、 `InAppBrowser` ウィンドウが閉じられます。 + +* **コールバック**: イベントが発生したときに実行される関数。関数に渡されますが、 `InAppBrowserEvent` オブジェクトをパラメーターとして。 + +### InAppBrowserEvent Properties + +* **タイプ**: eventname どちらか `loadstart` 、 `loadstop` 、 `loaderror` 、または `exit` 。*(文字列)* + +* **url**: URL が読み込まれました。*(文字列)* + +* **コード**: の場合にのみ、エラー コード `loaderror` 。*(数)* + +* **メッセージ**: の場合にのみ、エラー メッセージ `loaderror` 。*(文字列)* + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* iOS +* Windows Phone 7 と 8 + +### 簡単な例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstart', function(event) { alert(event.url); }); + + +## removeEventListener + +> イベントのリスナーを削除します、`InAppBrowser`. + + ref.removeEventListener(eventname, callback); + + +* **ref**: への参照を `InAppBrowser` ウィンドウ。*(InAppBrowser)* + +* **eventname**: イベントのリッスンを停止します。*(文字列)* + + * ****: イベントが発生するとき、 `InAppBrowser` の URL の読み込みが開始します。 + * **loadstop**: イベントが発生するとき、 `InAppBrowser` URL の読み込みが完了します。 + * **loaderror**: イベントが発生するとき、 `InAppBrowser` URL の読み込みエラーが発生します。 + * **終了**: イベントが発生するとき、 `InAppBrowser` ウィンドウが閉じられます。 + +* **コールバック**: イベントが発生するときに実行する関数。関数に渡されますが、 `InAppBrowserEvent` オブジェクト。 + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* iOS +* Windows Phone 7 と 8 + +### 簡単な例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var myCallback = function(event) { alert(event.url); } + ref.addEventListener('loadstart', myCallback); + ref.removeEventListener('loadstart', myCallback); + + +## close + +> 閉じる、 `InAppBrowser` ウィンドウ。 + + ref.close(); + + +* **ref**: への参照を `InAppBrowser` ウィンドウ*(InAppBrowser)* + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* iOS +* Windows Phone 7 と 8 + +### 簡単な例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.close(); + + +## show + +> 隠された開かれた InAppBrowser ウィンドウが表示されます。この関数を呼び出すは影響しません、InAppBrowser が既に表示されている場合。 + + ref.show(); + + +* **ref**: InAppBrowser ウィンドウ (への参照`InAppBrowser`) + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* iOS + +### 簡単な例 + + var ref = window.open('http://apache.org', '_blank', 'hidden=yes'); + // some time later... + ref.show(); + + +## executeScript + +> JavaScript コードに挿入します、 `InAppBrowser` ウィンドウ + + ref.executeScript(details, callback); + + +* **ref**: への参照を `InAppBrowser` ウィンドウ。*(InAppBrowser)* + +* **injectDetails**: 詳細を実行するスクリプトのいずれかを指定する、 `file` または `code` キー。*(オブジェクト)* + + * **ファイル**: スクリプトの URL を注入します。 + * **コード**: スクリプトのテキストを挿入します。 + +* **コールバック**: JavaScript コードを注入した後に実行される関数。 + + * 挿入されたスクリプトが型の場合 `code` 、スクリプトの戻り値は、1 つのパラメーターでコールバックを実行するのに包まれて、 `Array` 。 マルチライン スクリプトについては、最後のステートメントでは、または評価した最後の式の戻り値です。 + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* iOS + +### 簡単な例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.executeScript({file: "myscript.js"}); + }); + + +## insertCSS + +> CSS に注入する、 `InAppBrowser` ウィンドウ。 + + ref.insertCSS(details, callback); + + +* **ref**: への参照を `InAppBrowser` ウィンドウ*(InAppBrowser)* + +* **injectDetails**: 詳細を実行するスクリプトのいずれかを指定する、 `file` または `code` キー。*(オブジェクト)* + + * **ファイル**: 注入するスタイル シートの URL。 + * **コード**: 注入するスタイル シートのテキスト。 + +* **コールバック**: CSS の注入後に実行される関数。 + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* iOS + +### 簡単な例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.insertCSS({file: "mystyles.css"}); + }); \ No newline at end of file From 1953356fd20dd2f5d05f85d59435b418c061b8a5 Mon Sep 17 00:00:00 2001 From: ldeluca Date: Tue, 27 May 2014 21:22:18 -0400 Subject: [PATCH 095/106] Lisa testing pulling in plugins for plugin: cordova-plugin-inappbrowser --- doc/es/index.md | 41 ++++--- doc/fr/index.md | 57 +++++---- doc/it/index.md | 299 ++++++++++++++++++++++++++++++++++++++++++++++++ doc/ko/index.md | 299 ++++++++++++++++++++++++++++++++++++++++++++++++ doc/pl/index.md | 299 ++++++++++++++++++++++++++++++++++++++++++++++++ doc/zh/index.md | 299 ++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 1252 insertions(+), 42 deletions(-) create mode 100644 doc/it/index.md create mode 100644 doc/ko/index.md create mode 100644 doc/pl/index.md create mode 100644 doc/zh/index.md diff --git a/doc/es/index.md b/doc/es/index.md index 641ae0a..74b54b9 100644 --- a/doc/es/index.md +++ b/doc/es/index.md @@ -31,11 +31,22 @@ Este plugin proporciona una vista de navegador web que se muestra cuando se llam cordova plugin add org.apache.cordova.inappbrowser +### Firefox OS + +Crear **www/manifest.webapp** como se describe en [Manifestar Docs][1]. Agregar permisos pertinentes. + + [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest + + "permissions": { + "browser": {} + } + + ## window.open Se abre una dirección URL en una nueva `InAppBrowser` ejemplo, la instancia actual del navegador o el navegador del sistema. - var ref = window.open(url, target, options); + var ref = window.open (url, target, opciones); * **ref**: referencia a la `InAppBrowser` ventana. *(InAppBrowser)* @@ -57,7 +68,7 @@ Se abre una dirección URL en una nueva `InAppBrowser` ejemplo, la instancia act Android sólo: * **closebuttoncaption**: establecer una cadena para usar como título del botón **hecho** . - * **oculta**: a `yes` para crear el navegador y cargar la página, pero no lo demuestra. El evento load se desencadena cuando termine la carga. Omitir o a `no` (por defecto) para que el navegador abra y carga normalmente. + * **oculta**: a `yes` para crear el navegador y cargar la página, pero no lo demuestra. El evento loadstop se desencadena cuando termine la carga. Omitir o a `no` (por defecto) para que el navegador abra y carga normalmente. * **clearcache**: a `yes` para que el navegador es caché de galleta despejado antes de que se abra la nueva ventana * **clearsessioncache**: a `yes` que la caché de cookie de sesión despejado antes de que se abra la nueva ventana @@ -65,19 +76,21 @@ Se abre una dirección URL en una nueva `InAppBrowser` ejemplo, la instancia act * **closebuttoncaption**: establecer una cadena para usar como título del botón **hecho** . Tenga en cuenta que necesitas localizar este valor por sí mismo. * **disallowoverscroll**: A `yes` o `no` (valor por defecto es `no` ). Activa/desactiva la propiedad UIWebViewBounce. - * **oculta**: a `yes` para crear el navegador y cargar la página, pero no lo demuestra. El evento load se desencadena cuando termine la carga. Omitir o a `no` (por defecto) para que el navegador abra y carga normalmente. + * **oculta**: a `yes` para crear el navegador y cargar la página, pero no lo demuestra. El evento loadstop se desencadena cuando termine la carga. Omitir o a `no` (por defecto) para que el navegador abra y carga normalmente. + * **clearcache**: a `yes` para que el navegador es caché de galleta despejado antes de que se abra la nueva ventana + * **clearsessioncache**: a `yes` que la caché de cookie de sesión despejado antes de que se abra la nueva ventana * **barra de herramientas**: a `yes` o `no` para activar la barra de herramientas on u off para el InAppBrowser (por defecto`yes`) * **enableViewportScale**: A `yes` o `no` para evitar la vista escala a través de una etiqueta meta (por defecto`no`). * **mediaPlaybackRequiresUserAction**: A `yes` o `no` para evitar HTML5 audio o vídeo de reproducción automática (por defecto`no`). * **allowInlineMediaPlayback**: A `yes` o `no` para permitir la reproducción de los medios de comunicación en línea HTML5, mostrando en la ventana del navegador en lugar de una interfaz específica del dispositivo de reproducción. El código de HTML `video` elemento también debe incluir la `webkit-playsinline` atributo (por defecto`no`) * **keyboardDisplayRequiresUserAction**: A `yes` o `no` para abrir el teclado cuando elementos de formulario reciben el foco mediante JavaScript `focus()` llamada (por defecto`yes`). * **suppressesIncrementalRendering**: A `yes` o `no` que esperar a que todo el contenido nuevo vista es recibido antes de ser prestados (por defecto`no`). - * **presentationstyle**: A `pagesheet` , `formsheet` o `fullscreen` para establecer el [estilo de la presentación][1] (por defecto`fullscreen`). - * **transitionstyle**: A `fliphorizontal` , `crossdissolve` o `coververtical` para establecer el [estilo de transición][2] (por defecto`coververtical`). + * **presentationstyle**: A `pagesheet` , `formsheet` o `fullscreen` para establecer el [estilo de la presentación][2] (por defecto`fullscreen`). + * **transitionstyle**: A `fliphorizontal` , `crossdissolve` o `coververtical` para establecer el [estilo de transición][3] (por defecto`coververtical`). * **toolbarposition**: A `top` o `bottom` (valor por defecto es `bottom` ). Hace que la barra de herramientas en la parte superior o inferior de la ventana. - [1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle - [2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle ### Plataformas soportadas @@ -124,7 +137,7 @@ El objeto devuelto desde una llamada a`window.open`. * **devolución de llamada**: la función que se ejecuta cuando se desencadene el evento. La función se pasa un `InAppBrowserEvent` objeto como parámetro. -### InAppBrowserEvent Properties +### InAppBrowserEvent propiedades * **tipo**: eventname, ya sea `loadstart` , `loadstop` , `loaderror` , o `exit` . *(String)* @@ -138,14 +151,13 @@ El objeto devuelto desde una llamada a`window.open`. * Amazon fuego OS * Android -* BlackBerry 10 * iOS * Windows Phone 7 y 8 ### Ejemplo rápido var ref = window.open('http://apache.org', '_blank', 'location=yes'); - ref.addEventListener('loadstart', function() { alert(event.url); }); + ref.addEventListener('loadstart', function(event) { alert(event.url); }); ## removeEventListener @@ -170,14 +182,13 @@ El objeto devuelto desde una llamada a`window.open`. * Amazon fuego OS * Android -* BlackBerry 10 * iOS * Windows Phone 7 y 8 ### Ejemplo rápido var ref = window.open('http://apache.org', '_blank', 'location=yes'); - var myCallback = function() { alert(event.url); } + var myCallback = function(event) { alert(event.url); } ref.addEventListener('loadstart', myCallback); ref.removeEventListener('loadstart', myCallback); @@ -195,7 +206,6 @@ El objeto devuelto desde una llamada a`window.open`. * Amazon fuego OS * Android -* BlackBerry 10 * iOS * Windows Phone 7 y 8 @@ -209,7 +219,7 @@ El objeto devuelto desde una llamada a`window.open`. > Muestra una ventana InAppBrowser que abrió sus puertas ocultada. Esto no tiene efecto si el InAppBrowser ya era visible. - ref.show(); + Ref.Show(); * **ref**: referencia a la (ventana) InAppBrowser`InAppBrowser`) @@ -218,7 +228,6 @@ El objeto devuelto desde una llamada a`window.open`. * Amazon fuego OS * Android -* BlackBerry 10 * iOS ### Ejemplo rápido @@ -250,7 +259,6 @@ El objeto devuelto desde una llamada a`window.open`. * Amazon fuego OS * Android -* BlackBerry 10 * iOS ### Ejemplo rápido @@ -281,7 +289,6 @@ El objeto devuelto desde una llamada a`window.open`. * Amazon fuego OS * Android -* BlackBerry 10 * iOS ### Ejemplo rápido diff --git a/doc/fr/index.md b/doc/fr/index.md index 7ec630a..3af5e42 100644 --- a/doc/fr/index.md +++ b/doc/fr/index.md @@ -31,11 +31,22 @@ Ce plugin vous offre une vue de navigateur web qui s'affiche lorsque vous appele cordova plugin add org.apache.cordova.inappbrowser +### Firefox OS + +Créez **www/manifest.webapp** comme décrit dans [Les Docs manifeste][1]. Ajouter permisions pertinentes. + + [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest + + "permissions": { + "browser": {} + } + + ## window.open -Ouvre une URL dans une nouvelle instance de la classe `InAppBrowser`, une instance déjà existante ou dans le navigateur système. +Ouvre une URL dans une nouvelle `InAppBrowser` instance, l'instance de navigateur actuelle ou dans l'Explorateur du système. - var ref = window.open(url, target, options); + var Réf = window.open (url, cible, options) ; * **ref** : référence à la fenêtre `InAppBrowser`. *(InAppBrowser)* @@ -57,7 +68,7 @@ Ouvre une URL dans une nouvelle instance de la classe `InAppBrowser`, une instan Android uniquement : * **closebuttoncaption**: affectez une chaîne à utiliser comme la **fait** légende du bouton. - * **caché**: la valeur `yes` pour créer le navigateur et charger la page, mais ne pas le montrer. L'événement load est déclenché lorsque le chargement est terminé. Omettre ou la valeur `no` (par défaut) pour que le navigateur ouvrir et charger normalement. + * **caché**: la valeur `yes` pour créer le navigateur et charger la page, mais ne pas le montrer. L'événement loadstop est déclenché lorsque le chargement est terminé. Omettre ou la valeur `no` (par défaut) pour que le navigateur ouvrir et charger normalement. * **ClearCache**: la valeur `yes` pour que le navigateur du cache de cookie effacé, avant l'ouverture de la nouvelle fenêtre * **clearsessioncache**: la valeur `yes` pour avoir le cache de cookie de session autorisé avant l'ouverture de la nouvelle fenêtre @@ -65,19 +76,21 @@ Ouvre une URL dans une nouvelle instance de la classe `InAppBrowser`, une instan * **closebuttoncaption**: affectez une chaîne à utiliser comme la **fait** légende du bouton. Notez que vous devrez localiser cette valeur vous-même. * **disallowoverscroll**: la valeur `yes` ou `no` (valeur par défaut est `no` ). Active/désactive la propriété UIWebViewBounce. - * **caché**: la valeur `yes` pour créer le navigateur et charger la page, mais ne pas le montrer. L'événement load est déclenché lorsque le chargement est terminé. Omettre ou la valeur `no` (par défaut) pour que le navigateur ouvrir et charger normalement. + * **caché**: la valeur `yes` pour créer le navigateur et charger la page, mais ne pas le montrer. L'événement loadstop est déclenché lorsque le chargement est terminé. Omettre ou la valeur `no` (par défaut) pour que le navigateur ouvrir et charger normalement. + * **ClearCache**: la valeur `yes` pour que le navigateur du cache de cookie effacé, avant l'ouverture de la nouvelle fenêtre + * **clearsessioncache**: la valeur `yes` pour avoir le cache de cookie de session autorisé avant l'ouverture de la nouvelle fenêtre * **barre d'outils**: la valeur `yes` ou `no` pour activer la barre d'outils ou désactiver pour le InAppBrowser (par défaut,`yes`) - * **enableViewportScale** : selon si la valeur est `yes` ou `no`, une balise meta est injectée avec pour but de permettre ou empêcher l'utilisateur de zoomer dans le viewport (`no` par défaut). - * **mediaPlaybackRequiresUserAction** : selon si la valeur est `yes` ou `no`, la lecture automatique de contenus HTML5 audio ou vidéo (c'est à dire sans action préalable de l'utilisateur) est désactivée ou activée (`no` par défaut). - * **allowInlineMediaPlayback**: la valeur `yes` ou `no` pour permettre la lecture du média en ligne HTML5, affichage dans la fenêtre du navigateur plutôt que d'une interface de lecture spécifique au périphérique. L'élément HTML `video` doit également comporter l'attribut `webkit-playsinline` (`no` par défaut) - * **keyboardDisplayRequiresUserAction** : régler sur `yes` ou `no` pour interdire ou autoriser l'ouverture du clavier lorsque des éléments de formulaire reçoivent le focus par l'intermédiaire d'un appel à la méthode JavaScript `focus()` (`yes` par défaut). - * **suppressesIncrementalRendering** : selon si la valeur est `yes` ou `no`, le rendu de la vue attendra ou non que tout nouveau contenu soit reçu (`no` par défaut). - * **presentationstyle** : régler sur `pagesheet`, `formsheet` ou `fullscreen` afin d'obtenir le [style de présentation][1] de fenêtre souhaité (`fullscreen` par défaut). - * **transitionstyle**: régler la valeur à `fliphorizontal`, `crossdissolve` ou `coververtical` afin de définir le [style de transition][2] de fenêtre souhaité (`coververtical` par défaut). + * **enableViewportScale**: la valeur `yes` ou `no` pour empêcher la fenêtre de mise à l'échelle par une balise meta (par défaut,`no`). + * **mediaPlaybackRequiresUserAction**: la valeur `yes` ou `no` pour empêcher le HTML5 audio ou vidéo de la lecture automatique (par défaut,`no`). + * **allowInlineMediaPlayback**: la valeur `yes` ou `no` pour permettre la lecture du média en ligne HTML5, affichage dans la fenêtre du navigateur plutôt que d'une interface de lecture spécifique au périphérique. L'HTML `video` élément doit également inclure la `webkit-playsinline` attribut (par défaut,`no`) + * **keyboardDisplayRequiresUserAction**: la valeur `yes` ou `no` pour ouvrir le clavier lorsque les éléments reçoivent le focus par l'intermédiaire de JavaScript `focus()` appel (par défaut,`yes`). + * **suppressesIncrementalRendering**: la valeur `yes` ou `no` d'attendre que toutes les nouveautés de vue sont reçue avant d'être restitué (par défaut,`no`). + * **presentationstyle**: la valeur `pagesheet` , `formsheet` ou `fullscreen` pour définir le [style de présentation][2] (par défaut,`fullscreen`). + * **transitionstyle**: la valeur `fliphorizontal` , `crossdissolve` ou `coververtical` pour définir le [style de transition][3] (par défaut,`coververtical`). * **toolbarposition**: la valeur `top` ou `bottom` (valeur par défaut est `bottom` ). Causes de la barre d'outils être en haut ou en bas de la fenêtre. - [1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle - [2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle ### Plates-formes prises en charge @@ -95,7 +108,7 @@ Ouvre une URL dans une nouvelle instance de la classe `InAppBrowser`, une instan ## InAppBrowser -L'objet retourné par un appel à `window.open`. +L'objet retourné par un appel à`window.open`. ### Méthodes @@ -124,7 +137,7 @@ L'objet retourné par un appel à `window.open`. * **callback** : la fonction à exécuter lorsque l'évènement se déclenche. Un objet `InAppBrowserEvent` lui est transmis comme paramètre. -### InAppBrowserEvent Properties +### Propriétés de InAppBrowserEvent * **type** : le nom de l'évènement, soit `loadstart`, `loadstop`, `loaderror` ou `exit`. *(String)* @@ -138,14 +151,13 @@ L'objet retourné par un appel à `window.open`. * Amazon Fire OS * Android -* BlackBerry 10 * iOS * Windows Phone 7 et 8 ### Petit exemple var ref = window.open('http://apache.org', '_blank', 'location=yes'); - ref.addEventListener('loadstart', function() { alert(event.url); }); + ref.addEventListener('loadstart', function(event) { alert(event.url); }); ## removeEventListener @@ -170,14 +182,13 @@ L'objet retourné par un appel à `window.open`. * Amazon Fire OS * Android -* BlackBerry 10 * iOS * Windows Phone 7 et 8 ### Petit exemple var ref = window.open('http://apache.org', '_blank', 'location=yes'); - var myCallback = function() { alert(event.url); } + var myCallback = function(event) { alert(event.url); } ref.addEventListener('loadstart', myCallback); ref.removeEventListener('loadstart', myCallback); @@ -186,7 +197,7 @@ L'objet retourné par un appel à `window.open`. > Ferme la fenêtre `InAppBrowser`. - ref.close(); + Ref.Close() ; * **Réf**: référence à la `InAppBrowser` fenêtre *(InAppBrowser)* @@ -195,7 +206,6 @@ L'objet retourné par un appel à `window.open`. * Amazon Fire OS * Android -* BlackBerry 10 * iOS * Windows Phone 7 et 8 @@ -209,7 +219,7 @@ L'objet retourné par un appel à `window.open`. > Affiche une fenêtre InAppBrowser qui a été ouverte cachée. Appeler cette méthode n'a aucun effet si la fenêtre en question est déjà visible. - ref.show(); + Ref.Show() ; * **Réf**: référence à la fenêtre () InAppBrowser`InAppBrowser`) @@ -218,7 +228,6 @@ L'objet retourné par un appel à `window.open`. * Amazon Fire OS * Android -* BlackBerry 10 * iOS ### Petit exemple @@ -250,7 +259,6 @@ L'objet retourné par un appel à `window.open`. * Amazon Fire OS * Android -* BlackBerry 10 * iOS ### Petit exemple @@ -281,7 +289,6 @@ L'objet retourné par un appel à `window.open`. * Amazon Fire OS * Android -* BlackBerry 10 * iOS ### Petit exemple diff --git a/doc/it/index.md b/doc/it/index.md new file mode 100644 index 0000000..792e502 --- /dev/null +++ b/doc/it/index.md @@ -0,0 +1,299 @@ + + +# org.apache.cordova.inappbrowser + +Questo plugin fornisce una vista di browser web che viene visualizzata quando si chiama `window.open()` , o quando un link di apertura formata come``. + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + + +**Nota**: il InAppBrowser finestra si comporta come un browser web standard e non può accedere a Cordova APIs. + +## Installazione + + cordova plugin add org.apache.cordova.inappbrowser + + +### Firefox OS + +Creare **www/manifest.webapp** come descritto nel [Manifesto Docs][1]. Aggiungi permisions rilevanti. + + [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest + + "permissions": { + "browser": {} + } + + +## window.open + +Apre un URL in una nuova `InAppBrowser` istanza, l'istanza corrente del browser o il browser di sistema. + + rif var = Window. Open (url, destinazione, opzioni); + + +* **Rif**: fare riferimento alla `InAppBrowser` finestra. *(InAppBrowser)* + +* **URL**: l'URL da caricare *(String)*. Chiamare `encodeURI()` su questo, se l'URL contiene caratteri Unicode. + +* **destinazione**: la destinazione in cui caricare l'URL, un parametro facoltativo che il valore predefinito è `_self` . *(String)* + + * `_self`: Si apre in Cordova WebView se l'URL è nella lista bianca, altrimenti si apre nella`InAppBrowser`. + * `_blank`: Apre il`InAppBrowser`. + * `_system`: Si apre nel browser web del sistema. + +* **opzioni**: opzioni per il `InAppBrowser` . Opzionale, inadempiente a: `location=yes` . *(String)* + + Il `options` stringa non deve contenere alcun spazio vuoto, e coppie nome/valore ogni funzionalità devono essere separate da una virgola. Caratteristica nomi sono tra maiuscole e minuscole. Tutte le piattaforme supportano il valore riportato di seguito: + + * **posizione**: impostata su `yes` o `no` per trasformare il `InAppBrowser` di barra di posizione on o off. + + Solo su Android: + + * **closebuttoncaption**: impostare una stringa da utilizzare come didascalia del pulsante **fatto** . + * **nascosti**: impostare su `yes` per creare il browser e caricare la pagina, ma non mostrarlo. L'evento loadstop viene generato quando il caricamento è completato. Omettere o impostata su `no` (impostazione predefinita) per avere il browser aperto e caricare normalmente. + * **ClearCache**: impostare su `yes` per avere il browser di cookie cache cancellata prima dell'apertura della nuova finestra + * **clearsessioncache**: impostare su `yes` per avere la cache cookie di sessione cancellata prima dell'apertura della nuova finestra + + solo iOS: + + * **closebuttoncaption**: impostare una stringa da utilizzare come didascalia del pulsante **fatto** . Si noti che è necessario localizzare questo valore a te stesso. + * **disallowoverscroll**: impostare su `yes` o `no` (default è `no` ). Attiva/disattiva la proprietà UIWebViewBounce. + * **nascosti**: impostare su `yes` per creare il browser e caricare la pagina, ma non mostrarlo. L'evento loadstop viene generato quando il caricamento è completato. Omettere o impostata su `no` (impostazione predefinita) per avere il browser aperto e caricare normalmente. + * **ClearCache**: impostare su `yes` per avere il browser cache cookie ha lasciata prima dell'apertura della nuova finestra + * **clearsessioncache**: impostare su `yes` per avere la cache cookie di sessione cancellata prima dell'apertura della nuova finestra + * **Toolbar**: impostare su `yes` o `no` per attivare la barra degli strumenti o disattivare per il InAppBrowser (default`yes`) + * **enableViewportScale**: impostare su `yes` o `no` per impedire la viewport ridimensionamento tramite un tag meta (default`no`). + * **mediaPlaybackRequiresUserAction**: impostare su `yes` o `no` per impedire HTML5 audio o video da AutoPlay (default`no`). + * **allowInlineMediaPlayback**: impostare su `yes` o `no` per consentire la riproduzione dei supporti HTML5 in linea, visualizzare all'interno della finestra del browser, piuttosto che un'interfaccia specifica del dispositivo di riproduzione. L'HTML `video` elemento deve includere anche il `webkit-playsinline` (default di attributo`no`) + * **keyboardDisplayRequiresUserAction**: impostare su `yes` o `no` per aprire la tastiera quando elementi form ricevano lo stato attivo tramite di JavaScript `focus()` chiamata (default`yes`). + * **suppressesIncrementalRendering**: impostare su `yes` o `no` aspettare fino a quando tutti i nuovi contenuti di vista viene ricevuto prima il rendering (default`no`). + * **presentationstyle**: impostare su `pagesheet` , `formsheet` o `fullscreen` per impostare lo [stile di presentazione][2] (default`fullscreen`). + * **transitionstyle**: impostare su `fliphorizontal` , `crossdissolve` o `coververtical` per impostare lo [stile di transizione][3] (default`coververtical`). + * **toolbarposition**: impostare su `top` o `bottom` (default è `bottom` ). Provoca la barra degli strumenti sia nella parte superiore o inferiore della finestra. + + [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* BlackBerry 10 +* iOS +* Windows Phone 7 e 8 + +### Esempio + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); + + +## InAppBrowser + +L'oggetto restituito da una chiamata a`window.open`. + +### Metodi + +* addEventListener +* removeEventListener +* close +* show +* executeScript +* insertCSS + +## addEventListener + +> Aggiunge un listener per un evento dal`InAppBrowser`. + + ref.addEventListener(eventname, callback); + + +* **Rif**: fare riferimento alla `InAppBrowser` finestra *(InAppBrowser)* + +* **EventName**: l'evento per l'ascolto *(String)* + + * **loadstart**: evento viene generato quando il `InAppBrowser` comincia a caricare un URL. + * **loadstop**: evento viene generato quando il `InAppBrowser` termina il caricamento di un URL. + * **LoadError**: evento viene generato quando il `InAppBrowser` rileva un errore durante il caricamento di un URL. + * **uscita**: evento viene generato quando il `InAppBrowser` finestra è chiusa. + +* **richiamata**: la funzione che viene eseguito quando viene generato l'evento. La funzione viene passata un `InAppBrowserEvent` oggetto come parametro. + +### Proprietà InAppBrowserEvent + +* **tipo**: il eventname, o `loadstart` , `loadstop` , `loaderror` , o `exit` . *(String)* + +* **URL**: l'URL che è stato caricato. *(String)* + +* **codice**: il codice di errore, solo nel caso di `loaderror` . *(Numero)* + +* **messaggio**: il messaggio di errore, solo nel caso di `loaderror` . *(String)* + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* iOS +* Windows Phone 7 e 8 + +### Esempio rapido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstart', function(event) { alert(event.url); }); + + +## removeEventListener + +> Rimuove un listener per un evento dal`InAppBrowser`. + + ref.removeEventListener(eventname, callback); + + +* **Rif**: fare riferimento alla `InAppBrowser` finestra. *(InAppBrowser)* + +* **EventName**: interrompere l'attesa per l'evento. *(String)* + + * **loadstart**: evento viene generato quando il `InAppBrowser` comincia a caricare un URL. + * **loadstop**: evento viene generato quando il `InAppBrowser` termina il caricamento di un URL. + * **LoadError**: evento viene generato quando il `InAppBrowser` rileva un errore di caricamento di un URL. + * **uscita**: evento viene generato quando il `InAppBrowser` finestra è chiusa. + +* **richiamata**: la funzione da eseguire quando viene generato l'evento. La funzione viene passata un `InAppBrowserEvent` oggetto. + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* iOS +* Windows Phone 7 e 8 + +### Esempio rapido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var myCallback = function(event) { alert(event.url); } + ref.addEventListener('loadstart', myCallback); + ref.removeEventListener('loadstart', myCallback); + + +## close + +> Chiude la `InAppBrowser` finestra. + + Ref.Close(); + + +* **Rif**: fare riferimento alla `InAppBrowser` finestra *(InAppBrowser)* + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* iOS +* Windows Phone 7 e 8 + +### Esempio rapido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.close(); + + +## show + +> Visualizza una finestra di InAppBrowser che è stato aperto nascosta. Questa chiamata non ha effetto se la InAppBrowser era già visibile. + + Ref.Show(); + + +* **Rif**: riferimento per il InAppBrowser finestra (`InAppBrowser`) + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* iOS + +### Esempio rapido + + var ref = window.open('http://apache.org', '_blank', 'hidden=yes'); + // some time later... + ref.show(); + + +## executeScript + +> Inserisce il codice JavaScript nella `InAppBrowser` finestra + + ref.executeScript(details, callback); + + +* **Rif**: fare riferimento alla `InAppBrowser` finestra. *(InAppBrowser)* + +* **injectDetails**: dettagli dello script da eseguire, specificando un `file` o `code` chiave. *(Oggetto)* + + * **file**: URL dello script da iniettare. + * **codice**: testo dello script da iniettare. + +* **richiamata**: la funzione che viene eseguito dopo che il codice JavaScript viene iniettato. + + * Se lo script iniettato è di tipo `code` , il callback viene eseguita con un singolo parametro, che è il valore restituito del copione, avvolto in un `Array` . Per gli script multi-linea, questo è il valore restituito dell'ultima istruzione, o l'ultima espressione valutata. + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* iOS + +### Esempio rapido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.executeScript({file: "myscript.js"}); + }); + + +## insertCSS + +> Inietta CSS nella `InAppBrowser` finestra. + + ref.insertCSS(details, callback); + + +* **Rif**: fare riferimento alla `InAppBrowser` finestra *(InAppBrowser)* + +* **injectDetails**: dettagli dello script da eseguire, specificando un `file` o `code` chiave. *(Oggetto)* + + * **file**: URL del foglio di stile per iniettare. + * **codice**: testo del foglio di stile per iniettare. + +* **richiamata**: la funzione che viene eseguito dopo che il CSS viene iniettato. + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* iOS + +### Esempio rapido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.insertCSS({file: "mystyles.css"}); + }); \ No newline at end of file diff --git a/doc/ko/index.md b/doc/ko/index.md new file mode 100644 index 0000000..5f2825e --- /dev/null +++ b/doc/ko/index.md @@ -0,0 +1,299 @@ + + +# org.apache.cordova.inappbrowser + +호출할 때 표시 하는 웹 브라우저 보기를 제공 하는이 플러그인 `window.open()` , 또는 때로 형성 된 링크 열기``. + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + + +**참고**: 동작 하는 창에 InAppBrowser 표준 웹 브라우저를 좋아하고 코르도바 Api에 액세스할 수 없습니다. + +## 설치 + + cordova plugin add org.apache.cordova.inappbrowser + + +### Firefox 운영 체제 + +[참고 문서][1]에 설명 된 대로 **www/manifest.webapp** 를 만듭니다. 관련 부여할 추가 합니다. + + [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest + + "permissions": { + "browser": {} + } + + +## window.open + +새 URL을 엽니다 `InAppBrowser` 인스턴스, 현재 브라우저 인스턴스 또는 시스템 브라우저. + + var ref = window.open (url, 대상, 옵션); + + +* **심판**:에 대 한 참조는 `InAppBrowser` 창. *(InAppBrowser)* + +* **url**: *(문자열)를*로드 하는 URL. 전화 `encodeURI()` 이 경우에는 URL 유니코드 문자를 포함 합니다. + +* **대상**: 대상 URL, 기본적으로 선택적 매개 변수를 로드 하는 `_self` . *(문자열)* + + * `_self`: URL 화이트 리스트에 있으면 코르도바 WebView에서 열리고, 그렇지 않으면 열에`InAppBrowser`. + * `_blank`: 준공에`InAppBrowser`. + * `_system`: 시스템의 웹 브라우저에서 엽니다. + +* **옵션**: 옵션은 `InAppBrowser` . 선택적, 디폴트에: `location=yes` . *(문자열)* + + `options`문자열 텅 빈 어떤 스페이스 포함 해서는 안 그리고 쉼표 각 기능의 이름/값 쌍을 구분 합니다. 기능 이름은 대/소문자입니다. 모든 플랫폼 지원 아래 값: + + * **위치**: 설정 `yes` 또는 `no` 설정 하는 `InAppBrowser` 의 위치 표시줄 켜거나 끕니다. + + 안 드 로이드만: + + * **closebuttoncaption**: **수행** 하는 단추의 캡션으로 사용할 문자열을 설정 합니다. + * **숨겨진**: 설정 `yes` 브라우저를 만들 페이지를 로드 하면, 하지만 그것을 보여주지. Loadstop 이벤트는 로드가 완료 되 면 발생 합니다. 생략 하거나 설정 `no` (기본값) 브라우저 열고 정상적으로 로드 해야 합니다. + * **clearcache**: 설정 `yes` 브라우저를 쿠키 캐시 삭제 하기 전에 새 창이 열립니다 + * **clearsessioncache**: 설정 `yes` 세션 쿠키 캐시를 삭제 하기 전에 새 창이 열립니다 + + iOS만: + + * **closebuttoncaption**: **수행** 하는 단추의 캡션으로 사용할 문자열을 설정 합니다. 참고 직접이 값을 지역화 해야 합니다. + * **disallowoverscroll**: 설정 `yes` 또는 `no` (기본값은 `no` ). 회전 온/오프 UIWebViewBounce 속성입니다. + * **숨겨진**: 설정 `yes` 브라우저를 만들 페이지를 로드 하면, 하지만 그것을 보여주지. Loadstop 이벤트는 로드가 완료 되 면 발생 합니다. 생략 하거나 설정 `no` (기본값) 브라우저 열고 정상적으로 로드 해야 합니다. + * **clearcache**: 설정 `yes` 브라우저를 쿠키 캐시 삭제 하기 전에 새 창이 열립니다 + * **clearsessioncache**: 설정 `yes` 세션 쿠키 캐시를 삭제 하기 전에 새 창이 열립니다 + * **도구 모음**: 설정 `yes` 또는 `no` InAppBrowser (기본값:에 대 한 도구 모음 온 / 오프를 돌기 위하여`yes`) + * **enableViewportScale**: 설정 `yes` 또는 `no` 뷰포트 메타 태그 (기본값:를 통해 확장을 방지 하기 위해`no`). + * **mediaPlaybackRequiresUserAction**: 설정 `yes` 또는 `no` HTML5 오디오 또는 비디오 자동 재생 (기본값에서에서 방지 하기 위해`no`). + * **allowInlineMediaPlayback**: 설정 `yes` 또는 `no` 인라인 HTML5 미디어 재생, 장치 전용 재생 인터페이스 보다는 브라우저 창 내에서 표시할 수 있도록 합니다. HTML의 `video` 요소가 포함 되어야 합니다는 `webkit-playsinline` 특성 (기본값:`no`) + * **keyboardDisplayRequiresUserAction**: 설정 `yes` 또는 `no` 양식 요소는 자바 스크립트를 통해 포커스를 받을 때 키보드를 열고 `focus()` 전화 (기본값:`yes`). + * **suppressesIncrementalRendering**: 설정 `yes` 또는 `no` (기본값을 렌더링 하기 전에 모든 새로운 보기 콘텐츠를 받을 때까지 기다려야`no`). + * **presentationstyle**: 설정 `pagesheet` , `formsheet` 또는 `fullscreen` [프레 젠 테이 션 스타일][2] (기본값을 설정 하려면`fullscreen`). + * **transitionstyle**: 설정 `fliphorizontal` , `crossdissolve` 또는 `coververtical` [전환 스타일][3] (기본값을 설정 하려면`coververtical`). + * **toolbarposition**: 설정 `top` 또는 `bottom` (기본값은 `bottom` ). 위쪽 또는 아래쪽 창에 도구 모음을 발생 합니다. + + [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* 블랙베리 10 +* iOS +* Windows Phone 7과 8 + +### 예를 들어 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); + + +## InAppBrowser + +호출에서 반환 하는 개체`window.open`. + +### 메서드 + +* addEventListener +* removeEventListener +* close +* show +* executeScript +* insertCSS + +## addEventListener + +> 이벤트에 대 한 수신기를 추가 합니다`InAppBrowser`. + + ref.addEventListener(eventname, callback); + + +* **심판**:에 대 한 참조는 `InAppBrowser` 창 *(InAppBrowser)* + +* **eventname**: *(문자열)를* 수신 하도록 이벤트 + + * **loadstart**: 이벤트 발생 때는 `InAppBrowser` URL 로드를 시작 합니다. + * **loadstop**: 이벤트가 발생 시기는 `InAppBrowser` URL 로드 완료. + * **loaderror**: 이벤트 발생 때는 `InAppBrowser` URL을 로드할 때 오류가 발생 합니다. + * **종료**: 이벤트가 발생 시기는 `InAppBrowser` 창이 닫힙니다. + +* **콜백**: 이벤트가 발생 될 때 실행 되는 함수. 함수는 전달 된 `InAppBrowserEvent` 개체를 매개 변수로 합니다. + +### InAppBrowserEvent 속성 + +* **유형**: eventname, 중 `loadstart` , `loadstop` , `loaderror` , 또는 `exit` . *(문자열)* + +* **url**: URL 로드 된. *(문자열)* + +* **코드**: 오류 코드의 경우에만 `loaderror` . *(수)* + +* **메시지**: 오류 메시지의 경우에만 `loaderror` . *(문자열)* + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* iOS +* Windows Phone 7과 8 + +### 빠른 예제 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstart', function(event) { alert(event.url); }); + + +## removeEventListener + +> 이벤트에 대 한 수신기를 제거 합니다`InAppBrowser`. + + ref.removeEventListener(eventname, callback); + + +* **심판**:에 대 한 참조는 `InAppBrowser` 창. *(InAppBrowser)* + +* **eventname**: 이벤트 수신 대기를 중지 합니다. *(문자열)* + + * **loadstart**: 이벤트 발생 때는 `InAppBrowser` URL 로드를 시작 합니다. + * **loadstop**: 이벤트가 발생 시기는 `InAppBrowser` URL 로드 완료. + * **loaderror**: 이벤트 발생 때는 `InAppBrowser` URL 로드 오류가 발생 합니다. + * **종료**: 이벤트가 발생 시기는 `InAppBrowser` 창이 닫힙니다. + +* **콜백**: 이벤트가 발생 하면 실행할 함수. 함수는 전달 된 `InAppBrowserEvent` 개체. + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* iOS +* Windows Phone 7과 8 + +### 빠른 예제 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var myCallback = function(event) { alert(event.url); } + ref.addEventListener('loadstart', myCallback); + ref.removeEventListener('loadstart', myCallback); + + +## close + +> 종료는 `InAppBrowser` 창. + + ref.close(); + + +* **심판**:에 대 한 참조는 `InAppBrowser` 창 *(InAppBrowser)* + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* iOS +* Windows Phone 7과 8 + +### 빠른 예제 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.close(); + + +## show + +> 숨겨진 열은 한 InAppBrowser 창을 표시 합니다. 전화는 InAppBrowser가 이미 보이는 경우는 효과가 없습니다. + + ref.show(); + + +* **ref**: InAppBrowser 창 (참조`InAppBrowser`) + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* iOS + +### 빠른 예제 + + var ref = window.open('http://apache.org', '_blank', 'hidden=yes'); + // some time later... + ref.show(); + + +## executeScript + +> 에 자바 스크립트 코드를 삽입는 `InAppBrowser` 창 + + ref.executeScript(details, callback); + + +* **심판**:에 대 한 참조는 `InAppBrowser` 창. *(InAppBrowser)* + +* **injectDetails**: 스크립트 실행의 세부 사항 중 하나를 지정 하는 `file` 또는 `code` 키. *(개체)* + + * **파일**: 삽입 하는 스크립트의 URL. + * **코드**: 스크립트 텍스트를 삽입 합니다. + +* **콜백**: 자바 스크립트 코드를 주입 후 실행 기능. + + * 삽입 된 스크립트 유형의 경우 `code` , 스크립트의 반환 값은 단일 매개 변수는 콜백 실행에 싸여 있는 `Array` . 여러 줄 스크립트에 대 한 마지막 문 또는 평가 마지막 식의 반환 값입니다. + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* iOS + +### 빠른 예제 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.executeScript({file: "myscript.js"}); + }); + + +## insertCSS + +> 주사로 CSS는 `InAppBrowser` 창. + + ref.insertCSS(details, callback); + + +* **심판**:에 대 한 참조는 `InAppBrowser` 창 *(InAppBrowser)* + +* **injectDetails**: 스크립트 실행의 세부 사항 중 하나를 지정 하는 `file` 또는 `code` 키. *(개체)* + + * **파일**: 삽입 하는 스타일 시트의 URL. + * **코드**: 삽입 하는 스타일 시트의 텍스트. + +* **콜백**: CSS 주입 후 실행 기능. + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* iOS + +### 빠른 예제 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.insertCSS({file: "mystyles.css"}); + }); \ No newline at end of file diff --git a/doc/pl/index.md b/doc/pl/index.md new file mode 100644 index 0000000..cfa95a3 --- /dev/null +++ b/doc/pl/index.md @@ -0,0 +1,299 @@ + + +# org.apache.cordova.inappbrowser + +Plugin daje widok przeglądarki sieci web, które są wyświetlane podczas wywoływania `window.open()` , lub kiedy otwarcie łącza utworzone jako``. + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + + +**Uwaga**: The InAppBrowser okno zachowuje się jak standardowe przeglądarki, a nie ma dostępu do API Cordova. + +## Instalacji + + cordova plugin add org.apache.cordova.inappbrowser + + +### Firefox OS + +Tworzenie **www/manifest.webapp** , jak opisano w [Dokumentach Manifest][1]. Dodaj odpowiednie permisions. + + [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest + + "permissions": { + "browser": {} + } + + +## window.open + +Otwiera URL w nowym `InAppBrowser` wystąpienie, bieżące wystąpienie przeglądarki lub przeglądarki systemu. + + var ref = window.open (adres url, docelowy opcje); + + +* **ref**: odniesienie do `InAppBrowser` okna. *(InAppBrowser)* + +* **adres**: adres URL do ładowania *(ciąg)*. Wywołanie `encodeURI()` na to, czy adres URL zawiera znaki Unicode. + +* **miejsce docelowe**: miejsce docelowe, w którym wobec ciężar ten URL parametr opcjonalny, który domyślnie `_self` . *(String)* + + * `_self`: Otwiera w Cordova WebView, jeśli adres URL jest na białej liście, inaczej ono otwiera w`InAppBrowser`. + * `_blank`: Otwiera w`InAppBrowser`. + * `_system`: Otwiera w przeglądarce internetowej systemu. + +* **Opcje**: opcje dla `InAppBrowser` . Opcjonalnie, nie stawiła się: `location=yes` . *(String)* + + `options`Ciąg nie może zawierać żadnych spacji, i pary nazwa/wartość każdej funkcji muszą być oddzielone przecinkami. Nazwy funkcji jest rozróżniana. Wszystkich platform obsługuje wartości poniżej: + + * **Lokalizacja**: zestaw `yes` lub `no` Aby włączyć `InAppBrowser` na pasek lub wyłączyć. + + Android: + + * **closebuttoncaption**: aby użyć jak **zrobić** przycisk Podpis ustawiona na ciąg. + * **ukryte**: zestaw `yes` do stworzenia przeglądarki i ładowania strony, ale nie pokazuje go. Loadstop zdarzenie fires po zakończeniu ładowania. Pominąć lub zestaw `no` (domyślnie) do przeglądarki otworzyć i załadować normalnie. + * **ClearCache**: zestaw `yes` do przeglądarki w pamięci podręcznej plików cookie wyczyszczone zanim otworzy się nowe okno + * **clearsessioncache**: zestaw `yes` mieć w pamięci podręcznej plików cookie sesji wyczyszczone zanim otworzy się nowe okno + + tylko iOS: + + * **closebuttoncaption**: aby użyć jak **zrobić** przycisk Podpis ustawiona na ciąg. Należy pamiętać, że trzeba zlokalizować tę wartość siebie. + * **disallowoverscroll**: zestaw `yes` lub `no` (domyślnie `no` ). Włącza/wyłącza właściwość UIWebViewBounce. + * **ukryte**: zestaw `yes` do stworzenia przeglądarki i ładowania strony, ale nie pokazuje go. Loadstop zdarzenie fires po zakończeniu ładowania. Pominąć lub zestaw `no` (domyślnie) do przeglądarki otworzyć i załadować normalnie. + * **ClearCache**: zestaw `yes` do przeglądarki w pamięci podręcznej plików cookie wyczyszczone zanim otworzy się nowe okno + * **clearsessioncache**: zestaw `yes` mieć w pamięci podręcznej plików cookie sesji wyczyszczone zanim otworzy się nowe okno + * **pasek narzędzi**: zestaw `yes` lub `no` Aby włączyć pasek narzędzi lub wyłączyć dla InAppBrowser (domyślnie`yes`) + * **enableViewportScale**: zestaw `yes` lub `no` Aby zapobiec rzutni skalowanie za pomocą tagu meta (domyślnie`no`). + * **mediaPlaybackRequiresUserAction**: zestaw `yes` lub `no` Aby zapobiec HTML5 audio lub wideo z Autoodtwarzanie (domyślnie`no`). + * **allowInlineMediaPlayback**: zestaw `yes` lub `no` Aby w linii HTML5 odtwarzanie, wyświetlanie w oknie przeglądarki, a nie interfejs odtwarzanie specyficzne dla urządzenia. HTML `video` również musi zawierać element `webkit-playsinline` atrybut (domyślnie`no`) + * **keyboardDisplayRequiresUserAction**: zestaw `yes` lub `no` Aby otworzyć klawiaturę ekranową, gdy elementy formularza ostrości za pomocą JavaScript `focus()` połączenia (domyślnie`yes`). + * **suppressesIncrementalRendering**: zestaw `yes` lub `no` czekać, aż wszystkie nowe widok zawartości jest otrzymane przed renderowany (domyślnie`no`). + * **presentationstyle**: zestaw `pagesheet` , `formsheet` lub `fullscreen` Aby ustawić [styl prezentacji][2] (domyślnie`fullscreen`). + * **transitionstyle**: zestaw `fliphorizontal` , `crossdissolve` lub `coververtical` Aby ustawić [styl przejścia][3] (domyślnie`coververtical`). + * **toolbarposition**: zestaw `top` lub `bottom` (domyślnie `bottom` ). Powoduje, że pasek ma być na górze lub na dole okna. + + [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* Jeżyna 10 +* iOS +* Windows Phone 7 i 8 + +### Przykład + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); + + +## InAppBrowser + +Obiekt zwrócony z wywołania`window.open`. + +### Metody + +* metody addEventListener +* removeEventListener +* Zamknij +* Pokaż +* executeScript +* insertCSS + +## metody addEventListener + +> Dodaje detektor zdarzenia z`InAppBrowser`. + + ref.addEventListener(eventname, callback); + + +* **ref**: odniesienie do `InAppBrowser` okna *(InAppBrowser)* + +* **EventName**: zdarzenie słuchać *(String)* + + * **loadstart**: zdarzenie gdy odpalam `InAppBrowser` zaczyna się ładować adresu URL. + * **loadstop**: zdarzenie gdy odpalam `InAppBrowser` zakończeniu ładowania adresu URL. + * **LoadError**: zdarzenie odpala gdy `InAppBrowser` napotka błąd podczas ładowania adresu URL. + * **wyjście**: zdarzenie gdy odpalam `InAppBrowser` okno jest zamknięte. + +* **wywołania zwrotnego**: funkcja, która wykonuje, gdy zdarzenie. Funkcja jest przekazywany `InAppBrowserEvent` obiektu jako parametr. + +### Właściwości InAppBrowserEvent + +* **Typ**: eventname, albo `loadstart` , `loadstop` , `loaderror` , lub `exit` . *(String)* + +* **adres**: adres URL, który został załadowany. *(String)* + +* **Kod**: kod błędu, tylko w przypadku `loaderror` . *(Liczba)* + +* **wiadomość**: komunikat o błędzie, tylko w przypadku `loaderror` . *(String)* + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* iOS +* Windows Phone 7 i 8 + +### Szybki przykład + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstart', function(event) { alert(event.url); }); + + +## removeEventListener + +> Usuwa detektor zdarzenia z`InAppBrowser`. + + ref.removeEventListener(eventname, callback); + + +* **ref**: odniesienie do `InAppBrowser` okna. *(InAppBrowser)* + +* **EventName**: zdarzenie przestanie słuchać. *(String)* + + * **loadstart**: zdarzenie gdy odpalam `InAppBrowser` zaczyna się ładować adresu URL. + * **loadstop**: zdarzenie gdy odpalam `InAppBrowser` zakończeniu ładowania adresu URL. + * **LoadError**: zdarzenie odpala gdy `InAppBrowser` napotka błąd ładowania adresu URL. + * **wyjście**: zdarzenie gdy odpalam `InAppBrowser` okno jest zamknięte. + +* **wywołania zwrotnego**: funkcja do wykonania, gdy zdarzenie. Funkcja jest przekazywany `InAppBrowserEvent` obiektu. + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* iOS +* Windows Phone 7 i 8 + +### Szybki przykład + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var myCallback = function(event) { alert(event.url); } + ref.addEventListener('loadstart', myCallback); + ref.removeEventListener('loadstart', myCallback); + + +## Zamknij + +> Zamyka `InAppBrowser` okna. + + ref.Close(); + + +* **ref**: odniesienie do `InAppBrowser` okna *(InAppBrowser)* + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* iOS +* Windows Phone 7 i 8 + +### Szybki przykład + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.close(); + + +## Pokaż + +> Wyświetla InAppBrowser okno, który został otwarty ukryte. Zawód ten jest ignorowany, jeśli InAppBrowser już był widoczny. + + ref.show(); + + +* **ref**: odwołanie do InAppBrowser (okno`InAppBrowser`) + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* iOS + +### Szybki przykład + + var ref = window.open('http://apache.org', '_blank', 'hidden=yes'); + // some time later... + ref.show(); + + +## executeScript + +> Wstrzykuje kod JavaScript w `InAppBrowser` okna + + ref.executeScript(details, callback); + + +* **ref**: odniesienie do `InAppBrowser` okna. *(InAppBrowser)* + +* **injectDetails**: Szczegóły dotyczące skryptu, określając albo `file` lub `code` klucz. *(Obiekt)* + + * **plik**: adres URL skryptu, aby wstrzyknąć. + * **Kod**: tekst skryptu, aby wstrzyknąć. + +* **wywołania zwrotnego**: funkcja, która wykonuje po kod JavaScript jest wstrzykiwany. + + * Jeśli taki skrypt jest typu `code` , wykonuje wywołanie zwrotne z pojedynczym parametrem, który jest wartość zwracana przez skrypt, owinięte w `Array` . Dla wielu linii skrypty to wartość zwracana ostatniej instrukcja, lub ostatni wyrażenie oceniane. + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* iOS + +### Szybki przykład + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.executeScript({file: "myscript.js"}); + }); + + +## insertCSS + +> Wstrzykuje CSS w `InAppBrowser` okna. + + ref.insertCSS(details, callback); + + +* **ref**: odniesienie do `InAppBrowser` okna *(InAppBrowser)* + +* **injectDetails**: Szczegóły dotyczące skryptu, określając albo `file` lub `code` klucz. *(Obiekt)* + + * **plik**: URL arkusza stylów do wsuwania. + * **Kod**: tekst z arkusza stylów do wstrzykiwania. + +* **wywołania zwrotnego**: funkcja, która wykonuje po CSS jest wstrzykiwany. + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* iOS + +### Szybki przykład + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.insertCSS({file: "mystyles.css"}); + }); \ No newline at end of file diff --git a/doc/zh/index.md b/doc/zh/index.md new file mode 100644 index 0000000..f7791a8 --- /dev/null +++ b/doc/zh/index.md @@ -0,0 +1,299 @@ + + +# org.apache.cordova.inappbrowser + +這個外掛程式提供了一個 web 瀏覽器視圖,顯示時調用 `window.open()` ,或當打開連結形成的作為``. + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + + +**注**: InAppBrowser 視窗的行為像一個標準的 web 瀏覽器,並且無法訪問科爾多瓦的 Api。 + +## 安裝 + + cordova plugin add org.apache.cordova.inappbrowser + + +### 火狐瀏覽器作業系統 + +在[清單檔][1]中所述創建**www/manifest.webapp** 。添加相關許可權。 + + [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest + + "permissions": { + "browser": {} + } + + +## window.open + +在一個新的中打開 URL `InAppBrowser` 實例,當前的瀏覽器實例或系統瀏覽器。 + + var ref = window.open (url、 目標、 選項) ; + + +* **ref**: 參考 `InAppBrowser` 視窗。*() InAppBrowser* + +* **url**: 要載入*(字串)*的 URL。調用 `encodeURI()` 這個如果 URL 包含 Unicode 字元。 + +* **目標**: 目標在其中載入的 URL,可選參數,預設值為 `_self` 。*(字串)* + + * `_self`: 打開在科爾多瓦 web 視圖如果 URL 是在白名單中,否則它在打開`InAppBrowser`. + * `_blank`: 在打開`InAppBrowser`. + * `_system`: 在該系統的 web 瀏覽器中打開。 + +* **選項**: 選項為 `InAppBrowser` 。可選,拖欠到: `location=yes` 。*(字串)* + + `options`字串必須不包含任何空白的空間,和必須用逗號分隔每個功能的名稱/值對。 功能名稱區分大小寫。 所有平臺都支援下面的值: + + * **位置**: 設置為 `yes` 或 `no` ,打開 `InAppBrowser` 的位置欄打開或關閉。 + + Android 系統只有: + + * **closebuttoncaption**: 設置為一個字串,以用作**做**按鈕的標題。 + * **隱藏**: 將設置為 `yes` ,創建瀏覽器和載入頁面,但不是顯示它。 載入完成時,將觸發 loadstop 事件。 省略或設置為 `no` (預設值),有的瀏覽器打開,然後以正常方式載入。 + * **clearcache**: 將設置為 `yes` 有瀏覽器的 cookie 清除緩存之前打開新視窗 + * **clearsessioncache**: 將設置為 `yes` 有會話 cookie 緩存清除之前打開新視窗 + + 只有 iOS: + + * **closebuttoncaption**: 設置為一個字串,以用作**做**按鈕的標題。請注意您需要對此值進行當地語系化你自己。 + * **disallowoverscroll**: 將設置為 `yes` 或 `no` (預設值是 `no` )。打開/關閉的 UIWebViewBounce 屬性。 + * **隱藏**: 將設置為 `yes` ,創建瀏覽器和載入頁面,但不是顯示它。 載入完成時,將觸發 loadstop 事件。 省略或設置為 `no` (預設值),有的瀏覽器打開,然後以正常方式載入。 + * **clearcache**: 將設置為 `yes` 有瀏覽器的 cookie 清除緩存之前打開新視窗 + * **clearsessioncache**: 將設置為 `yes` 有會話 cookie 緩存清除之前打開新視窗 + * **工具列**: 設置為 `yes` 或 `no` ,為 InAppBrowser (預設為打開或關閉工具列`yes`) + * **enableViewportScale**: 將設置為 `yes` 或 `no` ,防止通過 meta 標記 (預設為縮放的視區`no`). + * **mediaPlaybackRequiresUserAction**: 將設置為 `yes` 或 `no` ,防止 HTML5 音訊或視頻從 autoplaying (預設為`no`). + * **allowInlineMediaPlayback**: 將設置為 `yes` 或 `no` ,讓線在 HTML5 播放媒體,在瀏覽器視窗中,而不是特定于設備播放介面內顯示。 HTML 的 `video` 元素還必須包括 `webkit-playsinline` 屬性 (預設為`no`) + * **keyboardDisplayRequiresUserAction**: 將設置為 `yes` 或 `no` 時,要打開鍵盤表單元素接收焦點通過 JavaScript 的 `focus()` 調用 (預設為`yes`). + * **suppressesIncrementalRendering**: 將設置為 `yes` 或 `no` 等待,直到所有新查看的內容正在呈現 (預設為前收到`no`). + * **presentationstyle**: 將設置為 `pagesheet` , `formsheet` 或 `fullscreen` 來設置[演示文稿樣式][2](預設為`fullscreen`). + * **transitionstyle**: 將設置為 `fliphorizontal` , `crossdissolve` 或 `coververtical` 設置[過渡樣式][3](預設為`coververtical`). + * **toolbarposition**: 將設置為 `top` 或 `bottom` (預設值是 `bottom` )。使工具列,則在頂部或底部的視窗。 + + [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* 黑莓 10 +* iOS +* Windows Phone 7 和 8 + +### 示例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); + + +## InAppBrowser + +從調用返回的物件`window.open`. + +### 方法 + +* addEventListener +* removeEventListener +* close +* show +* executeScript +* insertCSS + +## addEventListener + +> 為事件添加一個攔截器`InAppBrowser`. + + ref.addEventListener(eventname, callback); + + +* **ref**: 參考 `InAppBrowser` 視窗*(InAppBrowser)* + +* **事件名稱**: 事件偵聽*(字串)* + + * **loadstart**: 當觸發事件 `InAppBrowser` 開始載入一個 URL。 + * **loadstop**: 當觸發事件 `InAppBrowser` 完成載入一個 URL。 + * **loaderror**: 當觸發事件 `InAppBrowser` 載入 URL 時遇到錯誤。 + * **退出**: 當觸發事件 `InAppBrowser` 關閉視窗。 + +* **回檔**: 執行時觸發該事件的函數。該函數通過 `InAppBrowserEvent` 物件作為參數。 + +### InAppBrowserEvent 屬性 + +* **類型**: eventname,或者 `loadstart` , `loadstop` , `loaderror` ,或 `exit` 。*(字串)* + +* **url**: 已載入的 URL。*(字串)* + +* **代碼**: 僅中的情況的錯誤代碼 `loaderror` 。*(人數)* + +* **消息**: 該錯誤訊息,只有在的情況下 `loaderror` 。*(字串)* + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* iOS +* Windows Phone 7 和 8 + +### 快速的示例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstart', function(event) { alert(event.url); }); + + +## removeEventListener + +> 移除的事件攔截器`InAppBrowser`. + + ref.removeEventListener(eventname, callback); + + +* **ref**: 參考 `InAppBrowser` 視窗。*() InAppBrowser* + +* **事件名稱**: 要停止偵聽的事件。*(字串)* + + * **loadstart**: 當觸發事件 `InAppBrowser` 開始載入一個 URL。 + * **loadstop**: 當觸發事件 `InAppBrowser` 完成載入一個 URL。 + * **loaderror**: 當觸發事件 `InAppBrowser` 遇到錯誤載入一個 URL。 + * **退出**: 當觸發事件 `InAppBrowser` 關閉視窗。 + +* **回檔**: 要在事件觸發時執行的函數。該函數通過 `InAppBrowserEvent` 物件。 + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* iOS +* Windows Phone 7 和 8 + +### 快速的示例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var myCallback = function(event) { alert(event.url); } + ref.addEventListener('loadstart', myCallback); + ref.removeEventListener('loadstart', myCallback); + + +## close + +> 關閉 `InAppBrowser` 視窗。 + + ref.close() ; + + +* **ref**: 參考 `InAppBrowser` 視窗*(InAppBrowser)* + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* iOS +* Windows Phone 7 和 8 + +### 快速的示例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.close(); + + +## show + +> 顯示打開了隱藏的 InAppBrowser 視窗。調用這沒有任何影響,如果 InAppBrowser 是已經可見。 + + ref.show() ; + + +* **ref**: InAppBrowser 視窗 (參考`InAppBrowser`) + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* iOS + +### 快速的示例 + + var ref = window.open('http://apache.org', '_blank', 'hidden=yes'); + // some time later... + ref.show(); + + +## executeScript + +> 注入到 JavaScript 代碼 `InAppBrowser` 視窗 + + ref.executeScript(details, callback); + + +* **ref**: 參考 `InAppBrowser` 視窗。*() InAppBrowser* + +* **injectDetails**: 要運行的腳本的詳細資訊或指定 `file` 或 `code` 的關鍵。*(物件)* + + * **檔**: 腳本的 URL 來注入。 + * **代碼**: 要注入腳本的文本。 + +* **回檔**: 執行後注入的 JavaScript 代碼的函數。 + + * 如果插入的腳本的類型 `code` ,回檔執行使用單個參數,這是該腳本的傳回值,裹在 `Array` 。 對於多行腳本,這是最後一條語句或最後計算的運算式的傳回值。 + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* iOS + +### 快速的示例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.executeScript({file: "myscript.js"}); + }); + + +## insertCSS + +> 注入到 CSS `InAppBrowser` 視窗。 + + ref.insertCSS(details, callback); + + +* **ref**: 參考 `InAppBrowser` 視窗*(InAppBrowser)* + +* **injectDetails**: 要運行的腳本的詳細資訊或指定 `file` 或 `code` 的關鍵。*(物件)* + + * **檔**: 樣式表的 URL 來注入。 + * **代碼**: 文本樣式表的注入。 + +* **回檔**: 在 CSS 注射後執行的函數。 + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* iOS + +### 快速的示例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.insertCSS({file: "mystyles.css"}); + }); \ No newline at end of file From 9fc6654b895ce02e01e9da11dcd76ad2c2c8645e Mon Sep 17 00:00:00 2001 From: ldeluca Date: Tue, 27 May 2014 21:36:45 -0400 Subject: [PATCH 096/106] documentation translation: cordova-plugin-inappbrowser --- doc/de/index.md | 299 ++++++++++++++++++++++++++++++++++++++++++++++++ doc/ja/index.md | 30 ++--- 2 files changed, 314 insertions(+), 15 deletions(-) create mode 100644 doc/de/index.md diff --git a/doc/de/index.md b/doc/de/index.md new file mode 100644 index 0000000..0302a92 --- /dev/null +++ b/doc/de/index.md @@ -0,0 +1,299 @@ + + +# org.apache.cordova.inappbrowser + +Dieses Plugin bietet eine Web-Browser-Ansicht, die anzeigt, beim Aufrufen von `window.open()` , oder als als bildeten einen Link öffnen``. + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + + +**Hinweis**: die InAppBrowser Fenster verhält sich wie einen standard-Webbrowser und Cordova APIs kann nicht zugegriffen werden kann. + +## Installation + + cordova plugin add org.apache.cordova.inappbrowser + + +### Firefox OS + +Erstellen Sie **www/manifest.webapp** , wie in [Docs Manifest][1]beschrieben. Fügen Sie die entsprechenden Permisions. + + [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest + + "permissions": { + "browser": {} + } + + +## window.open + +Öffnet eine URL in einem neuen `InAppBrowser` Instanz, die aktuelle Browserinstanz oder der Systembrowser. + + Var Ref = window.open (Url, Ziel, Optionen); + + +* **Ref**: Bezugnahme auf die `InAppBrowser` Fenster. *(InAppBrowser)* + +* **URL**: die URL *(String)*zu laden. Rufen Sie `encodeURI()` auf diese Option, wenn die URL enthält Unicode-Zeichen. + +* **Ziel**: das Ziel in der URL, einen optionalen Parameter geladen, die standardmäßig auf `_self` . *(String)* + + * `_self`: Öffnet sich in der Cordova WebView wenn der URL in der Whitelist ist, andernfalls es öffnet sich in der`InAppBrowser`. + * `_blank`: Öffnet den`InAppBrowser`. + * `_system`: Öffnet in den System-Web-Browser. + +* **Optionen**: Optionen für die `InAppBrowser` . Optional, säumige an: `location=yes` . *(String)* + + Die `options` Zeichenfolge muss keine Leerstelle enthalten, und jede Funktion Name/Wert-Paare müssen durch ein Komma getrennt werden. Featurenamen Groß-/Kleinschreibung. Alle Plattformen unterstützen die anderen Werte: + + * **Lage**: Legen Sie auf `yes` oder `no` , machen die `InAppBrowser` der Adressleiste ein- oder ausschalten. + + Nur Android: + + * **Closebuttoncaption**: Legen Sie auf eine Zeichenfolge als Beschriftung der **fertig** -Schaltfläche verwenden. + * **versteckte**: Legen Sie auf `yes` um den Browser zu erstellen und laden Sie die Seite, aber nicht zeigen. Das Loadstop-Ereignis wird ausgelöst, wenn der Ladevorgang abgeschlossen ist. Weglassen oder auf `no` (Standard), den Browser öffnen und laden normalerweise zu haben. + * **ClearCache**: Legen Sie auf `yes` , der Browser ist Cookiecache gelöscht, bevor das neue Fenster geöffnet wird + * **Clearsessioncache**: Legen Sie auf `yes` , der Sitzungs-Cookie Cache gelöscht, bevor das neue Fenster geöffnet wird + + iOS nur: + + * **Closebuttoncaption**: Legen Sie auf eine Zeichenfolge als Beschriftung der **fertig** -Schaltfläche verwenden. Beachten Sie, dass Sie diesen Wert selbst zu lokalisieren müssen. + * **Disallowoverscroll**: Legen Sie auf `yes` oder `no` (Standard ist `no` ). Aktiviert/deaktiviert die UIWebViewBounce-Eigenschaft. + * **versteckte**: Legen Sie auf `yes` um den Browser zu erstellen und laden Sie die Seite, aber nicht zeigen. Das Loadstop-Ereignis wird ausgelöst, wenn der Ladevorgang abgeschlossen ist. Weglassen oder auf `no` (Standard), den Browser öffnen und laden normalerweise zu haben. + * **ClearCache**: Legen Sie auf `yes` , der Browser ist Cookiecache gelöscht, bevor das neue Fenster geöffnet wird + * **Clearsessioncache**: Legen Sie auf `yes` zu der Session Cookie Cache gelöscht, bevor das neue Fenster geöffnet wird + * **Symbolleiste**: Legen Sie auf `yes` oder `no` Aktivieren Sie die Symbolleiste ein- oder Ausschalten für InAppBrowser (Standard:`yes`) + * **EnableViewportScale**: Legen Sie auf `yes` oder `no` , Viewport Skalierung durch ein Meta-Tag (standardmäßig zu verhindern`no`). + * **MediaPlaybackRequiresUserAction**: Legen Sie auf `yes` oder `no` , HTML5 audio oder video von automatisches Abspielen (standardmäßig zu verhindern`no`). + * **AllowInlineMediaPlayback**: Legen Sie auf `yes` oder `no` Inline-HTML5-Media-Wiedergabe, Darstellung im Browser-Fenster, sondern in eine gerätespezifische Wiedergabe-Schnittstelle ermöglichen. Des HTML `video` Element muss auch die `webkit-playsinline` Attribut (Standard:`no`) + * **KeyboardDisplayRequiresUserAction**: Legen Sie auf `yes` oder `no` um die Tastatur zu öffnen, wenn Formularelemente Fokus per JavaScript erhalten `focus()` Anruf (Standard:`yes`). + * **SuppressesIncrementalRendering**: Legen Sie auf `yes` oder `no` zu warten, bis alle neuen anzeigen-Inhalte empfangen wird, bevor Sie wiedergegeben wird (standardmäßig`no`). + * **Presentationstyle**: Legen Sie auf `pagesheet` , `formsheet` oder `fullscreen` [Präsentationsstil][2] (standardmäßig fest`fullscreen`). + * **Transitionstyle**: Legen Sie auf `fliphorizontal` , `crossdissolve` oder `coververtical` [Übergangsstil][3] (standardmäßig fest`coververtical`). + * **Toolbarposition**: Legen Sie auf `top` oder `bottom` (Standard ist `bottom` ). Bewirkt, dass die Symbolleiste am oberen oder unteren Rand des Fensters sein. + + [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* BlackBerry 10 +* iOS +* Windows Phone 7 und 8 + +### Beispiel + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); + + +## InAppBrowser + +Aus einem Aufruf zurückgegebenen Objekts`window.open`. + +### Methoden + +* addEventListener +* removeEventListener +* Schließen +* Karte +* executeScript +* insertCSS + +## addEventListener + +> Fügt einen Listener für eine Veranstaltung aus der`InAppBrowser`. + + ref.addEventListener(eventname, callback); + + +* **Ref**: Bezugnahme auf die `InAppBrowser` Fenster *(InAppBrowser)* + +* **EventName**: das Ereignis zu warten *(String)* + + * **Loadstart**: Ereignis wird ausgelöst, wenn die `InAppBrowser` beginnt, eine URL zu laden. + * **Loadstop**: Ereignis wird ausgelöst, wenn der `InAppBrowser` beendet ist, eine URL laden. + * **LoadError**: Ereignis wird ausgelöst, wenn der `InAppBrowser` ein Fehler auftritt, wenn Sie eine URL zu laden. + * **Ausfahrt**: Ereignis wird ausgelöst, wenn das `InAppBrowser` -Fenster wird geschlossen. + +* **Rückruf**: die Funktion, die ausgeführt wird, wenn das Ereignis ausgelöst wird. Die Funktion übergeben wird ein `InAppBrowserEvent` -Objekt als Parameter. + +### InAppBrowserEvent Eigenschaften + +* **Typ**: Eventname, entweder `loadstart` , `loadstop` , `loaderror` , oder `exit` . *(String)* + +* **URL**: die URL, die geladen wurde. *(String)* + +* **Code**: der Fehler-Code, nur im Fall von `loaderror` . *(Anzahl)* + +* **Nachricht**: die Fehlermeldung angezeigt, nur im Fall von `loaderror` . *(String)* + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* iOS +* Windows Phone 7 und 8 + +### Kleines Beispiel + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstart', function(event) { alert(event.url); }); + + +## removeEventListener + +> Entfernt einen Listener für eine Veranstaltung aus der`InAppBrowser`. + + ref.removeEventListener(eventname, callback); + + +* **Ref**: Bezugnahme auf die `InAppBrowser` Fenster. *(InAppBrowser)* + +* **EventName**: das Ereignis zu warten. *(String)* + + * **Loadstart**: Ereignis wird ausgelöst, wenn die `InAppBrowser` beginnt, eine URL zu laden. + * **Loadstop**: Ereignis wird ausgelöst, wenn der `InAppBrowser` beendet ist, eine URL laden. + * **LoadError**: Ereignis wird ausgelöst, wenn die `InAppBrowser` trifft einen Fehler beim Laden einer URLs. + * **Ausfahrt**: Ereignis wird ausgelöst, wenn das `InAppBrowser` -Fenster wird geschlossen. + +* **Rückruf**: die Funktion ausgeführt, wenn das Ereignis ausgelöst wird. Die Funktion übergeben wird ein `InAppBrowserEvent` Objekt. + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* iOS +* Windows Phone 7 und 8 + +### Kleines Beispiel + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var myCallback = function(event) { alert(event.url); } + ref.addEventListener('loadstart', myCallback); + ref.removeEventListener('loadstart', myCallback); + + +## Schließen + +> Schließt die `InAppBrowser` Fenster. + + Ref.Close(); + + +* **Ref**: Bezugnahme auf die `InAppBrowser` Fenster *(InAppBrowser)* + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* iOS +* Windows Phone 7 und 8 + +### Kleines Beispiel + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.close(); + + +## Karte + +> Zeigt ein InAppBrowser-Fenster, das geöffnet wurde, versteckt. Aufrufen, dies hat keine Auswirkungen, wenn die InAppBrowser schon sichtbar war. + + Ref.Show(); + + +* **Ref**: Verweis auf die (InAppBrowser) Fenster`InAppBrowser`) + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* iOS + +### Kleines Beispiel + + var ref = window.open('http://apache.org', '_blank', 'hidden=yes'); + // some time later... + ref.show(); + + +## executeScript + +> Fügt JavaScript-Code in das `InAppBrowser` Fenster + + ref.executeScript(details, callback); + + +* **Ref**: Bezugnahme auf die `InAppBrowser` Fenster. *(InAppBrowser)* + +* **InjectDetails**: Informationen über das Skript ausgeführt, angeben, entweder ein `file` oder `code` Schlüssel. *(Objekt)* + + * **Datei**: URL des Skripts zu injizieren. + * **Code**: Text des Skripts zu injizieren. + +* **Rückruf**: die Funktion, die ausgeführt wird, nachdem der JavaScript-Code injiziert wird. + + * Wenn das eingefügte Skript vom Typ ist `code` , der Rückruf führt mit einen einzelnen Parameter, der der Rückgabewert des Skripts ist, umwickelt ein `Array` . Bei Multi-Line-Skripten ist der Rückgabewert von der letzten Anweisung oder den letzten Ausdruck ausgewertet. + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* iOS + +### Kleines Beispiel + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.executeScript({file: "myscript.js"}); + }); + + +## insertCSS + +> Injiziert CSS in der `InAppBrowser` Fenster. + + ref.insertCSS(details, callback); + + +* **Ref**: Bezugnahme auf die `InAppBrowser` Fenster *(InAppBrowser)* + +* **InjectDetails**: Informationen über das Skript ausgeführt, angeben, entweder ein `file` oder `code` Schlüssel. *(Objekt)* + + * **Datei**: URL des Stylesheets zu injizieren. + * **Code**: Text des Stylesheets zu injizieren. + +* **Rückruf**: die Funktion, die ausgeführt wird, nachdem die CSS injiziert wird. + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* iOS + +### Kleines Beispiel + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.insertCSS({file: "mystyles.css"}); + }); \ No newline at end of file diff --git a/doc/ja/index.md b/doc/ja/index.md index fb5bf47..0050ef0 100644 --- a/doc/ja/index.md +++ b/doc/ja/index.md @@ -19,7 +19,7 @@ # org.apache.cordova.inappbrowser -This plugin provides a web browser view that displays when calling `window.open()`, or when opening a link formed as ``. +このプラグインを呼び出すときに表示される web ブラウザーのビューを提供します `window.open()` 、または時として形成されたリンクを開く``. var ref = window.open('http://apache.org', '_blank', 'location=yes'); @@ -75,19 +75,19 @@ This plugin provides a web browser view that displays when calling `window.open( iOS のみ: * **closebuttoncaption**: [**完了**] ボタンのキャプションとして使用する文字列に設定します。自分でこの値をローカライズする必要があることに注意してください。 - * **disallowoverscroll**: Set to `yes` or `no` (default is `no`). Turns on/off the UIWebViewBounce property. - * **非表示**: 設定 `yes` ブラウザーを作成して、ページの読み込みが表示されません。 Loadstop イベントは、読み込みが完了すると発生します。 省略するか設定 `no` (既定値) を開くし、通常負荷ブラウザーを持っています。 + * **disallowoverscroll**: に設定されている `yes` または `no` (既定値は `no` )。/UIWebViewBounce プロパティをオフにします。 + * **非表示**: 設定 `yes` ブラウザーを作成して、ページの読み込みが表示されません。 Loadstop イベントは、読み込みが完了すると発生します。 省略するか設定 `no` (既定値) を開くし、通常読み込みブラウザーを持っています。 * **clearcache**: に設定されている `yes` 、ブラウザーのクッキー キャッシュ クリア新しいウィンドウが開く前に - * **clearsessioncache**: に設定されている `yes` はセッション cookie のキャッシュをオフに新しいウィンドウを開く前に - * **toolbar**: set to `yes` or `no` to turn the toolbar on or off for the InAppBrowser (defaults to `yes`) - * **enableViewportScale**: Set to `yes` or `no` to prevent viewport scaling through a meta tag (defaults to `no`). - * **mediaPlaybackRequiresUserAction**: Set to `yes` or `no` to prevent HTML5 audio or video from autoplaying (defaults to `no`). - * **allowInlineMediaPlayback**: Set to `yes` or `no` to allow in-line HTML5 media playback, displaying within the browser window rather than a device-specific playback interface. The HTML's `video` element must also include the `webkit-playsinline` attribute (defaults to `no`) - * **keyboardDisplayRequiresUserAction**: Set to `yes` or `no` to open the keyboard when form elements receive focus via JavaScript's `focus()` call (defaults to `yes`). - * **suppressesIncrementalRendering**: Set to `yes` or `no` to wait until all new view content is received before being rendered (defaults to `no`). - * **presentationstyle**: Set to `pagesheet`, `formsheet` or `fullscreen` to set the [presentation style][2] (defaults to `fullscreen`). - * **transitionstyle**: Set to `fliphorizontal`, `crossdissolve` or `coververtical` to set the [transition style][3] (defaults to `coververtical`). - * **toolbarposition**: Set to `top` or `bottom` (default is `bottom`). Causes the toolbar to be at the top or bottom of the window. + * **clearsessioncache**: に設定されている `yes` はセッション cookie のキャッシュをオフにすると、新しいウィンドウが開く前に + * **ツールバー**: に設定されている `yes` または `no` InAppBrowser (デフォルトのツールバーのオンまたはオフを有効にするには`yes`) + * **enableViewportScale**: に設定されている `yes` または `no` を (デフォルトではメタタグを介してスケーリング ビューポートを防ぐために`no`). + * **mediaPlaybackRequiresUserAction**: に設定されている `yes` または `no` を HTML5 オーディオまたはビデオを自動再生 (初期設定から防ぐために`no`). + * **allowInlineMediaPlayback**: に設定されている `yes` または `no` ラインで HTML5 メディア再生には、デバイス固有再生インターフェイスではなく、ブラウザー ウィンドウ内に表示するようにします。 HTML の `video` 要素を含める必要がありますまた、 `webkit-playsinline` 属性 (デフォルトは`no`) + * **keyboardDisplayRequiresUserAction**: に設定されている `yes` または `no` をフォーム要素の JavaScript を介してフォーカスを受け取るときに、キーボードを開く `focus()` コール (デフォルトは`yes`). + * **suppressesIncrementalRendering**: に設定されている `yes` または `no` (デフォルトでは表示される前にビューのすべての新しいコンテンツを受信するまで待機するには`no`). + * **presentationstyle**: に設定されている `pagesheet` 、 `formsheet` または `fullscreen` (デフォルトでは、[プレゼンテーション スタイル][2]を設定するには`fullscreen`). + * **transitionstyle**: に設定されている `fliphorizontal` 、 `crossdissolve` または `coververtical` (デフォルトでは、[トランジションのスタイル][3]を設定するには`coververtical`). + * **toolbarposition**: に設定されている `top` または `bottom` (既定値は `bottom` )。上部またはウィンドウの下部にツールバーが発生します。 [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle @@ -108,7 +108,7 @@ This plugin provides a web browser view that displays when calling `window.open( ## InAppBrowser -The object returned from a call to `window.open`. +呼び出しから返されるオブジェクト`window.open`. ### メソッド @@ -137,7 +137,7 @@ The object returned from a call to `window.open`. * **コールバック**: イベントが発生したときに実行される関数。関数に渡されますが、 `InAppBrowserEvent` オブジェクトをパラメーターとして。 -### InAppBrowserEvent Properties +### InAppBrowserEvent プロパティ * **タイプ**: eventname どちらか `loadstart` 、 `loadstop` 、 `loaderror` 、または `exit` 。*(文字列)* From 8fea6be60a27498f09957b791072a74b0de5b945 Mon Sep 17 00:00:00 2001 From: Rodrigo Silveira Date: Wed, 28 May 2014 12:36:59 -0700 Subject: [PATCH 097/106] Adding permission info --- doc/index.md | 11 ----------- plugin.xml | 3 +++ 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/doc/index.md b/doc/index.md index 760831a..1db39db 100644 --- a/doc/index.md +++ b/doc/index.md @@ -30,17 +30,6 @@ and can't access Cordova APIs. cordova plugin add org.apache.cordova.inappbrowser -### Firefox OS - -Create __www/manifest.webapp__ as described in -[Manifest Docs](https://developer.mozilla.org/en-US/Apps/Developing/Manifest). -Add relevant permisions. - - "permissions": { - "browser": {} - } - - ## window.open Opens a URL in a new `InAppBrowser` instance, the current browser diff --git a/plugin.xml b/plugin.xml index fcb1837..37c658e 100644 --- a/plugin.xml +++ b/plugin.xml @@ -165,6 +165,9 @@ + + + From 03e1715cfe54193c2261c655e6dd02e4d4284477 Mon Sep 17 00:00:00 2001 From: Marcel Kinard Date: Fri, 30 May 2014 11:30:32 -0400 Subject: [PATCH 098/106] CB-6806 Add license --- CONTRIBUTING.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1594d12..f7dbcab 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,24 @@ + + # Contributing to Apache Cordova Anyone can contribute to Cordova. And we need your contributions. From 846190a6f84a7f2ad01d36b3d1b78589aac1b8af Mon Sep 17 00:00:00 2001 From: Piotr Zalewa Date: Wed, 4 Jun 2014 15:24:21 +0200 Subject: [PATCH 099/106] default parameter added --- src/firefoxos/InAppBrowserProxy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/firefoxos/InAppBrowserProxy.js b/src/firefoxos/InAppBrowserProxy.js index f05689d..846f57a 100644 --- a/src/firefoxos/InAppBrowserProxy.js +++ b/src/firefoxos/InAppBrowserProxy.js @@ -47,7 +47,7 @@ var IABExecs = { open: function (win, lose, args) { var strUrl = args[0], target = args[1], - features_string = args[2], + features_string = args[2] || "location=yes", //location=yes is default features = {}, url, elem; From eb704f82124221af3dc436fe2decc47a81b58388 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Wed, 4 Jun 2014 14:22:41 -0400 Subject: [PATCH 100/106] Clean up whitespace (mainly due to no newline at eof warning) --- src/ios/CDVInAppBrowser.h | 3 ++- src/ios/CDVInAppBrowser.m | 43 ++++++++++++++++++++------------------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/ios/CDVInAppBrowser.h b/src/ios/CDVInAppBrowser.h index 0ba07f1..c92d9b7 100644 --- a/src/ios/CDVInAppBrowser.h +++ b/src/ios/CDVInAppBrowser.h @@ -98,4 +98,5 @@ @property (nonatomic, weak) id orientationDelegate; -@end \ No newline at end of file +@end + diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 8037a91..059fcde 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -73,7 +73,7 @@ if ([[url host] isEqualToString:@"itunes.apple.com"]) { return YES; } - + return NO; } @@ -90,7 +90,7 @@ if (url != nil) { NSURL* baseUrl = [self.webView.request URL]; NSURL* absoluteUrl = [[NSURL URLWithString:url relativeToURL:baseUrl] absoluteURL]; - + if ([self isSystemUrl:absoluteUrl]) { target = kInAppBrowserTargetSystem; } @@ -187,7 +187,7 @@ } } } - + // UIWebView options self.inAppBrowserViewController.webView.scalesPageToFit = browserOptions.enableviewportscale; self.inAppBrowserViewController.webView.mediaPlaybackRequiresUserAction = browserOptions.mediaplaybackrequiresuseraction; @@ -196,7 +196,7 @@ self.inAppBrowserViewController.webView.keyboardDisplayRequiresUserAction = browserOptions.keyboarddisplayrequiresuseraction; self.inAppBrowserViewController.webView.suppressesIncrementalRendering = browserOptions.suppressesincrementalrendering; } - + [self.inAppBrowserViewController navigateTo:url]; if (!browserOptions.hidden) { [self show:nil]; @@ -213,9 +213,9 @@ NSLog(@"Tried to show IAB while already shown"); return; } - + _previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle; - + CDVInAppBrowserNavigationController* nav = [[CDVInAppBrowserNavigationController alloc] initWithRootViewController:self.inAppBrowserViewController]; nav.orientationDelegate = self.inAppBrowserViewController; @@ -439,7 +439,7 @@ // Don't recycle the ViewController since it may be consuming a lot of memory. // Also - this is required for the PDF/User-Agent bug work-around. self.inAppBrowserViewController = nil; - + _previousStatusBarStyle = -1; if (IsAtLeastiOSVersion(@"7.0")) { @@ -477,7 +477,7 @@ BOOL toolbarIsAtBottom = ![_browserOptions.toolbarposition isEqualToString:kInAppBrowserToolbarBarPositionTop]; webViewBounds.size.height -= _browserOptions.location ? FOOTER_HEIGHT : TOOLBAR_HEIGHT; self.webView = [[UIWebView alloc] initWithFrame:webViewBounds]; - + self.webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); [self.view addSubview:self.webView]; @@ -519,7 +519,7 @@ float toolbarY = toolbarIsAtBottom ? self.view.bounds.size.height - TOOLBAR_HEIGHT : 0.0; CGRect toolbarFrame = CGRectMake(0.0, toolbarY, self.view.bounds.size.width, TOOLBAR_HEIGHT); - + self.toolbar = [[UIToolbar alloc] initWithFrame:toolbarFrame]; self.toolbar.alpha = 1.000; self.toolbar.autoresizesSubviews = YES; @@ -535,7 +535,7 @@ CGFloat labelInset = 5.0; float locationBarY = toolbarIsAtBottom ? self.view.bounds.size.height - FOOTER_HEIGHT : self.view.bounds.size.height - LOCATIONBAR_HEIGHT; - + self.addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(labelInset, locationBarY, self.view.bounds.size.width - labelInset, LOCATIONBAR_HEIGHT)]; self.addressLabel.adjustsFontSizeToFitWidth = NO; self.addressLabel.alpha = 1.000; @@ -549,13 +549,13 @@ self.addressLabel.enabled = YES; self.addressLabel.hidden = NO; self.addressLabel.lineBreakMode = NSLineBreakByTruncatingTail; - + if ([self.addressLabel respondsToSelector:NSSelectorFromString(@"setMinimumScaleFactor:")]) { [self.addressLabel setValue:@(10.0/[UIFont labelFontSize]) forKey:@"minimumScaleFactor"]; } else if ([self.addressLabel respondsToSelector:NSSelectorFromString(@"setMinimumFontSize:")]) { [self.addressLabel setValue:@(10.0) forKey:@"minimumFontSize"]; } - + self.addressLabel.multipleTouchEnabled = NO; self.addressLabel.numberOfLines = 1; self.addressLabel.opaque = NO; @@ -668,7 +668,7 @@ if (show) { self.toolbar.hidden = NO; CGRect webViewBounds = self.view.bounds; - + if (locationbarVisible) { // locationBar at the bottom, move locationBar up // put toolBar at the bottom @@ -682,7 +682,7 @@ webViewBounds.size.height -= TOOLBAR_HEIGHT; self.toolbar.frame = toolbarFrame; } - + if ([toolbarPosition isEqualToString:kInAppBrowserToolbarBarPositionTop]) { toolbarFrame.origin.y = 0; webViewBounds.origin.y += toolbarFrame.size.height; @@ -691,7 +691,7 @@ toolbarFrame.origin.y = (webViewBounds.size.height + LOCATIONBAR_HEIGHT); } [self setWebViewFrame:webViewBounds]; - + } else { self.toolbar.hidden = YES; @@ -725,7 +725,7 @@ [CDVUserAgentUtil releaseLock:&_userAgentLockToken]; [super viewDidUnload]; } - + - (UIStatusBarStyle)preferredStatusBarStyle { return UIStatusBarStyleDefault; @@ -735,7 +735,7 @@ { [CDVUserAgentUtil releaseLock:&_userAgentLockToken]; self.currentURL = nil; - + if ((self.navigationDelegate != nil) && [self.navigationDelegate respondsToSelector:@selector(browserExit)]) { [self.navigationDelegate browserExit]; } @@ -774,14 +774,14 @@ { [self.webView goForward]; } - + - (void)viewWillAppear:(BOOL)animated { if (IsAtLeastiOSVersion(@"7.0")) { [[UIApplication sharedApplication] setStatusBarStyle:[self preferredStatusBarStyle]]; } [self rePositionViews]; - + [super viewWillAppear:animated]; } @@ -982,7 +982,7 @@ if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(supportedInterfaceOrientations)]) { return [self.orientationDelegate supportedInterfaceOrientations]; } - + return 1 << UIInterfaceOrientationPortrait; } @@ -991,9 +991,10 @@ if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(shouldAutorotateToInterfaceOrientation:)]) { return [self.orientationDelegate shouldAutorotateToInterfaceOrientation:interfaceOrientation]; } - + return YES; } @end + From 393524a3eae7faa8a56a0782fd2f5f1f786d07ab Mon Sep 17 00:00:00 2001 From: Rodrigo Silveira Date: Wed, 28 May 2014 12:36:59 -0700 Subject: [PATCH 101/106] CB-6127 Spanish and rench Translations added. Github close #23 --- doc/de/index.md | 299 ++++++++++++++++++++++++++++++++++++++++++++++++ doc/es/index.md | 299 ++++++++++++++++++++++++++++++++++++++++++++++++ doc/fr/index.md | 299 ++++++++++++++++++++++++++++++++++++++++++++++++ doc/it/index.md | 299 ++++++++++++++++++++++++++++++++++++++++++++++++ doc/ja/index.md | 299 ++++++++++++++++++++++++++++++++++++++++++++++++ doc/ko/index.md | 299 ++++++++++++++++++++++++++++++++++++++++++++++++ doc/pl/index.md | 299 ++++++++++++++++++++++++++++++++++++++++++++++++ doc/zh/index.md | 299 ++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 2392 insertions(+) create mode 100644 doc/de/index.md create mode 100644 doc/es/index.md create mode 100644 doc/fr/index.md create mode 100644 doc/it/index.md create mode 100644 doc/ja/index.md create mode 100644 doc/ko/index.md create mode 100644 doc/pl/index.md create mode 100644 doc/zh/index.md diff --git a/doc/de/index.md b/doc/de/index.md new file mode 100644 index 0000000..0302a92 --- /dev/null +++ b/doc/de/index.md @@ -0,0 +1,299 @@ + + +# org.apache.cordova.inappbrowser + +Dieses Plugin bietet eine Web-Browser-Ansicht, die anzeigt, beim Aufrufen von `window.open()` , oder als als bildeten einen Link öffnen``. + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + + +**Hinweis**: die InAppBrowser Fenster verhält sich wie einen standard-Webbrowser und Cordova APIs kann nicht zugegriffen werden kann. + +## Installation + + cordova plugin add org.apache.cordova.inappbrowser + + +### Firefox OS + +Erstellen Sie **www/manifest.webapp** , wie in [Docs Manifest][1]beschrieben. Fügen Sie die entsprechenden Permisions. + + [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest + + "permissions": { + "browser": {} + } + + +## window.open + +Öffnet eine URL in einem neuen `InAppBrowser` Instanz, die aktuelle Browserinstanz oder der Systembrowser. + + Var Ref = window.open (Url, Ziel, Optionen); + + +* **Ref**: Bezugnahme auf die `InAppBrowser` Fenster. *(InAppBrowser)* + +* **URL**: die URL *(String)*zu laden. Rufen Sie `encodeURI()` auf diese Option, wenn die URL enthält Unicode-Zeichen. + +* **Ziel**: das Ziel in der URL, einen optionalen Parameter geladen, die standardmäßig auf `_self` . *(String)* + + * `_self`: Öffnet sich in der Cordova WebView wenn der URL in der Whitelist ist, andernfalls es öffnet sich in der`InAppBrowser`. + * `_blank`: Öffnet den`InAppBrowser`. + * `_system`: Öffnet in den System-Web-Browser. + +* **Optionen**: Optionen für die `InAppBrowser` . Optional, säumige an: `location=yes` . *(String)* + + Die `options` Zeichenfolge muss keine Leerstelle enthalten, und jede Funktion Name/Wert-Paare müssen durch ein Komma getrennt werden. Featurenamen Groß-/Kleinschreibung. Alle Plattformen unterstützen die anderen Werte: + + * **Lage**: Legen Sie auf `yes` oder `no` , machen die `InAppBrowser` der Adressleiste ein- oder ausschalten. + + Nur Android: + + * **Closebuttoncaption**: Legen Sie auf eine Zeichenfolge als Beschriftung der **fertig** -Schaltfläche verwenden. + * **versteckte**: Legen Sie auf `yes` um den Browser zu erstellen und laden Sie die Seite, aber nicht zeigen. Das Loadstop-Ereignis wird ausgelöst, wenn der Ladevorgang abgeschlossen ist. Weglassen oder auf `no` (Standard), den Browser öffnen und laden normalerweise zu haben. + * **ClearCache**: Legen Sie auf `yes` , der Browser ist Cookiecache gelöscht, bevor das neue Fenster geöffnet wird + * **Clearsessioncache**: Legen Sie auf `yes` , der Sitzungs-Cookie Cache gelöscht, bevor das neue Fenster geöffnet wird + + iOS nur: + + * **Closebuttoncaption**: Legen Sie auf eine Zeichenfolge als Beschriftung der **fertig** -Schaltfläche verwenden. Beachten Sie, dass Sie diesen Wert selbst zu lokalisieren müssen. + * **Disallowoverscroll**: Legen Sie auf `yes` oder `no` (Standard ist `no` ). Aktiviert/deaktiviert die UIWebViewBounce-Eigenschaft. + * **versteckte**: Legen Sie auf `yes` um den Browser zu erstellen und laden Sie die Seite, aber nicht zeigen. Das Loadstop-Ereignis wird ausgelöst, wenn der Ladevorgang abgeschlossen ist. Weglassen oder auf `no` (Standard), den Browser öffnen und laden normalerweise zu haben. + * **ClearCache**: Legen Sie auf `yes` , der Browser ist Cookiecache gelöscht, bevor das neue Fenster geöffnet wird + * **Clearsessioncache**: Legen Sie auf `yes` zu der Session Cookie Cache gelöscht, bevor das neue Fenster geöffnet wird + * **Symbolleiste**: Legen Sie auf `yes` oder `no` Aktivieren Sie die Symbolleiste ein- oder Ausschalten für InAppBrowser (Standard:`yes`) + * **EnableViewportScale**: Legen Sie auf `yes` oder `no` , Viewport Skalierung durch ein Meta-Tag (standardmäßig zu verhindern`no`). + * **MediaPlaybackRequiresUserAction**: Legen Sie auf `yes` oder `no` , HTML5 audio oder video von automatisches Abspielen (standardmäßig zu verhindern`no`). + * **AllowInlineMediaPlayback**: Legen Sie auf `yes` oder `no` Inline-HTML5-Media-Wiedergabe, Darstellung im Browser-Fenster, sondern in eine gerätespezifische Wiedergabe-Schnittstelle ermöglichen. Des HTML `video` Element muss auch die `webkit-playsinline` Attribut (Standard:`no`) + * **KeyboardDisplayRequiresUserAction**: Legen Sie auf `yes` oder `no` um die Tastatur zu öffnen, wenn Formularelemente Fokus per JavaScript erhalten `focus()` Anruf (Standard:`yes`). + * **SuppressesIncrementalRendering**: Legen Sie auf `yes` oder `no` zu warten, bis alle neuen anzeigen-Inhalte empfangen wird, bevor Sie wiedergegeben wird (standardmäßig`no`). + * **Presentationstyle**: Legen Sie auf `pagesheet` , `formsheet` oder `fullscreen` [Präsentationsstil][2] (standardmäßig fest`fullscreen`). + * **Transitionstyle**: Legen Sie auf `fliphorizontal` , `crossdissolve` oder `coververtical` [Übergangsstil][3] (standardmäßig fest`coververtical`). + * **Toolbarposition**: Legen Sie auf `top` oder `bottom` (Standard ist `bottom` ). Bewirkt, dass die Symbolleiste am oberen oder unteren Rand des Fensters sein. + + [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* BlackBerry 10 +* iOS +* Windows Phone 7 und 8 + +### Beispiel + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); + + +## InAppBrowser + +Aus einem Aufruf zurückgegebenen Objekts`window.open`. + +### Methoden + +* addEventListener +* removeEventListener +* Schließen +* Karte +* executeScript +* insertCSS + +## addEventListener + +> Fügt einen Listener für eine Veranstaltung aus der`InAppBrowser`. + + ref.addEventListener(eventname, callback); + + +* **Ref**: Bezugnahme auf die `InAppBrowser` Fenster *(InAppBrowser)* + +* **EventName**: das Ereignis zu warten *(String)* + + * **Loadstart**: Ereignis wird ausgelöst, wenn die `InAppBrowser` beginnt, eine URL zu laden. + * **Loadstop**: Ereignis wird ausgelöst, wenn der `InAppBrowser` beendet ist, eine URL laden. + * **LoadError**: Ereignis wird ausgelöst, wenn der `InAppBrowser` ein Fehler auftritt, wenn Sie eine URL zu laden. + * **Ausfahrt**: Ereignis wird ausgelöst, wenn das `InAppBrowser` -Fenster wird geschlossen. + +* **Rückruf**: die Funktion, die ausgeführt wird, wenn das Ereignis ausgelöst wird. Die Funktion übergeben wird ein `InAppBrowserEvent` -Objekt als Parameter. + +### InAppBrowserEvent Eigenschaften + +* **Typ**: Eventname, entweder `loadstart` , `loadstop` , `loaderror` , oder `exit` . *(String)* + +* **URL**: die URL, die geladen wurde. *(String)* + +* **Code**: der Fehler-Code, nur im Fall von `loaderror` . *(Anzahl)* + +* **Nachricht**: die Fehlermeldung angezeigt, nur im Fall von `loaderror` . *(String)* + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* iOS +* Windows Phone 7 und 8 + +### Kleines Beispiel + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstart', function(event) { alert(event.url); }); + + +## removeEventListener + +> Entfernt einen Listener für eine Veranstaltung aus der`InAppBrowser`. + + ref.removeEventListener(eventname, callback); + + +* **Ref**: Bezugnahme auf die `InAppBrowser` Fenster. *(InAppBrowser)* + +* **EventName**: das Ereignis zu warten. *(String)* + + * **Loadstart**: Ereignis wird ausgelöst, wenn die `InAppBrowser` beginnt, eine URL zu laden. + * **Loadstop**: Ereignis wird ausgelöst, wenn der `InAppBrowser` beendet ist, eine URL laden. + * **LoadError**: Ereignis wird ausgelöst, wenn die `InAppBrowser` trifft einen Fehler beim Laden einer URLs. + * **Ausfahrt**: Ereignis wird ausgelöst, wenn das `InAppBrowser` -Fenster wird geschlossen. + +* **Rückruf**: die Funktion ausgeführt, wenn das Ereignis ausgelöst wird. Die Funktion übergeben wird ein `InAppBrowserEvent` Objekt. + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* iOS +* Windows Phone 7 und 8 + +### Kleines Beispiel + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var myCallback = function(event) { alert(event.url); } + ref.addEventListener('loadstart', myCallback); + ref.removeEventListener('loadstart', myCallback); + + +## Schließen + +> Schließt die `InAppBrowser` Fenster. + + Ref.Close(); + + +* **Ref**: Bezugnahme auf die `InAppBrowser` Fenster *(InAppBrowser)* + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* iOS +* Windows Phone 7 und 8 + +### Kleines Beispiel + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.close(); + + +## Karte + +> Zeigt ein InAppBrowser-Fenster, das geöffnet wurde, versteckt. Aufrufen, dies hat keine Auswirkungen, wenn die InAppBrowser schon sichtbar war. + + Ref.Show(); + + +* **Ref**: Verweis auf die (InAppBrowser) Fenster`InAppBrowser`) + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* iOS + +### Kleines Beispiel + + var ref = window.open('http://apache.org', '_blank', 'hidden=yes'); + // some time later... + ref.show(); + + +## executeScript + +> Fügt JavaScript-Code in das `InAppBrowser` Fenster + + ref.executeScript(details, callback); + + +* **Ref**: Bezugnahme auf die `InAppBrowser` Fenster. *(InAppBrowser)* + +* **InjectDetails**: Informationen über das Skript ausgeführt, angeben, entweder ein `file` oder `code` Schlüssel. *(Objekt)* + + * **Datei**: URL des Skripts zu injizieren. + * **Code**: Text des Skripts zu injizieren. + +* **Rückruf**: die Funktion, die ausgeführt wird, nachdem der JavaScript-Code injiziert wird. + + * Wenn das eingefügte Skript vom Typ ist `code` , der Rückruf führt mit einen einzelnen Parameter, der der Rückgabewert des Skripts ist, umwickelt ein `Array` . Bei Multi-Line-Skripten ist der Rückgabewert von der letzten Anweisung oder den letzten Ausdruck ausgewertet. + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* iOS + +### Kleines Beispiel + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.executeScript({file: "myscript.js"}); + }); + + +## insertCSS + +> Injiziert CSS in der `InAppBrowser` Fenster. + + ref.insertCSS(details, callback); + + +* **Ref**: Bezugnahme auf die `InAppBrowser` Fenster *(InAppBrowser)* + +* **InjectDetails**: Informationen über das Skript ausgeführt, angeben, entweder ein `file` oder `code` Schlüssel. *(Objekt)* + + * **Datei**: URL des Stylesheets zu injizieren. + * **Code**: Text des Stylesheets zu injizieren. + +* **Rückruf**: die Funktion, die ausgeführt wird, nachdem die CSS injiziert wird. + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* iOS + +### Kleines Beispiel + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.insertCSS({file: "mystyles.css"}); + }); \ No newline at end of file diff --git a/doc/es/index.md b/doc/es/index.md new file mode 100644 index 0000000..74b54b9 --- /dev/null +++ b/doc/es/index.md @@ -0,0 +1,299 @@ + + +# org.apache.cordova.inappbrowser + +Este plugin proporciona una vista de navegador web que se muestra cuando se llama a `window.open()` , o cuando abre un enlace formado como``. + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + + +**Nota**: InAppBrowser la ventana se comporta como un navegador web estándar y no pueden acceder a Cordova APIs. + +## Instalación + + cordova plugin add org.apache.cordova.inappbrowser + + +### Firefox OS + +Crear **www/manifest.webapp** como se describe en [Manifestar Docs][1]. Agregar permisos pertinentes. + + [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest + + "permissions": { + "browser": {} + } + + +## window.open + +Se abre una dirección URL en una nueva `InAppBrowser` ejemplo, la instancia actual del navegador o el navegador del sistema. + + var ref = window.open (url, target, opciones); + + +* **ref**: referencia a la `InAppBrowser` ventana. *(InAppBrowser)* + +* **URL**: el URL para cargar *(String)*. Llame a `encodeURI()` en este si la URL contiene caracteres Unicode. + +* **objetivo**: el objetivo en el que se carga la URL, un parámetro opcional que por defecto es `_self` . *(String)* + + * `_self`: Se abre en el Cordova WebView si la URL está en la lista blanca, de lo contrario se abre en el`InAppBrowser`. + * `_blank`: Se abre en el`InAppBrowser`. + * `_system`: Se abre en el navegador web del sistema. + +* **Opciones**: opciones para el `InAppBrowser` . Opcional, contumaz a: `location=yes` . *(String)* + + La `options` cadena no debe contener ningún espacio en blanco, y pares nombre/valor de cada característica deben estar separados por una coma. Los nombres de función son minúsculas. Todas las plataformas admiten el valor siguiente: + + * **Ubicación**: A `yes` o `no` para activar el `InAppBrowser` de barra de ubicación activado o desactivado. + + Android sólo: + + * **closebuttoncaption**: establecer una cadena para usar como título del botón **hecho** . + * **oculta**: a `yes` para crear el navegador y cargar la página, pero no lo demuestra. El evento loadstop se desencadena cuando termine la carga. Omitir o a `no` (por defecto) para que el navegador abra y carga normalmente. + * **clearcache**: a `yes` para que el navegador es caché de galleta despejado antes de que se abra la nueva ventana + * **clearsessioncache**: a `yes` que la caché de cookie de sesión despejado antes de que se abra la nueva ventana + + Sólo iOS: + + * **closebuttoncaption**: establecer una cadena para usar como título del botón **hecho** . Tenga en cuenta que necesitas localizar este valor por sí mismo. + * **disallowoverscroll**: A `yes` o `no` (valor por defecto es `no` ). Activa/desactiva la propiedad UIWebViewBounce. + * **oculta**: a `yes` para crear el navegador y cargar la página, pero no lo demuestra. El evento loadstop se desencadena cuando termine la carga. Omitir o a `no` (por defecto) para que el navegador abra y carga normalmente. + * **clearcache**: a `yes` para que el navegador es caché de galleta despejado antes de que se abra la nueva ventana + * **clearsessioncache**: a `yes` que la caché de cookie de sesión despejado antes de que se abra la nueva ventana + * **barra de herramientas**: a `yes` o `no` para activar la barra de herramientas on u off para el InAppBrowser (por defecto`yes`) + * **enableViewportScale**: A `yes` o `no` para evitar la vista escala a través de una etiqueta meta (por defecto`no`). + * **mediaPlaybackRequiresUserAction**: A `yes` o `no` para evitar HTML5 audio o vídeo de reproducción automática (por defecto`no`). + * **allowInlineMediaPlayback**: A `yes` o `no` para permitir la reproducción de los medios de comunicación en línea HTML5, mostrando en la ventana del navegador en lugar de una interfaz específica del dispositivo de reproducción. El código de HTML `video` elemento también debe incluir la `webkit-playsinline` atributo (por defecto`no`) + * **keyboardDisplayRequiresUserAction**: A `yes` o `no` para abrir el teclado cuando elementos de formulario reciben el foco mediante JavaScript `focus()` llamada (por defecto`yes`). + * **suppressesIncrementalRendering**: A `yes` o `no` que esperar a que todo el contenido nuevo vista es recibido antes de ser prestados (por defecto`no`). + * **presentationstyle**: A `pagesheet` , `formsheet` o `fullscreen` para establecer el [estilo de la presentación][2] (por defecto`fullscreen`). + * **transitionstyle**: A `fliphorizontal` , `crossdissolve` o `coververtical` para establecer el [estilo de transición][3] (por defecto`coververtical`). + * **toolbarposition**: A `top` o `bottom` (valor por defecto es `bottom` ). Hace que la barra de herramientas en la parte superior o inferior de la ventana. + + [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* BlackBerry 10 +* iOS +* Windows Phone 7 y 8 + +### Ejemplo + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); + + +## InAppBrowser + +El objeto devuelto desde una llamada a`window.open`. + +### Métodos + +* addEventListener +* removeEventListener +* close +* show +* executeScript +* insertCSS + +## addEventListener + +> Añade un detector para un evento de la`InAppBrowser`. + + ref.addEventListener(eventname, callback); + + +* **ref**: referencia a la `InAppBrowser` ventana *(InAppBrowser)* + +* **eventName**: el evento para escuchar *(String)* + + * **loadstart**: evento desencadena cuando el `InAppBrowser` comienza a cargar una dirección URL. + * **loadstop**: evento desencadena cuando el `InAppBrowser` termina cargando una dirección URL. + * **loaderror**: evento desencadena cuando el `InAppBrowser` encuentra un error al cargar una dirección URL. + * **salida**: evento desencadena cuando el `InAppBrowser` se cierra la ventana. + +* **devolución de llamada**: la función que se ejecuta cuando se desencadene el evento. La función se pasa un `InAppBrowserEvent` objeto como parámetro. + +### InAppBrowserEvent propiedades + +* **tipo**: eventname, ya sea `loadstart` , `loadstop` , `loaderror` , o `exit` . *(String)* + +* **URL**: la URL que se cargó. *(String)* + +* **código**: el código de error, sólo en el caso de `loaderror` . *(Número)* + +* **mensaje**: el mensaje de error, sólo en el caso de `loaderror` . *(String)* + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* iOS +* Windows Phone 7 y 8 + +### Ejemplo rápido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstart', function(event) { alert(event.url); }); + + +## removeEventListener + +> Elimina un detector para un evento de la`InAppBrowser`. + + ref.removeEventListener(eventname, callback); + + +* **ref**: referencia a la `InAppBrowser` ventana. *(InAppBrowser)* + +* **eventName**: dejar de escuchar para el evento. *(String)* + + * **loadstart**: evento desencadena cuando el `InAppBrowser` comienza a cargar una dirección URL. + * **loadstop**: evento desencadena cuando el `InAppBrowser` termina cargando una dirección URL. + * **loaderror**: evento desencadena cuando el `InAppBrowser` se encuentra con un error al cargar una dirección URL. + * **salida**: evento desencadena cuando el `InAppBrowser` se cierra la ventana. + +* **devolución de llamada**: la función a ejecutar cuando se desencadene el evento. La función se pasa un `InAppBrowserEvent` objeto. + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* iOS +* Windows Phone 7 y 8 + +### Ejemplo rápido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var myCallback = function(event) { alert(event.url); } + ref.addEventListener('loadstart', myCallback); + ref.removeEventListener('loadstart', myCallback); + + +## close + +> Se cierra el `InAppBrowser` ventana. + + Ref.Close(); + + +* **ref**: referencia a la `InAppBrowser` ventana *(InAppBrowser)* + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* iOS +* Windows Phone 7 y 8 + +### Ejemplo rápido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.close(); + + +## show + +> Muestra una ventana InAppBrowser que abrió sus puertas ocultada. Esto no tiene efecto si el InAppBrowser ya era visible. + + Ref.Show(); + + +* **ref**: referencia a la (ventana) InAppBrowser`InAppBrowser`) + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* iOS + +### Ejemplo rápido + + var ref = window.open('http://apache.org', '_blank', 'hidden=yes'); + // some time later... + ref.show(); + + +## executeScript + +> Inyecta código JavaScript en la `InAppBrowser` ventana + + ref.executeScript(details, callback); + + +* **ref**: referencia a la `InAppBrowser` ventana. *(InAppBrowser)* + +* **injectDetails**: detalles de la secuencia de comandos para ejecutar, o especificar un `file` o `code` clave. *(Objeto)* + + * **archivo**: URL de la secuencia de comandos para inyectar. + * **código**: texto de la escritura para inyectar. + +* **devolución de llamada**: la función que se ejecuta después de inyecta el código JavaScript. + + * Si el script inyectado es de tipo `code` , la devolución de llamada se ejecuta con un solo parámetro, que es el valor devuelto por el guión, envuelto en un `Array` . Para los scripts de varias líneas, este es el valor devuelto de la última declaración, o la última expresión evaluada. + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* iOS + +### Ejemplo rápido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.executeScript({file: "myscript.js"}); + }); + + +## insertCSS + +> Inyecta CSS en la `InAppBrowser` ventana. + + ref.insertCSS(details, callback); + + +* **ref**: referencia a la `InAppBrowser` ventana *(InAppBrowser)* + +* **injectDetails**: detalles de la secuencia de comandos para ejecutar, o especificar un `file` o `code` clave. *(Objeto)* + + * **archivo**: URL de la hoja de estilos para inyectar. + * **código**: texto de la hoja de estilos para inyectar. + +* **devolución de llamada**: la función que se ejecuta después de inyectar el CSS. + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* iOS + +### Ejemplo rápido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.insertCSS({file: "mystyles.css"}); + }); \ No newline at end of file diff --git a/doc/fr/index.md b/doc/fr/index.md new file mode 100644 index 0000000..3af5e42 --- /dev/null +++ b/doc/fr/index.md @@ -0,0 +1,299 @@ + + +# org.apache.cordova.inappbrowser + +Ce plugin vous offre une vue de navigateur web qui s'affiche lorsque vous appelez `window.open()` , ou quand un lien d'ouverture formé comme``. + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + + +**Remarque**: InAppBrowser la fenêtre se comporte comme un navigateur web standard et ne peut pas accéder aux APIs Cordova. + +## Installation + + cordova plugin add org.apache.cordova.inappbrowser + + +### Firefox OS + +Créez **www/manifest.webapp** comme décrit dans [Les Docs manifeste][1]. Ajouter permisions pertinentes. + + [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest + + "permissions": { + "browser": {} + } + + +## window.open + +Ouvre une URL dans une nouvelle `InAppBrowser` instance, l'instance de navigateur actuelle ou dans l'Explorateur du système. + + var Réf = window.open (url, cible, options) ; + + +* **ref** : référence à la fenêtre `InAppBrowser`. *(InAppBrowser)* + +* **url** : l'URL à charger *(String)*. À encoder au préalable via `encodeURI()` si celle-ci contient des caractères Unicode. + +* **target** : la cible du chargement de l'URL, ce paramètre est optionnel, sa valeur par défaut est `_self`. *(String)* + + * `_self` : dirige le chargement vers la WebView Cordova si l'URL figure dans la liste blanche, sinon dans une fenêtre `InAppBrowser`. + * `_blank` : dirige le chargement vers une fenêtre `InAppBrowser`. + * `_system` : dirige le chargement vers le navigateur Web du système. + +* **options** : permet de personnaliser la fenêtre `InAppBrowser`. Paramètre facultatif dont la valeur par défaut est `location=yes`. *(String)* + + La chaîne `options` ne doit contenir aucun caractère vide, chaque paire nom/valeur représentant une fonctionnalité doit être séparée de la précédente par une virgule. Les noms de fonctionnalités sont sensibles à la casse. Toutes les plates-formes prennent en charge la valeur ci-dessous : + + * **location** : régler à `yes` ou `no` afin d'afficher ou masquer la barre d'adresse de la fenêtre `InAppBrowser`. + + Android uniquement : + + * **closebuttoncaption**: affectez une chaîne à utiliser comme la **fait** légende du bouton. + * **caché**: la valeur `yes` pour créer le navigateur et charger la page, mais ne pas le montrer. L'événement loadstop est déclenché lorsque le chargement est terminé. Omettre ou la valeur `no` (par défaut) pour que le navigateur ouvrir et charger normalement. + * **ClearCache**: la valeur `yes` pour que le navigateur du cache de cookie effacé, avant l'ouverture de la nouvelle fenêtre + * **clearsessioncache**: la valeur `yes` pour avoir le cache de cookie de session autorisé avant l'ouverture de la nouvelle fenêtre + + iOS uniquement : + + * **closebuttoncaption**: affectez une chaîne à utiliser comme la **fait** légende du bouton. Notez que vous devrez localiser cette valeur vous-même. + * **disallowoverscroll**: la valeur `yes` ou `no` (valeur par défaut est `no` ). Active/désactive la propriété UIWebViewBounce. + * **caché**: la valeur `yes` pour créer le navigateur et charger la page, mais ne pas le montrer. L'événement loadstop est déclenché lorsque le chargement est terminé. Omettre ou la valeur `no` (par défaut) pour que le navigateur ouvrir et charger normalement. + * **ClearCache**: la valeur `yes` pour que le navigateur du cache de cookie effacé, avant l'ouverture de la nouvelle fenêtre + * **clearsessioncache**: la valeur `yes` pour avoir le cache de cookie de session autorisé avant l'ouverture de la nouvelle fenêtre + * **barre d'outils**: la valeur `yes` ou `no` pour activer la barre d'outils ou désactiver pour le InAppBrowser (par défaut,`yes`) + * **enableViewportScale**: la valeur `yes` ou `no` pour empêcher la fenêtre de mise à l'échelle par une balise meta (par défaut,`no`). + * **mediaPlaybackRequiresUserAction**: la valeur `yes` ou `no` pour empêcher le HTML5 audio ou vidéo de la lecture automatique (par défaut,`no`). + * **allowInlineMediaPlayback**: la valeur `yes` ou `no` pour permettre la lecture du média en ligne HTML5, affichage dans la fenêtre du navigateur plutôt que d'une interface de lecture spécifique au périphérique. L'HTML `video` élément doit également inclure la `webkit-playsinline` attribut (par défaut,`no`) + * **keyboardDisplayRequiresUserAction**: la valeur `yes` ou `no` pour ouvrir le clavier lorsque les éléments reçoivent le focus par l'intermédiaire de JavaScript `focus()` appel (par défaut,`yes`). + * **suppressesIncrementalRendering**: la valeur `yes` ou `no` d'attendre que toutes les nouveautés de vue sont reçue avant d'être restitué (par défaut,`no`). + * **presentationstyle**: la valeur `pagesheet` , `formsheet` ou `fullscreen` pour définir le [style de présentation][2] (par défaut,`fullscreen`). + * **transitionstyle**: la valeur `fliphorizontal` , `crossdissolve` ou `coververtical` pour définir le [style de transition][3] (par défaut,`coververtical`). + * **toolbarposition**: la valeur `top` ou `bottom` (valeur par défaut est `bottom` ). Causes de la barre d'outils être en haut ou en bas de la fenêtre. + + [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* BlackBerry 10 +* iOS +* Windows Phone 7 et 8 + +### Exemple + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); + + +## InAppBrowser + +L'objet retourné par un appel à`window.open`. + +### Méthodes + +* addEventListener +* removeEventListener +* close +* show +* executeScript +* insertCSS + +## addEventListener + +> Ajoute un écouteur pour un évènement de la fenêtre `InAppBrowser`. + + ref.addEventListener(eventname, callback); + + +* **ref** : référence à la fenêtre `InAppBrowser`. *(InAppBrowser)* + +* **eventname** : l'évènement à écouter *(String)* + + * **loadstart** : évènement déclenché lorsque le chargement d'une URL débute dans la fenêtre `InAppBrowser`. + * **loadstop** : évènement déclenché lorsque la fenêtre `InAppBrowser` finit de charger une URL. + * **loaderror** : évènement déclenché si la fenêtre `InAppBrowser` rencontre une erreur lors du chargement d'une URL. + * **exit** : évènement déclenché lorsque la fenêtre `InAppBrowser` est fermée. + +* **callback** : la fonction à exécuter lorsque l'évènement se déclenche. Un objet `InAppBrowserEvent` lui est transmis comme paramètre. + +### Propriétés de InAppBrowserEvent + +* **type** : le nom de l'évènement, soit `loadstart`, `loadstop`, `loaderror` ou `exit`. *(String)* + +* **url** : l'URL ayant été chargée. *(String)* + +* **code** : le code d'erreur, seulement pour `loaderror`. *(Number)* + +* **message** : un message d'erreur, seulement pour `loaderror`. *(String)* + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* iOS +* Windows Phone 7 et 8 + +### Petit exemple + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstart', function(event) { alert(event.url); }); + + +## removeEventListener + +> Supprime un écouteur pour un évènement de la fenêtre `InAppBrowser`. + + ref.removeEventListener(eventname, callback); + + +* **ref** : référence à la fenêtre `InAppBrowser`. *(InAppBrowser)* + +* **eventname** : l'évènement pour lequel arrêter l'écoute. *(String)* + + * **loadstart**: événement déclenche quand le `InAppBrowser` commence à charger une URL. + * **loadstop**: événement déclenche lorsque la `InAppBrowser` finit de charger une URL. + * **loaderror** : évènement déclenché si la fenêtre `InAppBrowser` rencontre une erreur lors du chargement d'une URL. + * **sortie**: événement déclenche quand le `InAppBrowser` fenêtre est fermée. + +* **callback** : la fonction à exécuter lorsque l'évènement se déclenche. Un objet `InAppBrowserEvent` lui est transmis comme paramètre. + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* iOS +* Windows Phone 7 et 8 + +### Petit exemple + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var myCallback = function(event) { alert(event.url); } + ref.addEventListener('loadstart', myCallback); + ref.removeEventListener('loadstart', myCallback); + + +## close + +> Ferme la fenêtre `InAppBrowser`. + + Ref.Close() ; + + +* **Réf**: référence à la `InAppBrowser` fenêtre *(InAppBrowser)* + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* iOS +* Windows Phone 7 et 8 + +### Petit exemple + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.close(); + + +## show + +> Affiche une fenêtre InAppBrowser qui a été ouverte cachée. Appeler cette méthode n'a aucun effet si la fenêtre en question est déjà visible. + + Ref.Show() ; + + +* **Réf**: référence à la fenêtre () InAppBrowser`InAppBrowser`) + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* iOS + +### Petit exemple + + var ref = window.open('http://apache.org', '_blank', 'hidden=yes'); + // some time later... + ref.show(); + + +## executeScript + +> Injecte du code JavaScript dans la fenêtre `InAppBrowser` + + ref.executeScript(details, callback); + + +* **Réf**: référence à la `InAppBrowser` fenêtre. *(InAppBrowser)* + +* **injectDetails** : détails du script à exécuter, requérant une propriété `file` ou `code`. *(Object)* + + * **file** : URL du script à injecter. + * **code** : texte du script à injecter. + +* **callback** : une fonction exécutée après l'injection du code JavaScript. + + * Si le script injecté est de type `code`, un seul paramètre est transmis à la fonction callback, correspondant à la valeur de retour du script enveloppée dans un `Array`. Pour les scripts multilignes, il s'agit de la valeur renvoyée par la dernière instruction ou la dernière expression évaluée. + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* iOS + +### Petit exemple + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.executeScript({file: "myscript.js"}); + }); + + +## insertCSS + +> Injecte des règles CSS dans la fenêtre `InAppBrowser`. + + ref.insertCSS(details, callback); + + +* **Réf**: référence à la `InAppBrowser` fenêtre *(InAppBrowser)* + +* **injectDetails**: Détails du script à exécuter, spécifiant soit un `file` ou `code` clés. *(Objet)* + + * **file** : URL de la feuille de style à injecter. + * **code** : contenu de la feuille de style à injecter. + +* **callback** : une fonction exécutée après l'injection du fichier CSS. + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* iOS + +### Petit exemple + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.insertCSS({file: "mystyles.css"}); + }); \ No newline at end of file diff --git a/doc/it/index.md b/doc/it/index.md new file mode 100644 index 0000000..792e502 --- /dev/null +++ b/doc/it/index.md @@ -0,0 +1,299 @@ + + +# org.apache.cordova.inappbrowser + +Questo plugin fornisce una vista di browser web che viene visualizzata quando si chiama `window.open()` , o quando un link di apertura formata come``. + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + + +**Nota**: il InAppBrowser finestra si comporta come un browser web standard e non può accedere a Cordova APIs. + +## Installazione + + cordova plugin add org.apache.cordova.inappbrowser + + +### Firefox OS + +Creare **www/manifest.webapp** come descritto nel [Manifesto Docs][1]. Aggiungi permisions rilevanti. + + [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest + + "permissions": { + "browser": {} + } + + +## window.open + +Apre un URL in una nuova `InAppBrowser` istanza, l'istanza corrente del browser o il browser di sistema. + + rif var = Window. Open (url, destinazione, opzioni); + + +* **Rif**: fare riferimento alla `InAppBrowser` finestra. *(InAppBrowser)* + +* **URL**: l'URL da caricare *(String)*. Chiamare `encodeURI()` su questo, se l'URL contiene caratteri Unicode. + +* **destinazione**: la destinazione in cui caricare l'URL, un parametro facoltativo che il valore predefinito è `_self` . *(String)* + + * `_self`: Si apre in Cordova WebView se l'URL è nella lista bianca, altrimenti si apre nella`InAppBrowser`. + * `_blank`: Apre il`InAppBrowser`. + * `_system`: Si apre nel browser web del sistema. + +* **opzioni**: opzioni per il `InAppBrowser` . Opzionale, inadempiente a: `location=yes` . *(String)* + + Il `options` stringa non deve contenere alcun spazio vuoto, e coppie nome/valore ogni funzionalità devono essere separate da una virgola. Caratteristica nomi sono tra maiuscole e minuscole. Tutte le piattaforme supportano il valore riportato di seguito: + + * **posizione**: impostata su `yes` o `no` per trasformare il `InAppBrowser` di barra di posizione on o off. + + Solo su Android: + + * **closebuttoncaption**: impostare una stringa da utilizzare come didascalia del pulsante **fatto** . + * **nascosti**: impostare su `yes` per creare il browser e caricare la pagina, ma non mostrarlo. L'evento loadstop viene generato quando il caricamento è completato. Omettere o impostata su `no` (impostazione predefinita) per avere il browser aperto e caricare normalmente. + * **ClearCache**: impostare su `yes` per avere il browser di cookie cache cancellata prima dell'apertura della nuova finestra + * **clearsessioncache**: impostare su `yes` per avere la cache cookie di sessione cancellata prima dell'apertura della nuova finestra + + solo iOS: + + * **closebuttoncaption**: impostare una stringa da utilizzare come didascalia del pulsante **fatto** . Si noti che è necessario localizzare questo valore a te stesso. + * **disallowoverscroll**: impostare su `yes` o `no` (default è `no` ). Attiva/disattiva la proprietà UIWebViewBounce. + * **nascosti**: impostare su `yes` per creare il browser e caricare la pagina, ma non mostrarlo. L'evento loadstop viene generato quando il caricamento è completato. Omettere o impostata su `no` (impostazione predefinita) per avere il browser aperto e caricare normalmente. + * **ClearCache**: impostare su `yes` per avere il browser cache cookie ha lasciata prima dell'apertura della nuova finestra + * **clearsessioncache**: impostare su `yes` per avere la cache cookie di sessione cancellata prima dell'apertura della nuova finestra + * **Toolbar**: impostare su `yes` o `no` per attivare la barra degli strumenti o disattivare per il InAppBrowser (default`yes`) + * **enableViewportScale**: impostare su `yes` o `no` per impedire la viewport ridimensionamento tramite un tag meta (default`no`). + * **mediaPlaybackRequiresUserAction**: impostare su `yes` o `no` per impedire HTML5 audio o video da AutoPlay (default`no`). + * **allowInlineMediaPlayback**: impostare su `yes` o `no` per consentire la riproduzione dei supporti HTML5 in linea, visualizzare all'interno della finestra del browser, piuttosto che un'interfaccia specifica del dispositivo di riproduzione. L'HTML `video` elemento deve includere anche il `webkit-playsinline` (default di attributo`no`) + * **keyboardDisplayRequiresUserAction**: impostare su `yes` o `no` per aprire la tastiera quando elementi form ricevano lo stato attivo tramite di JavaScript `focus()` chiamata (default`yes`). + * **suppressesIncrementalRendering**: impostare su `yes` o `no` aspettare fino a quando tutti i nuovi contenuti di vista viene ricevuto prima il rendering (default`no`). + * **presentationstyle**: impostare su `pagesheet` , `formsheet` o `fullscreen` per impostare lo [stile di presentazione][2] (default`fullscreen`). + * **transitionstyle**: impostare su `fliphorizontal` , `crossdissolve` o `coververtical` per impostare lo [stile di transizione][3] (default`coververtical`). + * **toolbarposition**: impostare su `top` o `bottom` (default è `bottom` ). Provoca la barra degli strumenti sia nella parte superiore o inferiore della finestra. + + [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* BlackBerry 10 +* iOS +* Windows Phone 7 e 8 + +### Esempio + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); + + +## InAppBrowser + +L'oggetto restituito da una chiamata a`window.open`. + +### Metodi + +* addEventListener +* removeEventListener +* close +* show +* executeScript +* insertCSS + +## addEventListener + +> Aggiunge un listener per un evento dal`InAppBrowser`. + + ref.addEventListener(eventname, callback); + + +* **Rif**: fare riferimento alla `InAppBrowser` finestra *(InAppBrowser)* + +* **EventName**: l'evento per l'ascolto *(String)* + + * **loadstart**: evento viene generato quando il `InAppBrowser` comincia a caricare un URL. + * **loadstop**: evento viene generato quando il `InAppBrowser` termina il caricamento di un URL. + * **LoadError**: evento viene generato quando il `InAppBrowser` rileva un errore durante il caricamento di un URL. + * **uscita**: evento viene generato quando il `InAppBrowser` finestra è chiusa. + +* **richiamata**: la funzione che viene eseguito quando viene generato l'evento. La funzione viene passata un `InAppBrowserEvent` oggetto come parametro. + +### Proprietà InAppBrowserEvent + +* **tipo**: il eventname, o `loadstart` , `loadstop` , `loaderror` , o `exit` . *(String)* + +* **URL**: l'URL che è stato caricato. *(String)* + +* **codice**: il codice di errore, solo nel caso di `loaderror` . *(Numero)* + +* **messaggio**: il messaggio di errore, solo nel caso di `loaderror` . *(String)* + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* iOS +* Windows Phone 7 e 8 + +### Esempio rapido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstart', function(event) { alert(event.url); }); + + +## removeEventListener + +> Rimuove un listener per un evento dal`InAppBrowser`. + + ref.removeEventListener(eventname, callback); + + +* **Rif**: fare riferimento alla `InAppBrowser` finestra. *(InAppBrowser)* + +* **EventName**: interrompere l'attesa per l'evento. *(String)* + + * **loadstart**: evento viene generato quando il `InAppBrowser` comincia a caricare un URL. + * **loadstop**: evento viene generato quando il `InAppBrowser` termina il caricamento di un URL. + * **LoadError**: evento viene generato quando il `InAppBrowser` rileva un errore di caricamento di un URL. + * **uscita**: evento viene generato quando il `InAppBrowser` finestra è chiusa. + +* **richiamata**: la funzione da eseguire quando viene generato l'evento. La funzione viene passata un `InAppBrowserEvent` oggetto. + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* iOS +* Windows Phone 7 e 8 + +### Esempio rapido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var myCallback = function(event) { alert(event.url); } + ref.addEventListener('loadstart', myCallback); + ref.removeEventListener('loadstart', myCallback); + + +## close + +> Chiude la `InAppBrowser` finestra. + + Ref.Close(); + + +* **Rif**: fare riferimento alla `InAppBrowser` finestra *(InAppBrowser)* + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* iOS +* Windows Phone 7 e 8 + +### Esempio rapido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.close(); + + +## show + +> Visualizza una finestra di InAppBrowser che è stato aperto nascosta. Questa chiamata non ha effetto se la InAppBrowser era già visibile. + + Ref.Show(); + + +* **Rif**: riferimento per il InAppBrowser finestra (`InAppBrowser`) + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* iOS + +### Esempio rapido + + var ref = window.open('http://apache.org', '_blank', 'hidden=yes'); + // some time later... + ref.show(); + + +## executeScript + +> Inserisce il codice JavaScript nella `InAppBrowser` finestra + + ref.executeScript(details, callback); + + +* **Rif**: fare riferimento alla `InAppBrowser` finestra. *(InAppBrowser)* + +* **injectDetails**: dettagli dello script da eseguire, specificando un `file` o `code` chiave. *(Oggetto)* + + * **file**: URL dello script da iniettare. + * **codice**: testo dello script da iniettare. + +* **richiamata**: la funzione che viene eseguito dopo che il codice JavaScript viene iniettato. + + * Se lo script iniettato è di tipo `code` , il callback viene eseguita con un singolo parametro, che è il valore restituito del copione, avvolto in un `Array` . Per gli script multi-linea, questo è il valore restituito dell'ultima istruzione, o l'ultima espressione valutata. + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* iOS + +### Esempio rapido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.executeScript({file: "myscript.js"}); + }); + + +## insertCSS + +> Inietta CSS nella `InAppBrowser` finestra. + + ref.insertCSS(details, callback); + + +* **Rif**: fare riferimento alla `InAppBrowser` finestra *(InAppBrowser)* + +* **injectDetails**: dettagli dello script da eseguire, specificando un `file` o `code` chiave. *(Oggetto)* + + * **file**: URL del foglio di stile per iniettare. + * **codice**: testo del foglio di stile per iniettare. + +* **richiamata**: la funzione che viene eseguito dopo che il CSS viene iniettato. + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* iOS + +### Esempio rapido + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.insertCSS({file: "mystyles.css"}); + }); \ No newline at end of file diff --git a/doc/ja/index.md b/doc/ja/index.md new file mode 100644 index 0000000..0050ef0 --- /dev/null +++ b/doc/ja/index.md @@ -0,0 +1,299 @@ + + +# org.apache.cordova.inappbrowser + +このプラグインを呼び出すときに表示される web ブラウザーのビューを提供します `window.open()` 、または時として形成されたリンクを開く``. + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + + +**注**: ウィンドウの動作、InAppBrowser 標準的な web ブラウザーのようとコルドバの Api にアクセスできません。 + +## インストール + + cordova plugin add org.apache.cordova.inappbrowser + + +### Firefox の OS + +[マニフェストのドキュメント][1]で説明されているように、 **www/manifest.webapp**を作成します。関連する権限を追加します。 + + [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest + + "permissions": { + "browser": {} + } + + +## window.open + +新しい URL を開き `InAppBrowser` インスタンス、現在のブラウザー インスタンスまたはシステムのブラウザー。 + + var ref = window.open url、ターゲット (オプション); + + +* **ref**: への参照を `InAppBrowser` ウィンドウ。*(InAppBrowser)* + +* **url**: *(文字列)*をロードする URL。電話 `encodeURI()` 場合は、この上の URL は Unicode 文字を含みます。 + +* **ターゲット**: ターゲット URL は、既定値は、省略可能なパラメーターをロードするを `_self` 。*(文字列)* + + * `_self`: コルドバ WebView URL がホワイト リストにある場合で開きます、それ以外の場合で開きます、`InAppBrowser`. + * `_blank`: で開きます、`InAppBrowser`. + * `_system`: システムの web ブラウザーで開きます。 + +* **オプション**: おぷしょん、 `InAppBrowser` 。省略可能にする: `location=yes` 。*(文字列)* + + `options`文字列にはする必要があります任意の空白スペースが含まれていないと、各機能の名前と値のペアをコンマで区切る必要があります。 機能名では大文字小文字を区別します。 以下の値をサポートするプラットフォーム。 + + * **場所**: に設定 `yes` または `no` を有効にする、 `InAppBrowser` の場所バー オンまたはオフにします。 + + アンドロイドのみ: + + * **closebuttoncaption**: [**完了**] ボタンのキャプションとして使用する文字列に設定します。 + * **非表示**: 設定 `yes` ブラウザーを作成して、ページの読み込みが表示されません。 Loadstop イベントは、読み込みが完了すると発生します。 省略するか設定 `no` (既定値) を開くし、通常負荷ブラウザーを持っています。 + * **clearcache**: に設定されている `yes` 、ブラウザーのクッキー キャッシュ クリア新しいウィンドウが開く前に + * **clearsessioncache**: に設定されている `yes` はセッション cookie のキャッシュをオフに新しいウィンドウを開く前に + + iOS のみ: + + * **closebuttoncaption**: [**完了**] ボタンのキャプションとして使用する文字列に設定します。自分でこの値をローカライズする必要があることに注意してください。 + * **disallowoverscroll**: に設定されている `yes` または `no` (既定値は `no` )。/UIWebViewBounce プロパティをオフにします。 + * **非表示**: 設定 `yes` ブラウザーを作成して、ページの読み込みが表示されません。 Loadstop イベントは、読み込みが完了すると発生します。 省略するか設定 `no` (既定値) を開くし、通常読み込みブラウザーを持っています。 + * **clearcache**: に設定されている `yes` 、ブラウザーのクッキー キャッシュ クリア新しいウィンドウが開く前に + * **clearsessioncache**: に設定されている `yes` はセッション cookie のキャッシュをオフにすると、新しいウィンドウが開く前に + * **ツールバー**: に設定されている `yes` または `no` InAppBrowser (デフォルトのツールバーのオンまたはオフを有効にするには`yes`) + * **enableViewportScale**: に設定されている `yes` または `no` を (デフォルトではメタタグを介してスケーリング ビューポートを防ぐために`no`). + * **mediaPlaybackRequiresUserAction**: に設定されている `yes` または `no` を HTML5 オーディオまたはビデオを自動再生 (初期設定から防ぐために`no`). + * **allowInlineMediaPlayback**: に設定されている `yes` または `no` ラインで HTML5 メディア再生には、デバイス固有再生インターフェイスではなく、ブラウザー ウィンドウ内に表示するようにします。 HTML の `video` 要素を含める必要がありますまた、 `webkit-playsinline` 属性 (デフォルトは`no`) + * **keyboardDisplayRequiresUserAction**: に設定されている `yes` または `no` をフォーム要素の JavaScript を介してフォーカスを受け取るときに、キーボードを開く `focus()` コール (デフォルトは`yes`). + * **suppressesIncrementalRendering**: に設定されている `yes` または `no` (デフォルトでは表示される前にビューのすべての新しいコンテンツを受信するまで待機するには`no`). + * **presentationstyle**: に設定されている `pagesheet` 、 `formsheet` または `fullscreen` (デフォルトでは、[プレゼンテーション スタイル][2]を設定するには`fullscreen`). + * **transitionstyle**: に設定されている `fliphorizontal` 、 `crossdissolve` または `coververtical` (デフォルトでは、[トランジションのスタイル][3]を設定するには`coververtical`). + * **toolbarposition**: に設定されている `top` または `bottom` (既定値は `bottom` )。上部またはウィンドウの下部にツールバーが発生します。 + + [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* ブラックベリー 10 +* iOS +* Windows Phone 7 と 8 + +### 例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); + + +## InAppBrowser + +呼び出しから返されるオブジェクト`window.open`. + +### メソッド + +* addEventListener +* removeEventListener +* close +* show +* executeScript +* insertCSS + +## addEventListener + +> イベントのリスナーを追加します、`InAppBrowser`. + + ref.addEventListener(eventname, callback); + + +* **ref**: への参照を `InAppBrowser` ウィンドウ*(InAppBrowser)* + +* **eventname**: *(文字列)*をリッスンするイベント + + * ****: イベントが発生するとき、 `InAppBrowser` の URL の読み込みが開始します。 + * **loadstop**: イベントが発生するとき、 `InAppBrowser` URL の読み込みが完了します。 + * **loaderror**: イベントが発生するとき、 `InAppBrowser` URL の読み込みでエラーが発生します。 + * **終了**: イベントが発生するとき、 `InAppBrowser` ウィンドウが閉じられます。 + +* **コールバック**: イベントが発生したときに実行される関数。関数に渡されますが、 `InAppBrowserEvent` オブジェクトをパラメーターとして。 + +### InAppBrowserEvent プロパティ + +* **タイプ**: eventname どちらか `loadstart` 、 `loadstop` 、 `loaderror` 、または `exit` 。*(文字列)* + +* **url**: URL が読み込まれました。*(文字列)* + +* **コード**: の場合にのみ、エラー コード `loaderror` 。*(数)* + +* **メッセージ**: の場合にのみ、エラー メッセージ `loaderror` 。*(文字列)* + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* iOS +* Windows Phone 7 と 8 + +### 簡単な例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstart', function(event) { alert(event.url); }); + + +## removeEventListener + +> イベントのリスナーを削除します、`InAppBrowser`. + + ref.removeEventListener(eventname, callback); + + +* **ref**: への参照を `InAppBrowser` ウィンドウ。*(InAppBrowser)* + +* **eventname**: イベントのリッスンを停止します。*(文字列)* + + * ****: イベントが発生するとき、 `InAppBrowser` の URL の読み込みが開始します。 + * **loadstop**: イベントが発生するとき、 `InAppBrowser` URL の読み込みが完了します。 + * **loaderror**: イベントが発生するとき、 `InAppBrowser` URL の読み込みエラーが発生します。 + * **終了**: イベントが発生するとき、 `InAppBrowser` ウィンドウが閉じられます。 + +* **コールバック**: イベントが発生するときに実行する関数。関数に渡されますが、 `InAppBrowserEvent` オブジェクト。 + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* iOS +* Windows Phone 7 と 8 + +### 簡単な例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var myCallback = function(event) { alert(event.url); } + ref.addEventListener('loadstart', myCallback); + ref.removeEventListener('loadstart', myCallback); + + +## close + +> 閉じる、 `InAppBrowser` ウィンドウ。 + + ref.close(); + + +* **ref**: への参照を `InAppBrowser` ウィンドウ*(InAppBrowser)* + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* iOS +* Windows Phone 7 と 8 + +### 簡単な例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.close(); + + +## show + +> 隠された開かれた InAppBrowser ウィンドウが表示されます。この関数を呼び出すは影響しません、InAppBrowser が既に表示されている場合。 + + ref.show(); + + +* **ref**: InAppBrowser ウィンドウ (への参照`InAppBrowser`) + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* iOS + +### 簡単な例 + + var ref = window.open('http://apache.org', '_blank', 'hidden=yes'); + // some time later... + ref.show(); + + +## executeScript + +> JavaScript コードに挿入します、 `InAppBrowser` ウィンドウ + + ref.executeScript(details, callback); + + +* **ref**: への参照を `InAppBrowser` ウィンドウ。*(InAppBrowser)* + +* **injectDetails**: 詳細を実行するスクリプトのいずれかを指定する、 `file` または `code` キー。*(オブジェクト)* + + * **ファイル**: スクリプトの URL を注入します。 + * **コード**: スクリプトのテキストを挿入します。 + +* **コールバック**: JavaScript コードを注入した後に実行される関数。 + + * 挿入されたスクリプトが型の場合 `code` 、スクリプトの戻り値は、1 つのパラメーターでコールバックを実行するのに包まれて、 `Array` 。 マルチライン スクリプトについては、最後のステートメントでは、または評価した最後の式の戻り値です。 + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* iOS + +### 簡単な例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.executeScript({file: "myscript.js"}); + }); + + +## insertCSS + +> CSS に注入する、 `InAppBrowser` ウィンドウ。 + + ref.insertCSS(details, callback); + + +* **ref**: への参照を `InAppBrowser` ウィンドウ*(InAppBrowser)* + +* **injectDetails**: 詳細を実行するスクリプトのいずれかを指定する、 `file` または `code` キー。*(オブジェクト)* + + * **ファイル**: 注入するスタイル シートの URL。 + * **コード**: 注入するスタイル シートのテキスト。 + +* **コールバック**: CSS の注入後に実行される関数。 + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* iOS + +### 簡単な例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.insertCSS({file: "mystyles.css"}); + }); \ No newline at end of file diff --git a/doc/ko/index.md b/doc/ko/index.md new file mode 100644 index 0000000..5f2825e --- /dev/null +++ b/doc/ko/index.md @@ -0,0 +1,299 @@ + + +# org.apache.cordova.inappbrowser + +호출할 때 표시 하는 웹 브라우저 보기를 제공 하는이 플러그인 `window.open()` , 또는 때로 형성 된 링크 열기``. + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + + +**참고**: 동작 하는 창에 InAppBrowser 표준 웹 브라우저를 좋아하고 코르도바 Api에 액세스할 수 없습니다. + +## 설치 + + cordova plugin add org.apache.cordova.inappbrowser + + +### Firefox 운영 체제 + +[참고 문서][1]에 설명 된 대로 **www/manifest.webapp** 를 만듭니다. 관련 부여할 추가 합니다. + + [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest + + "permissions": { + "browser": {} + } + + +## window.open + +새 URL을 엽니다 `InAppBrowser` 인스턴스, 현재 브라우저 인스턴스 또는 시스템 브라우저. + + var ref = window.open (url, 대상, 옵션); + + +* **심판**:에 대 한 참조는 `InAppBrowser` 창. *(InAppBrowser)* + +* **url**: *(문자열)를*로드 하는 URL. 전화 `encodeURI()` 이 경우에는 URL 유니코드 문자를 포함 합니다. + +* **대상**: 대상 URL, 기본적으로 선택적 매개 변수를 로드 하는 `_self` . *(문자열)* + + * `_self`: URL 화이트 리스트에 있으면 코르도바 WebView에서 열리고, 그렇지 않으면 열에`InAppBrowser`. + * `_blank`: 준공에`InAppBrowser`. + * `_system`: 시스템의 웹 브라우저에서 엽니다. + +* **옵션**: 옵션은 `InAppBrowser` . 선택적, 디폴트에: `location=yes` . *(문자열)* + + `options`문자열 텅 빈 어떤 스페이스 포함 해서는 안 그리고 쉼표 각 기능의 이름/값 쌍을 구분 합니다. 기능 이름은 대/소문자입니다. 모든 플랫폼 지원 아래 값: + + * **위치**: 설정 `yes` 또는 `no` 설정 하는 `InAppBrowser` 의 위치 표시줄 켜거나 끕니다. + + 안 드 로이드만: + + * **closebuttoncaption**: **수행** 하는 단추의 캡션으로 사용할 문자열을 설정 합니다. + * **숨겨진**: 설정 `yes` 브라우저를 만들 페이지를 로드 하면, 하지만 그것을 보여주지. Loadstop 이벤트는 로드가 완료 되 면 발생 합니다. 생략 하거나 설정 `no` (기본값) 브라우저 열고 정상적으로 로드 해야 합니다. + * **clearcache**: 설정 `yes` 브라우저를 쿠키 캐시 삭제 하기 전에 새 창이 열립니다 + * **clearsessioncache**: 설정 `yes` 세션 쿠키 캐시를 삭제 하기 전에 새 창이 열립니다 + + iOS만: + + * **closebuttoncaption**: **수행** 하는 단추의 캡션으로 사용할 문자열을 설정 합니다. 참고 직접이 값을 지역화 해야 합니다. + * **disallowoverscroll**: 설정 `yes` 또는 `no` (기본값은 `no` ). 회전 온/오프 UIWebViewBounce 속성입니다. + * **숨겨진**: 설정 `yes` 브라우저를 만들 페이지를 로드 하면, 하지만 그것을 보여주지. Loadstop 이벤트는 로드가 완료 되 면 발생 합니다. 생략 하거나 설정 `no` (기본값) 브라우저 열고 정상적으로 로드 해야 합니다. + * **clearcache**: 설정 `yes` 브라우저를 쿠키 캐시 삭제 하기 전에 새 창이 열립니다 + * **clearsessioncache**: 설정 `yes` 세션 쿠키 캐시를 삭제 하기 전에 새 창이 열립니다 + * **도구 모음**: 설정 `yes` 또는 `no` InAppBrowser (기본값:에 대 한 도구 모음 온 / 오프를 돌기 위하여`yes`) + * **enableViewportScale**: 설정 `yes` 또는 `no` 뷰포트 메타 태그 (기본값:를 통해 확장을 방지 하기 위해`no`). + * **mediaPlaybackRequiresUserAction**: 설정 `yes` 또는 `no` HTML5 오디오 또는 비디오 자동 재생 (기본값에서에서 방지 하기 위해`no`). + * **allowInlineMediaPlayback**: 설정 `yes` 또는 `no` 인라인 HTML5 미디어 재생, 장치 전용 재생 인터페이스 보다는 브라우저 창 내에서 표시할 수 있도록 합니다. HTML의 `video` 요소가 포함 되어야 합니다는 `webkit-playsinline` 특성 (기본값:`no`) + * **keyboardDisplayRequiresUserAction**: 설정 `yes` 또는 `no` 양식 요소는 자바 스크립트를 통해 포커스를 받을 때 키보드를 열고 `focus()` 전화 (기본값:`yes`). + * **suppressesIncrementalRendering**: 설정 `yes` 또는 `no` (기본값을 렌더링 하기 전에 모든 새로운 보기 콘텐츠를 받을 때까지 기다려야`no`). + * **presentationstyle**: 설정 `pagesheet` , `formsheet` 또는 `fullscreen` [프레 젠 테이 션 스타일][2] (기본값을 설정 하려면`fullscreen`). + * **transitionstyle**: 설정 `fliphorizontal` , `crossdissolve` 또는 `coververtical` [전환 스타일][3] (기본값을 설정 하려면`coververtical`). + * **toolbarposition**: 설정 `top` 또는 `bottom` (기본값은 `bottom` ). 위쪽 또는 아래쪽 창에 도구 모음을 발생 합니다. + + [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* 블랙베리 10 +* iOS +* Windows Phone 7과 8 + +### 예를 들어 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); + + +## InAppBrowser + +호출에서 반환 하는 개체`window.open`. + +### 메서드 + +* addEventListener +* removeEventListener +* close +* show +* executeScript +* insertCSS + +## addEventListener + +> 이벤트에 대 한 수신기를 추가 합니다`InAppBrowser`. + + ref.addEventListener(eventname, callback); + + +* **심판**:에 대 한 참조는 `InAppBrowser` 창 *(InAppBrowser)* + +* **eventname**: *(문자열)를* 수신 하도록 이벤트 + + * **loadstart**: 이벤트 발생 때는 `InAppBrowser` URL 로드를 시작 합니다. + * **loadstop**: 이벤트가 발생 시기는 `InAppBrowser` URL 로드 완료. + * **loaderror**: 이벤트 발생 때는 `InAppBrowser` URL을 로드할 때 오류가 발생 합니다. + * **종료**: 이벤트가 발생 시기는 `InAppBrowser` 창이 닫힙니다. + +* **콜백**: 이벤트가 발생 될 때 실행 되는 함수. 함수는 전달 된 `InAppBrowserEvent` 개체를 매개 변수로 합니다. + +### InAppBrowserEvent 속성 + +* **유형**: eventname, 중 `loadstart` , `loadstop` , `loaderror` , 또는 `exit` . *(문자열)* + +* **url**: URL 로드 된. *(문자열)* + +* **코드**: 오류 코드의 경우에만 `loaderror` . *(수)* + +* **메시지**: 오류 메시지의 경우에만 `loaderror` . *(문자열)* + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* iOS +* Windows Phone 7과 8 + +### 빠른 예제 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstart', function(event) { alert(event.url); }); + + +## removeEventListener + +> 이벤트에 대 한 수신기를 제거 합니다`InAppBrowser`. + + ref.removeEventListener(eventname, callback); + + +* **심판**:에 대 한 참조는 `InAppBrowser` 창. *(InAppBrowser)* + +* **eventname**: 이벤트 수신 대기를 중지 합니다. *(문자열)* + + * **loadstart**: 이벤트 발생 때는 `InAppBrowser` URL 로드를 시작 합니다. + * **loadstop**: 이벤트가 발생 시기는 `InAppBrowser` URL 로드 완료. + * **loaderror**: 이벤트 발생 때는 `InAppBrowser` URL 로드 오류가 발생 합니다. + * **종료**: 이벤트가 발생 시기는 `InAppBrowser` 창이 닫힙니다. + +* **콜백**: 이벤트가 발생 하면 실행할 함수. 함수는 전달 된 `InAppBrowserEvent` 개체. + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* iOS +* Windows Phone 7과 8 + +### 빠른 예제 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var myCallback = function(event) { alert(event.url); } + ref.addEventListener('loadstart', myCallback); + ref.removeEventListener('loadstart', myCallback); + + +## close + +> 종료는 `InAppBrowser` 창. + + ref.close(); + + +* **심판**:에 대 한 참조는 `InAppBrowser` 창 *(InAppBrowser)* + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* iOS +* Windows Phone 7과 8 + +### 빠른 예제 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.close(); + + +## show + +> 숨겨진 열은 한 InAppBrowser 창을 표시 합니다. 전화는 InAppBrowser가 이미 보이는 경우는 효과가 없습니다. + + ref.show(); + + +* **ref**: InAppBrowser 창 (참조`InAppBrowser`) + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* iOS + +### 빠른 예제 + + var ref = window.open('http://apache.org', '_blank', 'hidden=yes'); + // some time later... + ref.show(); + + +## executeScript + +> 에 자바 스크립트 코드를 삽입는 `InAppBrowser` 창 + + ref.executeScript(details, callback); + + +* **심판**:에 대 한 참조는 `InAppBrowser` 창. *(InAppBrowser)* + +* **injectDetails**: 스크립트 실행의 세부 사항 중 하나를 지정 하는 `file` 또는 `code` 키. *(개체)* + + * **파일**: 삽입 하는 스크립트의 URL. + * **코드**: 스크립트 텍스트를 삽입 합니다. + +* **콜백**: 자바 스크립트 코드를 주입 후 실행 기능. + + * 삽입 된 스크립트 유형의 경우 `code` , 스크립트의 반환 값은 단일 매개 변수는 콜백 실행에 싸여 있는 `Array` . 여러 줄 스크립트에 대 한 마지막 문 또는 평가 마지막 식의 반환 값입니다. + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* iOS + +### 빠른 예제 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.executeScript({file: "myscript.js"}); + }); + + +## insertCSS + +> 주사로 CSS는 `InAppBrowser` 창. + + ref.insertCSS(details, callback); + + +* **심판**:에 대 한 참조는 `InAppBrowser` 창 *(InAppBrowser)* + +* **injectDetails**: 스크립트 실행의 세부 사항 중 하나를 지정 하는 `file` 또는 `code` 키. *(개체)* + + * **파일**: 삽입 하는 스타일 시트의 URL. + * **코드**: 삽입 하는 스타일 시트의 텍스트. + +* **콜백**: CSS 주입 후 실행 기능. + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* iOS + +### 빠른 예제 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.insertCSS({file: "mystyles.css"}); + }); \ No newline at end of file diff --git a/doc/pl/index.md b/doc/pl/index.md new file mode 100644 index 0000000..cfa95a3 --- /dev/null +++ b/doc/pl/index.md @@ -0,0 +1,299 @@ + + +# org.apache.cordova.inappbrowser + +Plugin daje widok przeglądarki sieci web, które są wyświetlane podczas wywoływania `window.open()` , lub kiedy otwarcie łącza utworzone jako``. + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + + +**Uwaga**: The InAppBrowser okno zachowuje się jak standardowe przeglądarki, a nie ma dostępu do API Cordova. + +## Instalacji + + cordova plugin add org.apache.cordova.inappbrowser + + +### Firefox OS + +Tworzenie **www/manifest.webapp** , jak opisano w [Dokumentach Manifest][1]. Dodaj odpowiednie permisions. + + [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest + + "permissions": { + "browser": {} + } + + +## window.open + +Otwiera URL w nowym `InAppBrowser` wystąpienie, bieżące wystąpienie przeglądarki lub przeglądarki systemu. + + var ref = window.open (adres url, docelowy opcje); + + +* **ref**: odniesienie do `InAppBrowser` okna. *(InAppBrowser)* + +* **adres**: adres URL do ładowania *(ciąg)*. Wywołanie `encodeURI()` na to, czy adres URL zawiera znaki Unicode. + +* **miejsce docelowe**: miejsce docelowe, w którym wobec ciężar ten URL parametr opcjonalny, który domyślnie `_self` . *(String)* + + * `_self`: Otwiera w Cordova WebView, jeśli adres URL jest na białej liście, inaczej ono otwiera w`InAppBrowser`. + * `_blank`: Otwiera w`InAppBrowser`. + * `_system`: Otwiera w przeglądarce internetowej systemu. + +* **Opcje**: opcje dla `InAppBrowser` . Opcjonalnie, nie stawiła się: `location=yes` . *(String)* + + `options`Ciąg nie może zawierać żadnych spacji, i pary nazwa/wartość każdej funkcji muszą być oddzielone przecinkami. Nazwy funkcji jest rozróżniana. Wszystkich platform obsługuje wartości poniżej: + + * **Lokalizacja**: zestaw `yes` lub `no` Aby włączyć `InAppBrowser` na pasek lub wyłączyć. + + Android: + + * **closebuttoncaption**: aby użyć jak **zrobić** przycisk Podpis ustawiona na ciąg. + * **ukryte**: zestaw `yes` do stworzenia przeglądarki i ładowania strony, ale nie pokazuje go. Loadstop zdarzenie fires po zakończeniu ładowania. Pominąć lub zestaw `no` (domyślnie) do przeglądarki otworzyć i załadować normalnie. + * **ClearCache**: zestaw `yes` do przeglądarki w pamięci podręcznej plików cookie wyczyszczone zanim otworzy się nowe okno + * **clearsessioncache**: zestaw `yes` mieć w pamięci podręcznej plików cookie sesji wyczyszczone zanim otworzy się nowe okno + + tylko iOS: + + * **closebuttoncaption**: aby użyć jak **zrobić** przycisk Podpis ustawiona na ciąg. Należy pamiętać, że trzeba zlokalizować tę wartość siebie. + * **disallowoverscroll**: zestaw `yes` lub `no` (domyślnie `no` ). Włącza/wyłącza właściwość UIWebViewBounce. + * **ukryte**: zestaw `yes` do stworzenia przeglądarki i ładowania strony, ale nie pokazuje go. Loadstop zdarzenie fires po zakończeniu ładowania. Pominąć lub zestaw `no` (domyślnie) do przeglądarki otworzyć i załadować normalnie. + * **ClearCache**: zestaw `yes` do przeglądarki w pamięci podręcznej plików cookie wyczyszczone zanim otworzy się nowe okno + * **clearsessioncache**: zestaw `yes` mieć w pamięci podręcznej plików cookie sesji wyczyszczone zanim otworzy się nowe okno + * **pasek narzędzi**: zestaw `yes` lub `no` Aby włączyć pasek narzędzi lub wyłączyć dla InAppBrowser (domyślnie`yes`) + * **enableViewportScale**: zestaw `yes` lub `no` Aby zapobiec rzutni skalowanie za pomocą tagu meta (domyślnie`no`). + * **mediaPlaybackRequiresUserAction**: zestaw `yes` lub `no` Aby zapobiec HTML5 audio lub wideo z Autoodtwarzanie (domyślnie`no`). + * **allowInlineMediaPlayback**: zestaw `yes` lub `no` Aby w linii HTML5 odtwarzanie, wyświetlanie w oknie przeglądarki, a nie interfejs odtwarzanie specyficzne dla urządzenia. HTML `video` również musi zawierać element `webkit-playsinline` atrybut (domyślnie`no`) + * **keyboardDisplayRequiresUserAction**: zestaw `yes` lub `no` Aby otworzyć klawiaturę ekranową, gdy elementy formularza ostrości za pomocą JavaScript `focus()` połączenia (domyślnie`yes`). + * **suppressesIncrementalRendering**: zestaw `yes` lub `no` czekać, aż wszystkie nowe widok zawartości jest otrzymane przed renderowany (domyślnie`no`). + * **presentationstyle**: zestaw `pagesheet` , `formsheet` lub `fullscreen` Aby ustawić [styl prezentacji][2] (domyślnie`fullscreen`). + * **transitionstyle**: zestaw `fliphorizontal` , `crossdissolve` lub `coververtical` Aby ustawić [styl przejścia][3] (domyślnie`coververtical`). + * **toolbarposition**: zestaw `top` lub `bottom` (domyślnie `bottom` ). Powoduje, że pasek ma być na górze lub na dole okna. + + [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* Jeżyna 10 +* iOS +* Windows Phone 7 i 8 + +### Przykład + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); + + +## InAppBrowser + +Obiekt zwrócony z wywołania`window.open`. + +### Metody + +* metody addEventListener +* removeEventListener +* Zamknij +* Pokaż +* executeScript +* insertCSS + +## metody addEventListener + +> Dodaje detektor zdarzenia z`InAppBrowser`. + + ref.addEventListener(eventname, callback); + + +* **ref**: odniesienie do `InAppBrowser` okna *(InAppBrowser)* + +* **EventName**: zdarzenie słuchać *(String)* + + * **loadstart**: zdarzenie gdy odpalam `InAppBrowser` zaczyna się ładować adresu URL. + * **loadstop**: zdarzenie gdy odpalam `InAppBrowser` zakończeniu ładowania adresu URL. + * **LoadError**: zdarzenie odpala gdy `InAppBrowser` napotka błąd podczas ładowania adresu URL. + * **wyjście**: zdarzenie gdy odpalam `InAppBrowser` okno jest zamknięte. + +* **wywołania zwrotnego**: funkcja, która wykonuje, gdy zdarzenie. Funkcja jest przekazywany `InAppBrowserEvent` obiektu jako parametr. + +### Właściwości InAppBrowserEvent + +* **Typ**: eventname, albo `loadstart` , `loadstop` , `loaderror` , lub `exit` . *(String)* + +* **adres**: adres URL, który został załadowany. *(String)* + +* **Kod**: kod błędu, tylko w przypadku `loaderror` . *(Liczba)* + +* **wiadomość**: komunikat o błędzie, tylko w przypadku `loaderror` . *(String)* + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* iOS +* Windows Phone 7 i 8 + +### Szybki przykład + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstart', function(event) { alert(event.url); }); + + +## removeEventListener + +> Usuwa detektor zdarzenia z`InAppBrowser`. + + ref.removeEventListener(eventname, callback); + + +* **ref**: odniesienie do `InAppBrowser` okna. *(InAppBrowser)* + +* **EventName**: zdarzenie przestanie słuchać. *(String)* + + * **loadstart**: zdarzenie gdy odpalam `InAppBrowser` zaczyna się ładować adresu URL. + * **loadstop**: zdarzenie gdy odpalam `InAppBrowser` zakończeniu ładowania adresu URL. + * **LoadError**: zdarzenie odpala gdy `InAppBrowser` napotka błąd ładowania adresu URL. + * **wyjście**: zdarzenie gdy odpalam `InAppBrowser` okno jest zamknięte. + +* **wywołania zwrotnego**: funkcja do wykonania, gdy zdarzenie. Funkcja jest przekazywany `InAppBrowserEvent` obiektu. + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* iOS +* Windows Phone 7 i 8 + +### Szybki przykład + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var myCallback = function(event) { alert(event.url); } + ref.addEventListener('loadstart', myCallback); + ref.removeEventListener('loadstart', myCallback); + + +## Zamknij + +> Zamyka `InAppBrowser` okna. + + ref.Close(); + + +* **ref**: odniesienie do `InAppBrowser` okna *(InAppBrowser)* + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* iOS +* Windows Phone 7 i 8 + +### Szybki przykład + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.close(); + + +## Pokaż + +> Wyświetla InAppBrowser okno, który został otwarty ukryte. Zawód ten jest ignorowany, jeśli InAppBrowser już był widoczny. + + ref.show(); + + +* **ref**: odwołanie do InAppBrowser (okno`InAppBrowser`) + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* iOS + +### Szybki przykład + + var ref = window.open('http://apache.org', '_blank', 'hidden=yes'); + // some time later... + ref.show(); + + +## executeScript + +> Wstrzykuje kod JavaScript w `InAppBrowser` okna + + ref.executeScript(details, callback); + + +* **ref**: odniesienie do `InAppBrowser` okna. *(InAppBrowser)* + +* **injectDetails**: Szczegóły dotyczące skryptu, określając albo `file` lub `code` klucz. *(Obiekt)* + + * **plik**: adres URL skryptu, aby wstrzyknąć. + * **Kod**: tekst skryptu, aby wstrzyknąć. + +* **wywołania zwrotnego**: funkcja, która wykonuje po kod JavaScript jest wstrzykiwany. + + * Jeśli taki skrypt jest typu `code` , wykonuje wywołanie zwrotne z pojedynczym parametrem, który jest wartość zwracana przez skrypt, owinięte w `Array` . Dla wielu linii skrypty to wartość zwracana ostatniej instrukcja, lub ostatni wyrażenie oceniane. + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* iOS + +### Szybki przykład + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.executeScript({file: "myscript.js"}); + }); + + +## insertCSS + +> Wstrzykuje CSS w `InAppBrowser` okna. + + ref.insertCSS(details, callback); + + +* **ref**: odniesienie do `InAppBrowser` okna *(InAppBrowser)* + +* **injectDetails**: Szczegóły dotyczące skryptu, określając albo `file` lub `code` klucz. *(Obiekt)* + + * **plik**: URL arkusza stylów do wsuwania. + * **Kod**: tekst z arkusza stylów do wstrzykiwania. + +* **wywołania zwrotnego**: funkcja, która wykonuje po CSS jest wstrzykiwany. + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* iOS + +### Szybki przykład + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.insertCSS({file: "mystyles.css"}); + }); \ No newline at end of file diff --git a/doc/zh/index.md b/doc/zh/index.md new file mode 100644 index 0000000..f7791a8 --- /dev/null +++ b/doc/zh/index.md @@ -0,0 +1,299 @@ + + +# org.apache.cordova.inappbrowser + +這個外掛程式提供了一個 web 瀏覽器視圖,顯示時調用 `window.open()` ,或當打開連結形成的作為``. + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + + +**注**: InAppBrowser 視窗的行為像一個標準的 web 瀏覽器,並且無法訪問科爾多瓦的 Api。 + +## 安裝 + + cordova plugin add org.apache.cordova.inappbrowser + + +### 火狐瀏覽器作業系統 + +在[清單檔][1]中所述創建**www/manifest.webapp** 。添加相關許可權。 + + [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest + + "permissions": { + "browser": {} + } + + +## window.open + +在一個新的中打開 URL `InAppBrowser` 實例,當前的瀏覽器實例或系統瀏覽器。 + + var ref = window.open (url、 目標、 選項) ; + + +* **ref**: 參考 `InAppBrowser` 視窗。*() InAppBrowser* + +* **url**: 要載入*(字串)*的 URL。調用 `encodeURI()` 這個如果 URL 包含 Unicode 字元。 + +* **目標**: 目標在其中載入的 URL,可選參數,預設值為 `_self` 。*(字串)* + + * `_self`: 打開在科爾多瓦 web 視圖如果 URL 是在白名單中,否則它在打開`InAppBrowser`. + * `_blank`: 在打開`InAppBrowser`. + * `_system`: 在該系統的 web 瀏覽器中打開。 + +* **選項**: 選項為 `InAppBrowser` 。可選,拖欠到: `location=yes` 。*(字串)* + + `options`字串必須不包含任何空白的空間,和必須用逗號分隔每個功能的名稱/值對。 功能名稱區分大小寫。 所有平臺都支援下面的值: + + * **位置**: 設置為 `yes` 或 `no` ,打開 `InAppBrowser` 的位置欄打開或關閉。 + + Android 系統只有: + + * **closebuttoncaption**: 設置為一個字串,以用作**做**按鈕的標題。 + * **隱藏**: 將設置為 `yes` ,創建瀏覽器和載入頁面,但不是顯示它。 載入完成時,將觸發 loadstop 事件。 省略或設置為 `no` (預設值),有的瀏覽器打開,然後以正常方式載入。 + * **clearcache**: 將設置為 `yes` 有瀏覽器的 cookie 清除緩存之前打開新視窗 + * **clearsessioncache**: 將設置為 `yes` 有會話 cookie 緩存清除之前打開新視窗 + + 只有 iOS: + + * **closebuttoncaption**: 設置為一個字串,以用作**做**按鈕的標題。請注意您需要對此值進行當地語系化你自己。 + * **disallowoverscroll**: 將設置為 `yes` 或 `no` (預設值是 `no` )。打開/關閉的 UIWebViewBounce 屬性。 + * **隱藏**: 將設置為 `yes` ,創建瀏覽器和載入頁面,但不是顯示它。 載入完成時,將觸發 loadstop 事件。 省略或設置為 `no` (預設值),有的瀏覽器打開,然後以正常方式載入。 + * **clearcache**: 將設置為 `yes` 有瀏覽器的 cookie 清除緩存之前打開新視窗 + * **clearsessioncache**: 將設置為 `yes` 有會話 cookie 緩存清除之前打開新視窗 + * **工具列**: 設置為 `yes` 或 `no` ,為 InAppBrowser (預設為打開或關閉工具列`yes`) + * **enableViewportScale**: 將設置為 `yes` 或 `no` ,防止通過 meta 標記 (預設為縮放的視區`no`). + * **mediaPlaybackRequiresUserAction**: 將設置為 `yes` 或 `no` ,防止 HTML5 音訊或視頻從 autoplaying (預設為`no`). + * **allowInlineMediaPlayback**: 將設置為 `yes` 或 `no` ,讓線在 HTML5 播放媒體,在瀏覽器視窗中,而不是特定于設備播放介面內顯示。 HTML 的 `video` 元素還必須包括 `webkit-playsinline` 屬性 (預設為`no`) + * **keyboardDisplayRequiresUserAction**: 將設置為 `yes` 或 `no` 時,要打開鍵盤表單元素接收焦點通過 JavaScript 的 `focus()` 調用 (預設為`yes`). + * **suppressesIncrementalRendering**: 將設置為 `yes` 或 `no` 等待,直到所有新查看的內容正在呈現 (預設為前收到`no`). + * **presentationstyle**: 將設置為 `pagesheet` , `formsheet` 或 `fullscreen` 來設置[演示文稿樣式][2](預設為`fullscreen`). + * **transitionstyle**: 將設置為 `fliphorizontal` , `crossdissolve` 或 `coververtical` 設置[過渡樣式][3](預設為`coververtical`). + * **toolbarposition**: 將設置為 `top` 或 `bottom` (預設值是 `bottom` )。使工具列,則在頂部或底部的視窗。 + + [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* 黑莓 10 +* iOS +* Windows Phone 7 和 8 + +### 示例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); + + +## InAppBrowser + +從調用返回的物件`window.open`. + +### 方法 + +* addEventListener +* removeEventListener +* close +* show +* executeScript +* insertCSS + +## addEventListener + +> 為事件添加一個攔截器`InAppBrowser`. + + ref.addEventListener(eventname, callback); + + +* **ref**: 參考 `InAppBrowser` 視窗*(InAppBrowser)* + +* **事件名稱**: 事件偵聽*(字串)* + + * **loadstart**: 當觸發事件 `InAppBrowser` 開始載入一個 URL。 + * **loadstop**: 當觸發事件 `InAppBrowser` 完成載入一個 URL。 + * **loaderror**: 當觸發事件 `InAppBrowser` 載入 URL 時遇到錯誤。 + * **退出**: 當觸發事件 `InAppBrowser` 關閉視窗。 + +* **回檔**: 執行時觸發該事件的函數。該函數通過 `InAppBrowserEvent` 物件作為參數。 + +### InAppBrowserEvent 屬性 + +* **類型**: eventname,或者 `loadstart` , `loadstop` , `loaderror` ,或 `exit` 。*(字串)* + +* **url**: 已載入的 URL。*(字串)* + +* **代碼**: 僅中的情況的錯誤代碼 `loaderror` 。*(人數)* + +* **消息**: 該錯誤訊息,只有在的情況下 `loaderror` 。*(字串)* + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* iOS +* Windows Phone 7 和 8 + +### 快速的示例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstart', function(event) { alert(event.url); }); + + +## removeEventListener + +> 移除的事件攔截器`InAppBrowser`. + + ref.removeEventListener(eventname, callback); + + +* **ref**: 參考 `InAppBrowser` 視窗。*() InAppBrowser* + +* **事件名稱**: 要停止偵聽的事件。*(字串)* + + * **loadstart**: 當觸發事件 `InAppBrowser` 開始載入一個 URL。 + * **loadstop**: 當觸發事件 `InAppBrowser` 完成載入一個 URL。 + * **loaderror**: 當觸發事件 `InAppBrowser` 遇到錯誤載入一個 URL。 + * **退出**: 當觸發事件 `InAppBrowser` 關閉視窗。 + +* **回檔**: 要在事件觸發時執行的函數。該函數通過 `InAppBrowserEvent` 物件。 + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* iOS +* Windows Phone 7 和 8 + +### 快速的示例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var myCallback = function(event) { alert(event.url); } + ref.addEventListener('loadstart', myCallback); + ref.removeEventListener('loadstart', myCallback); + + +## close + +> 關閉 `InAppBrowser` 視窗。 + + ref.close() ; + + +* **ref**: 參考 `InAppBrowser` 視窗*(InAppBrowser)* + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* iOS +* Windows Phone 7 和 8 + +### 快速的示例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.close(); + + +## show + +> 顯示打開了隱藏的 InAppBrowser 視窗。調用這沒有任何影響,如果 InAppBrowser 是已經可見。 + + ref.show() ; + + +* **ref**: InAppBrowser 視窗 (參考`InAppBrowser`) + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* iOS + +### 快速的示例 + + var ref = window.open('http://apache.org', '_blank', 'hidden=yes'); + // some time later... + ref.show(); + + +## executeScript + +> 注入到 JavaScript 代碼 `InAppBrowser` 視窗 + + ref.executeScript(details, callback); + + +* **ref**: 參考 `InAppBrowser` 視窗。*() InAppBrowser* + +* **injectDetails**: 要運行的腳本的詳細資訊或指定 `file` 或 `code` 的關鍵。*(物件)* + + * **檔**: 腳本的 URL 來注入。 + * **代碼**: 要注入腳本的文本。 + +* **回檔**: 執行後注入的 JavaScript 代碼的函數。 + + * 如果插入的腳本的類型 `code` ,回檔執行使用單個參數,這是該腳本的傳回值,裹在 `Array` 。 對於多行腳本,這是最後一條語句或最後計算的運算式的傳回值。 + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* iOS + +### 快速的示例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.executeScript({file: "myscript.js"}); + }); + + +## insertCSS + +> 注入到 CSS `InAppBrowser` 視窗。 + + ref.insertCSS(details, callback); + + +* **ref**: 參考 `InAppBrowser` 視窗*(InAppBrowser)* + +* **injectDetails**: 要運行的腳本的詳細資訊或指定 `file` 或 `code` 的關鍵。*(物件)* + + * **檔**: 樣式表的 URL 來注入。 + * **代碼**: 文本樣式表的注入。 + +* **回檔**: 在 CSS 注射後執行的函數。 + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* iOS + +### 快速的示例 + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.insertCSS({file: "mystyles.css"}); + }); \ No newline at end of file From df001e2765a512bc2b9c7e5d730f438556112067 Mon Sep 17 00:00:00 2001 From: Piotr Zalewa Date: Thu, 5 Jun 2014 13:03:51 +0200 Subject: [PATCH 102/106] after code review --- doc/index.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/index.md b/doc/index.md index 1106457..d59cd99 100644 --- a/doc/index.md +++ b/doc/index.md @@ -94,7 +94,7 @@ instance, or the system browser. ### Firefox OS Quirks As plugin doesn't enforce any design there is a need to add some CSS rules if -opened with `target` `'_blank'`. The rules might look like these +opened with `target='_blank'`. The rules might look like these ``` css .inAppBrowserWrap { @@ -110,7 +110,6 @@ opened with `target` `'_blank'`. The rules might look like these font-size: 25px; height: 25px; float: left; - margin-right: 0px; margin: 0 10px; padding: 3px 10px; text-decoration: none; From 992306bbc58f3ba9dc0f4dbcde1b084db5ba8169 Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Thu, 5 Jun 2014 13:39:43 -0700 Subject: [PATCH 103/106] CB-6877 Updated version and RELEASENOTES.md for release 0.5.0 --- RELEASENOTES.md | 15 +++++++++++++++ plugin.xml | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 3d6cd70..e6c931a 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -97,3 +97,18 @@ * CB-6212: [iOS] fix warnings compiled under arm64 64-bit * CB-6218: Update docs for BB10 * CB-6460: Update license headers + +### 0.5.0 (Jun 05, 2014) +* CB-6127 Spanish and rench Translations added. Github close #23 +* Clean up whitespace (mainly due to no newline at eof warning) +* Adding permission info +* CB-6806 Add license +* CB-6491 add CONTRIBUTING.md +* Add necessary capability so the plugin works on its own +* CB-6474 InAppBrowser. Add data urls support to WP8 +* CB-6482 InAppBrowser calls incorrect callback on WP8 +* Fixed use of iOS 6 deprecated methods +* CB-6360 - improvement: feature detection instead of iOS version detection +* CB-5649 - InAppBrowser overrides App's orientation +* refactoring fixed +* CB-6396 [Firefox OS] Adding basic support diff --git a/plugin.xml b/plugin.xml index 37c658e..af47a77 100644 --- a/plugin.xml +++ b/plugin.xml @@ -20,7 +20,7 @@ + version="0.5.0"> InAppBrowser Cordova InAppBrowser Plugin From c011fe2d9dd7b5b018cadb4d7a00a0f0f9428892 Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Thu, 5 Jun 2014 13:40:50 -0700 Subject: [PATCH 104/106] CB-6877 Incremented plugin version. --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index af47a77..9c47e0b 100644 --- a/plugin.xml +++ b/plugin.xml @@ -20,7 +20,7 @@ + version="0.5.1-dev"> InAppBrowser Cordova InAppBrowser Plugin From 91b84579e8a85d2cf1b84420301c42c74c340473 Mon Sep 17 00:00:00 2001 From: bwin Date: Tue, 27 May 2014 16:23:23 +0200 Subject: [PATCH 105/106] CB-6769 ios: Fix statusbar color reset wasn't working on iOS7+ close #45 --- src/ios/CDVInAppBrowser.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 059fcde..4169b6e 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -440,11 +440,11 @@ // Also - this is required for the PDF/User-Agent bug work-around. self.inAppBrowserViewController = nil; - _previousStatusBarStyle = -1; - if (IsAtLeastiOSVersion(@"7.0")) { [[UIApplication sharedApplication] setStatusBarStyle:_previousStatusBarStyle]; } + + _previousStatusBarStyle = -1; // this value was reset before reapplying it. caused statusbar to stay black on ios7 } @end From f866e0ed9f08e2bd33acf05f518ffbde961d53c4 Mon Sep 17 00:00:00 2001 From: Lisa Seacat DeLuca Date: Mon, 7 Jul 2014 15:27:50 -0400 Subject: [PATCH 106/106] CB-6127lisa7cordova-plugin-consolecordova-plugin-inappbrowser documentation translation: cordova-plugin-inappbrowser --- doc/de/index.md | 53 +++++--- doc/es/index.md | 53 +++++--- doc/fr/index.md | 53 +++++--- doc/it/index.md | 53 +++++--- doc/ja/index.md | 53 +++++--- doc/ko/index.md | 53 +++++--- doc/ru/index.md | 320 ++++++++++++++++++++++++++++++++++++++++++++++++ doc/zh/index.md | 55 ++++++--- 8 files changed, 580 insertions(+), 113 deletions(-) create mode 100644 doc/ru/index.md diff --git a/doc/de/index.md b/doc/de/index.md index 0302a92..87f2341 100644 --- a/doc/de/index.md +++ b/doc/de/index.md @@ -31,22 +31,11 @@ Dieses Plugin bietet eine Web-Browser-Ansicht, die anzeigt, beim Aufrufen von `w cordova plugin add org.apache.cordova.inappbrowser -### Firefox OS - -Erstellen Sie **www/manifest.webapp** , wie in [Docs Manifest][1]beschrieben. Fügen Sie die entsprechenden Permisions. - - [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest - - "permissions": { - "browser": {} - } - - ## window.open Öffnet eine URL in einem neuen `InAppBrowser` Instanz, die aktuelle Browserinstanz oder der Systembrowser. - Var Ref = window.open (Url, Ziel, Optionen); + var ref = window.open(url, target, options); * **Ref**: Bezugnahme auf die `InAppBrowser` Fenster. *(InAppBrowser)* @@ -85,18 +74,19 @@ Erstellen Sie **www/manifest.webapp** , wie in [Docs Manifest][1]beschrieben. F * **AllowInlineMediaPlayback**: Legen Sie auf `yes` oder `no` Inline-HTML5-Media-Wiedergabe, Darstellung im Browser-Fenster, sondern in eine gerätespezifische Wiedergabe-Schnittstelle ermöglichen. Des HTML `video` Element muss auch die `webkit-playsinline` Attribut (Standard:`no`) * **KeyboardDisplayRequiresUserAction**: Legen Sie auf `yes` oder `no` um die Tastatur zu öffnen, wenn Formularelemente Fokus per JavaScript erhalten `focus()` Anruf (Standard:`yes`). * **SuppressesIncrementalRendering**: Legen Sie auf `yes` oder `no` zu warten, bis alle neuen anzeigen-Inhalte empfangen wird, bevor Sie wiedergegeben wird (standardmäßig`no`). - * **Presentationstyle**: Legen Sie auf `pagesheet` , `formsheet` oder `fullscreen` [Präsentationsstil][2] (standardmäßig fest`fullscreen`). - * **Transitionstyle**: Legen Sie auf `fliphorizontal` , `crossdissolve` oder `coververtical` [Übergangsstil][3] (standardmäßig fest`coververtical`). + * **Presentationstyle**: Legen Sie auf `pagesheet` , `formsheet` oder `fullscreen` [Präsentationsstil][1] (standardmäßig fest`fullscreen`). + * **Transitionstyle**: Legen Sie auf `fliphorizontal` , `crossdissolve` oder `coververtical` [Übergangsstil][2] (standardmäßig fest`coververtical`). * **Toolbarposition**: Legen Sie auf `top` oder `bottom` (Standard ist `bottom` ). Bewirkt, dass die Symbolleiste am oberen oder unteren Rand des Fensters sein. - [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle - [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + [1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle ### Unterstützte Plattformen * Amazon Fire OS * Android * BlackBerry 10 +* Firefox OS * iOS * Windows Phone 7 und 8 @@ -106,6 +96,36 @@ Erstellen Sie **www/manifest.webapp** , wie in [Docs Manifest][1]beschrieben. F var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); +### Firefox OS Macken + +Als Plugin jedes Design erzwingen nicht besteht die Notwendigkeit, einige CSS-Regeln hinzuzufügen, wenn bei `target='_blank'` . Die Regeln könnte wie diese aussehen. + + css + .inAppBrowserWrap { + background-color: rgba(0,0,0,0.75); + color: rgba(235,235,235,1.0); + } + .inAppBrowserWrap menu { + overflow: auto; + list-style-type: none; + padding-left: 0; + } + .inAppBrowserWrap menu li { + font-size: 25px; + height: 25px; + float: left; + margin: 0 10px; + padding: 3px 10px; + text-decoration: none; + color: #ccc; + display: block; + background: rgba(30,30,30,0.50); + } + .inAppBrowserWrap menu li.disabled { + color: #777; + } + + ## InAppBrowser Aus einem Aufruf zurückgegebenen Objekts`window.open`. @@ -206,6 +226,7 @@ Aus einem Aufruf zurückgegebenen Objekts`window.open`. * Amazon Fire OS * Android +* Firefox OS * iOS * Windows Phone 7 und 8 diff --git a/doc/es/index.md b/doc/es/index.md index 74b54b9..d76d634 100644 --- a/doc/es/index.md +++ b/doc/es/index.md @@ -31,22 +31,11 @@ Este plugin proporciona una vista de navegador web que se muestra cuando se llam cordova plugin add org.apache.cordova.inappbrowser -### Firefox OS - -Crear **www/manifest.webapp** como se describe en [Manifestar Docs][1]. Agregar permisos pertinentes. - - [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest - - "permissions": { - "browser": {} - } - - ## window.open Se abre una dirección URL en una nueva `InAppBrowser` ejemplo, la instancia actual del navegador o el navegador del sistema. - var ref = window.open (url, target, opciones); + var ref = window.open(url, target, options); * **ref**: referencia a la `InAppBrowser` ventana. *(InAppBrowser)* @@ -85,18 +74,19 @@ Se abre una dirección URL en una nueva `InAppBrowser` ejemplo, la instancia act * **allowInlineMediaPlayback**: A `yes` o `no` para permitir la reproducción de los medios de comunicación en línea HTML5, mostrando en la ventana del navegador en lugar de una interfaz específica del dispositivo de reproducción. El código de HTML `video` elemento también debe incluir la `webkit-playsinline` atributo (por defecto`no`) * **keyboardDisplayRequiresUserAction**: A `yes` o `no` para abrir el teclado cuando elementos de formulario reciben el foco mediante JavaScript `focus()` llamada (por defecto`yes`). * **suppressesIncrementalRendering**: A `yes` o `no` que esperar a que todo el contenido nuevo vista es recibido antes de ser prestados (por defecto`no`). - * **presentationstyle**: A `pagesheet` , `formsheet` o `fullscreen` para establecer el [estilo de la presentación][2] (por defecto`fullscreen`). - * **transitionstyle**: A `fliphorizontal` , `crossdissolve` o `coververtical` para establecer el [estilo de transición][3] (por defecto`coververtical`). + * **presentationstyle**: A `pagesheet` , `formsheet` o `fullscreen` para establecer el [estilo de la presentación][1] (por defecto`fullscreen`). + * **transitionstyle**: A `fliphorizontal` , `crossdissolve` o `coververtical` para establecer el [estilo de transición][2] (por defecto`coververtical`). * **toolbarposition**: A `top` o `bottom` (valor por defecto es `bottom` ). Hace que la barra de herramientas en la parte superior o inferior de la ventana. - [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle - [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + [1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle ### Plataformas soportadas * Amazon fuego OS * Android * BlackBerry 10 +* Firefox OS * iOS * Windows Phone 7 y 8 @@ -106,6 +96,36 @@ Se abre una dirección URL en una nueva `InAppBrowser` ejemplo, la instancia act var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); +### Firefox OS rarezas + +Como plugin no cumplir cualquier diseño es necesario añadir algunas reglas CSS si abre con `target='_blank'` . Las reglas pueden parecerse a estos + + css + .inAppBrowserWrap { + background-color: rgba(0,0,0,0.75); + color: rgba(235,235,235,1.0); + } + .inAppBrowserWrap menu { + overflow: auto; + list-style-type: none; + padding-left: 0; + } + .inAppBrowserWrap menu li { + font-size: 25px; + height: 25px; + float: left; + margin: 0 10px; + padding: 3px 10px; + text-decoration: none; + color: #ccc; + display: block; + background: rgba(30,30,30,0.50); + } + .inAppBrowserWrap menu li.disabled { + color: #777; + } + + ## InAppBrowser El objeto devuelto desde una llamada a`window.open`. @@ -206,6 +226,7 @@ El objeto devuelto desde una llamada a`window.open`. * Amazon fuego OS * Android +* Firefox OS * iOS * Windows Phone 7 y 8 diff --git a/doc/fr/index.md b/doc/fr/index.md index 3af5e42..e9dc62e 100644 --- a/doc/fr/index.md +++ b/doc/fr/index.md @@ -31,22 +31,11 @@ Ce plugin vous offre une vue de navigateur web qui s'affiche lorsque vous appele cordova plugin add org.apache.cordova.inappbrowser -### Firefox OS - -Créez **www/manifest.webapp** comme décrit dans [Les Docs manifeste][1]. Ajouter permisions pertinentes. - - [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest - - "permissions": { - "browser": {} - } - - ## window.open Ouvre une URL dans une nouvelle `InAppBrowser` instance, l'instance de navigateur actuelle ou dans l'Explorateur du système. - var Réf = window.open (url, cible, options) ; + var ref = window.open(url, target, options); * **ref** : référence à la fenêtre `InAppBrowser`. *(InAppBrowser)* @@ -85,18 +74,19 @@ Ouvre une URL dans une nouvelle `InAppBrowser` instance, l'instance de navigateu * **allowInlineMediaPlayback**: la valeur `yes` ou `no` pour permettre la lecture du média en ligne HTML5, affichage dans la fenêtre du navigateur plutôt que d'une interface de lecture spécifique au périphérique. L'HTML `video` élément doit également inclure la `webkit-playsinline` attribut (par défaut,`no`) * **keyboardDisplayRequiresUserAction**: la valeur `yes` ou `no` pour ouvrir le clavier lorsque les éléments reçoivent le focus par l'intermédiaire de JavaScript `focus()` appel (par défaut,`yes`). * **suppressesIncrementalRendering**: la valeur `yes` ou `no` d'attendre que toutes les nouveautés de vue sont reçue avant d'être restitué (par défaut,`no`). - * **presentationstyle**: la valeur `pagesheet` , `formsheet` ou `fullscreen` pour définir le [style de présentation][2] (par défaut,`fullscreen`). - * **transitionstyle**: la valeur `fliphorizontal` , `crossdissolve` ou `coververtical` pour définir le [style de transition][3] (par défaut,`coververtical`). + * **presentationstyle**: la valeur `pagesheet` , `formsheet` ou `fullscreen` pour définir le [style de présentation][1] (par défaut,`fullscreen`). + * **transitionstyle**: la valeur `fliphorizontal` , `crossdissolve` ou `coververtical` pour définir le [style de transition][2] (par défaut,`coververtical`). * **toolbarposition**: la valeur `top` ou `bottom` (valeur par défaut est `bottom` ). Causes de la barre d'outils être en haut ou en bas de la fenêtre. - [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle - [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + [1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle ### Plates-formes prises en charge * Amazon Fire OS * Android * BlackBerry 10 +* Firefox OS * iOS * Windows Phone 7 et 8 @@ -106,6 +96,36 @@ Ouvre une URL dans une nouvelle `InAppBrowser` instance, l'instance de navigateu var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); +### Firefox OS Quirks + +Comme plugin n'est pas appliquer n'importe quelle conception il est nécessaire d'ajouter quelques règles CSS si ouvert avec `target='_blank'` . Les règles pourraient ressembler à ces + + css + .inAppBrowserWrap { + background-color: rgba(0,0,0,0.75); + color: rgba(235,235,235,1.0); + } + .inAppBrowserWrap menu { + overflow: auto; + list-style-type: none; + padding-left: 0; + } + .inAppBrowserWrap menu li { + font-size: 25px; + height: 25px; + float: left; + margin: 0 10px; + padding: 3px 10px; + text-decoration: none; + color: #ccc; + display: block; + background: rgba(30,30,30,0.50); + } + .inAppBrowserWrap menu li.disabled { + color: #777; + } + + ## InAppBrowser L'objet retourné par un appel à`window.open`. @@ -206,6 +226,7 @@ L'objet retourné par un appel à`window.open`. * Amazon Fire OS * Android +* Firefox OS * iOS * Windows Phone 7 et 8 diff --git a/doc/it/index.md b/doc/it/index.md index 792e502..51f3478 100644 --- a/doc/it/index.md +++ b/doc/it/index.md @@ -31,22 +31,11 @@ Questo plugin fornisce una vista di browser web che viene visualizzata quando si cordova plugin add org.apache.cordova.inappbrowser -### Firefox OS - -Creare **www/manifest.webapp** come descritto nel [Manifesto Docs][1]. Aggiungi permisions rilevanti. - - [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest - - "permissions": { - "browser": {} - } - - ## window.open Apre un URL in una nuova `InAppBrowser` istanza, l'istanza corrente del browser o il browser di sistema. - rif var = Window. Open (url, destinazione, opzioni); + var ref = window.open(url, target, options); * **Rif**: fare riferimento alla `InAppBrowser` finestra. *(InAppBrowser)* @@ -85,18 +74,19 @@ Apre un URL in una nuova `InAppBrowser` istanza, l'istanza corrente del browser * **allowInlineMediaPlayback**: impostare su `yes` o `no` per consentire la riproduzione dei supporti HTML5 in linea, visualizzare all'interno della finestra del browser, piuttosto che un'interfaccia specifica del dispositivo di riproduzione. L'HTML `video` elemento deve includere anche il `webkit-playsinline` (default di attributo`no`) * **keyboardDisplayRequiresUserAction**: impostare su `yes` o `no` per aprire la tastiera quando elementi form ricevano lo stato attivo tramite di JavaScript `focus()` chiamata (default`yes`). * **suppressesIncrementalRendering**: impostare su `yes` o `no` aspettare fino a quando tutti i nuovi contenuti di vista viene ricevuto prima il rendering (default`no`). - * **presentationstyle**: impostare su `pagesheet` , `formsheet` o `fullscreen` per impostare lo [stile di presentazione][2] (default`fullscreen`). - * **transitionstyle**: impostare su `fliphorizontal` , `crossdissolve` o `coververtical` per impostare lo [stile di transizione][3] (default`coververtical`). + * **presentationstyle**: impostare su `pagesheet` , `formsheet` o `fullscreen` per impostare lo [stile di presentazione][1] (default`fullscreen`). + * **transitionstyle**: impostare su `fliphorizontal` , `crossdissolve` o `coververtical` per impostare lo [stile di transizione][2] (default`coververtical`). * **toolbarposition**: impostare su `top` o `bottom` (default è `bottom` ). Provoca la barra degli strumenti sia nella parte superiore o inferiore della finestra. - [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle - [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + [1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle ### Piattaforme supportate * Amazon fuoco OS * Android * BlackBerry 10 +* Firefox OS * iOS * Windows Phone 7 e 8 @@ -106,6 +96,36 @@ Apre un URL in una nuova `InAppBrowser` istanza, l'istanza corrente del browser var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); +### Firefox OS stranezze + +Come plugin non imporre alcun disegno c'è bisogno di aggiungere alcune regole CSS se aperto con `target='_blank'` . Le regole potrebbero apparire come questi + + css + .inAppBrowserWrap { + background-color: rgba(0,0,0,0.75); + color: rgba(235,235,235,1.0); + } + .inAppBrowserWrap menu { + overflow: auto; + list-style-type: none; + padding-left: 0; + } + .inAppBrowserWrap menu li { + font-size: 25px; + height: 25px; + float: left; + margin: 0 10px; + padding: 3px 10px; + text-decoration: none; + color: #ccc; + display: block; + background: rgba(30,30,30,0.50); + } + .inAppBrowserWrap menu li.disabled { + color: #777; + } + + ## InAppBrowser L'oggetto restituito da una chiamata a`window.open`. @@ -206,6 +226,7 @@ L'oggetto restituito da una chiamata a`window.open`. * Amazon fuoco OS * Android +* Firefox OS * iOS * Windows Phone 7 e 8 diff --git a/doc/ja/index.md b/doc/ja/index.md index 0050ef0..23d53ab 100644 --- a/doc/ja/index.md +++ b/doc/ja/index.md @@ -31,22 +31,11 @@ cordova plugin add org.apache.cordova.inappbrowser -### Firefox の OS - -[マニフェストのドキュメント][1]で説明されているように、 **www/manifest.webapp**を作成します。関連する権限を追加します。 - - [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest - - "permissions": { - "browser": {} - } - - ## window.open 新しい URL を開き `InAppBrowser` インスタンス、現在のブラウザー インスタンスまたはシステムのブラウザー。 - var ref = window.open url、ターゲット (オプション); + var ref = window.open(url, target, options); * **ref**: への参照を `InAppBrowser` ウィンドウ。*(InAppBrowser)* @@ -85,18 +74,19 @@ * **allowInlineMediaPlayback**: に設定されている `yes` または `no` ラインで HTML5 メディア再生には、デバイス固有再生インターフェイスではなく、ブラウザー ウィンドウ内に表示するようにします。 HTML の `video` 要素を含める必要がありますまた、 `webkit-playsinline` 属性 (デフォルトは`no`) * **keyboardDisplayRequiresUserAction**: に設定されている `yes` または `no` をフォーム要素の JavaScript を介してフォーカスを受け取るときに、キーボードを開く `focus()` コール (デフォルトは`yes`). * **suppressesIncrementalRendering**: に設定されている `yes` または `no` (デフォルトでは表示される前にビューのすべての新しいコンテンツを受信するまで待機するには`no`). - * **presentationstyle**: に設定されている `pagesheet` 、 `formsheet` または `fullscreen` (デフォルトでは、[プレゼンテーション スタイル][2]を設定するには`fullscreen`). - * **transitionstyle**: に設定されている `fliphorizontal` 、 `crossdissolve` または `coververtical` (デフォルトでは、[トランジションのスタイル][3]を設定するには`coververtical`). + * **presentationstyle**: に設定されている `pagesheet` 、 `formsheet` または `fullscreen` (デフォルトでは、[プレゼンテーション スタイル][1]を設定するには`fullscreen`). + * **transitionstyle**: に設定されている `fliphorizontal` 、 `crossdissolve` または `coververtical` (デフォルトでは、[トランジションのスタイル][2]を設定するには`coververtical`). * **toolbarposition**: に設定されている `top` または `bottom` (既定値は `bottom` )。上部またはウィンドウの下部にツールバーが発生します。 - [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle - [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + [1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle ### サポートされているプラットフォーム * アマゾン火 OS * アンドロイド * ブラックベリー 10 +* Firefox の OS * iOS * Windows Phone 7 と 8 @@ -106,6 +96,36 @@ var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); +### Firefox OS 癖 + +開かれた場合にいくつかの CSS ルールを追加する必要があるプラグインは任意のデザインを適用しないよう `target='_blank'` 。これらのような規則になります。 + + css + .inAppBrowserWrap { + background-color: rgba(0,0,0,0.75); + color: rgba(235,235,235,1.0); + } + .inAppBrowserWrap menu { + overflow: auto; + list-style-type: none; + padding-left: 0; + } + .inAppBrowserWrap menu li { + font-size: 25px; + height: 25px; + float: left; + margin: 0 10px; + padding: 3px 10px; + text-decoration: none; + color: #ccc; + display: block; + background: rgba(30,30,30,0.50); + } + .inAppBrowserWrap menu li.disabled { + color: #777; + } + + ## InAppBrowser 呼び出しから返されるオブジェクト`window.open`. @@ -206,6 +226,7 @@ * アマゾン火 OS * アンドロイド +* Firefox の OS * iOS * Windows Phone 7 と 8 diff --git a/doc/ko/index.md b/doc/ko/index.md index 5f2825e..6c3523a 100644 --- a/doc/ko/index.md +++ b/doc/ko/index.md @@ -31,22 +31,11 @@ cordova plugin add org.apache.cordova.inappbrowser -### Firefox 운영 체제 - -[참고 문서][1]에 설명 된 대로 **www/manifest.webapp** 를 만듭니다. 관련 부여할 추가 합니다. - - [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest - - "permissions": { - "browser": {} - } - - ## window.open 새 URL을 엽니다 `InAppBrowser` 인스턴스, 현재 브라우저 인스턴스 또는 시스템 브라우저. - var ref = window.open (url, 대상, 옵션); + var ref = window.open(url, target, options); * **심판**:에 대 한 참조는 `InAppBrowser` 창. *(InAppBrowser)* @@ -85,18 +74,19 @@ * **allowInlineMediaPlayback**: 설정 `yes` 또는 `no` 인라인 HTML5 미디어 재생, 장치 전용 재생 인터페이스 보다는 브라우저 창 내에서 표시할 수 있도록 합니다. HTML의 `video` 요소가 포함 되어야 합니다는 `webkit-playsinline` 특성 (기본값:`no`) * **keyboardDisplayRequiresUserAction**: 설정 `yes` 또는 `no` 양식 요소는 자바 스크립트를 통해 포커스를 받을 때 키보드를 열고 `focus()` 전화 (기본값:`yes`). * **suppressesIncrementalRendering**: 설정 `yes` 또는 `no` (기본값을 렌더링 하기 전에 모든 새로운 보기 콘텐츠를 받을 때까지 기다려야`no`). - * **presentationstyle**: 설정 `pagesheet` , `formsheet` 또는 `fullscreen` [프레 젠 테이 션 스타일][2] (기본값을 설정 하려면`fullscreen`). - * **transitionstyle**: 설정 `fliphorizontal` , `crossdissolve` 또는 `coververtical` [전환 스타일][3] (기본값을 설정 하려면`coververtical`). + * **presentationstyle**: 설정 `pagesheet` , `formsheet` 또는 `fullscreen` [프레 젠 테이 션 스타일][1] (기본값을 설정 하려면`fullscreen`). + * **transitionstyle**: 설정 `fliphorizontal` , `crossdissolve` 또는 `coververtical` [전환 스타일][2] (기본값을 설정 하려면`coververtical`). * **toolbarposition**: 설정 `top` 또는 `bottom` (기본값은 `bottom` ). 위쪽 또는 아래쪽 창에 도구 모음을 발생 합니다. - [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle - [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + [1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle ### 지원 되는 플랫폼 * 아마존 화재 운영 체제 * 안 드 로이드 * 블랙베리 10 +* Firefox 운영 체제 * iOS * Windows Phone 7과 8 @@ -106,6 +96,36 @@ var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); +### 파이어 폭스 OS 단점 + +플러그인 어떤 디자인을 적용 하지 않는 경우 열 일부 CSS의 규칙을 추가할 필요가 있다 `target='_blank'` . 이 같이 규칙 + + css + .inAppBrowserWrap { + background-color: rgba(0,0,0,0.75); + color: rgba(235,235,235,1.0); + } + .inAppBrowserWrap menu { + overflow: auto; + list-style-type: none; + padding-left: 0; + } + .inAppBrowserWrap menu li { + font-size: 25px; + height: 25px; + float: left; + margin: 0 10px; + padding: 3px 10px; + text-decoration: none; + color: #ccc; + display: block; + background: rgba(30,30,30,0.50); + } + .inAppBrowserWrap menu li.disabled { + color: #777; + } + + ## InAppBrowser 호출에서 반환 하는 개체`window.open`. @@ -206,6 +226,7 @@ * 아마존 화재 운영 체제 * 안 드 로이드 +* Firefox 운영 체제 * iOS * Windows Phone 7과 8 diff --git a/doc/ru/index.md b/doc/ru/index.md new file mode 100644 index 0000000..0f67f12 --- /dev/null +++ b/doc/ru/index.md @@ -0,0 +1,320 @@ + + +# org.apache.cordova.inappbrowser + +Этот плагин дает представление веб-браузера, что показывает при вызове `window.open()` , или когда открытие ссылки формируется как``. + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + + +**Примечание**: InAppBrowser окно ведет себя как стандартный веб-браузер и не может доступ API Cordova. + +## Установка + + cordova plugin add org.apache.cordova.inappbrowser + + +## window.open + +Открывает URL-адрес в новом `InAppBrowser` например, текущий экземпляр браузера или браузера системы. + + var ref = window.open(url, target, options); + + +* **ссылка**: ссылка для `InAppBrowser` окно. *(InAppBrowser)* + +* **URL**: URL-адрес для загрузки *(String)*. Вызвать `encodeURI()` на это, если URL-адрес содержит символы Unicode. + +* **Цель**: цель для загрузки URL-адреса, необязательный параметр, по умолчанию `_self` . *(Строка)* + + * `_self`: Открывается в Cordova WebView, если URL-адрес в белый список, в противном случае он открывается в`InAppBrowser`. + * `_blank`: Открывает в`InAppBrowser`. + * `_system`: Открывается в веб-браузера системы. + +* **опции**: параметры для `InAppBrowser` . Необязательный параметр, виновная в: `location=yes` . *(Строка)* + + `options`Строка не должна содержать каких-либо пустое пространство, и каждая функция пар имя/значение должны быть разделены запятой. Функция имена нечувствительны к регистру. Все платформы поддерживают исходное значение: + + * **Расположение**: равным `yes` или `no` превратить `InAppBrowser` в адресную строку или выключить. + + Только андроид: + + * **closebuttoncaption**: задайте строку для использования в качестве заголовка кнопки **сделали** . + * **скрытые**: значение `yes` для создания браузера и загрузки страницы, но не показать его. Событие loadstop возникает, когда загрузка завершена. Опустить или набор `no` (по умолчанию), чтобы браузер открыть и загрузить нормально. + * **ClearCache**: набор `yes` иметь браузера куки кэш очищен перед открытием нового окна + * **clearsessioncache**: значение `yes` иметь кэш cookie сеанса очищается перед открытием нового окна + + только iOS: + + * **closebuttoncaption**: задайте строку для использования в качестве заголовка кнопки **сделали** . Обратите внимание, что вам нужно самостоятельно локализовать это значение. + * **disallowoverscroll**: значение `yes` или `no` (по умолчанию `no` ). Включает/отключает свойство UIWebViewBounce. + * **скрытые**: значение `yes` для создания браузера и загрузки страницы, но не показать его. Событие loadstop возникает, когда загрузка завершена. Опустить или набор `no` (по умолчанию), чтобы браузер открыть и загрузить нормально. + * **ClearCache**: набор `yes` иметь браузера куки кэш очищен перед открытием нового окна + * **clearsessioncache**: значение `yes` иметь кэш cookie сеанса очищается перед открытием нового окна + * **панели инструментов**: набор `yes` или `no` для включения панели инструментов или выключить InAppBrowser (по умолчанию`yes`) + * **enableViewportScale**: значение `yes` или `no` для предотвращения просмотра, масштабирования через тег meta (по умолчанию`no`). + * **mediaPlaybackRequiresUserAction**: значение `yes` или `no` для предотвращения HTML5 аудио или видео от Автовоспроизведение (по умолчанию`no`). + * **allowInlineMediaPlayback**: значение `yes` или `no` чтобы разрешить воспроизведение мультимедиа HTML5 в строки, отображения в окне браузера, а не конкретного устройства воспроизведения интерфейс. HTML `video` элемент должен также включать `webkit-playsinline` атрибут (по умолчанию`no`) + * **keyboardDisplayRequiresUserAction**: значение `yes` или `no` чтобы открыть клавиатуру, когда формы элементы получают фокус через JavaScript в `focus()` вызов (по умолчанию`yes`). + * **suppressesIncrementalRendering**: значение `yes` или `no` ждать, пока все новое содержание представление получено до визуализации (по умолчанию`no`). + * **presentationstyle**: набор `pagesheet` , `formsheet` или `fullscreen` чтобы задать [стиль презентации][1] (по умолчанию`fullscreen`). + * **transitionstyle**: набор `fliphorizontal` , `crossdissolve` или `coververtical` чтобы задать [стиль перехода][2] (по умолчанию`coververtical`). + * **toolbarposition**: значение `top` или `bottom` (по умолчанию `bottom` ). Вызывает панели инструментов, чтобы быть в верхней или нижней части окна. + + [1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + +### Поддерживаемые платформы + +* Amazon Fire ОС +* Android +* BlackBerry 10 +* Firefox OS +* iOS +* Windows Phone 7 и 8 + +### Пример + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); + + +### Firefox OS причуды + +Как плагин не применять любой дизайн есть необходимость добавить некоторые правила CSS, если открыт с `target='_blank'` . Правила может выглядеть как эти + + css + .inAppBrowserWrap { + background-color: rgba(0,0,0,0.75); + color: rgba(235,235,235,1.0); + } + .inAppBrowserWrap menu { + overflow: auto; + list-style-type: none; + padding-left: 0; + } + .inAppBrowserWrap menu li { + font-size: 25px; + height: 25px; + float: left; + margin: 0 10px; + padding: 3px 10px; + text-decoration: none; + color: #ccc; + display: block; + background: rgba(30,30,30,0.50); + } + .inAppBrowserWrap menu li.disabled { + color: #777; + } + + +## InAppBrowser + +Объект, возвращаемый из вызова`window.open`. + +### Методы + +* addEventListener +* removeEventListener +* close +* show +* executeScript +* insertCSS + +## addEventListener + +> Добавляет прослушиватель для события от`InAppBrowser`. + + ref.addEventListener(eventname, callback); + + +* **ссылка**: ссылка для `InAppBrowser` окно *(InAppBrowser)* + +* **EventName**: событие для прослушивания *(String)* + + * **loadstart**: событие возникает, когда `InAppBrowser` начинает для загрузки URL-адреса. + * **loadstop**: событие возникает, когда `InAppBrowser` завершит загрузку URL-адреса. + * **loaderror**: событие возникает, когда `InAppBrowser` обнаруживает ошибку при загрузке URL-адреса. + * **выход**: возникает событие, когда `InAppBrowser` окно закрыто. + +* **обратного вызова**: функция, которая выполняется, когда возникает событие. Функция передается `InAppBrowserEvent` объект в качестве параметра. + +### InAppBrowserEvent свойства + +* **тип**: eventname, либо `loadstart` , `loadstop` , `loaderror` , или `exit` . *(Строка)* + +* **URL**: URL-адрес, который был загружен. *(Строка)* + +* **код**: код ошибки, только в случае `loaderror` . *(Число)* + +* **сообщение**: сообщение об ошибке, только в случае `loaderror` . *(Строка)* + +### Поддерживаемые платформы + +* Amazon Fire ОС +* Android +* iOS +* Windows Phone 7 и 8 + +### Быстрый пример + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstart', function(event) { alert(event.url); }); + + +## метод removeEventListener + +> Удаляет прослушиватель для события от`InAppBrowser`. + + ref.removeEventListener(eventname, callback); + + +* **ссылка**: ссылка для `InAppBrowser` окно. *(InAppBrowser)* + +* **EventName**: событие прекратить прослушивание. *(Строка)* + + * **loadstart**: событие возникает, когда `InAppBrowser` начинает для загрузки URL-адреса. + * **loadstop**: событие возникает, когда `InAppBrowser` завершит загрузку URL-адреса. + * **loaderror**: событие возникает, когда `InAppBrowser` обнаруживает ошибку загрузки URL-адреса. + * **выход**: возникает событие, когда `InAppBrowser` окно закрывается. + +* **обратного вызова**: функция, выполняемая когда это событие наступает. Функция передается `InAppBrowserEvent` объект. + +### Поддерживаемые платформы + +* Amazon Fire ОС +* Android +* iOS +* Windows Phone 7 и 8 + +### Быстрый пример + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + var myCallback = function(event) { alert(event.url); } + ref.addEventListener('loadstart', myCallback); + ref.removeEventListener('loadstart', myCallback); + + +## close + +> Закрывает `InAppBrowser` окно. + + Ref.Close(); + + +* **ссылка**: ссылка на `InAppBrowser` окно *(InAppBrowser)* + +### Поддерживаемые платформы + +* Amazon Fire ОС +* Android +* Firefox OS +* iOS +* Windows Phone 7 и 8 + +### Быстрый пример + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.close(); + + +## show + +> Отображается окно InAppBrowser, был открыт скрытые. Вызов это не имеет эффекта при InAppBrowser уже был виден. + + Ref.Show(); + + +* **ссылка**: ссылка на окно (InAppBrowser`InAppBrowser`) + +### Поддерживаемые платформы + +* Amazon Fire ОС +* Android +* iOS + +### Быстрый пример + + var ref = window.open('http://apache.org', '_blank', 'hidden=yes'); + // some time later... + ref.show(); + + +## executeScript + +> Вставляет код JavaScript в `InAppBrowser` окно + + ref.executeScript(details, callback); + + +* **ссылка**: ссылка на `InAppBrowser` окно. *(InAppBrowser)* + +* **injectDetails**: подробности сценария для запуска, указав либо `file` или `code` ключ. *(Объект)* + + * **файл**: URL-адрес сценария вставки. + * **код**: текст сценария для вставки. + +* **обратного вызова**: функция, которая выполняет после вводят JavaScript-код. + + * Если введенный скрипт имеет тип `code` , обратный вызов выполняется с одним параметром, который является возвращаемое значение сценария, завернутые в `Array` . Для многострочных сценариев это возвращаемое значение последнего оператора, или последнее вычисленное выражение. + +### Поддерживаемые платформы + +* Amazon Fire ОС +* Android +* iOS + +### Быстрый пример + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.executeScript({file: "myscript.js"}); + }); + + +## insertCSS + +> Внедряет CSS в `InAppBrowser` окно. + + ref.insertCSS(details, callback); + + +* **ссылка**: ссылка на `InAppBrowser` окно *(InAppBrowser)* + +* **injectDetails**: детали сценария для запуска, указав либо `file` или `code` ключ. *(Объект)* + + * **файл**: URL-адрес таблицы стилей для вставки. + * **код**: текст таблицы стилей для вставки. + +* **обратного вызова**: функция, которая выполняет после вводят CSS. + +### Поддерживаемые платформы + +* Amazon Fire ОС +* Android +* iOS + +### Быстрый пример + + var ref = window.open('http://apache.org', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function() { + ref.insertCSS({file: "mystyles.css"}); + }); \ No newline at end of file diff --git a/doc/zh/index.md b/doc/zh/index.md index f7791a8..81e5f01 100644 --- a/doc/zh/index.md +++ b/doc/zh/index.md @@ -31,22 +31,11 @@ cordova plugin add org.apache.cordova.inappbrowser -### 火狐瀏覽器作業系統 - -在[清單檔][1]中所述創建**www/manifest.webapp** 。添加相關許可權。 - - [1]: https://developer.mozilla.org/en-US/Apps/Developing/Manifest - - "permissions": { - "browser": {} - } - - ## window.open -在一個新的中打開 URL `InAppBrowser` 實例,當前的瀏覽器實例或系統瀏覽器。 +在一個新打開一個 URL `InAppBrowser` 實例,當前的瀏覽器實例或系統瀏覽器。 - var ref = window.open (url、 目標、 選項) ; + var ref = window.open(url, target, options); * **ref**: 參考 `InAppBrowser` 視窗。*() InAppBrowser* @@ -85,18 +74,19 @@ * **allowInlineMediaPlayback**: 將設置為 `yes` 或 `no` ,讓線在 HTML5 播放媒體,在瀏覽器視窗中,而不是特定于設備播放介面內顯示。 HTML 的 `video` 元素還必須包括 `webkit-playsinline` 屬性 (預設為`no`) * **keyboardDisplayRequiresUserAction**: 將設置為 `yes` 或 `no` 時,要打開鍵盤表單元素接收焦點通過 JavaScript 的 `focus()` 調用 (預設為`yes`). * **suppressesIncrementalRendering**: 將設置為 `yes` 或 `no` 等待,直到所有新查看的內容正在呈現 (預設為前收到`no`). - * **presentationstyle**: 將設置為 `pagesheet` , `formsheet` 或 `fullscreen` 來設置[演示文稿樣式][2](預設為`fullscreen`). - * **transitionstyle**: 將設置為 `fliphorizontal` , `crossdissolve` 或 `coververtical` 設置[過渡樣式][3](預設為`coververtical`). + * **presentationstyle**: 將設置為 `pagesheet` , `formsheet` 或 `fullscreen` 來設置[演示文稿樣式][1](預設為`fullscreen`). + * **transitionstyle**: 將設置為 `fliphorizontal` , `crossdissolve` 或 `coververtical` 設置[過渡樣式][2](預設為`coververtical`). * **toolbarposition**: 將設置為 `top` 或 `bottom` (預設值是 `bottom` )。使工具列,則在頂部或底部的視窗。 - [2]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle - [3]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle + [1]: http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle + [2]: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle ### 支援的平臺 * 亞馬遜火 OS * Android 系統 * 黑莓 10 +* 火狐瀏覽器的作業系統 * iOS * Windows Phone 7 和 8 @@ -106,6 +96,36 @@ var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes'); +### 火狐瀏覽器作業系統的怪癖 + +外掛程式不會執行任何的設計是需要添加一些 CSS 規則,如果打開的 `target='_blank'` 。規則 》 可能看起來像這些 + + css + .inAppBrowserWrap { + background-color: rgba(0,0,0,0.75); + color: rgba(235,235,235,1.0); + } + .inAppBrowserWrap menu { + overflow: auto; + list-style-type: none; + padding-left: 0; + } + .inAppBrowserWrap menu li { + font-size: 25px; + height: 25px; + float: left; + margin: 0 10px; + padding: 3px 10px; + text-decoration: none; + color: #ccc; + display: block; + background: rgba(30,30,30,0.50); + } + .inAppBrowserWrap menu li.disabled { + color: #777; + } + + ## InAppBrowser 從調用返回的物件`window.open`. @@ -206,6 +226,7 @@ * 亞馬遜火 OS * Android 系統 +* 火狐瀏覽器的作業系統 * iOS * Windows Phone 7 和 8