Popup: display enabled styles first
Optionally sort enabled styles before disabled styles in the popup menu. Preference `localStorage['popup.enabledFirst']` controls the behavior; default is 'true'.
This commit is contained in:
parent
110c31d495
commit
f8600c2fb3
6
popup.js
6
popup.js
|
@ -52,7 +52,11 @@ chrome.tabs.getSelected(null, function(tab) {
|
|||
});
|
||||
|
||||
function showStyles(styles) {
|
||||
styles.sort(function(a, b) { return a.name.localeCompare(b.name)});
|
||||
var enabledFirst = localStorage["popup.enabledFirst"] !== "false";
|
||||
styles.sort(function(a, b) {
|
||||
if (enabledFirst && a.enabled !== b.enabled) return !(a.enabled < b.enabled) ? -1 : 1;
|
||||
return a.name.localeCompare(b.name);
|
||||
});
|
||||
var installed = document.getElementById("installed");
|
||||
if (styles.length == 0) {
|
||||
installed.innerHTML = "<div class='entry' id='no-styles'>" + t('noStylesForSite') + "</div>";
|
||||
|
|
Loading…
Reference in New Issue
Block a user