From 191ea113118ae81afc38b08367ee08f06a6131c2 Mon Sep 17 00:00:00 2001 From: wbamberg Date: Tue, 9 May 2017 15:57:19 -0700 Subject: [PATCH] Add examples of differen window types (#217) --- window-manipulator/window.html | 9 ++++++-- window-manipulator/window.js | 38 ++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/window-manipulator/window.html b/window-manipulator/window.html index 8faa3ad..c1ba472 100644 --- a/window-manipulator/window.html +++ b/window-manipulator/window.html @@ -13,16 +13,21 @@ Resize window to 768x1024
+ Resize all windows to 1024x768
Minimize
Create new incognito window
- Remove active window
+ Create normal window
+ Create panel
+ Create detached panel
+ Create popup
- Resize all windows to 1024x768
+ Remove active window
+ diff --git a/window-manipulator/window.js b/window-manipulator/window.js index 8e0b9ba..d6e36eb 100644 --- a/window-manipulator/window.js +++ b/window-manipulator/window.js @@ -25,6 +25,14 @@ document.addEventListener("click", (e) => { }); } + else if (e.target.id === "window-create-normal") { + var createData = {}; + var creating = browser.windows.create(createData); + creating.then(() => { + console.log("The normal window has been created"); + }); + } + else if (e.target.id === "window-create-incognito") { var createData = { incognito: true, @@ -35,6 +43,36 @@ document.addEventListener("click", (e) => { }); } + else if (e.target.id === "window-create-panel") { + var createData = { + type: "panel", + }; + var creating = browser.windows.create(createData); + creating.then(() => { + console.log("The panel has been created"); + }); + } + + else if (e.target.id === "window-create-detached-panel") { + var createData = { + type: "detached_panel", + }; + var creating = browser.windows.create(createData); + creating.then(() => { + console.log("The detached panel has been created"); + }); + } + + else if (e.target.id === "window-create-popup") { + var createData = { + type: "popup", + }; + var creating = browser.windows.create(createData); + creating.then(() => { + console.log("The popup has been created"); + }); + } + else if (e.target.id === "window-remove") { getCurrentWindow().then((currentWindow) => { browser.windows.remove(currentWindow.id);