diff --git a/tabs-tabs-tabs/manifest.json b/tabs-tabs-tabs/manifest.json
index 6877e80..6600171 100644
--- a/tabs-tabs-tabs/manifest.json
+++ b/tabs-tabs-tabs/manifest.json
@@ -6,6 +6,7 @@
}
},
"browser_action": {
+ "browser_style": true,
"default_title": "Tabs, tabs, tabs",
"default_popup": "tabs.html"
},
diff --git a/tabs-tabs-tabs/tabs.css b/tabs-tabs-tabs/tabs.css
index 8620216..959491f 100644
--- a/tabs-tabs-tabs/tabs.css
+++ b/tabs-tabs-tabs/tabs.css
@@ -1,3 +1,12 @@
html, body {
width: 350px;
}
+
+a {
+ margin: 10px;
+ display: inline-block;
+}
+
+.panel {
+ margin: 5px;
+}
diff --git a/tabs-tabs-tabs/tabs.html b/tabs-tabs-tabs/tabs.html
index afcf29a..14946e8 100644
--- a/tabs-tabs-tabs/tabs.html
+++ b/tabs-tabs-tabs/tabs.html
@@ -7,13 +7,34 @@
- Move active tab to the beginning of the window
- Move active tab to the end of the window
- Duplicate active tab
- Reload active tab
- Remove active tab
- Create a tab
- Alert active tab info
+
+
diff --git a/tabs-tabs-tabs/tabs.js b/tabs-tabs-tabs/tabs.js
index 4b09ffd..be20e26 100644
--- a/tabs-tabs-tabs/tabs.js
+++ b/tabs-tabs-tabs/tabs.js
@@ -1,3 +1,9 @@
+// Zoom constants. Define Max, Min, increment and default values
+const ZOOM_INCREMENT = 0.2;
+const MAX_ZOOM = 3;
+const MIN_ZOOM = 0.3;
+const DEFAULT_ZOOM = 1;
+
function firstUnpinnedTab(tabs) {
for (var tab of tabs) {
if (!tab.pinned) {
@@ -70,5 +76,51 @@ document.addEventListener("click", function(e) {
});
}
+ else if (e.target.id === "tabs-add-zoom") {
+ callOnActiveTab((tab) => {
+ chrome.tabs.getZoom(tab.id, function(zoomFactor){
+ //the maximum zoomFactor is 3, it can't go higher
+ if (zoomFactor >= MAX_ZOOM) {
+ alert("Tab zoom factor is already at max!");
+ } else {
+ var newZoomFactor = zoomFactor + ZOOM_INCREMENT;
+ //if the newZoomFactor is set to higher than the max accepted
+ //it won't change, and will never alert that it's at maximum
+ newZoomFactor = newZoomFactor > MAX_ZOOM ? MAX_ZOOM : newZoomFactor;
+ chrome.tabs.setZoom(tab.id, newZoomFactor);
+ }
+ });
+ });
+ }
+
+ else if (e.target.id === "tabs-decrease-zoom") {
+ callOnActiveTab((tab) => {
+ chrome.tabs.getZoom(tab.id, function(zoomFactor){
+ //the minimum zoomFactor is 0.3, it can't go lower
+ if (zoomFactor <= MIN_ZOOM) {
+ alert("Tab zoom factor is already at minimum!");
+ } else {
+ var newZoomFactor = zoomFactor - ZOOM_INCREMENT;
+ //if the newZoomFactor is set to lower than the min accepted
+ //it won't change, and will never alert that it's at minimum
+ newZoomFactor = newZoomFactor < MIN_ZOOM ? MIN_ZOOM : newZoomFactor;
+ chrome.tabs.setZoom(tab.id, newZoomFactor);
+ }
+ });
+ });
+ }
+
+ else if (e.target.id === "tabs-default-zoom") {
+ callOnActiveTab((tab) => {
+ chrome.tabs.getZoom(tab.id, function(zoomFactor){
+ if (zoomFactor == DEFAULT_ZOOM) {
+ alert("Tab zoom is already at the default zoom factor");
+ } else {
+ chrome.tabs.setZoom(tab.id, DEFAULT_ZOOM);
+ }
+ });
+ });
+ }
+
e.preventDefault();
});