From a065e04d529da1d847b5062a12c46d916408bf32 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 21:46:22 -0500 Subject: update based on https://github.com/mdn/yari/issues/2028 --- .../add-ons/add-on_manager/addonauthor/index.html | 31 --------- .../add-on_manager/addonscreenshot/index.html | 34 ---------- .../add-ons/add-on_manager/code_samples/index.html | 75 ---------------------- files/ja/mozilla/add-ons/add-on_manager/index.html | 68 -------------------- 4 files changed, 208 deletions(-) delete mode 100644 files/ja/mozilla/add-ons/add-on_manager/addonauthor/index.html delete mode 100644 files/ja/mozilla/add-ons/add-on_manager/addonscreenshot/index.html delete mode 100644 files/ja/mozilla/add-ons/add-on_manager/code_samples/index.html delete mode 100644 files/ja/mozilla/add-ons/add-on_manager/index.html (limited to 'files/ja/mozilla/add-ons/add-on_manager') diff --git a/files/ja/mozilla/add-ons/add-on_manager/addonauthor/index.html b/files/ja/mozilla/add-ons/add-on_manager/addonauthor/index.html deleted file mode 100644 index 03d58b8a15..0000000000 --- a/files/ja/mozilla/add-ons/add-on_manager/addonauthor/index.html +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: AddonAuthor -slug: Mozilla/Add-ons/Add-on_Manager/AddonAuthor -tags: - - Add-on Manager - - Add-ons -translation_of: Mozilla/JavaScript_code_modules/Add-on_Manager/AddonAuthor ---- -

作成者、開発者、貢献者、アドオンの翻訳者を表します。

- - -

属性

- - - - - - - - - - - - - - - - - - -
属性説明
namestring人名
url {{optional_inline}}stringname 属性で指定した人物の詳細が記載された URL
diff --git a/files/ja/mozilla/add-ons/add-on_manager/addonscreenshot/index.html b/files/ja/mozilla/add-ons/add-on_manager/addonscreenshot/index.html deleted file mode 100644 index b3a81b55e5..0000000000 --- a/files/ja/mozilla/add-ons/add-on_manager/addonscreenshot/index.html +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: AddonScreenshot -slug: Mozilla/Add-ons/Add-on_Manager/AddonScreenshot -tags: - - Add-on Manager - - Add-ons -translation_of: Mozilla/JavaScript_code_modules/Add-on_Manager/AddonScreenshot ---- -

アドオンのスクリーンショット

-

属性

- - - - - - - - - - - - - - - - - - - - - - - -
属性説明
urlstringスクリーンショットの URL
thumbnailURL {{optional_inline}}stringスクリーンショットのサムネイルの URL
caption {{optional_inline}}stringスクリーンショットのキャプション
diff --git a/files/ja/mozilla/add-ons/add-on_manager/code_samples/index.html b/files/ja/mozilla/add-ons/add-on_manager/code_samples/index.html deleted file mode 100644 index 0cc6c7b6ee..0000000000 --- a/files/ja/mozilla/add-ons/add-on_manager/code_samples/index.html +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: コードの実例 -slug: Mozilla/Add-ons/Add-on_Manager/Code_Samples -tags: - - Add-on Manager - - Add-ons -translation_of: Mozilla/JavaScript_code_modules/Add-on_Manager/Code_Samples ---- -

アドオンが格納されているディレクトリの取得

- -

あなたのアドオンがインストールされているディレクトリを確認する必要がある場合、次の様なトリックを用います。コード中の YOUREXTENSIONID はあなたのアドオンの ID で置き換えてください。

- -
Components.utils.import("resource://gre/modules/AddonManager.jsm");
-
-AddonManager.getAddonByID("YOUREXTENSIONID", function(addon) {
-  var addonLocation = addon.getResourceURI("").QueryInterface(Components.interfaces.{{ Interface( "nsIFileURL" ) }}).file.path;
-});
-
- -

ファイルとバージョン情報へのアクセス

- -
Components.utils.import("resource://gre/modules/AddonManager.jsm");
-
-AddonManager.getAddonByID("my-addon@foo.com", function(addon) {
-  alert("My extension's version is " + addon.version);
-  alert("Did I remember to include that file.txt file in my XPI? " +
-        addon.hasResource("file.txt") ? "YES!" : "No");
-  alert("Let's pretend I did, it's available from the URL " + addon.getResourceURI("file.txt").spec);
-});
-
- -

アドオンの削除

- -
Components.utils.import("resource://gre/modules/AddonManager.jsm");
-
-AddonManager.getAddonByID("youraddon@youraddon.com", function(addon) {
-  addon.uninstall();
-});
-
- -

アドオンの無効化

- -
Components.utils.import("resource://gre/modules/AddonManager.jsm");
-AddonManager.getAddonByID("youraddon@youraddon.com", function(addon) {
-  if (addon.isActive) addon.userDisabled = addon.isActive;
-});
-
- -

アドオンのアンインストールのリスニング

- - -

以下の例では、アドオンのアンインストール時にクリーンアップを実行する profile-before-change メッセージを取得する際に確認することができる変数 "beingUninstalled" を設定しています。

- - -
var beingUninstalled;
-
-let listener = {
-  onUninstalling: function(addon) {
-    if (addon.id == "youraddon@youraddon.com") {
-      beingUninstalled = true;
-    }
-  },
-  onOperationCancelled: function(addon) {
-    if (addon.id == "youraddon@youraddon.com") {
-      beingUninstalled = (addon.pendingOperations & AddonManager.PENDING_UNINSTALL) != 0;
-    }
-  }
-}
-
-try {
-  Components.utils.import("resource://gre/modules/AddonManager.jsm");
-
-  AddonManager.addAddonListener(listener);
-} catch (ex) {}
-
diff --git a/files/ja/mozilla/add-ons/add-on_manager/index.html b/files/ja/mozilla/add-ons/add-on_manager/index.html deleted file mode 100644 index 292d5b739b..0000000000 --- a/files/ja/mozilla/add-ons/add-on_manager/index.html +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: Add-on Manager -slug: Mozilla/Add-ons/Add-on_Manager -tags: - - Add-on Manager - - Add-ons - - NeedsEditorialReview - - NeedsTechnicalReview - - NeedsTranslation - - TopicStub -translation_of: Mozilla/JavaScript_code_modules/Add-on_Manager ---- -

{{ gecko_minversion_header("2.0") }}

- -

The Add-on Manager is responsible for managing all of the add-ons installed in the application. Through its APIs information about all installed add-ons can be retrieved and new add-ons can be installed. The APIs are designed to be generic and support many different types of add-ons.

- -

Many functions in the Add-on Manager interface operate asynchronously returning results through callbacks passed to the functions. The callbacks may be called immediately while the initial function is still executing or shortly after depending on when the requested data becomes available.

- -

Accessing installed add-ons

- -

Information about installed add-ons can be retrieved through the main AddonManager API. All of its functions are asynchronous meaning that a callback function must be passed to receive the Addon instances. The callback may well only be called after the API function returns. For example:

- -
Components.utils.import("resource://gre/modules/AddonManager.jsm");
-
-AddonManager.getAllAddons(function(aAddons) {
-  // Here aAddons is an array of Addon objects
-});
-// This code will execute before the code inside the callback
-
- -

Notifications about changes to installed add-ons are dispatched to any registered AddonListeners. They must be registered through the addAddonListener() method.

- -

Installing new add-ons

- -

New add-ons can be installed by using the getInstallForFile() or getInstallForURL() methods on the AddonManager object. These will pass an AddonInstall instance to the callback which can then be used to install the add-on:

- -
Components.utils.import("resource://gre/modules/AddonManager.jsm");
-
-AddonManager.getInstallForURL("http://www.foo.com/test.xpi", function(aInstall) {
-  // aInstall is an instance of AddonInstall
-  aInstall.install();
-}, "application/x-xpinstall");
-
- -

The progress of AddonInstalls can be monitored using an InstallListener. A listener can be registered either for a specific install using the addListener() method or for all installs using the addInstallListener() method.

- -

Finding updates

- -

Add-ons can be checked for updates using the findUpdates() method. It must be passed an UpdateListener to receive information about compatibility information and new update information. Any available update is returned as an AddonInstall which is ready to be downloaded and installed.

- -

{{ h1_gecko_minversion("Detecting add-on changes", "7.0") }}

- -

You can also get lists of add-ons that, at startup, were changed in various ways. The getStartupChanges() method lets you find out which add-ons were installed, removed, updated, enabled, or disabled at application startup.

- -

For example, to take a look at the add-ons that were disabled at startup:

- -
Components.utils.import("resource://gre/modules/AddonManager.jsm");
-
-let addonIDs = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_DISABLED);
-if (addonIDs.length > 0) {
-  // addonIDs is now an array of the add-on IDs that have been disabled
-alert("Note: " + addonIDs.length + " add-ons have been disabled.");
-}
-
- -

See also

- -

{{ ListSubpages() }}

-- cgit v1.2.3-54-g00ecf