Merge pull request #34 from hideheader/Enabled-styles-first
Popup: sort enabled styles first
This commit is contained in:
commit
b2bce0fa7a
6
popup.js
6
popup.js
|
@ -52,7 +52,11 @@ chrome.tabs.getSelected(null, function(tab) {
|
||||||
});
|
});
|
||||||
|
|
||||||
function showStyles(styles) {
|
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");
|
var installed = document.getElementById("installed");
|
||||||
if (styles.length == 0) {
|
if (styles.length == 0) {
|
||||||
installed.innerHTML = "<div class='entry' id='no-styles'>" + t('noStylesForSite') + "</div>";
|
installed.innerHTML = "<div class='entry' id='no-styles'>" + t('noStylesForSite') + "</div>";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user