diff --git a/Changelog b/Changelog index 0c28de594..c8797dba8 100644 --- a/Changelog +++ b/Changelog @@ -12,6 +12,7 @@ - FEATURE: Got rid of libmagick++ dependency - FEATURE: Updated Web interface to MochaUI v0.9.5 - BUGFIX: Fixed several memory leaks + - BUGFIX: WebUI is now working with IE7 * Unknown - Christophe Dumez - v1.2.1 - BUGFIX: Fixed possible crash when deleting a torrent permanently diff --git a/src/webui/scripts/client.js b/src/webui/scripts/client.js index f48df8379..2b9d61fa2 100644 --- a/src/webui/scripts/client.js +++ b/src/webui/scripts/client.js @@ -22,6 +22,9 @@ * THE SOFTWARE. */ +myTable = new dynamicTable(); +myTableUP = new dynamicTable(); + window.addEvent('domready', function(){ MochaUI.Desktop = new MochaUI.Desktop(); MochaUI.Desktop.desktop.setStyles({ @@ -34,9 +37,8 @@ window.addEvent('domready', function(){ width: '100%', height: '100%' }); - // Download list - myTable = new dynamicTable('myTable', {overCls: 'over', selectCls: 'selected', altCls: 'alt'}); - myTableUP = new dynamicTable('myTableUP', {overCls: 'over', selectCls: 'selected', altCls: 'alt'}); + myTable.setup('myTable'); + myTableUP.setup('myTableUP'); var r=0; var waiting=false; var stateToImg = function(state){ diff --git a/src/webui/scripts/dynamicTable.js b/src/webui/scripts/dynamicTable.js index 2394fef92..fe039bbf5 100644 --- a/src/webui/scripts/dynamicTable.js +++ b/src/webui/scripts/dynamicTable.js @@ -32,13 +32,11 @@ **************************************************************/ var dynamicTable = new Class ({ + + initialize: function(){ + }, - initialize: function(table, options){ - this.setOptions({ - overCls: false, - selectCls: false, - altCls: false - }, options); + setup: function(table){ this.table = $(table); this.rows = new Object(); this.cur = new Array(); @@ -47,16 +45,13 @@ var dynamicTable = new Class ({ altRow: function() { var trs = this.table.getElements('tr'); - if(this.options.altCls) - { trs.each(function(el,i){ if(i % 2){ - el.addClass(this.options.altCls); + el.addClass('alt'); }else{ - el.removeClass(this.options.altCls); + el.removeClass('alt'); } }.bind(this)); - } }, insertRow: function(id, row){ @@ -73,14 +68,12 @@ var dynamicTable = new Class ({ td.injectInside(tr); }; - if(this.options.overCls){ tr.addEvent('mouseover', function(e){ - tr.addClass(this.options.overCls); + tr.addClass('over'); }.bind(this)); tr.addEvent('mouseout', function(e){ - tr.removeClass(this.options.overCls); + tr.removeClass('over'); }.bind(this)); - } tr.addEvent('click', function(e){ e.stop(); if(e.control) { @@ -91,14 +84,14 @@ var dynamicTable = new Class ({ // Remove selected style temptr = this.rows[id]; if(temptr){ - temptr.removeClass(this.options.selectCls); + temptr.removeClass('selected'); } } else { this.cur[this.cur.length] = id; // Add selected style temptr = this.rows[id]; if(temptr){ - temptr.addClass(this.options.selectCls); + temptr.addClass('selected'); } } } else { @@ -119,7 +112,7 @@ var dynamicTable = new Class ({ // Add selected style temptr = this.rows[curID]; if(temptr){ - temptr.addClass(this.options.selectCls); + temptr.addClass('selected'); } } } else { @@ -128,14 +121,14 @@ var dynamicTable = new Class ({ for(i=0; i