[Greasemonkey] sorting scripts

Jeremy Dunck jdunck at gmail.com
Tue Jun 20 16:00:04 EDT 2006


On 6/20/06, Bill Donnelly <donnelly at snowcrest.net> wrote:
> this is a long-standing request that has as yet to be implemented
>
> you can manually change the order in the gm_scripts/config.xml using an
> editor,
> but be careful about corruption --- save a backup copy first
>

If you just want it in the Manage screen (and don't want to wait for
someone to get around to fixing it, you can, after backing up your
profile, change
extensions\{e4a8a97b-f2ed-450b-b12d-ee082ba24781}\chrome\chromeFiles\content\manage.xul

replace the populateChooser function with this:

    function populateChooser() {
        var sortedScripts = config.scripts.slice(0,config.scripts.length);
        sortedScripts.sort(function(a,b) {
          a=a.name.toLowerCase();
          b=b.name.toLowerCase();
          if (a < b) return -1;
          if (a > b) return 1;
          return 0;
        });
        for (var i = 0, script = null; (script = sortedScripts[i]); i++) {
            var listitem = document.createElement("listitem");

            listitem.setAttribute("label", script.name);
            listitem.setAttribute("crop", "end");
            listitem.script = script;
            if (!script.enabled) {
                listitem.style.color = 'gray';
            }
            listbox.appendChild(listitem);
        }
    }


That's purely cosmetic and not more than superficially tested.


More information about the Greasemonkey mailing list