From 1fbbeae9b924f9ae43d7a0f4d6cf4f8a824c142c Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Mon, 31 Dec 2018 23:11:45 -0600 Subject: [PATCH] Update popup style sort after toggle. Closes #619 (#624) * Update popup style sort after toggle. Closes #619 * Add popup auto resort option * Switch autoResort to true by default * Refactor sorting * Fix: simplify sortStyles function * Change: autoResort=false --- _locales/en/messages.json | 4 +++ js/prefs.js | 1 + options.html | 7 ++++++ popup/popup.js | 52 +++++++++++++++++++++++---------------- 4 files changed, 43 insertions(+), 21 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 5575b2ec..3c5964f3 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1056,6 +1056,10 @@ "message": "Styles before commands", "description": "Label for the checkbox controlling section order in the popup." }, + "popupAutoResort": { + "message": "Resort styles in popup after toggling", + "description": "Label for the checkbox controlling popup resorting." + }, "prefShowBadge": { "message": "Number of styles active for the current site", "description": "Label for the checkbox controlling toolbar badge text." diff --git a/js/prefs.js b/js/prefs.js index 3e30d600..962a7ecf 100644 --- a/js/prefs.js +++ b/js/prefs.js @@ -18,6 +18,7 @@ const prefs = (() => { 'popup.breadcrumbs.usePath': false, // use URL path for 'this URL' 'popup.enabledFirst': true, // display enabled styles before disabled styles 'popup.stylesFirst': true, // display enabled styles before disabled styles + 'popup.autoResort': false, // auto resort styles after toggling 'popup.borders': false, // add white borders on the sides 'popup.findStylesInline': true, // use the inline style search diff --git a/options.html b/options.html index d20834b5..bee5654e 100644 --- a/options.html +++ b/options.html @@ -101,6 +101,13 @@ +