Browse Source

- WebUI is now working for IE7

adaptive-webui-19844
Christophe Dumez 16 years ago
parent
commit
e497789ec7
  1. 1
      Changelog
  2. 8
      src/webui/scripts/client.js
  3. 41
      src/webui/scripts/dynamicTable.js

1
Changelog

@ -12,6 +12,7 @@
- FEATURE: Got rid of libmagick++ dependency - FEATURE: Got rid of libmagick++ dependency
- FEATURE: Updated Web interface to MochaUI v0.9.5 - FEATURE: Updated Web interface to MochaUI v0.9.5
- BUGFIX: Fixed several memory leaks - BUGFIX: Fixed several memory leaks
- BUGFIX: WebUI is now working with IE7
* Unknown - Christophe Dumez <chris@qbittorrent.org> - v1.2.1 * Unknown - Christophe Dumez <chris@qbittorrent.org> - v1.2.1
- BUGFIX: Fixed possible crash when deleting a torrent permanently - BUGFIX: Fixed possible crash when deleting a torrent permanently

8
src/webui/scripts/client.js

@ -22,6 +22,9 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
myTable = new dynamicTable();
myTableUP = new dynamicTable();
window.addEvent('domready', function(){ window.addEvent('domready', function(){
MochaUI.Desktop = new MochaUI.Desktop(); MochaUI.Desktop = new MochaUI.Desktop();
MochaUI.Desktop.desktop.setStyles({ MochaUI.Desktop.desktop.setStyles({
@ -34,9 +37,8 @@ window.addEvent('domready', function(){
width: '100%', width: '100%',
height: '100%' height: '100%'
}); });
// Download list myTable.setup('myTable');
myTable = new dynamicTable('myTable', {overCls: 'over', selectCls: 'selected', altCls: 'alt'}); myTableUP.setup('myTableUP');
myTableUP = new dynamicTable('myTableUP', {overCls: 'over', selectCls: 'selected', altCls: 'alt'});
var r=0; var r=0;
var waiting=false; var waiting=false;
var stateToImg = function(state){ var stateToImg = function(state){

41
src/webui/scripts/dynamicTable.js

@ -32,13 +32,11 @@
**************************************************************/ **************************************************************/
var dynamicTable = new Class ({ var dynamicTable = new Class ({
initialize: function(){
},
initialize: function(table, options){ setup: function(table){
this.setOptions({
overCls: false,
selectCls: false,
altCls: false
}, options);
this.table = $(table); this.table = $(table);
this.rows = new Object(); this.rows = new Object();
this.cur = new Array(); this.cur = new Array();
@ -47,16 +45,13 @@ var dynamicTable = new Class ({
altRow: function() altRow: function()
{ {
var trs = this.table.getElements('tr'); var trs = this.table.getElements('tr');
if(this.options.altCls)
{
trs.each(function(el,i){ trs.each(function(el,i){
if(i % 2){ if(i % 2){
el.addClass(this.options.altCls); el.addClass('alt');
}else{ }else{
el.removeClass(this.options.altCls); el.removeClass('alt');
} }
}.bind(this)); }.bind(this));
}
}, },
insertRow: function(id, row){ insertRow: function(id, row){
@ -73,14 +68,12 @@ var dynamicTable = new Class ({
td.injectInside(tr); td.injectInside(tr);
}; };
if(this.options.overCls){
tr.addEvent('mouseover', function(e){ tr.addEvent('mouseover', function(e){
tr.addClass(this.options.overCls); tr.addClass('over');
}.bind(this)); }.bind(this));
tr.addEvent('mouseout', function(e){ tr.addEvent('mouseout', function(e){
tr.removeClass(this.options.overCls); tr.removeClass('over');
}.bind(this)); }.bind(this));
}
tr.addEvent('click', function(e){ tr.addEvent('click', function(e){
e.stop(); e.stop();
if(e.control) { if(e.control) {
@ -91,14 +84,14 @@ var dynamicTable = new Class ({
// Remove selected style // Remove selected style
temptr = this.rows[id]; temptr = this.rows[id];
if(temptr){ if(temptr){
temptr.removeClass(this.options.selectCls); temptr.removeClass('selected');
} }
} else { } else {
this.cur[this.cur.length] = id; this.cur[this.cur.length] = id;
// Add selected style // Add selected style
temptr = this.rows[id]; temptr = this.rows[id];
if(temptr){ if(temptr){
temptr.addClass(this.options.selectCls); temptr.addClass('selected');
} }
} }
} else { } else {
@ -119,7 +112,7 @@ var dynamicTable = new Class ({
// Add selected style // Add selected style
temptr = this.rows[curID]; temptr = this.rows[curID];
if(temptr){ if(temptr){
temptr.addClass(this.options.selectCls); temptr.addClass('selected');
} }
} }
} else { } else {
@ -128,14 +121,14 @@ var dynamicTable = new Class ({
for(i=0; i<this.cur.length; i++) { for(i=0; i<this.cur.length; i++) {
var temptr = this.rows[this.cur[i]]; var temptr = this.rows[this.cur[i]];
if(temptr){ if(temptr){
temptr.removeClass(this.options.selectCls); temptr.removeClass('selected');
} }
} }
this.cur.empty(); this.cur.empty();
// Add selected style to new one // Add selected style to new one
temptr = this.rows[id]; temptr = this.rows[id];
if(temptr){ if(temptr){
temptr.addClass(this.options.selectCls); temptr.addClass('selected');
} }
this.cur[0] = id; this.cur[0] = id;
} }
@ -153,8 +146,8 @@ var dynamicTable = new Class ({
this.cur[this.cur.length] = id; this.cur[this.cur.length] = id;
temptr = this.rows[id]; temptr = this.rows[id];
if(temptr){ if(temptr){
if(!temptr.hasClass(this.options.selectCls)) { if(!temptr.hasClass('selected')) {
temptr.addClass(this.options.selectCls); temptr.addClass('selected');
} }
} }
} }
@ -204,7 +197,7 @@ var dynamicTable = new Class ({
return ids; return ids;
} }
}); });
dynamicTable.implement(new Options); //dynamicTable.implement(new Options);
dynamicTable.implement(new Events); //dynamicTable.implement(new Events);
/*************************************************************/ /*************************************************************/

Loading…
Cancel
Save