diff --git a/BUILD.md b/BUILD.md index 35f4315..98d865c 100644 --- a/BUILD.md +++ b/BUILD.md @@ -1,4 +1,4 @@ -# Building Quick Tab Switcher 1.1.0 +# Building Quick Tab Switcher 1.1.1 System details: * Fedora 38 @@ -9,7 +9,7 @@ System details: # Building Complete Extension -The source code is in `./src`. It is written in TypeScript and compiled and bundled using Parcel. "webextension-polyfill-ts" is included from the npm package. +The source code is in `./src`. It is written in TypeScript and compiled and bundled using webpack. "webextension-polyfill" is included from the npm package. Run ```shell @@ -17,7 +17,7 @@ npm install npm run build:production npm run build:extension ``` -The built extension will be in `./dist` and the zipped version in `./web-ext-artifacts/quick_tab_switcher-1.1.0.zip` +The built extension will be in `./dist` and the zipped version in `./web-ext-artifacts/quick_tab_switcher-1.1.1.zip` # Live Testing Version diff --git a/CHANGELOG.md b/CHANGELOG.md index c8f63a8..c869750 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ -v1.0.1 - 2020-10-29 - * Convert extension to TypeScript - * Extension now bundled with Parcel - * Fix issue where using the arrow keys would scroll extra - * Moved help page to a PDF +v1.1.1 Changes + + +**Full Changelog**: v1.0.1...v1.1.1 diff --git a/help.fodt b/help.fodt index 1db299a..5ef59ed 100644 --- a/help.fodt +++ b/help.fodt @@ -1,10 +1,10 @@ - Joe Jarvis2020-10-26T09:59:21.9879276032023-04-23T16:16:41.243364627PT30M7S7LibreOffice/7.5.2.2$Linux_X86_64 LibreOffice_project/50$Build-2 + Joe Jarvis2020-10-26T09:59:21.9879276032023-07-25T13:54:44.518927997PT39M51S10LibreOffice/7.5.3.2$Linux_X86_64 LibreOffice_project/50$Build-2 - 97003 + 2732 0 38774 17119 @@ -13,19 +13,18 @@ view2 - 23516 - 103036 + 21886 + 6064 0 - 97003 + 2732 38772 - 114120 + 19849 0 1 false 130 false false - false false false false @@ -75,7 +74,7 @@ true false false - 707321 + 750155 true false false @@ -162,8 +161,8 @@ - - + + @@ -389,19 +388,13 @@ - - - - - - + + + - - - - - - + + + @@ -428,8 +421,10 @@ - - + + + + @@ -473,6 +468,9 @@ + + + @@ -555,7 +553,7 @@ - 2 + 5 @@ -570,7 +568,7 @@ Quick Tab Switcher Help Joe Jarvis - v1.1.0 – Updated 2023-04-23 + v1.2.0 – Updated 2023-07-25 GithubAMO @@ -660,12 +658,12 @@ Table of Contents - Basic Usage2 - Settings3 - Shortcut3 - Search3 - Recently Closed Tabs4 - UI4 + Basic Usage2 + Settings3 + Shortcut3 + Search3 + Recently Closed Tabs4 + UI4 @@ -2024,8 +2022,8 @@ Press Enter after you enter your search term to put the cursor back on the tab list. If search mode is Normal (default), it will show only the items that contain the search term. If search mode is regex, you can use regular expressions in your search terms. Here is an example of the search (RegEx mode) showing only tabs with http or https in the title or URL: - - + + iVBORw0KGgoAAAANSUhEUgAAAkAAAADoCAIAAACIKMzLAAAACXBIWXMAAA7EAAAOxAGVKw4b AAAgAElEQVR4nO3df1gTZ74w/G9ImAAlFk2qayg9oXUJLSb9YbAF1AJdEVsFt4rdVnoOi552 8amv7lLx1Vf3chfXvmDdwqGPbvsoxz1iPYp2BVoFXYFWwJaEdgliGY6WbJVhtclKGQvMkJDn @@ -2892,7 +2890,7 @@ UI You can select the theme of the extension. The light theme was shown above, here is an example of the dark theme: You can set the theme to follow your system theme preferences. If the color scheme is set to follow system, the dark theme will be used if your operating system is set to use a dark theme. Otherwise, the light theme will be used. - + iVBORw0KGgoAAAANSUhEUgAAAjkAAADxCAIAAACmrTHKAAAACXBIWXMAAA7EAAAOxAGVKw4b AAAgAElEQVR4nO3de1wTZ7o48CcXZgAZBBOlBnFDdQmKQVuDraAW6Iq0Uul661rtHhZ76tLT 1m69Ha3dY9dLj5duYd0jp/1Vj91irbW69daKWqAqWCG0GqQSKiVbJBRNBBkEZkjI749ACCE3 @@ -3219,7 +3217,7 @@ B1dUE7XhZ+/GAAAAAElFTkSuQmCC - + If the sort mode is set to “Tab Order”, the tabs will be displayed in the same order as they are in the tab bar. If sort mode is set to “Last Accessed”, the tabs will be displayed in the order they were last used (with the currently selected tab always appearing at the top). \ No newline at end of file diff --git a/package.json b/package.json index 7fa8166..9110161 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "quick-tab-switcher", - "version": "1.1.0", + "version": "1.2.0", "description": "", "main": "index.js", "scripts": { diff --git a/src/OptionsInterface.ts b/src/OptionsInterface.ts index 0019889..726490c 100644 --- a/src/OptionsInterface.ts +++ b/src/OptionsInterface.ts @@ -9,6 +9,11 @@ export enum Themes { DARK = "dark" } +export enum SortModes { + DEFAULT = "default", + LAST_ACCESSED = "lastAccessed" +} + export interface OptionsInterface { shortcut: string; searchMode: SearchModes; @@ -16,7 +21,8 @@ export interface OptionsInterface { theme: Themes; showDead: boolean; maxDead: number; - autofocusSearch: boolean + autofocusSearch: boolean; + sortMode: SortModes; } export class Options implements OptionsInterface { @@ -27,6 +33,7 @@ export class Options implements OptionsInterface { showDead: boolean; maxDead: number; autofocusSearch: boolean; + sortMode: SortModes; constructor(obj: Partial) { this.shortcut = obj.shortcut ?? "Ctrl+Shift+B"; @@ -36,5 +43,6 @@ export class Options implements OptionsInterface { this.showDead = obj.showDead ?? false; this.maxDead = obj.maxDead ?? 5; this.autofocusSearch = obj.autofocusSearch ?? false; + this.sortMode = obj.sortMode ?? SortModes.DEFAULT; } } diff --git a/src/help.pdf b/src/help.pdf index f61edfd..dcc531d 100644 Binary files a/src/help.pdf and b/src/help.pdf differ diff --git a/src/manifest.json b/src/manifest.json index df09753..d6765ba 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Quick Tab Switcher", - "version": "1.1.0", + "version": "1.2.0", "description": "A quick tab switcher for Firefox", "browser_specific_settings": { "gecko": { diff --git a/src/options/index.ts b/src/options/index.ts index a071022..9620fc4 100644 --- a/src/options/index.ts +++ b/src/options/index.ts @@ -1,6 +1,6 @@ require("./index.css"); import browser from "webextension-polyfill"; -import { Options, SearchModes, Themes } from "../OptionsInterface"; +import { Options, SearchModes, SortModes, Themes } from "../OptionsInterface"; const shortcut = document.querySelector("#shortcut") as HTMLInputElement; const searchMode = document.querySelector("#searchMode") as HTMLSelectElement; @@ -9,6 +9,7 @@ const showDead = document.querySelector("#showDead") as HTMLSelectElement; const maxDead = document.querySelector("#maxDead") as HTMLInputElement; const theme = document.querySelector("#theme") as HTMLSelectElement; const autofocusSearch = document.querySelector("#autofocusSearch") as HTMLSelectElement; +const sortMode = document.querySelector("#sortMode") as HTMLSelectElement; /** Loads from storage onto page */ async function load() { @@ -20,6 +21,7 @@ async function load() { showDead.value = res.showDead.toString(); maxDead.value = res.maxDead.toString(); autofocusSearch.value = res.autofocusSearch.toString(); + sortMode.value = res.sortMode; } /** Saves from form on page to storage */ @@ -31,7 +33,8 @@ function save() { theme: theme.value as Themes, showDead: showDead.value === "true", maxDead: Number(maxDead.value), - autofocusSearch: autofocusSearch.value === "true" + autofocusSearch: autofocusSearch.value === "true", + sortMode: sortMode.value as SortModes }); browser.storage.local.set(opt); diff --git a/src/options/options.html b/src/options/options.html index 714159a..39a2c93 100644 --- a/src/options/options.html +++ b/src/options/options.html @@ -45,13 +45,19 @@

Recently Closed Tabs

UI

-
+
Colorscheme: + + Sort Tabs +
diff --git a/src/popup/index.ts b/src/popup/index.ts index 760485a..da9c7cb 100644 --- a/src/popup/index.ts +++ b/src/popup/index.ts @@ -2,7 +2,7 @@ require("./index.css"); import browser, { Tabs } from "webextension-polyfill"; import { TabElement } from "./TabElement"; import { TabList } from "./TabList"; -import { Options, Themes } from "../OptionsInterface"; +import { Options, SortModes, Themes } from "../OptionsInterface"; /** List of tabs on the page */ let tabList: TabList; @@ -146,6 +146,9 @@ function filter(): void { } async function main(): Promise { + // get options + const res = new Options(await browser.storage.local.get()); + // hide overlay if in focus if (document.hasFocus()) { overlay.style.display = "none"; @@ -153,16 +156,17 @@ async function main(): Promise { // get tabs const tabs = await browser.tabs.query({ currentWindow: true }); + if (res.sortMode === SortModes.LAST_ACCESSED) { + tabs.sort((a, b) => { + // sort based on last accessed key for tabs + // typecast used since ts says lastAccessed could be undefined, + // but according to the docs, this isn't true! + return (b.lastAccessed as number) - (a.lastAccessed as number); + }); + } // create html elements from tab query let tabEles = tabs.map(createTabs); - // get options - const res = new Options(await browser.storage.local.get()); - - if (res.autofocusSearch) { - search.focus(); - } - if (res.showDead) { // get recently closed, with limit or unlimited if maxDead is 0 const recentlyClosed = await browser.sessions.getRecentlyClosed( @@ -198,6 +202,11 @@ async function main(): Promise { } tabList = new TabList(tabEles, res.searchMode, res.caseSensitivity); + + if (res.autofocusSearch) { + search.focus(); + tabList.getActive().setActive = false; + } } // keyboard event diff --git a/webpack.config.js b/webpack.config.js index d2bbe5d..d0774e2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -61,7 +61,8 @@ module.exports = { // toType: "dir" //}, { from: "node_modules/webextension-polyfill/dist/browser-polyfill.min.js" }, - { from: "node_modules/webextension-polyfill/dist/browser-polyfill.min.js.map" } + { from: "node_modules/webextension-polyfill/dist/browser-polyfill.min.js.map" }, + { from: "src/help.pdf" } ] }) ],