Skip to content

Commit

Permalink
Fix 'a' deselect when all visible tabs are already selected for when …
Browse files Browse the repository at this point in the history
…filtering is active; add options for the what's new page
  • Loading branch information
Bill13579 committed Sep 21, 2024
1 parent 1f3e885 commit c36de38
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 7 deletions.
14 changes: 14 additions & 0 deletions dist/options/options.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,18 @@ body {
.beta {
color: #ff0000;
font-weight: bold;
}

/* Option specific declarations */
#option-show-whats-new-on[data-state="update"]::after {
content: "Showing on updates";
}
#option-show-whats-new-on[data-state="major-update"]::after {
content: "Showing on major updates";
}
#option-show-whats-new-on[data-state="never"]::after {
content: "Never showing";
}
#option-show-whats-new-on {
font-size: small;
}
3 changes: 2 additions & 1 deletion dist/options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@
<span style="font-size: 15px;">
[<a target="_blank" rel="noopener"
href="https://github.com/Bill13579/tabby/wiki/3.2-The-Uwa!!-So-QoL%E2%99%AB-Update">What's
new?</a>]<br />
new?</a>]
<a id="option-show-whats-new-on" rel="noopener" href="#!"></a><br />
[<a target="_blank" rel="noopener" href="https://github.com/Bill13579/tabby/issues">Bug Report
with Github</a>]
[<a target="_blank" rel="noopener" href="https://goo.gl/forms/hdEdjHo6RPwYCiJC2">Bug Report
Expand Down
3 changes: 2 additions & 1 deletion ext-info.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
EXT_VERSION: "3.2"
EXT_VERSION: "3.2",
EXT_IS_MAJOR_RELEASE: true
};
14 changes: 10 additions & 4 deletions src/background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { TSession } from "../tapi/tsession";
import { TTabActions } from "../tapi/taction";
import LZString from "lz-string";
import { TargetBrowser } from "../polyfill";
import { resolveDefault } from "../options/exports";
import { EXT_IS_MAJOR_RELEASE } from "../../ext-info";

// import { TSession } from "tapi/tsession";

Expand All @@ -15,10 +17,14 @@ import { TargetBrowser } from "../polyfill";

browser.runtime.onInstalled.addListener(({ reason }) => {
if (reason !== "browser_update" && reason !== "chrome_update" && reason !== "shared_module_update") {
browser.tabs.create({
active: true,
url: "https://github.com/Bill13579/tabby/wiki/3.2-The-Uwa!!-So-QoL%E2%99%AB-Update"
});
$local$.fulfillOnce("option:show-whats-new-on", (showWhatsNewOn) => {
if (showWhatsNewOn === "update" || (EXT_IS_MAJOR_RELEASE && showWhatsNewOn === "major-update")) {
browser.tabs.create({
active: true,
url: "https://github.com/Bill13579/tabby/wiki/3.2-The-Uwa!!-So-QoL%E2%99%AB-Update"
});
}
}, resolveDefault("option:show-whats-new-on"));
}
});

Expand Down
1 change: 1 addition & 0 deletions src/options/exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ let defaults = {
"option:popup-custom-theme": "",
"option:popup-theme": "classic",
"option:dont-clear-search": true,
"option:show-whats-new-on": "major-update",
"option:separate-save": false
};
export function resolveDefault(optionID) {
Expand Down
23 changes: 23 additions & 0 deletions src/options/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,29 @@ $local$.fulfill("option:dont-clear-search", (dontClearSearch) => {
dontClearSearchSwitch.checked = dontClearSearch;
}, resolveDefault("option:dont-clear-search"));

//option:show-whats-new-on
$local$.fulfill("option:show-whats-new-on", (showWhatsNewOn) => {
// Get elements
let showWhatsNewOnLabel = document.querySelector("#option-show-whats-new-on");

// Set on click listener
showWhatsNewOnLabel.onclick = (evt) => {
$local$.modify("option:show-whats-new-on", (current) => {
switch (current) {
case "update":
return "major-update";
case "major-update":
return "never";
case "never":
return "update";
}
}, true);
};

// Set current values
showWhatsNewOnLabel.setAttribute("data-state", showWhatsNewOn);
}, resolveDefault("option:show-whats-new-on"));

//option:separate-save
$local$.fulfill("option:separate-save", (separateSave) => {
// Get elements
Expand Down
5 changes: 4 additions & 1 deletion src/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -1981,8 +1981,11 @@ class TUITabsList extends TUIListDataInterpret {
}
}
let allChildren = tabsList.children(tabsList.root, true);
let visibleChildrenCount = allChildren.reduce((accum, child) => accum + (
TUIList.isElementVisible(child) ? 1 : 0
), 0);
for (let child of allChildren) {
if (allChildren.length > count && TUIList.isElementVisible(child)) {
if (visibleChildrenCount > count && TUIList.isElementVisible(child)) {
processSelectCB(child, evt, "selecting", true);
} else {
processSelectCB(child, evt, "unselecting", true);
Expand Down

0 comments on commit c36de38

Please sign in to comment.