cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Maj <...@adobe.com>
Subject Re: docs commit: [CB-2305] Add documntation for InAppBrowser.executeScript and InAppBrowser.insertCSS APIs
Date Mon, 25 Mar 2013 20:10:29 GMT
Yes that makes sense. We can simply branch for 2.6.x before this commit,
that would work in our process ya?

On 3/25/13 11:28 AM, "Shazron" <shazron@gmail.com> wrote:

>This is for 2.7.0 right? The feature is not in 2.6.0 so it shouldn't be in
>2.6.0 docs. (the 2.6.x docs should branch off master before this commit
>since it hasn't been created yet)
>
>
>On Mon, Mar 25, 2013 at 8:37 AM, <mwbrooks@apache.org> wrote:
>
>> Updated Branches:
>>   refs/heads/master a897edd1f -> 40eb8dedd
>>
>>
>> [CB-2305] Add documntation for InAppBrowser.executeScript and
>> InAppBrowser.insertCSS APIs
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo
>> Commit:
>> http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/40eb8ded
>> Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/40eb8ded
>> Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/40eb8ded
>>
>> Branch: refs/heads/master
>> Commit: 40eb8dedd117cc91b692944a5f933b086d770a4f
>> Parents: a897edd
>> Author: Ian Clelland <iclelland@chromium.org>
>> Authored: Mon Mar 18 12:06:41 2013 -0400
>> Committer: Michael Brooks <michael@michaelbrooks.ca>
>> Committed: Mon Mar 25 08:36:23 2013 -0700
>>
>> ----------------------------------------------------------------------
>>  docs/en/edge/cordova/inappbrowser/inappbrowser.md |  154
>>++++++++++++++++
>>  1 files changed, 154 insertions(+), 0 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>>
>> 
>>http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/40eb8ded/docs/en
>>/edge/cordova/inappbrowser/inappbrowser.md
>> ----------------------------------------------------------------------
>> diff --git 
>>a/docs/en/edge/cordova/inappbrowser/inappbrowser.mdb/docs/en/edge/cordova
>>/inappbrowser/
>> inappbrowser.md
>> index bbf5cf6..5cd267b 100644
>> --- a/docs/en/edge/cordova/inappbrowser/inappbrowser.md
>> +++ b/docs/en/edge/cordova/inappbrowser/inappbrowser.md
>> @@ -262,6 +262,160 @@ Full Example
>>        </body>
>>      </html>
>>
>> +executeScript
>> +=============
>> +
>> +> Injects JavaScript code into the InAppBrowser window
>> +
>> +    ref.executeScript(details, callback);
>> +
>> +- __ref:__ reference to the InAppBrowser window (`InAppBrowser`)
>> +- __injectDetails:__ details of the script ot run (`Object`)
>> +    - Supported keys:  (exactly one of "file" or "code" should be
>>present)
>> +
>> +            "file" - URL of the script to inject
>> +            "code" - Text of the script to inject
>> +
>> +- __callback:__ the function that is to be called in the Cordova
>> application after the JavaScript code is injected.
>> +
>> +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
>> +------------
>> +
>> +    <!DOCTYPE html>
>> +    <html>
>> +      <head>
>> +        <title>InAppBrowser.executeScript Example</title>
>> +
>> +        <script type="text/javascript" charset="utf-8"
>> src="cordova-2.5.0.js"></script>
>> +        <script type="text/javascript" charset="utf-8">
>> +
>> +        // Wait for Cordova to load
>> +        //
>> +        document.addEventListener("deviceready", onDeviceReady, false);
>> +
>> +        // Global InAppBrowser reference
>> +        var iabRef = null;
>> +
>> +        // Inject our custom JavaScript into the InAppBrowser window
>> +        //
>> +        function replaceHeaderImage() {
>> +            iabRef.executeScript({
>> +                code: "var img=document.querySelector('#header img');
>> img.src='http://cordova.apache.org/images/cordova_bot.png';"
>> +            }, function() {
>> +                alert("Image Element Successfully Hijacked");
>> +            }
>> +        }
>> +
>> +        function iabClose(event) {
>> +             iabRef.removeEventListener('loadstop',
>>replaceHeaderImage);
>> +             iabRef.removeEventListener('exit', iabClose);
>> +        }
>> +
>> +        // Cordova is ready
>> +        //
>> +        function onDeviceReady() {
>> +             iabRef = window.open('http://apache.org', '_blank',
>> 'location=yes');
>> +             iabRef.addEventListener('loadstop', replaceHeaderImage);
>> +             iabRef.addEventListener('exit', iabClose);
>> +        }
>> +
>> +        </script>
>> +      </head>
>> +      <body>
>> +      </body>
>> +    </html>
>> +
>> +insertCSS
>> +=========
>> +
>> +> Injects CSS into the InAppBrowser window
>> +
>> +    ref.insertCSS(details, callback);
>> +
>> +- __ref:__ reference to the InAppBrowser window (`InAppBrowser`)
>> +- __injectDetails:__ details of the script ot run (`Object`)
>> +    - Supported keys:  (exactly one of "file" or "code" should be
>>present)
>> +
>> +            "file" - URL of the stylesheet to inject
>> +            "code" - Text of the stylesheet to inject
>> +
>> +- __callback:__ the function that is to be called in the Cordova
>> application 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
>> +------------
>> +
>> +    <!DOCTYPE html>
>> +    <html>
>> +      <head>
>> +        <title>InAppBrowser.executeScript Example</title>
>> +
>> +        <script type="text/javascript" charset="utf-8"
>> src="cordova-2.5.0.js"></script>
>> +        <script type="text/javascript" charset="utf-8">
>> +
>> +        // Wait for Cordova to load
>> +        //
>> +        document.addEventListener("deviceready", onDeviceReady, false);
>> +
>> +        // Global InAppBrowser reference
>> +        var iabRef = null;
>> +
>> +        // Inject our custom CSS into the InAppBrowser window
>> +        //
>> +        function changeBackgroundColor() {
>> +            iabRef.executeScript({
>> +                code: "body { background: #ffff00"
>> +            }, function() {
>> +                alert("Styles Altered");
>> +            }
>> +        }
>> +
>> +        function iabClose(event) {
>> +             iabRef.removeEventListener('loadstop',
>> changeBackgroundColor);
>> +             iabRef.removeEventListener('exit', iabClose);
>> +        }
>> +
>> +        // Cordova is ready
>> +        //
>> +        function onDeviceReady() {
>> +             iabRef = window.open('http://apache.org', '_blank',
>> 'location=yes');
>> +             iabRef.addEventListener('loadstop',
>>changeBackgroundColor);
>> +             iabRef.addEventListener('exit', iabClose);
>> +        }
>> +
>> +        </script>
>> +      </head>
>> +      <body>
>> +      </body>
>> +    </html>
>> +
>>  InAppBrowserEvent
>>  =================
>>
>>
>>


Mime
View raw message