Skip to content

Commit

Permalink
Sort the list by execution order when one of the execution order cont…
Browse files Browse the repository at this point in the history
…ext menu it

ems is selected. Closes #1219
  • Loading branch information
sizzlemctwizzle authored and arantius committed May 17, 2011
1 parent 38406e1 commit 428021d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions content/addons4-overlay.js
Expand Up @@ -62,6 +62,12 @@ function addonIsInstalledScript(aAddon) {
return true;
};

function sortedByExecOrder() {
return document.getElementById('greasemonkey-sort-bar')
.getElementsByAttribute('sortBy', 'executionIndex')[0]
.hasAttribute('checkState');
};

function init() {
GM_getConfig().addObserver(observer);

Expand Down Expand Up @@ -168,7 +174,17 @@ function onViewChanged(aEvent) {
}
};

function selectScriptExecOrder() {
if (sortedByExecOrder()) return;

var button = document.getElementById('greasemonkey-sort-bar')
.getElementsByAttribute('sortBy', 'executionIndex')[0];
// Sort the script list by execution order
onSortersClicked({'target': button});
};

function reorderScriptExecution(aAddon, moveBy) {
selectScriptExecOrder();
GM_getConfig().move(aAddon._script, moveBy);
AddonManager.getAddonsByTypes(['user-script'], function(aAddons) {
// Fix all the 'executionOrder' attributes.
Expand Down

0 comments on commit 428021d

Please sign in to comment.