diff --git a/README.md b/README.md index 3fba214..929a44c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,2 @@ -# Skeleton for an Add-on in Firefox on Android - This repo is deprecated! Please use the canoncial hub boilerplate repo located here: https://github.com/mozilla/firefox-for-android-addons/tree/master/boilerplate/native-ui-boilerplate diff --git a/bootstrap.js b/bootstrap.js deleted file mode 100644 index c1926b4..0000000 --- a/bootstrap.js +++ /dev/null @@ -1,128 +0,0 @@ -const { classes: Cc, interfaces: Ci, utils: Cu } = Components; - -Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); - -// An example of how to create a string bundle for localization. -XPCOMUtils.defineLazyGetter(this, "Strings", function() { - return Services.strings.createBundle("chrome://skeleton/locale/skeleton.properties"); -}); - -// An example of how to import a helper module. -XPCOMUtils.defineLazyGetter(this, "Helper", function() { - let sandbox = {}; - Services.scriptloader.loadSubScript("chrome://skeleton/content/helper.js", sandbox); - return sandbox["Helper"]; -}); - -function isNativeUI() { - return (Services.appinfo.ID == "{aa3c5121-dab2-40e2-81ca-7ea25febc110}"); -} - -function showToast(aWindow) { - aWindow.NativeWindow.toast.show(Strings.GetStringFromName("toast.message"), "short"); -} - -function showDoorhanger(aWindow) { - let buttons = [ - { - label: "Button 1", - callback: function() { - aWindow.NativeWindow.toast.show("Button 1 was tapped", "short"); - } - } , { - label: "Button 2", - callback: function() { - aWindow.NativeWindow.toast.show("Button 2 was tapped", "short"); - } - }]; - - aWindow.NativeWindow.doorhanger.show("Showing a doorhanger with two button choices.", "doorhanger-test", buttons); -} - -function copyLink(aWindow, aTarget) { - let url = aWindow.NativeWindow.contextmenus._getLinkURL(aTarget); - aWindow.NativeWindow.toast.show("Todo: copy > " + url, "short"); -} - -var gToastMenuId = null; -var gDoorhangerMenuId = null; -var gContextMenuId = null; - -function loadIntoWindow(window) { - if (!window) - return; - - if (isNativeUI()) { - gToastMenuId = window.NativeWindow.menu.add("Show Toast", null, function() { showToast(window); }); - gDoorhangerMenuId = window.NativeWindow.menu.add("Show Doorhanger", null, function() { showDoorhanger(window); }); - gContextMenuId = window.NativeWindow.contextmenus.add("Copy Link", window.NativeWindow.contextmenus.linkOpenableContext, function(aTarget) { copyLink(window, aTarget); }); - } -} - -function unloadFromWindow(window) { - if (!window) - return; - - if (isNativeUI()) { - window.NativeWindow.menu.remove(gToastMenuId); - window.NativeWindow.menu.remove(gDoorhangerMenuId); - window.NativeWindow.contextmenus.remove(gContextMenuId); - } -} - - -/** - * bootstrap.js API - */ -var windowListener = { - onOpenWindow: function(aWindow) { - // Wait for the window to finish loading - let domWindow = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow); - domWindow.addEventListener("load", function() { - domWindow.removeEventListener("load", arguments.callee, false); - loadIntoWindow(domWindow); - }, false); - }, - - onCloseWindow: function(aWindow) { - }, - - onWindowTitleChange: function(aWindow, aTitle) { - } -}; - -function startup(aData, aReason) { - // Load into any existing windows - let windows = Services.wm.getEnumerator("navigator:browser"); - while (windows.hasMoreElements()) { - let domWindow = windows.getNext().QueryInterface(Ci.nsIDOMWindow); - loadIntoWindow(domWindow); - } - - // Load into any new windows - Services.wm.addListener(windowListener); -} - -function shutdown(aData, aReason) { - // When the application is shutting down we normally don't have to clean - // up any UI changes made - if (aReason == APP_SHUTDOWN) - return; - - // Stop listening for new windows - Services.wm.removeListener(windowListener); - - // Unload from any existing windows - let windows = Services.wm.getEnumerator("navigator:browser"); - while (windows.hasMoreElements()) { - let domWindow = windows.getNext().QueryInterface(Ci.nsIDOMWindow); - unloadFromWindow(domWindow); - } -} - -function install(aData, aReason) { -} - -function uninstall(aData, aReason) { -} diff --git a/build b/build deleted file mode 100755 index 4c6d402..0000000 --- a/build +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -# Replace this value with your add-on name -XPI=youraddon.xpi - -# Replace this value to push to different release channels. -# Nightly = org.mozilla.fennec -# Aurora = org.mozilla.fennec_aurora -# Beta = org.mozilla.firefox_beta -# Release = org.mozilla.firefox -ANDROID_APP_ID=org.mozilla.fennec - -# List add-on files here -zip -r $XPI bootstrap.js \ - install.rdf \ - chrome.manifest \ - content \ - locale \ - README.md \ - -x *.DS_Store* - -# Push the add-on to your device to test -adb push "$XPI" /sdcard/"$XPI" && \ -adb shell am start -a android.intent.action.VIEW \ - -c android.intent.category.DEFAULT \ - -d file:///mnt/sdcard/"$XPI" \ - -n $ANDROID_APP_ID/.App && \ -echo Pushed $XPI to $ANDROID_APP_ID diff --git a/chrome.manifest b/chrome.manifest deleted file mode 100644 index 23df920..0000000 --- a/chrome.manifest +++ /dev/null @@ -1,3 +0,0 @@ -content skeleton content/ -locale skeleton en-US locale/en-US/ -locale skeleton fr locale/fr/ diff --git a/content/helper.js b/content/helper.js deleted file mode 100644 index 6056d6a..0000000 --- a/content/helper.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -var Helper = { - // An example of how to import a helper module. -}; diff --git a/content/test.html b/content/test.html deleted file mode 100644 index bbb70ce..0000000 --- a/content/test.html +++ /dev/null @@ -1,10 +0,0 @@ - - - Test - - - - - - - diff --git a/content/test.js b/content/test.js deleted file mode 100644 index 0b2aa74..0000000 --- a/content/test.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; - -// You can run any test code here by loading chrome://skeleton/content/test.html diff --git a/install.rdf b/install.rdf deleted file mode 100644 index 06942fc..0000000 --- a/install.rdf +++ /dev/null @@ -1,23 +0,0 @@ - - - - - ADDON.NAME@SOMEDOMAIN.ORG - 2 - ADDON NAME - 1.0 - true - ADDON DESCRIPTION - YOUR NAME - - - - - {aa3c5121-dab2-40e2-81ca-7ea25febc110} - 29.0 - 32.* - - - - - diff --git a/locale/en-US/skeleton.properties b/locale/en-US/skeleton.properties deleted file mode 100644 index 453da43..0000000 --- a/locale/en-US/skeleton.properties +++ /dev/null @@ -1 +0,0 @@ -toast.message=Showing you a toast