Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dist/options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
<label>Search in URLs:</label>
<div id="option-search-urls" class="ui-switch"></div>
</div>
<div class="option">
<label>Show most recent tabs at top:</label>
<div id="option-show-most-recent-top" class="ui-switch"></div>
</div>
</div>
<div id="about" class="section">
<label>About</label>
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/options/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function readOptions() {
setSubOptionState(options.popup.showDetails, document.getElementById("option-preview").parentElement);
setSwitchState(document.getElementById("option-hide-after-tab-switch"), options.popup.hideAfterTabSelection);
setSwitchState(document.getElementById("option-search-urls"), options.popup.searchInURLs);
setSwitchState(document.getElementById("option-show-most-recent-top"), options.popup.sortByLastAccessed);
});
}

Expand Down Expand Up @@ -118,6 +119,13 @@ function addEventListeners() {
browser.storage.local.set(data);
});
});

document.getElementById("option-show-most-recent-top").addEventListener("input", e => {
browser.storage.local.get(["options"]).then(data => {
data.options.popup.sortByLastAccessed = getSwitchState(e.target);
browser.storage.local.set(data);
});
});
}

function main() {
Expand Down
3 changes: 2 additions & 1 deletion src/popup/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const globals = {
tabsList: undefined,
isSelecting: false,
hideAfterTabSelection: undefined,
searchInURLs: undefined
searchInURLs: undefined,
sortByLastAccessed: undefined
};
export default globals;
4 changes: 3 additions & 1 deletion src/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ async function fulfillOptions() {
G.hideAfterTabSelection = Options.stbool(popupOptions.hideAfterTabSelection);
// popup.searchInURLs
G.searchInURLs = Options.stbool(popupOptions.searchInURLs);
// popup.sortByLastAccessed
G.sortByLastAccessed = Options.stbool(popupOptions.sortByLastAccessed);
}

async function main() {
Expand Down Expand Up @@ -151,4 +153,4 @@ function generalSetup() {

// Tell background script that everything is loaded now
sendRuntimeMessage("INIT__POPUP_LOADED", {});
}
}
3 changes: 3 additions & 0 deletions src/popup/wtinit.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ export async function updateTabs(windows) {

let windowTabsListFragment = document.createDocumentFragment();
// Loop through tabs
if(G.sortByLastAccessed){
w.tabs.sort((a,b)=>a.lastAccessed < b.lastAccessed)
}
for (let i = 0; i < w.tabs.length; i++) {
let tab = w.tabs[i];
// Check tab id
Expand Down