if you guys can't tell, i'm kind of an organization fiend. thus, it's only natural that I make another plugin pertaining to labels. my previous plugin loaded all previous labels into a dropdown menu for easy access on new torrents, allowing me to easily manage a list of category/subcategory based labels. now, i'd like to nest the labels in the left column. i've developed a jquery plugin that, when initialized, encapsulates the entire category with a div, prepends a LI with the name of the category, and unwraps the group. this serves the function of automatically sorting the list into categories and adding a label. however, once the status is updated in rutorrent, the added LI disappears. this action also seems to nullify the listener on the LI's that get wrapped and unwrapped, as they do not do anything when clicked (whereas anything without subcategories can be clicked)
any ideas on how to inject this into the update mechanism/support the listeners? sorry i'm a bit new at this
this is the code:
Code:
//
// ruTorrent Nested Categorical Label-Sorter
// Version 0.1
// by thezwallrus
//
var theLbl;
var lblArray = [];
var lblExists;
var theLIs = '';
var liCheck;
var removeMe;
theWebUI.initSortLabels = function()
{
setTimeout( function() {
$('#lbll li').each( function() {
theLbl = $(this).attr("id").replace(/-_-_-/g,'');
splitLbl = theLbl.split('/');
lblExists = $.inArray(splitLbl[0], lblArray);
if (lblExists == -1) {
lblArray.push(splitLbl[0]);
};
});
$.each(lblArray, function(i, val) {
liCheck = $('#lbll li:contains(' + val + '/")').attr('id');
if ( liCheck != undefined ) {
$('#lbll li:contains(' + val + '/")').wrapAll( $('<div></div>').attr('id','-' + val) );
removeMe = $('div[id="-' + val + '"]')
$(removeMe).prepend( $('<li></li>').attr('id','+' + val).html(val) );
$(removeMe).after(removeMe.html()).remove();
};
});
}, 3000 );
plugin.markLoaded();
};
theWebUI.initSortLabels();
any ideas on how to inject this into the update mechanism/support the listeners? sorry i'm a bit new at this
this is the code:
Code:
//
// ruTorrent Nested Categorical Label-Sorter
// Version 0.1
// by thezwallrus
//
var theLbl;
var lblArray = [];
var lblExists;
var theLIs = '';
var liCheck;
var removeMe;
theWebUI.initSortLabels = function()
{
setTimeout( function() {
$('#lbll li').each( function() {
theLbl = $(this).attr("id").replace(/-_-_-/g,'');
splitLbl = theLbl.split('/');
lblExists = $.inArray(splitLbl[0], lblArray);
if (lblExists == -1) {
lblArray.push(splitLbl[0]);
};
});
$.each(lblArray, function(i, val) {
liCheck = $('#lbll li:contains(' + val + '/")').attr('id');
if ( liCheck != undefined ) {
$('#lbll li:contains(' + val + '/")').wrapAll( $('<div></div>').attr('id','-' + val) );
removeMe = $('div[id="-' + val + '"]')
$(removeMe).prepend( $('<li></li>').attr('id','+' + val).html(val) );
$(removeMe).after(removeMe.html()).remove();
};
});
}, 3000 );
plugin.markLoaded();
};
theWebUI.initSortLabels();