You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ripple.apache.org by gt...@apache.org on 2013/10/21 04:42:39 UTC

[10/15] git commit: removed custom RIM extension

removed custom RIM extension


Project: http://git-wip-us.apache.org/repos/asf/incubator-ripple/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ripple/commit/b873cedf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ripple/tree/b873cedf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ripple/diff/b873cedf

Branch: refs/heads/next
Commit: b873cedf1f73d02706092c7b04f1804eea568a07
Parents: 29d85c0
Author: Gord Tanner <gt...@gmail.com>
Authored: Thu Oct 3 20:21:21 2013 -0400
Committer: Gord Tanner <gt...@gmail.com>
Committed: Thu Oct 3 20:21:21 2013 -0400

----------------------------------------------------------------------
 build/build.js                                  |   5 -
 .../controllers/Background.js                   | 354 -------------------
 .../rim.chrome.extension/controllers/PopUp.js   |  89 -----
 targets/rim.chrome.extension/manifest.json      |  37 --
 targets/rim.chrome.extension/updates.xml        |   6 -
 .../rim.chrome.extension/views/background.html  |  29 --
 targets/rim.chrome.extension/views/popup.html   |  72 ----
 7 files changed, 592 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/b873cedf/build/build.js
----------------------------------------------------------------------
diff --git a/build/build.js b/build/build.js
index 7d80ead..2925065 100644
--- a/build/build.js
+++ b/build/build.js
@@ -26,7 +26,6 @@ var fs = require('fs'),
     _c = require('./conf'),
     compress = require('./compress'),
     chromeExt = require('./targets/chrome.extension'),
-    rimChromeExt = require('./targets/rim.chrome.extension'),
     hosted = require('./targets/hosted');
 
 function _done(error) {
@@ -61,15 +60,11 @@ module.exports = _handle(function (ext, opts) {
     case 'chrome.extension':
         build.andThen(chromeExt);
         break;
-    case 'rim.chrome.extension':
-        build.andThen(rimChromeExt);
-        break;
     case 'hosted':
         build.andThen(hosted);
         break;
     default:
         build.andThen(chromeExt)
-             .andThen(rimChromeExt)
              .andThen(hosted);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/b873cedf/targets/rim.chrome.extension/controllers/Background.js
----------------------------------------------------------------------
diff --git a/targets/rim.chrome.extension/controllers/Background.js b/targets/rim.chrome.extension/controllers/Background.js
deleted file mode 100644
index 537f34b..0000000
--- a/targets/rim.chrome.extension/controllers/Background.js
+++ /dev/null
@@ -1,354 +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.
- *
- */
-if (!window.tinyHippos) {
-    window.tinyHippos = {};
-}
-
-tinyHippos.Background = (function () {
-    var _wasJustInstalled = false,
-        _self;
-
-    function isLocalRequest(uri) {
-        return !!uri.match(/^https?:\/\/(127\.0\.0\.1|localhost)|^file:\/\//);
-    }
-
-    function initialize() {
-        // check version info for showing welcome/update views
-        var version = window.localStorage["ripple-version"],
-            xhr = new window.XMLHttpRequest(),
-            userAgent,
-            requestUri = chrome.extension.getURL("manifest.json");
-
-        _self.bindContextMenu();
-
-        xhr.onreadystatechange = function () {
-            if (xhr.readyState === 4) {
-                var manifest = JSON.parse(xhr.responseText),
-                    currentVersion = manifest.version;
-
-                if (!version) {
-                    _wasJustInstalled = true;
-                }
-
-                if (version !== currentVersion) {
-                    webkitNotifications.createHTMLNotification('/views/update.html').show();
-                }
-
-                window.localStorage["ripple-version"] = currentVersion;
-            }
-        };
-
-        xhr.open("GET", requestUri, true);
-
-        xhr.send();
-
-        chrome.extension.onRequest.addListener(function (request, sender, sendResponse) {
-            var xhr, postData, data, eula;
-            switch (request.action) {
-            case "isEnabled":
-                console.log("isEnabled? ==> " + request.tabURL);
-                sendResponse({"enabled": tinyHippos.Background.isEnabled(request.tabURL)});
-                break;
-            case "enable":
-                console.log("enabling ==> " + request.tabURL);
-                tinyHippos.Background.enable();
-                sendResponse();
-                break;
-            case "disable":
-                console.log("disabling ==> " + request.tabURL);
-                tinyHippos.Background.disable();
-                sendResponse();
-                break;
-            case "checkEula":
-                eula = tinyHippos.Background.checkEula();
-                console.log("EULA signed ==> " + eula);
-                sendResponse({"eula": eula});
-                break;
-            case "acceptEula":
-                localStorage['ripple-eula'] = JSON.stringify(true);
-                console.log("EULA accepted!");
-                sendResponse({"eula": true});
-                break;
-            case "userAgent":
-                console.log("user agent ==> " + request.data);
-                userAgent = request.data;
-                break;
-            case "version":
-                sendResponse({"version": version});
-                break;
-            case "xhr":
-                xhr = new XMLHttpRequest();
-                postData = new FormData();
-                data = JSON.parse(request.data);
-
-                console.log("xhr ==> " + data.url);
-
-                $.ajax({
-                    type: data.method,
-                    url: data.url,
-                    async: true,
-                    data: data.data,
-                    success: function (data, status) {
-                        sendResponse({
-                            code: 200,
-                            data: data
-                        });
-                    },
-                    error: function (xhr, status, errorMessage) {
-                        sendResponse({
-                            code: xhr.status,
-                            data: status
-                        });
-                    }
-                });
-                break;
-            case "services":
-                console.log("services", request.data);
-                if (request.data === '"start"') {
-                    _self.start(sendResponse);
-                }
-                else if (request.data === '"stop"') {
-                    _self.stop(sendResponse);
-                }
-                break;
-            case "lag":
-            case "network":
-                // methods to be implemented at a later date
-                break;
-            default:
-                throw {name: "MethodNotImplemented", message: "Requested action is not supported! "};
-                break;
-            };
-        });
-
-        chrome.webRequest.onBeforeSendHeaders.addListener(function (details) {
-            if (tinyHippos.Background.isEnabled(details.url)) {
-                var ua = details.requestHeaders.reduce(function (match, header) {
-                    return header.name === "User-Agent" ? header : match;
-                });
-
-                ua.value = userAgent || ua.value;
-            }
-
-            return {
-                requestHeaders: details.requestHeaders
-            };
-        }, {urls: ["<all_urls>"]}, ["requestHeaders", "blocking"] );
-
-        chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
-            if (tinyHippos.Background.isEnabled(tab.url)) {
-                chrome.tabs.executeScript(tabId, {
-                    code: "rippleExtensionId = '" + chrome.extension.getURL('') + "';",
-                    allFrames: false
-                }, function () {
-                    chrome.tabs.executeScript(tabId, {
-                        file: "bootstrap.js",
-                        allFrames: false
-                    });
-                });
-            }
-        });
-    }
-
-    function _getEnabledURIs() {
-        var parsed = localStorage["tinyhippos-enabled-uri"];
-        return parsed ? JSON.parse(parsed) : {};
-    }
-
-    function _persistEnabled(url) {
-        var jsonObject = _getEnabledURIs();
-        jsonObject[url.replace(/.[^\/]*$/, "")] = "widget";
-        localStorage["tinyhippos-enabled-uri"] = JSON.stringify(jsonObject);
-    }
-
-    _self = {
-        metaData: function () {
-            return {
-                justInstalled: _wasJustInstalled,
-                version: window.localStorage["ripple-version"]
-            };
-        },
-
-        checkEula: function () {
-            return !!localStorage['ripple-eula'];
-        },
-
-        bindContextMenu: function () {
-            var id = chrome.contextMenus.create({
-                "type": "normal",
-                "title": "Emulator"
-            });
-
-            // TODO: hack for now (since opened tab is assumed to be page context was called from
-            // eventually will be able to pass in data.pageUrl to enable/disable when persistence refactor is done
-            chrome.contextMenus.create({
-                "type": "normal",
-                "title": "Enable",
-                "contexts": ["page"],
-                "parentId": id,
-                "onclick": function (data) {
-                        _self.enable();
-                    }
-            });
-
-            chrome.contextMenus.create({
-                "type": "normal",
-                "title": "Disable",
-                "contexts": ["page"],
-                "parentId": id,
-                "onclick": function (data) {
-                        _self.disable();
-                    }
-            });
-        },
-
-        enable: function () {
-            chrome.tabs.getSelected(null, function (tab) {
-                console.log("enable ==> " + tab.url);
-                _persistEnabled(tab.url);
-                chrome.tabs.sendRequest(tab.id, {"action": "enable", "mode": "widget", "tabURL": tab.url});
-            });
-        },
-
-        disable: function () {
-            chrome.tabs.getSelected(null, function (tab) {
-                console.log("disable ==> " + tab.url);
-
-                var jsonObject = _getEnabledURIs(),
-                    url = tab.url;
-
-                while (url && url.length > 0) {
-                    url = url.replace(/.[^\/]*$/, "");
-                    if (jsonObject[url]) {
-                        delete jsonObject[url];
-                        break;
-                    }
-                }
-
-                localStorage["tinyhippos-enabled-uri"] = JSON.stringify(jsonObject);
-
-                chrome.tabs.sendRequest(tab.id, {"action": "disable", "tabURL": tab.url });
-            });
-        },
-
-        start: function (sendResponse) {
-            var plugin = document.getElementById("pluginRippleBD");
-            if (plugin) {
-                var result = plugin.startBD(9910);
-                console.log("return from startBD", result);
-                if (sendResponse && typeof sendResponse === 'function') {
-                    sendResponse({result: result});
-                }
-            }
-        },
-
-        stop: function (sendResponse) {
-            var xhr = new XMLHttpRequest();
-            try {
-                xhr.open("GET", "http://127.0.0.1:9910/ripple/shutdown", false);
-                xhr.send();
-                if (sendResponse && typeof sendResponse === 'function') {
-                    sendResponse({});
-                }
-            }
-            catch (e) {
-                if (e.code === 101) {
-                    sendResponse({});
-                    return;
-                }
-                console.log("error", e);
-            }
-        },
-
-        autostart: function (start) {
-            if (start) {
-                window.localStorage['ripple-services'] = JSON.stringify(true);
-            }
-            else {
-                delete window.localStorage['ripple-services'];
-            }
-        },
-
-        serviceIsRunning: function () {
-            var xhr = new XMLHttpRequest();
-
-            xhr.open("GET", "http://127.0.0.1:9910/ripple/about", false);
-            xhr.send();
-            console.log(xhr);
-            if (xhr.response) {
-                return true;
-            }
-            else {
-                return false;
-            }
-        },
-
-        isAutostart: function () {
-            if (window.localStorage['ripple-services']) {
-                return JSON.parse(window.localStorage['ripple-services']);
-            }
-
-            return false;
-        },
-
-        isEnabled: function (url, enabledURIs) {
-            if (url.match(/enableripple=/i)) {
-                _persistEnabled(url);
-                return true;
-            }
-
-            // HACK: I'm sure there's a WAY better way to do this regex
-            if ((url.match(/^file:\/\/\//) && url.match(/\/+$/)) || url.match(/(.*?)\.(jpg|jpeg|png|gif|css|js)$/)) {
-                return false;
-            }
-
-            enabledURIs = enabledURIs || _getEnabledURIs();
-
-            if (url.length === 0) {
-                return false;
-            }
-            else if (enabledURIs[url]) {
-                return true;
-            }
-
-            return tinyHippos.Background.isEnabled(url.replace(/.[^\/]*$/, ""), enabledURIs);
-        }
-    };
-
-    initialize();
-
-    return _self;
-}());
-
-// check to see if Ripple Services need to be enabled
-if (tinyHippos.Background.isAutostart() === true) {
-    window.addEventListener("load", function () {
-        tinyHippos.Background.start();
-        console.log("ripple services started on http://localhost:9910");
-    });
-}
-
-
-//HACK: need to find a better way to do this since it's
-//WebWorks specific!!!
-window.onunload = function () {
-    tinyHippos.Background.stop();
-};

http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/b873cedf/targets/rim.chrome.extension/controllers/PopUp.js
----------------------------------------------------------------------
diff --git a/targets/rim.chrome.extension/controllers/PopUp.js b/targets/rim.chrome.extension/controllers/PopUp.js
deleted file mode 100644
index f9bf719..0000000
--- a/targets/rim.chrome.extension/controllers/PopUp.js
+++ /dev/null
@@ -1,89 +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.
- *
- */
-window.addEventListener('load', function () {
-    var background = chrome.extension.getBackgroundPage().tinyHippos.Background,
-        backgroundConsole = chrome.extension.getBackgroundPage().console;
-        autostart = document.getElementById("popup-autostart"),
-        start = document.getElementById("popup-start"),
-        stop = document.getElementById("popup-stop");
-
-    autostart.checked = !!background.isAutostart();
-
-    function _handle(func) {
-        return function () {
-            try {
-                func();
-            } catch (e) {
-                backgroundConsole.log(e.message, e.stack);
-            }
-        };
-    }
-
-    function _manageServices() {
-        var running;
-
-        try {
-            running = background.serviceIsRunning();
-        }
-        catch (e) {
-            running = false;
-        }
-
-        backgroundConsole.log("running: ", running);
-
-        if (running) {
-            start.style.display = "none";
-            stop.style.display = "";
-        }
-        else {
-            start.style.display = "";
-            stop.style.display = "none";
-        }
-    }
-
-    document.getElementById("popup-enable")
-        .addEventListener('click', _handle(background.enable));
-
-    document.getElementById("popup-disable")
-        .addEventListener('click', _handle(background.disable));
-
-    if (background.checkEula()) {
-        document.getElementById("ripple-services").style.display = "";
-    }
-
-    start.addEventListener('click', _handle(function () {
-        background.start();
-        window.setTimeout(function () {
-            _manageServices();
-        }, 1000);
-    }));
-
-    stop.addEventListener('click', _handle(function () {
-        background.stop();
-        _manageServices();
-    }));
-
-    autostart.addEventListener('change', function () {
-        background.autostart(autostart.checked);
-    });
-
-    _manageServices();
-});

http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/b873cedf/targets/rim.chrome.extension/manifest.json
----------------------------------------------------------------------
diff --git a/targets/rim.chrome.extension/manifest.json b/targets/rim.chrome.extension/manifest.json
deleted file mode 100644
index 0d2694f..0000000
--- a/targets/rim.chrome.extension/manifest.json
+++ /dev/null
@@ -1,37 +0,0 @@
-{
-    "version": "",
-    "manifest_version": 2,
-    "name": "Ripple Emulator (Beta)",
-    "background": {
-        "page": "views/background.html"
-    },
-    "web_accessible_resources": [],
-    "plugins": [
-        { "path": "plugins/npRippleBD.dll" },
-        { "path": "plugins/RippleBD.plugin" }
-    ],
-    "icons":{
-        "16":"images/Icon_16x16.png",
-        "128":"images/Icon_128x128.png",
-        "48":"images/Icon_48x48.png"
-    },
-    "browser_action":{
-        "default_popup":"views/popup.html",
-        "default_icon":"images/Icon_48x48.png",
-        "default_title":"Ripple"
-    },
-    "content_scripts":[{
-        "run_at": "document_start",
-        "js": ["controllers/Insertion.js"],
-        "matches": ["http://*/*","https://*/*","file:///*"]
-    },
-    {
-        "run_at": "document_start",
-        "js": ["controllers/frame.js"],
-        "matches": ["http://*/*","https://*/*","file:///*"],
-        "all_frames": true
-    }],
-    "permissions": ["tabs", "unlimitedStorage", "notifications", "contextMenus", "webRequest", "webRequestBlocking", "<all_urls>"],
-    "description": "A browser based html5 mobile application development and testing tool",
-    "update_url": "http://developer.blackberry.com/ripple/updates.xml"
-}

http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/b873cedf/targets/rim.chrome.extension/updates.xml
----------------------------------------------------------------------
diff --git a/targets/rim.chrome.extension/updates.xml b/targets/rim.chrome.extension/updates.xml
deleted file mode 100644
index 5278512..0000000
--- a/targets/rim.chrome.extension/updates.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<gupdate xmlns="http://www.google.com/update2/response" protocol="2.0">
-  <app appid="cnijnnaimeaacneklcndcafbnkeicckh">
-      <updatecheck codebase="https://developer.blackberry.com/html5/downloads/fetch/ripple_ui.crx" version="" />
-  </app>
-</gupdate>

http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/b873cedf/targets/rim.chrome.extension/views/background.html
----------------------------------------------------------------------
diff --git a/targets/rim.chrome.extension/views/background.html b/targets/rim.chrome.extension/views/background.html
deleted file mode 100644
index 68d7dfa..0000000
--- a/targets/rim.chrome.extension/views/background.html
+++ /dev/null
@@ -1,29 +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.
- *
--->
-<html>
-    <head>
-        <script type="text/javascript" src="../controllers/jquery.js"></script>
-        <script type="text/javascript" src="../controllers/Background.js"></script>
-    </head>
-    <body>
-        <embed type="application/x-ripplebd" id="pluginRippleBD" hidden="true" width="0" height="0" /> 
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/b873cedf/targets/rim.chrome.extension/views/popup.html
----------------------------------------------------------------------
diff --git a/targets/rim.chrome.extension/views/popup.html b/targets/rim.chrome.extension/views/popup.html
deleted file mode 100644
index c252cac..0000000
--- a/targets/rim.chrome.extension/views/popup.html
+++ /dev/null
@@ -1,72 +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.
- *
--->
-<!DOCTYPE html>
-<html>
-  <head>
-        <link media="screen" rel="stylesheet" type="text/css" href="../styles/extension.css" />
-        <link media="screen" rel="stylesheet" type="text/css" href="../themes/dark/theme.css" />
-        <script type="text/javascript" src="../controllers/PopUp.js"></script>
-  </head>
-  <body class="popup-body">
-        <div id="main" class="layout">
-
-            <div id="popup-enable-container">
-                <h1>Ripple Mission Control</h1>
-                <p>This is the Ripple control panel, where you can enable and disable Ripple for the current page URL and all pages contained within it.</p>
-
-                <button id="popup-enable" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">
-                    <span class="ui-button-text">Enable</span>
-                </button>
-
-                <button id="popup-disable" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">
-                    <span class="ui-button-text">Disable</span>
-                </button>
-
-                <hr>
-
-                <div id="ripple-services" style="display: none;">
-                    <h1>Ripple Services</h1>
-
-                    <p>Here you can start and stop the Ripple services. The services will give you the ability to build, sign, and deploy your BlackBerry WebWorks application as well as provide you with a local web server on port 9910</p>
-
-                    <button id="popup-start" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">
-                        <span class="ui-button-text">Start Ripple Services</span>
-                    </button>
-
-                    <button id="popup-stop" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">
-                        <span class="ui-button-text">Stop Ripple Services</span>
-                    </button>
-
-                    <p>
-                        <input id="popup-autostart" type="checkbox"/> Auto start services every time Chrome is launched
-                    </p>
-
-                    <p id="popup-services">Ripple services are now running on <a href="http://localhost:9910" target="_blank">http://localhost:9910</a></p>
-
-                    <hr>
-                </div>
-
-                <p>New to Ripple? Hit up the <a href="http://developer.blackberry.com/html5/documentation" target="_new">Main Documentation</a> to get started.</p>
-            </div>
-        </div>
-  </body>
-</html>
-