Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Keep a script in its execution position when reinstalling.

  • Loading branch information...
commit 222a0a7ba9a8b90d1565bdcdbaaf1efed4212326 1 parent 1e83648
@sizzlemctwizzle sizzlemctwizzle authored arantius committed
Showing with 9 additions and 3 deletions.
  1. +2 −1  content/addons.js
  2. +7 −2 content/config.js
View
3  content/addons.js
@@ -50,7 +50,8 @@ showView = function(aView) {
var observer = {
notifyEvent: function(script, event, data) {
if (event == "install") {
- var item = greasemonkeyAddons.addScriptToList(script);
+ var beforeNode = data > -1 ? gUserscriptsView.childNodes[data] : null;
+ var item = greasemonkeyAddons.addScriptToList(script, beforeNode);
if (gView == "userscripts") gUserscriptsView.selectedItem = item;
item.setAttribute('newAddon', 'true');
return;
View
9 content/config.js
@@ -263,7 +263,7 @@ Config.prototype = {
// save the old script's state
script._enabled = this._scripts[existingIndex].enabled;
- // unintall the old script
+ // uninstall the old script
this.uninstall(this._scripts[existingIndex], true);
}
@@ -287,7 +287,12 @@ Config.prototype = {
script._dependhash = GM_sha1(script._rawMeta);
this._scripts.push(script);
- this._changed(script, "install", null);
+
+ if (existingIndex > -1) {
+ this.move(script, existingIndex - this._scripts.length + 1);
+ }
+
+ this._changed(script, "install", existingIndex);
GM_log("< Config.install");
},

1 comment on commit 222a0a7

@arantius
Collaborator
Please sign in to comment.
Something went wrong with that request. Please try again.