From 95aca4b4d8fa62815d4bd412fff1a364f842814a Mon Sep 17 00:00:00 2001 From: Ryan Johnson Date: Thu, 29 Apr 2021 16:16:42 -0700 Subject: remove retired locales (#699) --- files/id/mozilla/add-ons/index.html | 16 - .../webextensions/api/browsersettings/index.html | 63 --- .../mozilla/add-ons/webextensions/api/index.html | 50 -- .../webextensions/api/notifications/index.html | 63 --- .../api/windows/createtype/index.html | 65 --- .../add-ons/webextensions/api/windows/index.html | 127 ----- .../browser_support_for_javascript_apis/index.html | 21 - .../webextensions/content_scripts/index.html | 554 --------------------- files/id/mozilla/add-ons/webextensions/index.html | 91 ---- .../what_are_webextensions/index.html | 35 -- .../your_first_webextension/index.html | 153 ------ files/id/mozilla/firefox/index.html | 75 --- files/id/mozilla/firefox/releases/index.html | 12 - files/id/mozilla/index.html | 13 - 14 files changed, 1338 deletions(-) delete mode 100644 files/id/mozilla/add-ons/index.html delete mode 100644 files/id/mozilla/add-ons/webextensions/api/browsersettings/index.html delete mode 100644 files/id/mozilla/add-ons/webextensions/api/index.html delete mode 100644 files/id/mozilla/add-ons/webextensions/api/notifications/index.html delete mode 100644 files/id/mozilla/add-ons/webextensions/api/windows/createtype/index.html delete mode 100644 files/id/mozilla/add-ons/webextensions/api/windows/index.html delete mode 100644 files/id/mozilla/add-ons/webextensions/browser_support_for_javascript_apis/index.html delete mode 100644 files/id/mozilla/add-ons/webextensions/content_scripts/index.html delete mode 100644 files/id/mozilla/add-ons/webextensions/index.html delete mode 100644 files/id/mozilla/add-ons/webextensions/what_are_webextensions/index.html delete mode 100644 files/id/mozilla/add-ons/webextensions/your_first_webextension/index.html delete mode 100644 files/id/mozilla/firefox/index.html delete mode 100644 files/id/mozilla/firefox/releases/index.html delete mode 100644 files/id/mozilla/index.html (limited to 'files/id/mozilla') diff --git a/files/id/mozilla/add-ons/index.html b/files/id/mozilla/add-ons/index.html deleted file mode 100644 index f25d110860..0000000000 --- a/files/id/mozilla/add-ons/index.html +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: Add-ons -slug: Mozilla/Add-ons -translation_of: Mozilla/Add-ons ---- -

{{AddonSidebar}}

- -

Add-ons Menambah fungsi baru pada aplikasi berbasis Gecko seperti Firefox, SeaMonkey dan Thunderbird. Ada dua jenis "add-on" :  Extensions menambahkan fitur ke aplikasi, sedangkan Tema merubah tampilan pada aplikasi.

- -

Keduanya (Extention, dan Tema) ditemukan dalam addons.mozilla.org, dikenal juga sebagai AMO. Ketika Anda masukan add-ons ke AMO mereka meninjau, dan setelah melewati tinjauan maka mereka menyajikan untuk pengguna. Anda tidak harus masukan add-on ke AMO, tetapi anda lakukan, pengguna dapat menaruh keyakinan bahwa mereka telah ditinjau, dan Anda dapat keuntungan dari visibilitas AMO sebagai sumber add-on yang berguna.

- -

Add-ons dapat mempengaruhi perilaku aplikasi host mereka. Kami telah membangun sekumpulan panduan untuk membantu memastikan bahwa mereka telah didukung mendapatkan pengalaman yang baik pada pengguna. Panduan ini digunakan untuk beberapa add-on, apakah mereka juga ditaruh di addons.mozilla.org atau tidak.

- -

Extentions

- -

Extention menambah fungsi dari aplikasi Mozzila seperti Firefox dan Thunderbird. Extension dapat menambahkan fitur pada peramban, seperti mengatur tab, dan mereka dapat merubah konten web untuk meningkatkan pengguanan atau keamanan website tertentu.

diff --git a/files/id/mozilla/add-ons/webextensions/api/browsersettings/index.html b/files/id/mozilla/add-ons/webextensions/api/browsersettings/index.html deleted file mode 100644 index 2372f738e0..0000000000 --- a/files/id/mozilla/add-ons/webextensions/api/browsersettings/index.html +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: browserSettings -slug: Mozilla/Add-ons/WebExtensions/API/browserSettings -translation_of: Mozilla/Add-ons/WebExtensions/API/browserSettings ---- -
{{AddonSidebar}}
- -
Enables an extension to modify certain global browser settings. Each property of this API is a {{WebExtAPIRef("types.BrowserSetting", "BrowserSetting")}} object, providing the ability to modify a particular setting.
- -
- -
Because these are global settings, it's possible for extensions to conflict. See the documentation for BrowserSetting.set() for details of how conflicts are handled.
- -
- -
-

To use this API you need to have the "browserSettings" permission.

-
- -

Properties

- -
-
{{WebExtAPIRef("browserSettings.allowPopupsForUserEvents")}}
-
Determines whether code running in web pages can display popups in response to user events.
-
{{WebExtAPIRef("browserSettings.cacheEnabled")}}
-
Determines whether the browser cache is enabled or not.
-
{{WebExtAPIRef("browserSettings.closeTabsByDoubleClick")}}
-
Determines whether the selected tab can be closed with a double click.
-
{{WebExtAPIRef("browserSettings.contextMenuShowEvent")}}
-
Determines the mouse event that triggers a context menu popup.
-
{{WebExtAPIRef("browserSettings.ftpProtocolEnabled")}}
-
Determines whether the FTP protocol is enabled.
-
{{WebExtAPIRef("browserSettings.homepageOverride")}}
-
Read the value of the browser's home page.
-
{{WebExtAPIRef("browserSettings.imageAnimationBehavior")}}
-
Determines how the browser treats animated images.
-
{{WebExtAPIRef("browserSettings.newTabPageOverride")}}
-
Reads the value of the browser's new tab page.
-
{{WebExtAPIRef("browserSettings.newTabPosition")}}
-
Controls the position of newly opened tabs relative to already open tabs.
-
{{WebExtAPIRef("browserSettings.openBookmarksInNewTabs")}}
-
Determines whether bookmarks are opened in the current tab or a new tab.
-
{{WebExtAPIRef("browserSettings.openSearchResultsInNewTabs")}}
-
Determines whether search results are opened in the current tab or a new tab.
-
{{WebExtAPIRef("browserSettings.openUrlbarResultsInNewTabs")}}
-
Determines whether address bar autocomplete suggestions are opened in the current tab or a new tab.
-
{{WebExtAPIRef("browserSettings.overrideDocumentColors")}}
-
Controls whether the user-chosen colors override the page's colors.
-
{{WebExtAPIRef("browserSettings.useDocumentFonts")}}
-
Controls whether the browser will use the fonts specified by a web page or use only built-in fonts.
-
{{WebExtAPIRef("browserSettings.webNotificationsDisabled")}}
-
Prevents websites from showing notifications using the Notification Web API.
-
{{WebExtAPIRef("browserSettings.zoomFullPage")}}
-
Controls whether zoom is applied to the entire page or to text only.
-
{{WebExtAPIRef("browserSettings.zoomSiteSpecific")}}
-
Controls whether page zoom is applied on a per-site or per-tab basis. If {{WebExtAPIRef("privacy.websites")}}.resistFingerprinting is true, this setting has no effect and zoom is applied on a per-tab basis.
-
- -

Browser compatibility

- -

{{Compat("webextensions.api.browserSettings")}}

- -

{{WebExtExamples("h2")}}

diff --git a/files/id/mozilla/add-ons/webextensions/api/index.html b/files/id/mozilla/add-ons/webextensions/api/index.html deleted file mode 100644 index 9b63bd59e8..0000000000 --- a/files/id/mozilla/add-ons/webextensions/api/index.html +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: JavaScript APIs -slug: Mozilla/Add-ons/WebExtensions/API -tags: - - NeedsTranslation - - TopicStub -translation_of: Mozilla/Add-ons/WebExtensions/API ---- -
{{AddonSidebar}}
- -
-

The WebExtension JavaScript APIs can be used inside the add-on's background scripts and in any browser action or page action popups that the add-on defines. A few of these APIs can also be accessed by an add-on's content scripts (see the list in the content script guide).

- -

To use the more powerful APIs you need to request permission in your add-on's manifest.json.

- -

You can access the APIs using the browser namespace:

- -
function logTabs(tabs) {
-  console.log(tabs);
-}
-
-browser.tabs.query({currentWindow: true}, logTabs);
-
- -
-

Many of the APIs are asynchronous, returning a Promise:

- -
function logCookie(c) {
-  console.log(c);
-}
-
-function logError(e) {
-  console.error(e);
-}
-
-var setCookie = browser.cookies.set(
-  {url: "https://developer.mozilla.org/"}
-);
-setCookie.then(logCookie, logError);
-
- -
-

Note that this is different from Google Chrome's extension system, which uses the chrome namespace instead of browser, and which uses callbacks instead of promises for asynchronous functions. As a porting aid, the Firefox implementation of WebExtensions supports chrome and callbacks as well as browser and promises. Mozilla has also written a polyfill which enables code that uses browser and promises to work unchanged in Chrome: https://github.com/mozilla/webextension-polyfill.

- -

Microsoft Edge uses the browser namespace, but doesn't yet support promise-based asynchronous APIs. In Edge, for the time being, asynchronous APIs must use callbacks.

- -

Not all browsers support all the APIs: for the details, see Browser support for JavaScript APIs.

-
- -
{{SubpagesWithSummaries}}
diff --git a/files/id/mozilla/add-ons/webextensions/api/notifications/index.html b/files/id/mozilla/add-ons/webextensions/api/notifications/index.html deleted file mode 100644 index 76b0e1cfe0..0000000000 --- a/files/id/mozilla/add-ons/webextensions/api/notifications/index.html +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: notifikasi -slug: Mozilla/Add-ons/WebExtensions/API/notifications -tags: - - API - - Add-ons - - Ekstensi - - Notifikasi - - WebExtensions -translation_of: Mozilla/Add-ons/WebExtensions/API/notifications -original_slug: Mozilla/Add-ons/WebExtensions/API/notifikasi ---- -
{{AddonSidebar}}
- -

Tampilkan pemberitahuan kepada pengguna, menggunakan mekanisme pemberitahuan sistem operasi yang mendasarinya. Karena API ini menggunakan mekanisme pemberitahuan sistem operasi, detail tentang bagaimana pemberitahuan muncul dan berperilaku mungkin berbeda sesuai dengan sistem operasi dan pengaturan pengguna.

- -

Untuk menggunakan API ini Anda harus memiliki izin "notifikasi"

- -

Tipe

- -
-
{{WebExtAPIRef("notifications.NotificationOptions")}}
-
Menentukan isi pemberitahuan.
-
{{WebExtAPIRef("notifications.TemplateType")}}
-
Jenis pemberitahuan. Misalnya, ini menentukan apakah pemberitahuan dapat memuat gambar.
-
- -

Fungsi

- -
-
{{WebExtAPIRef("notifications.clear()")}}
-
Hapus pemberitahuan khusus, berikan ID-nya.
-
{{WebExtAPIRef("notifications.create()")}}
-
Buat dan tampilkan pemberitahuan baru.
-
{{WebExtAPIRef("notifications.getAll()")}}
-
Dapatkan semua notifikasi.
-
{{WebExtAPIRef("notifications.update()")}}
-
Perbarui notifikasi
-
- -

Events

- -
-
{{WebExtAPIRef("notifications.onButtonClicked")}}
-
Dipecat ketika pengguna mengklik tombol di notifikasi.
-
{{WebExtAPIRef("notifications.onClicked")}}
-
Dipecat ketika pengguna mengklik pemberitahuan, tetapi tidak pada tombol.
-
{{WebExtAPIRef("notifications.onClosed")}}
-
Dipecat ketika pemberitahuan ditutup, baik oleh sistem atau karena pengguna memecatnya.
-
{{WebExtAPIRef("notifications.onShown")}}
-
Dipecat segera setelah pemberitahuan telah ditampilkan.
-
- -

Kompatibilitas peramban

- -

{{Compat("webextensions.api.notifications")}}

- -

{{WebExtExamples("h2")}}

- -
Ucapan terima kasih - -

API ini berdasarkan pada API Chromium chrome.notifications.

-
diff --git a/files/id/mozilla/add-ons/webextensions/api/windows/createtype/index.html b/files/id/mozilla/add-ons/webextensions/api/windows/createtype/index.html deleted file mode 100644 index 569dbc0b97..0000000000 --- a/files/id/mozilla/add-ons/webextensions/api/windows/createtype/index.html +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: windows.CreateType -slug: Mozilla/Add-ons/WebExtensions/API/windows/CreateType -translation_of: Mozilla/Add-ons/WebExtensions/API/windows/CreateType ---- -
{{AddonSidebar()}}
- -

Menentukan jenis browser window yang akan dibuat.

- -

Tipe

- -

Nilai dari tipe ini adalah strings. Nilai yang tersedia adalah:

- - - -

Browser compatibility

- - - -

{{Compat("webextensions.api.windows.CreateType")}}

- -

{{WebExtExamples}}

- -
Acknowledgements - -

This API is based on Chromium's chrome.windows API. This documentation is derived from windows.json in the Chromium code.

- -

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

-
- - diff --git a/files/id/mozilla/add-ons/webextensions/api/windows/index.html b/files/id/mozilla/add-ons/webextensions/api/windows/index.html deleted file mode 100644 index d0611824cd..0000000000 --- a/files/id/mozilla/add-ons/webextensions/api/windows/index.html +++ /dev/null @@ -1,127 +0,0 @@ ---- -title: windows -slug: Mozilla/Add-ons/WebExtensions/API/windows -tags: - - API - - Add-ons - - Extensions - - Interface - - NeedsTranslation - - Non-standard - - Reference - - TopicStub - - WebExtensions - - Windows -translation_of: Mozilla/Add-ons/WebExtensions/API/windows ---- -
{{AddonSidebar}}
- -

Interact with browser windows. You can use this API to get information about open windows and to open, modify, and close windows. You can also listen for window open, close, and activate events.

- -

Types

- -
-
{{WebExtAPIRef("windows.WindowType")}}
-
The type of browser window this is.
-
{{WebExtAPIRef("windows.WindowState")}}
-
The state of this browser window.
-
{{WebExtAPIRef("windows.Window")}}
-
Contains information about a browser window.
-
{{WebExtAPIRef("windows.CreateType")}}
-
Specifies the type of browser window to create.
-
- -

Properties

- -
-
{{WebExtAPIRef("windows.WINDOW_ID_NONE")}}
-
The windowId value that represents the absence of a browser window.
-
{{WebExtAPIRef("windows.WINDOW_ID_CURRENT")}}
-
The windowId value that represents the current window.
-
- -

Functions

- -
-
{{WebExtAPIRef("windows.get()")}}
-
Gets details about a window, given its ID.
-
{{WebExtAPIRef("windows.getCurrent()")}}
-
Gets the current window.
-
{{WebExtAPIRef("windows.getLastFocused()")}}
-
Gets the window that was most recently focused — typically the window 'on top'.
-
{{WebExtAPIRef("windows.getAll()")}}
-
Gets all windows.
-
{{WebExtAPIRef("windows.create()")}}
-
-

Creates a new window.

-
-
{{WebExtAPIRef("windows.update()")}}
-
Updates the properties of a window. Use this to move, resize, and (un)focus a window, etc.
-
{{WebExtAPIRef("windows.remove()")}}
-
Closes a window, and all its tabs.
-
- -

Events

- -
-
{{WebExtAPIRef("windows.onCreated")}}
-
Fired when a window is created.
-
{{WebExtAPIRef("windows.onRemoved")}}
-
Fired when a window is closed.
-
{{WebExtAPIRef("windows.onFocusChanged")}}
-
Fired when the currently focused window changes.
-
- -

Browser compatibility

- -

{{Compat("webextensions.api.windows")}}

- - - -

Edge incompatibilities

- -

Promises are not supported in Edge. Use callbacks instead.

- -

{{WebExtExamples("h2")}}

- -
Acknowledgements - -

This API is based on Chromium's chrome.windows API. This documentation is derived from windows.json in the Chromium code.

- -

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

-
- - diff --git a/files/id/mozilla/add-ons/webextensions/browser_support_for_javascript_apis/index.html b/files/id/mozilla/add-ons/webextensions/browser_support_for_javascript_apis/index.html deleted file mode 100644 index 96ab65479e..0000000000 --- a/files/id/mozilla/add-ons/webextensions/browser_support_for_javascript_apis/index.html +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: Browser support for JavaScript APIs -slug: Mozilla/Add-ons/WebExtensions/Browser_support_for_JavaScript_APIs -translation_of: Mozilla/Add-ons/WebExtensions/Browser_support_for_JavaScript_APIs ---- -
{{AddonSidebar}}
- - - -

{{WebExtAllCompatTables}}

- -
Acknowledgments - -

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

-
- -

See also

- - diff --git a/files/id/mozilla/add-ons/webextensions/content_scripts/index.html b/files/id/mozilla/add-ons/webextensions/content_scripts/index.html deleted file mode 100644 index da5a653034..0000000000 --- a/files/id/mozilla/add-ons/webextensions/content_scripts/index.html +++ /dev/null @@ -1,554 +0,0 @@ ---- -title: Content scripts -slug: Mozilla/Add-ons/WebExtensions/Content_scripts -translation_of: Mozilla/Add-ons/WebExtensions/Content_scripts ---- -
{{AddonSidebar}}
- -

A content script is a part of your extension that runs in the context of a particular web page (as opposed to background scripts which are part of the extension, or scripts which are part of the web site itself, such as those loaded using the {{HTMLElement("script")}} element).

- -

Background scripts can access all the WebExtension JavaScript APIs, but they can't directly access the content of web pages. So if your extension needs to do that, you need content scripts.

- -

Just like the scripts loaded by normal web pages, content scripts can read and modify the content of their pages using the standard DOM APIs.

- -

Content scripts can only access a small subset of the WebExtension APIs, but they can communicate with background scripts using a messaging system, and thereby indirectly access the WebExtension APIs.

- -
-

Note that content scripts are blocked on the following domains:

- - - -

If you try to inject a content script into a page in these domains, it fails and the page logs a CSP error.

- -

Because these restrictions include addons.mozilla.org, users may attempt to use your extension immediately after installation—only to find that it doesn't work! You may want to add an appropriate warning, or an onboarding page to move users away from addons.mozilla.org.

-
- -
-

Values added to the global scope of a content script with let foo or window.foo = "bar" may disappear due to bug 1408996.

-
- -

Loading content scripts

- -

You can load a content script into a web page in one of three ways:

- -
    -
  1. -
    -
    At install time, into pages that match URL patterns.
    -
    Using the content_scripts key in your manifest.json, you can ask the browser to load a content script whenever the browser loads a page whose URL matches a given pattern.
    -
    -
  2. -
  3. -
    -
    At runtime, into pages that match URL patterns.
    -
    Using the {{WebExtAPIRef("contentScripts")}} API, you can ask the browser to load a content script whenever the browser loads a page whose URL matches a given pattern. (This is similar to method 1, except that you can add and remove content scripts at runtime.)
    -
    -
  4. -
  5. -
    -
    At runtime, into specific tabs.
    -
    Using the tabs.executeScript() API, you can load a content script into a specific tab whenever you want. (For example, in response to the user clicking on a browser action.)
    -
    -
  6. -
- -

There is only one global scope per frame, per extension. This means that variables from one content script can directly be accessed by another content script, regardless of how the content script was loaded.

- -

Using methods (1) and (2), you can only load scripts into pages whose URLs can be represented using a match pattern.

- -

Using method (3), you can also load scripts into pages packaged with your extension, but you can't load scripts into privileged browser pages (like "about:debugging" or "about:addons").

- -

Content script environment

- -

DOM access

- -

Content scripts can access and modify the page's DOM, just like normal page scripts can. They can also see any changes that were made to the DOM by page scripts.

- -

However, content scripts get a "clean" view of the DOM. This means:

- - - -

In Firefox, this behavior is called Xray vision.

- -

Consider a web page like this:

- -
<!DOCTYPE html>
-<html>
-  <head>
-    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
-  </head>
-
-  <body>
-    <script src="page-scripts/page-script.js"></script>
-  </body>
-</html>
- -

The script page-script.js does this:

- -
// page-script.js
-
-// add a new element to the DOM
-let p = document.createElement("p");
-p.textContent = "This paragraph was added by a page script.";
-p.setAttribute("id", "page-script-para");
-document.body.appendChild(p);
-
-// define a new property on the window
-window.foo = "This global variable was added by a page script";
-
-// redefine the built-in window.confirm() function
-window.confirm = function() {
-  alert("The page script has also redefined 'confirm'");
-}
- -

Now an extension injects a content script into the page:

- -
// content-script.js
-
-// can access and modify the DOM
-let pageScriptPara = document.getElementById("page-script-para");
-pageScriptPara.style.backgroundColor = "blue";
-
-// can't see page-script-added properties
-console.log(window.foo);  // undefined
-
-// sees the original form of redefined properties
-window.confirm("Are you sure?"); // calls the original window.confirm()
- -

The same is true in reverse; page scripts cannot see JavaScript properties added by content scripts.

- -

This means that content scripts can rely on DOM properties behaving predictably, without worrying about its variables clashing with variables from the page script.

- -

One practical consequence of this behavior is that a content script doesn't have access to any JavaScript libraries loaded by the page. So, for example, if the page includes jQuery, the content script can't see it.

- -

If a content script needs to use a JavaScript library, then the library itself should be injected as a content script alongside the content script that wants to use it:

- -
"content_scripts": [
-  {
-    "matches": ["*://*.mozilla.org/*"],
-    "js": ["jquery.js", "content-script.js"]
-  }
-]
- -
-

Note: Firefox does provide some APIs that enable content scripts to access JavaScript objects created by page scripts, and to expose their own JavaScript objects to page scripts.

- -

See Sharing objects with page scripts for more details.

-
- -

WebExtension APIs

- -

In addition to the standard DOM APIs, content scripts can use the following WebExtension APIs:

- -
-
From extension:
-
- -
-
From runtime:
-
- -
-
From i18n:
-
- -
-
From menus:
-
- -
-
Everything from:
-
storage
-
- -

XHR and Fetch

- -

Content scripts can make requests using the normal window.XMLHttpRequest and window.fetch() APIs.

- -
-

In Firefox, content script requests (for example, using fetch()) happen in the context of an extension, so you must provide an absolute URL to reference page content.

- -

In Chrome, these requests happen in context of the page, so they are made to a relative URL.  For example, /api is sent to https://«current page URL»/api.

-
- -

Content scripts get the same cross-domain privileges as the rest of the extension: so if the extension has requested cross-domain access for a domain using the permissions key in manifest.json, then its content scripts get access that domain as well.

- -

This is accomplished by exposing more privileged XHR and fetch instances in the content script, which has the side-effect of not setting the Origin and Referer headers like a request from the page itself would; this is often preferable to prevent the request from revealing its cross-origin nature.

- -
-

In Firefox, extensions that need to perform requests that behave as if they were sent by the content itself can use  content.XMLHttpRequest and content.fetch() instead.

- -

For cross-browser extensions, the presence of these methods must be feature-detected.

-
- -

Communicating with background scripts

- -

Although content scripts can't directly use most of the WebExtension APIs, they can communicate with the extension's background scripts using the messaging APIs, and can therefore indirectly access all the same APIs that the background scripts can.

- -

There are two basic patterns for communicating between the background scripts and content scripts:

- - - -

One-off messages

- -

To send one-off messages, with an optional response, you can use the following APIs:

- - - - - - - - - - - - - - - - - - - - - -
In content scriptIn background script
Send a messagebrowser.runtime.sendMessage()browser.tabs.sendMessage()
Receive a messagebrowser.runtime.onMessagebrowser.runtime.onMessage
- -

For example, here's a content script that listens for click events in the web page.

- -

If the click was on a link, it sends a message to the background page with the target URL:

- -
// content-script.js
-
-window.addEventListener("click", notifyExtension);
-
-function notifyExtension(e) {
-  if (e.target.tagName != "A") {
-    return;
-  }
-  browser.runtime.sendMessage({"url": e.target.href});
-}
- -

The background script listens for these messages and displays a notification using the notifications API:

- -
// background-script.js
-
-browser.runtime.onMessage.addListener(notify);
-
-function notify(message) {
-  browser.notifications.create({
-    "type": "basic",
-    "iconUrl": browser.extension.getURL("link.png"),
-    "title": "You clicked a link!",
-    "message": message.url
-  });
-}
-
- -

(This example code is lightly adapted from the notify-link-clicks-i18n example on GitHub.)

- -

Connection-based messaging

- -

Sending one-off messages can get cumbersome if you are exchanging a lot of messages between a background script and a content script. So an alternative pattern is to establish a longer-lived connection between the two contexts, and use this connection to exchange messages.

- -

Both sides have a runtime.Port object, which they can use to exchange messages.

- -

To create the connection:

- - - -

This returns a runtime.Port object.

- - - -

Once each side has a port, the two sides can:

- - - -

For example, as soon as it loads, the following content script:

- - - -
// content-script.js
-
-let myPort = browser.runtime.connect({name:"port-from-cs"});
-myPort.postMessage({greeting: "hello from content script"});
-
-myPort.onMessage.addListener(function(m) {
-  console.log("In content script, received message from background script: ");
-  console.log(m.greeting);
-});
-
-document.body.addEventListener("click", function() {
-  myPort.postMessage({greeting: "they clicked the page!"});
-});
- -

The corresponding background script:

- - - -
// background-script.js
-
-let portFromCS;
-
-function connected(p) {
-  portFromCS = p;
-  portFromCS.postMessage({greeting: "hi there content script!"});
-  portFromCS.onMessage.addListener(function(m) {
-    portFromCS.postMessage({greeting: "In background script, received message from content script:" + m.greeting});
-  });
-}
-
-browser.runtime.onConnect.addListener(connected);
-
-browser.browserAction.onClicked.addListener(function() {
-  portFromCS.postMessage({greeting: "they clicked the button!"});
-});
-
- -

Multiple content scripts

- -

If you have multiple content scripts communicating at the same time, you might want to store connections to them in an array.

- - - -
// background-script.js
-
-let ports = []
-
-function connected(p) {
-  ports[p.sender.tab.id] = p
-  //...
-}
-
-browser.runtime.onConnect.addListener(connected)
-
-browser.browserAction.onClicked.addListener(function() {
-  ports.forEach( p => {
-        p.postMessage({greeting: "they clicked the button!"})
-    })
-});
-
- - - -

Choosing between one-off messages and connection-based messaging

- -

The choice between one-off and connection-based messaging depends on how your extension expects to make use of messaging.

- -

The recommended best practices are:

- -
-
Use one-off messages when…
-
-
    -
  • Only one response is expected to a message.
  • -
  • A small number of scripts listen to receive messages ({{WebExtAPIRef("runtime.onMessage")}} calls).
  • -
-
-
Use connection-based messaging when…
-
-
    -
  • Scripts engage in sessions where multiple messages are exchanged.
  • -
  • The extension need to know about task progress, needs to know if a task is interrupted, or may want to interrupt a task initiated using messaging.
  • -
-
-
- -

Communicating with the web page

- -

By default, content scripts don't get access to objects created by page scripts. However, they can communicate with page scripts using the DOM window.postMessage and window.addEventListener APIs.

- -

For example:

- -
// page-script.js
-
-let messenger = document.getElementById("from-page-script");
-
-messenger.addEventListener("click", messageContentScript);
-
-function messageContentScript() {
-  window.postMessage({
-    direction: "from-page-script",
-    message: "Message from the page"
-  }, "*");
-}
-
- -
// content-script.js
-
-window.addEventListener("message", function(event) {
-  if (event.source == window &&
-      event.data &&
-      event.data.direction == "from-page-script") {
-    alert("Content script received message: \"" + event.data.message + "\"");
-  }
-});
- -

For a complete working example of this, visit the demo page on GitHub and follow the instructions.

- -
-

Be very careful when interacting with untrusted web content in this manner! Extensions are privileged code which can have powerful capabilities and hostile web pages can easily trick them into accessing those capabilities.

- -

To give a trivial example, suppose the content script code that receives the message does something like this:

- -
// content-script.js
-
-window.addEventListener("message", function(event) {
-  if (event.source == window &&
-      event.data.direction   &&
-      event.data.direction == "from-page-script") {
-    eval(event.data.message);
-  }
-});
- -

Now the page script can run any code with all the privileges of the content script.

-
- -

Using eval() in content scripts

- -
-
In Chrome
-
{{jsxref("eval")}} always runs code in the context of the content script, not in the context of the page.
-
In Firefox
-
-

If you call eval(), it runs code in the context of the content script.

- -

If you call window.eval(), it runs code in the context of the page.

-
-
- -

For example, consider a content script like this:

- -
// content-script.js
-
-window.eval('window.x = 1;');
-eval('window.y = 2');
-
-console.log(`In content script, window.x: ${window.x}`);
-console.log(`In content script, window.y: ${window.y}`);
-
-window.postMessage({
-  message: "check"
-}, "*");
- -

This code just creates some variables x and y using window.eval() and eval(),  logs their values, and then messages the page.

- -

On receiving the message, the page script logs the same variables:

- -
window.addEventListener("message", function(event) {
-  if (event.source === window && event.data && event.data.message === "check") {
-    console.log(`In page script, window.x: ${window.x}`);
-    console.log(`In page script, window.y: ${window.y}`);
-  }
-});
- -
-
In Chrome, this produces output like this:
-
-
In content script, window.x: 1
-In content script, window.y: 2
-In page script, window.x: undefined
-In page script, window.y: undefined
-
-
In Firefox, this produces output like this:
-
-
In content script, window.x: undefined
-In content script, window.y: 2
-In page script, window.x: 1
-In page script, window.y: undefined
-
-
- -

The same applies to setTimeout(), setInterval(), and Function().

- -
-

Be very careful when running code in the context of the page! 

- -

The page's environment is controlled by potentially malicious web pages, which can redefine objects you interact with to behave in unexpected ways:

- -
// page.js redefines console.log
-
-let original = console.log;
-
-console.log = function() {
-  original(true);
-}
-
- - -
// content-script.js calls the redefined version
-
-window.eval('console.log(false)');
-
-
diff --git a/files/id/mozilla/add-ons/webextensions/index.html b/files/id/mozilla/add-ons/webextensions/index.html deleted file mode 100644 index a486f8391c..0000000000 --- a/files/id/mozilla/add-ons/webextensions/index.html +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: WebExtensions -slug: Mozilla/Add-ons/WebExtensions -tags: - - NeedsTranslation - - TopicStub -translation_of: Mozilla/Add-ons/WebExtensions ---- -
{{AddonSidebar}}
- -

WebExtensions adalah sistem cross-browser untuk mengembangkan browser add-ons. Untuk sebagian besar API tersebut kompatibel dengan extension API yang didukung oleh Google Chrome dan Opera. Ekstensi ditulis untuk browser ini dalam banyak kasus akan berjalan di Firefox atau Microsoft Edge hanya dengan beberapa perubahan. API ini juga sepenuhnya kompatibel dengan multiprocess Firefox.

- -

Kami juga berniat untuk memperpanjang API untuk mendukung kebutuhan para pengembang, jadi jika Anda memiliki ide, kami akan senang mendengar mereka. Anda dapat menghubungi kami dev-addons mailing list atau #webextensions di IRC.

- -
- - -
-

Reference

- - - -

JavaScript APIs

- -
{{ ListSubpages ("/en-US/Add-ons/WebExtensions/API") }}
- -

Manifest keys

- -
{{ ListSubpages ("/en-US/Add-ons/WebExtensions/manifest.json") }}
-
-
diff --git a/files/id/mozilla/add-ons/webextensions/what_are_webextensions/index.html b/files/id/mozilla/add-ons/webextensions/what_are_webextensions/index.html deleted file mode 100644 index 917d65c274..0000000000 --- a/files/id/mozilla/add-ons/webextensions/what_are_webextensions/index.html +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: Apa itu WebExtensions? -slug: Mozilla/Add-ons/WebExtensions/What_are_WebExtensions -translation_of: Mozilla/Add-ons/WebExtensions/What_are_WebExtensions -original_slug: Mozilla/Add-ons/WebExtensions/Apa_Itu_WebExtensions ---- -
{{AddonSidebar}}
- -

Add-ons memperluas dan memodifikasi fungsi dari web browser. Mereka ditulis menggunakan teknologi Web standar - JavaScript, HTML, dan CSS - ditambah beberapa API JavaScript. Antara lain, add-ons dapat menambahkan fitur baru untuk browser atau mengubah tampilan atau konten dari situs web tertentu.

- -

WebExtensions adalah sistem cross-browser untuk mengembangkan browser add-ons. Untuk sebagian besar API tersebut kompatibel dengan ekstensi API yang didukung oleh Google Chrome dan Opera. Ekstensi ditulis untuk browser ini dalam banyak kasus akan berjalan di Firefox atau Microsoft Edge hanya dengan beberapa perubahan. API ini juga sepenuhnya kompatibel dengan multiprocess Firefox.

- -

Kami juga berniat untuk memperpanjang API untuk mendukung kebutuhan para pengembang, jadi jika Anda memiliki ide, kami akan senang mendengar mereka. Anda dapat menghubungi kami dev-addons mailing list atau #webextensions di IRC.

- -

Sebelum WebExtensions, Anda bisa mengembangkan Firefox add-ons menggunakan salah satu dari tiga sistem yang berbeda: XUL/XPCOM overlays, bootstrapped extensions, atau Add-on SDK. Di masa depan, WebExtensions akan menjadi cara yang direkomendasikan untuk mengembangkan add-ons pada Firefox, dan sistem lainnya akan dihentikan.

- -

Apa berikutnya?

- - diff --git a/files/id/mozilla/add-ons/webextensions/your_first_webextension/index.html b/files/id/mozilla/add-ons/webextensions/your_first_webextension/index.html deleted file mode 100644 index 27204f8504..0000000000 --- a/files/id/mozilla/add-ons/webextensions/your_first_webextension/index.html +++ /dev/null @@ -1,153 +0,0 @@ ---- -title: WebExtensions Pertama Anda -slug: Mozilla/Add-ons/WebExtensions/Your_first_WebExtension -translation_of: Mozilla/Add-ons/WebExtensions/Your_first_WebExtension ---- -
{{AddonSidebar}}
- -

Dalam artikel ini kita akan mulai menciptakan WebExtension untuk Firefox, dari awal sampai akhir. add-on ini hanya menambahkan garis merah untuk setiap halaman yang dimuat dari "mozilla.org" atau subdomainnya.

- -

Kode sumber untuk contoh ini ada pada GitHub: https://github.com/mdn/webextensions-examples/tree/master/borderify.

- -

Pertama, anda membutuhkan Firefox versi 45 atau lebih baru.

- - - -

Buat sebuah directory baru dan arahkan kesana:

- -
mkdir borderify
-cd borderify
- -

manifest.json

- -

Sekarang buat file baru dengan nama "manifest.json" di dalam folder "borderify". Berikan kode seperti berikut:

- -
{
-
-  "manifest_version": 2,
-  "name": "Borderify",
-  "version": "1.0",
-
-  "description": "Adds a red border to all webpages matching mozilla.org.",
-
-  "icons": {
-    "48": "icons/border-48.png"
-  },
-
-  "content_scripts": [
-    {
-      "matches": ["*://*.mozilla.org/*"],
-      "js": ["borderify.js"]
-    }
-  ]
-
-}
- - - -

Kunci yang paling menarik di sini adalah content_scripts, yang memberitahu Firefox untuk memuat script ke Halaman web dengan URL yang cocok dengan pola tertentu. Dalam hal ini, Kita akan meminta Firefox untuk memuat script yang di disebut "borderify.js" ke semua halaman HTTP atau HTTPS yang disajikan dari "mozilla.org" atau subdomainnya.

- - - -
-

Jika anda menggunakan Firefox versi 48 kebawah, Anda juga akan memerlukan key tambahan yang disebut applications:

- -
"applications": {
-  "gecko": {
-    "id": "borderify@example.com",
-    "strict_min_version": "42.0",
-    "strict_max_version": "50.*",
-    "update_url": "https://example.com/updates.json"
-  }
-}
-
- -

icons/border-48.png

- -

Add-on harus memiliki ikon. Ini akan ditampilkan di sebelah list add-on di Add-ons Manager. Manifest.json menjanjikan bahwa kita akan memiliki ikon di "icons/border-48.png".

- -

Membuat sebuah folder "ikon" pada folder "borderify". Simpan ikon dengan nama "border-48.png".  Anda dapat menggunakan salah satu dari contoh kami, yang diambil dari ikon Google Material Design iconset, dan digunakan di bawah ketentuan lisensi Creative Commons Attribution-ShareAlike.

- -

Jika Anda memilih untuk menggunakan ikon Anda sendiri, itu harus berukuran 48x48 pixel. Anda juga bisa menggunakan ikon 96x96 pixel, untuk display resolusi tinggi, dan jika Anda melakukan hal ini akan ditentukan property 96 milik ikon objek di manifest.json:

- -
"icons": {
-  "48": "icons/border-48.png",
-  "96": "icons/border-96.png"
-}
- -

Atau, Anda bisa menggunakan file SVG, dan itu akan ditingkatkan dengan benar.

- - - -

borderify.js

- -

Akhirnya, buat file dengan nama "borderify.js" pada folder "borderify". Berikan kode seperti berikut:

- -
document.body.style.border = "5px solid red";
- -

Script ini akan dimuat ke dalam halaman yang cocok dengan pola yang diberikan dalam key content_scripts pada manifest.json. Script memiliki akses langsung ke dokumen, seperti script dimuat oleh halaman itu sendiri.

- - - -

Trying it out

- -

Pertama, periksa bahwa Anda memiliki file yang tepat di tempat yang tepat:

- -
borderify/
-    icons/
-        border-48.png
-    borderify.js
-    manifest.json
- -

Pemasangan

- -

Buka "about:debugging" di Firefox, klik "Load Temporary Add-on" dan pilih file pada folder add-on anda:

- -

{{EmbedYouTube("cer9EUKegG4")}}

- -

Add-on kini akan diinstal, dan akan tetap sampai Anda me-restart Firefox.

- -

Atau, Anda dapat menjalankan WebExtension dari baris perintah menggunakan web-ext tool.

- -

Testing

- -

Sekarang coba kunjungi halaman dengan domain "mozilla.org", dan Anda akan melihat garis merah melingkar pada halaman:

- -

{{EmbedYouTube("rxBQl2Z9IBQ")}}

- -
-

Jangan mencobanya pada addons.mozilla.org! skrip konten saat ini diblokir pada domain tersebut..

-
- -

Coba bereksperimen sedikit. Edit script konten untuk mengubah warna garis, atau melakukan sesuatu yang lain untuk konten halaman. Simpan script konten, kemudian muat kembali file add-on dengan mengklik button "Reload" pada about:debugging. Anda dapat melihat perubahan segera.

- -

{{EmbedYouTube("NuajE60jfGY")}}

- - - -

Packaging dan publishing

- -

Bagi orang lain yang akan untuk menggunakan add-on, Anda perlu memaketkan itu dan mengirimkannya ke Mozilla untuk penandaan. Untuk mempelajari lebih lanjut tentang itu, lihat "Publishing your WebExtension".

- -

Apa berikutnya?

- -

Sekarang Anda punya ide dari proses pengembangan WebExtension untuk Firefox, coba:

- - diff --git a/files/id/mozilla/firefox/index.html b/files/id/mozilla/firefox/index.html deleted file mode 100644 index cf3e7acc66..0000000000 --- a/files/id/mozilla/firefox/index.html +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: Firefox -slug: Mozilla/Firefox -tags: - - Firefox - - Landing - - Mozilla -translation_of: Mozilla/Firefox ---- -
{{FirefoxSidebar}}
- -

Firefox adalah peramban populer milik Mozilla, tersedia untuk berbagai platforms, termasuk Windows, Mac OS X dan Linux pada desktop dan perangkat mobile Android. Dengan kompatibilitas luas, teknologi Web terbaru dan alat pengembangan yang kuat, Firefox adalah yang terbesar untuk pengguna dan pengembang web.

- -

Firefox adalah sebuah proyek open sorce, sebagian besar kode ini disumbangkan oleh komunitas besar relawan kami. Di sini Anda akan belajar cara untuk berkontribusi pada proyek Firefox dan Anda juga akan menemukan link ke informasi tentang pembuatan add-ons Firefox, memakai alat pengembang Firefox, dan tugas lainnya.

- -
-

Pelajari cara membuat add-ons Firefox, cara mengembangkan dan membuat Firefox sendiri, dan cara internal dari Firefox dan subproyek-nya bekerja.

-
- - - -

- -

Channel Firefox

- -

Firefox tersedia dalam lima channel.

- -

Firefox Nightly

- -

Each night we build Firefox from the latest code in mozilla-central. These builds are for Firefox developers or those who want to try out the very latest cutting edge features while they're still under active development.

- -

Download Firefox Nightly

- -

Firefox Developer Edition

- -

This is a version of Firefox tailored for developers. Every six weeks, we take the features in Firefox Nightly that are stable enough and create a new version of Firefox Developer Edition. We also add some extra features for developers that are only available in this channel.

- -

Learn more about Firefox Developer Edition.

- -

Download Firefox Developer Edition

- -

Firefox Beta

- -

After spending six weeks in Firefox Developer Edition, we take the features that are stable enough, and create a new version of Firefox Beta. Firefox Beta builds are for Firefox enthusiasts to test what's destined to become the next released Firefox version.

- -

Download Firefox Beta

- -

Firefox

- -

After stabilizing for another six weeks in Beta, we're ready to ship the new features to hundreds of millions of users in a new release version of Firefox.

- -

Download Firefox

- -

Firefox Extended Support Release (ESR)

- -

Firefox ESR is the long-term support edition of Firefox for desktop for use by organizations including schools, universities, businesses and others who need extended support for mass deployments.

- -

Learn more about Firefox Extended Support Release.

- -

Download Firefox ESR

- -

Firefox profiles

- -

If you find yourself using multiple Firefox channels—or just multiple configurations—on a regular basis, you should read how to use multiple Firefox profiles by turning Firefox's Profile Manager and other profile management tools to your advantage.

diff --git a/files/id/mozilla/firefox/releases/index.html b/files/id/mozilla/firefox/releases/index.html deleted file mode 100644 index af6a0b7c7a..0000000000 --- a/files/id/mozilla/firefox/releases/index.html +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Firefox developer release notes -slug: Mozilla/Firefox/Releases -tags: - - Firefox - - NeedsTranslation - - TopicStub -translation_of: Mozilla/Firefox/Releases ---- -
{{FirefoxSidebar}}

Dibawah ini anda bisa menemukan link ke catatan rilis pengembang untuk setiap rilis Firefox. Catatan yang ditulis dengan cinta ini memberikan detail tentang fitur dan API yang ditambahkan dan di tingkatkan serta bug yang disingkirkan pada setiap versi Firefox. Semuanya ditulis untuk memberikan informasi yang diperlukan oleh pengembang. Terima kasih.

- -
{{ListSubpages("",1,1,1)}}
diff --git a/files/id/mozilla/index.html b/files/id/mozilla/index.html deleted file mode 100644 index ecbabce71c..0000000000 --- a/files/id/mozilla/index.html +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Mozilla -slug: Mozilla -tags: - - NeedsTranslation - - TopicStub -translation_of: Mozilla ---- -
- {{draft}}
-

This will soon be an awesome landing page for Mozilla internals. For now, it's not.

-
- {{LandingPageListSubpages}}
-- cgit v1.2.3-54-g00ecf