aboutsummaryrefslogtreecommitdiff
path: root/files/pt-pt/mozilla/add-ons/webextensions/user_interface/extension_pages
diff options
context:
space:
mode:
Diffstat (limited to 'files/pt-pt/mozilla/add-ons/webextensions/user_interface/extension_pages')
-rw-r--r--files/pt-pt/mozilla/add-ons/webextensions/user_interface/extension_pages/index.html65
1 files changed, 65 insertions, 0 deletions
diff --git a/files/pt-pt/mozilla/add-ons/webextensions/user_interface/extension_pages/index.html b/files/pt-pt/mozilla/add-ons/webextensions/user_interface/extension_pages/index.html
new file mode 100644
index 0000000000..bea67ee60c
--- /dev/null
+++ b/files/pt-pt/mozilla/add-ons/webextensions/user_interface/extension_pages/index.html
@@ -0,0 +1,65 @@
+---
+title: Páginas de extensão
+slug: Mozilla/Add-ons/WebExtensions/user_interface/Extension_pages
+translation_of: Mozilla/Add-ons/WebExtensions/user_interface/Extension_pages
+original_slug: Mozilla/Add-ons/WebExtensions/interface_do_utilizador/Paginas_de_extensão
+---
+<div>{{AddonSidebar()}}</div>
+
+<p>Pode inclur páginas html na sua extensão para fornecer formulários, ajuda, ou qualquer outro conteúdo que a sua extensão precisar.</p>
+
+<p><img alt="Example of a simple bundled page displayed as a detached panel." src="https://mdn.mozillademos.org/files/15752/bundled_page_as_panel_small.png" style="display: block; height: 216px; margin-left: auto; margin-right: auto; width: 350px;"></p>
+
+<p>These pages also get access to the same privileged JavaScript APIs that are available to your extension's background scripts.</p>
+
+<h2 id="Especificar_páginas_de_extensão">Especificar páginas de extensão</h2>
+
+<p>You can include HTML files, and their associated CSS or JavaScript files, in your extension. The files can be included in the root or organized within meaningful sub-folders.</p>
+
+<pre>/my-extension
+ /manifest.json
+ /my-page.html
+ /my-page.js</pre>
+
+<h2 id="Exibir_páginas_de_extensão">Exibir páginas de extensão</h2>
+
+<p>There are two options for displaying extension pages: {{WebExtAPIRef("windows.create()")}} and {{WebExtAPIRef("tabs.create()")}}.</p>
+
+<p>Using <code>windows.create()</code>, for example, you can open an HTML page into a detached panel (a window without the normal browser UI of address bar, bookmark bar, and alike) to create a dialog-like user experience:</p>
+
+<pre class="brush: js">var createData = {
+ type: "detached_panel",
+ url: "panel.html",
+ width: 250,
+ height: 100
+};
+var creating = browser.windows.create(createData);</pre>
+
+<p>When the window is no longer needed, it can be closed programmatically, for example, after the user clicks a button, by passing the id of the current window to {{WebExtAPIRef("windows.remove()")}}:</p>
+
+<pre class="brush: js">document.getElementById("closeme").addEventListener("click", function(){
+ var winId = browser.windows.WINDOW_ID_CURRENT;
+ var removing = browser.windows.remove(winId);
+}); </pre>
+
+<h2 id="Páginas_de_extensão_e_histório">Páginas de extensão e histório</h2>
+
+<p>By default, pages you open in this way will be stored in the user's history, just like normal web pages. If you don't want to have this behavior, use {{WebExtAPIRef("history.deleteUrl()")}} to remove the browser's record:</p>
+
+<pre class="comment-text " id="ct-4">function onVisited(historyItem) {
+ if (historyItem.url == browser.extension.getURL(myPage)) {
+ browser.history.deleteUrl({url: historyItem.url});
+ }
+}
+
+browser.history.onVisited.addListener(onVisited);</pre>
+
+<p>To use the history API, you must request the "history" <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">permission</a> in your <code><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json">manifest.json</a></code> file.</p>
+
+<h2 id="Desenho_da_página_da_Web">Desenho da página da Web</h2>
+
+<p>For details on how to design your web page's to match the style of Firefox, see the <a class="grey-90 no-underline hover-no-underline" href="https://design.firefox.com/photon/index.html">Photon Design System</a> documentation.</p>
+
+<h2 id="Exemplos">Exemplos</h2>
+
+<p>The <a class="external external-icon" href="https://github.com/mdn/webextensions-examples">webextensions-examples</a> repository on GitHub includes the <a class="external external-icon" href="https://github.com/mdn/webextensions-examples/tree/master/window-manipulator">window-manipulator</a> example, which implements several of the options for creating windows.</p>