thedewil / rutorrent-tadd-labels

Automatically exported from code.google.com/p/rutorrent-tadd-labels
0 stars 0 forks source link

Labels not sorted properly #2

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
It appears labels are not sorted properly, and this sometimes causes sublabels 
to appear above their parent.

I fixed the code like this (don't have an actual diff atm, but you should be 
able to figure out where it goes).  I basically just added back in the sorting 
that rutorrent's native loadLabels function does.

plugin.loadLabels = theWebUI.loadLabels;
theWebUI.loadLabels = function(d)
{
        if (plugin.enabled)
        {
                var p = $("#lbll");
                var subArray = [];
                var temp = new Array();
                var keys = new Array();
                for(var lbl in d)
                        keys.push(lbl);
                keys.sort();

                for(var i=0; i<keys.length; i++)
                {
                        var lbl = keys[i];
                        this.labels["-_-_-" + lbl + "-_-_-"] = d[lbl];
                        this.cLabels[lbl] = 1;
                        temp["-_-_-" + lbl + "-_-_-"] = true;
                        if(!$$("-_-_-" + lbl + "-_-_-"))
                        {

Original issue reported on code.google.com by gr...@emsley.ca on 1 Sep 2011 at 4:30

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I am attaching a patch of the suggested fix. I confirm this fixes the sort 
issue.

Could you please review and commit?

Thanks

Original comment by guilla...@alaux.net on 15 Jun 2014 at 6:46

Attachments:

GoogleCodeExporter commented 8 years ago
Can I ask where this patch should be applied, please?

Original comment by CraigDun...@gmail.com on 7 Jan 2015 at 4:26

GoogleCodeExporter commented 8 years ago
I'm presuming it is in the init.js file but I'm afraid my javascript knowledge 
sucks! Do I just add it in at the bottom or does it replace a section?
Many thanks!

Original comment by CraigDun...@gmail.com on 7 Jan 2015 at 4:33