mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
commit
dcfe95f04b
@ -29,6 +29,8 @@
|
||||
}
|
||||
|
||||
|
||||
#myTable tr:nth-child(even),
|
||||
#filesTable tr:nth-child(even),
|
||||
#properties #torrentFiles tr.alt,
|
||||
#properties #trackers tr.alt,
|
||||
#transferList tr.alt {
|
||||
@ -49,6 +51,8 @@
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#myTable tr:hover,
|
||||
#filesTable tr:hover,
|
||||
#properties #torrentFiles tr.over,
|
||||
#properties #trackers tr.over,
|
||||
#transferList tr.over {
|
||||
|
@ -350,15 +350,6 @@ ul.filterList li:hover a {
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
#filesTable tr:nth-child(even) {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
#filesTable tr:hover {
|
||||
background-color: #e60;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#addTrackersPlus {
|
||||
width: 16px;
|
||||
cursor: pointer;
|
||||
|
@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
myTable = new dynamicTable();
|
||||
ajaxfn = function () {};
|
||||
|
||||
window.addEvent('load', function () {
|
||||
|
||||
@ -76,9 +75,10 @@ window.addEvent('load', function () {
|
||||
height : 300
|
||||
});
|
||||
initializeWindows();
|
||||
var r = 0;
|
||||
var waiting = false;
|
||||
var waitingTrInfo = false;
|
||||
|
||||
var speedInTitle = localStorage.getItem('speed_in_browser_title_bar') == "true";
|
||||
if (!speedInTitle)
|
||||
$('speedInBrowserTitleBarLink').firstChild.style.opacity = '0';
|
||||
|
||||
var stateToImg = function (state) {
|
||||
if (state == "pausedUP" || state == "pausedDL") {
|
||||
@ -94,142 +94,158 @@ window.addEvent('load', function () {
|
||||
}
|
||||
return 'images/skin/' + state + '.png';
|
||||
};
|
||||
|
||||
var loadTransferInfoTimer;
|
||||
var loadTransferInfo = function () {
|
||||
var url = 'json/transferInfo';
|
||||
if (!waitingTrInfo) {
|
||||
waitingTrInfo = true;
|
||||
var request = new Request.JSON({
|
||||
url : url,
|
||||
noCache : true,
|
||||
method : 'get',
|
||||
onFailure : function () {
|
||||
$('error_div').set('html', '_(qBittorrent client is not reachable)');
|
||||
waitingTrInfo = false;
|
||||
loadTransferInfo.delay(4000);
|
||||
},
|
||||
onSuccess : function (info) {
|
||||
if (info) {
|
||||
$("DlInfos").set('html', "_(D: %1 - T: %2)"
|
||||
.replace("%1", friendlyUnit(info.dl_info_speed, true))
|
||||
.replace("%2", friendlyUnit(info.dl_info_data, false)));
|
||||
$("UpInfos").set('html', "_(U: %1 - T: %2)"
|
||||
.replace("%1", friendlyUnit(info.up_info_speed, true))
|
||||
.replace("%2", friendlyUnit(info.up_info_data, false)));
|
||||
if(localStorage.getItem('speed_in_browser_title_bar') == 'true')
|
||||
document.title = "_(D:%1 U:%2)".replace("%1", friendlyUnit(info.dl_info_speed, true)).replace("%2", friendlyUnit(info.up_info_speed, true));
|
||||
else
|
||||
document.title = "_(qBittorrent web User Interface)";
|
||||
waitingTrInfo = false;
|
||||
loadTransferInfo.delay(3000);
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
var request = new Request.JSON({
|
||||
url : url,
|
||||
noCache : true,
|
||||
method : 'get',
|
||||
onFailure : function () {
|
||||
$('error_div').set('html', '_(qBittorrent client is not reachable)');
|
||||
loadTransferInfoTimer = loadTransferInfo.delay(4000);
|
||||
},
|
||||
onSuccess : function (info) {
|
||||
if (info) {
|
||||
$("DlInfos").set('html', "_(D: %1 - T: %2)"
|
||||
.replace("%1", friendlyUnit(info.dl_info_speed, true))
|
||||
.replace("%2", friendlyUnit(info.dl_info_data, false)));
|
||||
$("UpInfos").set('html', "_(U: %1 - T: %2)"
|
||||
.replace("%1", friendlyUnit(info.up_info_speed, true))
|
||||
.replace("%2", friendlyUnit(info.up_info_data, false)));
|
||||
if (speedInTitle)
|
||||
document.title = "_(D:%1 U:%2)".replace("%1", friendlyUnit(info.dl_info_speed, true)).replace("%2", friendlyUnit(info.up_info_speed, true));
|
||||
else
|
||||
document.title = "_(qBittorrent web User Interface)";
|
||||
loadTransferInfoTimer = loadTransferInfo.delay(3000);
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
};
|
||||
|
||||
var updateTransferInfo = function() {
|
||||
clearTimeout(loadTransferInfoTimer);
|
||||
loadTransferInfoTimer = loadTransferInfo();
|
||||
}
|
||||
|
||||
// Start fetching data now
|
||||
loadTransferInfo();
|
||||
|
||||
$('DlInfos').addEvent('click', globalDownloadLimitFN);
|
||||
$('UpInfos').addEvent('click', globalUploadLimitFN);
|
||||
|
||||
var ajaxfnTimer;
|
||||
var ajaxfn = function () {
|
||||
var queueing_enabled = false;
|
||||
var url = new URI('json/torrents');
|
||||
url.setData('filter', filter);
|
||||
url.setData('sort', myTable.table.sortedColumn);
|
||||
url.setData('reverse', myTable.table.reverseSort);
|
||||
if (!waiting) {
|
||||
waiting = true;
|
||||
var request = new Request.JSON({
|
||||
url : url,
|
||||
noCache : true,
|
||||
method : 'get',
|
||||
onFailure : function () {
|
||||
$('error_div').set('html', '_(qBittorrent client is not reachable)');
|
||||
waiting = false;
|
||||
ajaxfn.delay(2000);
|
||||
},
|
||||
onSuccess : function (events) {
|
||||
$('error_div').set('html', '');
|
||||
if (events) {
|
||||
// Add new torrents or update them
|
||||
torrent_hashes = myTable.getRowIds();
|
||||
events_hashes = new Array();
|
||||
pos = 0;
|
||||
events.each(function (event) {
|
||||
events_hashes[events_hashes.length] = event.hash;
|
||||
var row = new Array();
|
||||
var data = new Array();
|
||||
row.length = 10;
|
||||
row[0] = stateToImg(event.state);
|
||||
row[1] = event.name;
|
||||
row[2] = event.priority > -1 ? event.priority : null;
|
||||
data[2] = event.priority;
|
||||
row[3] = friendlyUnit(event.size, false);
|
||||
data[3] = event.size;
|
||||
row[4] = (event.progress * 100).round(1);
|
||||
if (row[4] == 100.0 && event.progress != 1.0)
|
||||
row[4] = 99.9;
|
||||
data[4] = event.progress;
|
||||
row[5] = event.num_seeds;
|
||||
if (event.num_complete != -1)
|
||||
row[5] += " (" + event.num_complete + ")";
|
||||
data[5] = event.num_seeds;
|
||||
row[6] = event.num_leechs;
|
||||
if (event.num_incomplete != -1)
|
||||
row[6] += " (" + event.num_incomplete + ")";
|
||||
data[6] = event.num_leechs;
|
||||
row[7] = friendlyUnit(event.dlspeed, true);
|
||||
data[7] = event.dlspeed;
|
||||
row[8] = friendlyUnit(event.upspeed, true);
|
||||
data[8] = event.upspeed;
|
||||
row[9] = friendlyDuration(event.eta);
|
||||
data[9] = event.eta;
|
||||
if (event.ratio == -1)
|
||||
row[10] = "∞";
|
||||
else
|
||||
row[10] = (Math.floor(100 * event.ratio) / 100).toFixed(2); //Don't round up
|
||||
data[10] = event.ratio;
|
||||
if (row[2] != null)
|
||||
queueing_enabled = true;
|
||||
if (!torrent_hashes.contains(event.hash)) {
|
||||
// New unfinished torrent
|
||||
torrent_hashes[torrent_hashes.length] = event.hash;
|
||||
//alert("Inserting row");
|
||||
myTable.insertRow(event.hash, row, data, event.state, pos);
|
||||
} else {
|
||||
// Update torrent data
|
||||
myTable.updateRow(event.hash, row, data, event.state, pos);
|
||||
}
|
||||
|
||||
pos++;
|
||||
});
|
||||
// Remove deleted torrents
|
||||
torrent_hashes.each(function (hash) {
|
||||
if (!events_hashes.contains(hash)) {
|
||||
myTable.removeRow(hash);
|
||||
}
|
||||
});
|
||||
if (queueing_enabled) {
|
||||
$('queueingButtons').removeClass('invisible');
|
||||
myTable.showPriority();
|
||||
} else {
|
||||
$('queueingButtons').addClass('invisible');
|
||||
myTable.hidePriority();
|
||||
}
|
||||
|
||||
myTable.altRow();
|
||||
var request = new Request.JSON({
|
||||
url : url,
|
||||
noCache : true,
|
||||
method : 'get',
|
||||
onFailure : function () {
|
||||
$('error_div').set('html', '_(qBittorrent client is not reachable)');
|
||||
ajaxfnTimer = ajaxfn.delay(2000);
|
||||
},
|
||||
onSuccess : function (events) {
|
||||
$('error_div').set('html', '');
|
||||
if (events) {
|
||||
// Add new torrents or update them
|
||||
torrent_hashes = myTable.getRowIds();
|
||||
events_hashes = new Array();
|
||||
pos = 0;
|
||||
events.each(function (event) {
|
||||
events_hashes[events_hashes.length] = event.hash;
|
||||
var row = new Array();
|
||||
var data = new Array();
|
||||
row.length = 10;
|
||||
row[0] = stateToImg(event.state);
|
||||
row[1] = event.name;
|
||||
row[2] = event.priority > -1 ? event.priority : null;
|
||||
data[2] = event.priority;
|
||||
row[3] = friendlyUnit(event.size, false);
|
||||
data[3] = event.size;
|
||||
row[4] = (event.progress * 100).round(1);
|
||||
if (row[4] == 100.0 && event.progress != 1.0)
|
||||
row[4] = 99.9;
|
||||
data[4] = event.progress;
|
||||
row[5] = event.num_seeds;
|
||||
if (event.num_complete != -1)
|
||||
row[5] += " (" + event.num_complete + ")";
|
||||
data[5] = event.num_seeds;
|
||||
row[6] = event.num_leechs;
|
||||
if (event.num_incomplete != -1)
|
||||
row[6] += " (" + event.num_incomplete + ")";
|
||||
data[6] = event.num_leechs;
|
||||
row[7] = friendlyUnit(event.dlspeed, true);
|
||||
data[7] = event.dlspeed;
|
||||
row[8] = friendlyUnit(event.upspeed, true);
|
||||
data[8] = event.upspeed;
|
||||
row[9] = friendlyDuration(event.eta);
|
||||
data[9] = event.eta;
|
||||
if (event.ratio == -1)
|
||||
row[10] = "∞";
|
||||
else
|
||||
row[10] = (Math.floor(100 * event.ratio) / 100).toFixed(2); //Don't round up
|
||||
data[10] = event.ratio;
|
||||
if (row[2] != null)
|
||||
queueing_enabled = true;
|
||||
if (!torrent_hashes.contains(event.hash)) {
|
||||
// New unfinished torrent
|
||||
torrent_hashes[torrent_hashes.length] = event.hash;
|
||||
//alert("Inserting row");
|
||||
myTable.insertRow(event.hash, row, data, event.state, pos);
|
||||
} else {
|
||||
// Update torrent data
|
||||
myTable.updateRow(event.hash, row, data, event.state, pos);
|
||||
}
|
||||
waiting = false;
|
||||
ajaxfn.delay(1500);
|
||||
|
||||
pos++;
|
||||
});
|
||||
// Remove deleted torrents
|
||||
torrent_hashes.each(function (hash) {
|
||||
if (!events_hashes.contains(hash)) {
|
||||
myTable.removeRow(hash);
|
||||
}
|
||||
});
|
||||
if (queueing_enabled) {
|
||||
$('queueingButtons').removeClass('invisible');
|
||||
myTable.showPriority();
|
||||
} else {
|
||||
$('queueingButtons').addClass('invisible');
|
||||
myTable.hidePriority();
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
|
||||
myTable.altRow();
|
||||
}
|
||||
ajaxfnTimer = ajaxfn.delay(1500);
|
||||
}
|
||||
}).send();
|
||||
};
|
||||
|
||||
|
||||
var updateTransferList = function() {
|
||||
clearTimeout(ajaxfnTimer);
|
||||
ajaxfnTimer = ajaxfn();
|
||||
}
|
||||
|
||||
setSortedColumn = function (column) {
|
||||
myTable.setSortedColumn(column);
|
||||
// reload torrents
|
||||
ajaxfn();
|
||||
updateTransferList();
|
||||
};
|
||||
|
||||
$('speedInBrowserTitleBarLink').addEvent('click', function(e) {
|
||||
speedInTitle = !speedInTitle;
|
||||
localStorage.setItem('speed_in_browser_title_bar', speedInTitle.toString());
|
||||
if (speedInTitle)
|
||||
$('speedInBrowserTitleBarLink').firstChild.style.opacity = '1';
|
||||
else
|
||||
$('speedInBrowserTitleBarLink').firstChild.style.opacity = '0';
|
||||
updateTransferInfo();
|
||||
});
|
||||
|
||||
new MochaUI.Panel({
|
||||
id : 'transferList',
|
||||
title : 'Panel',
|
||||
@ -243,7 +259,7 @@ window.addEvent('load', function () {
|
||||
loadMethod : 'xhr',
|
||||
contentURL : 'transferlist.html',
|
||||
onContentLoaded : function () {
|
||||
ajaxfn();
|
||||
updateTransferList();
|
||||
},
|
||||
column : 'mainColumn',
|
||||
onResize : saveColumnSizes,
|
||||
@ -272,8 +288,6 @@ window.addEvent('load', function () {
|
||||
column : 'mainColumn',
|
||||
height : prop_h
|
||||
});
|
||||
//ajaxfn();
|
||||
loadTransferInfo();
|
||||
|
||||
setFilter = function (f) {
|
||||
// Visually Select the right filter
|
||||
@ -287,7 +301,7 @@ window.addEvent('load', function () {
|
||||
filter = f;
|
||||
localStorage.setItem('selected_filter', f);
|
||||
// Reload torrents
|
||||
ajaxfn();
|
||||
updateTransferList();
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -1,171 +1,182 @@
|
||||
var ContextMenu = new Class({
|
||||
|
||||
//implements
|
||||
Implements: [Options,Events],
|
||||
//implements
|
||||
Implements: [Options, Events],
|
||||
|
||||
//options
|
||||
options: {
|
||||
actions: {},
|
||||
menu: 'contextmenu',
|
||||
stopEvent: true,
|
||||
targets: 'body',
|
||||
trigger: 'contextmenu',
|
||||
offsets: { x:0, y:0 },
|
||||
onShow: $empty,
|
||||
onHide: $empty,
|
||||
onClick: $empty,
|
||||
fadeSpeed: 200
|
||||
},
|
||||
|
||||
//initialization
|
||||
initialize: function(options) {
|
||||
//set options
|
||||
this.setOptions(options)
|
||||
|
||||
//option diffs menu
|
||||
this.menu = $(this.options.menu);
|
||||
this.targets = $$(this.options.targets);
|
||||
|
||||
//fx
|
||||
this.fx = new Fx.Tween(this.menu, {
|
||||
property: 'opacity',
|
||||
duration:this.options.fadeSpeed,
|
||||
onComplete: function() {
|
||||
if(this.getStyle('opacity')){
|
||||
this.setStyle('visibility','visible');
|
||||
}else{
|
||||
this.setStyle('visibility','hidden');
|
||||
}
|
||||
}.bind(this.menu)
|
||||
});
|
||||
|
||||
//hide and begin the listener
|
||||
this.hide().startListener();
|
||||
|
||||
//hide the menu
|
||||
this.menu.setStyles({ 'position':'absolute','top':'-900000px', 'display':'block' });
|
||||
},
|
||||
|
||||
addTarget: function(t) {
|
||||
this.targets[this.targets.length] = t;
|
||||
t.addEvent(this.options.trigger,function(e) {
|
||||
//enabled?
|
||||
if(!this.options.disabled) {
|
||||
//prevent default, if told to
|
||||
if(this.options.stopEvent) { e.stop(); }
|
||||
//record this as the trigger
|
||||
this.options.element = $(t);
|
||||
//position the menu
|
||||
this.menu.setStyles({
|
||||
top: (e.page.y + this.options.offsets.y),
|
||||
left: (e.page.x + this.options.offsets.x),
|
||||
position: 'absolute',
|
||||
'z-index': '2000'
|
||||
});
|
||||
//show the menu
|
||||
this.show();
|
||||
}
|
||||
}.bind(this));
|
||||
t.addEvent('click',function(e) {
|
||||
this.hide();
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
//get things started
|
||||
startListener: function() {
|
||||
/* all elements */
|
||||
this.targets.each(function(el) {
|
||||
/* show the menu */
|
||||
el.addEvent(this.options.trigger,function(e) {
|
||||
//enabled?
|
||||
if(!this.options.disabled) {
|
||||
//prevent default, if told to
|
||||
if(this.options.stopEvent) { e.stop(); }
|
||||
//record this as the trigger
|
||||
this.options.element = $(el);
|
||||
//position the menu
|
||||
this.menu.setStyles({
|
||||
top: (e.page.y + this.options.offsets.y),
|
||||
left: (e.page.x + this.options.offsets.x),
|
||||
position: 'absolute',
|
||||
'z-index': '2000'
|
||||
});
|
||||
//show the menu
|
||||
this.show();
|
||||
}
|
||||
}.bind(this));
|
||||
el.addEvent('click',function(e) {
|
||||
this.hide();
|
||||
}.bind(this));
|
||||
},this);
|
||||
|
||||
/* menu items */
|
||||
this.menu.getElements('a').each(function(item) {
|
||||
item.addEvent('click',function(e) {
|
||||
if(!item.hasClass('disabled')) {
|
||||
this.execute(item.get('href').split('#')[1],$(this.options.element));
|
||||
this.fireEvent('click',[item,e]);
|
||||
}
|
||||
}.bind(this));
|
||||
},this);
|
||||
|
||||
//hide on body click
|
||||
$(document.body).addEvent('click', function() {
|
||||
this.hide();
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
//show menu
|
||||
show: function(trigger) {
|
||||
//this.menu.fade('in');
|
||||
this.fx.start(1);
|
||||
this.fireEvent('show');
|
||||
this.shown = true;
|
||||
return this;
|
||||
},
|
||||
|
||||
//hide the menu
|
||||
hide: function(trigger) {
|
||||
if(this.shown)
|
||||
{
|
||||
this.fx.start(0);
|
||||
//this.menu.fade('out');
|
||||
this.fireEvent('hide');
|
||||
this.shown = false;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
//disable an item
|
||||
disableItem: function(item) {
|
||||
this.menu.getElements('a[href$=' + item + ']').addClass('disabled');
|
||||
return this;
|
||||
},
|
||||
|
||||
//enable an item
|
||||
enableItem: function(item) {
|
||||
this.menu.getElements('a[href$=' + item + ']').removeClass('disabled');
|
||||
return this;
|
||||
},
|
||||
|
||||
//diable the entire menu
|
||||
disable: function() {
|
||||
this.options.disabled = true;
|
||||
return this;
|
||||
},
|
||||
|
||||
//enable the entire menu
|
||||
enable: function() {
|
||||
this.options.disabled = false;
|
||||
return this;
|
||||
},
|
||||
|
||||
//execute an action
|
||||
execute: function(action,element) {
|
||||
if(this.options.actions[action]) {
|
||||
this.options.actions[action](element,this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
||||
//options
|
||||
options: {
|
||||
actions: {},
|
||||
menu: 'contextmenu',
|
||||
stopEvent: true,
|
||||
targets: 'body',
|
||||
trigger: 'contextmenu',
|
||||
offsets: {
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
onShow: $empty,
|
||||
onHide: $empty,
|
||||
onClick: $empty,
|
||||
fadeSpeed: 200
|
||||
},
|
||||
|
||||
//initialization
|
||||
initialize: function(options) {
|
||||
//set options
|
||||
this.setOptions(options)
|
||||
|
||||
//option diffs menu
|
||||
this.menu = $(this.options.menu);
|
||||
this.targets = $$(this.options.targets);
|
||||
|
||||
//fx
|
||||
this.fx = new Fx.Tween(this.menu, {
|
||||
property: 'opacity',
|
||||
duration: this.options.fadeSpeed,
|
||||
onComplete: function() {
|
||||
if (this.getStyle('opacity')) {
|
||||
this.setStyle('visibility', 'visible');
|
||||
}
|
||||
else {
|
||||
this.setStyle('visibility', 'hidden');
|
||||
}
|
||||
}.bind(this.menu)
|
||||
});
|
||||
|
||||
//hide and begin the listener
|
||||
this.hide().startListener();
|
||||
|
||||
//hide the menu
|
||||
this.menu.setStyles({
|
||||
'position': 'absolute',
|
||||
'top': '-900000px',
|
||||
'display': 'block'
|
||||
});
|
||||
},
|
||||
|
||||
addTarget: function(t) {
|
||||
this.targets[this.targets.length] = t;
|
||||
t.addEvent(this.options.trigger, function(e) {
|
||||
//enabled?
|
||||
if (!this.options.disabled) {
|
||||
//prevent default, if told to
|
||||
if (this.options.stopEvent) {
|
||||
e.stop();
|
||||
}
|
||||
//record this as the trigger
|
||||
this.options.element = $(t);
|
||||
//position the menu
|
||||
this.menu.setStyles({
|
||||
top: (e.page.y + this.options.offsets.y),
|
||||
left: (e.page.x + this.options.offsets.x),
|
||||
position: 'absolute',
|
||||
'z-index': '2000'
|
||||
});
|
||||
//show the menu
|
||||
this.show();
|
||||
}
|
||||
}.bind(this));
|
||||
t.addEvent('click', function(e) {
|
||||
this.hide();
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
//get things started
|
||||
startListener: function() {
|
||||
/* all elements */
|
||||
this.targets.each(function(el) {
|
||||
/* show the menu */
|
||||
el.addEvent(this.options.trigger, function(e) {
|
||||
//enabled?
|
||||
if (!this.options.disabled) {
|
||||
//prevent default, if told to
|
||||
if (this.options.stopEvent) {
|
||||
e.stop();
|
||||
}
|
||||
//record this as the trigger
|
||||
this.options.element = $(el);
|
||||
//position the menu
|
||||
this.menu.setStyles({
|
||||
top: (e.page.y + this.options.offsets.y),
|
||||
left: (e.page.x + this.options.offsets.x),
|
||||
position: 'absolute',
|
||||
'z-index': '2000'
|
||||
});
|
||||
//show the menu
|
||||
this.show();
|
||||
}
|
||||
}.bind(this));
|
||||
el.addEvent('click', function(e) {
|
||||
this.hide();
|
||||
}.bind(this));
|
||||
}, this);
|
||||
|
||||
/* menu items */
|
||||
this.menu.getElements('a').each(function(item) {
|
||||
item.addEvent('click', function(e) {
|
||||
if (!item.hasClass('disabled')) {
|
||||
this.execute(item.get('href').split('#')[1], $(this.options.element));
|
||||
this.fireEvent('click', [item, e]);
|
||||
}
|
||||
}.bind(this));
|
||||
}, this);
|
||||
|
||||
//hide on body click
|
||||
$(document.body).addEvent('click', function() {
|
||||
this.hide();
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
//show menu
|
||||
show: function(trigger) {
|
||||
//this.menu.fade('in');
|
||||
this.fx.start(1);
|
||||
this.fireEvent('show');
|
||||
this.shown = true;
|
||||
return this;
|
||||
},
|
||||
|
||||
//hide the menu
|
||||
hide: function(trigger) {
|
||||
if (this.shown) {
|
||||
this.fx.start(0);
|
||||
//this.menu.fade('out');
|
||||
this.fireEvent('hide');
|
||||
this.shown = false;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
//disable an item
|
||||
disableItem: function(item) {
|
||||
this.menu.getElements('a[href$=' + item + ']').addClass('disabled');
|
||||
return this;
|
||||
},
|
||||
|
||||
//enable an item
|
||||
enableItem: function(item) {
|
||||
this.menu.getElements('a[href$=' + item + ']').removeClass('disabled');
|
||||
return this;
|
||||
},
|
||||
|
||||
//diable the entire menu
|
||||
disable: function() {
|
||||
this.options.disabled = true;
|
||||
return this;
|
||||
},
|
||||
|
||||
//enable the entire menu
|
||||
enable: function() {
|
||||
this.options.disabled = false;
|
||||
return this;
|
||||
},
|
||||
|
||||
//execute an action
|
||||
execute: function(action, element) {
|
||||
if (this.options.actions[action]) {
|
||||
this.options.actions[action](element, this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
@ -8,10 +8,10 @@
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -20,15 +20,19 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
window.addEvent('domready', function(){
|
||||
$('urls').focus();
|
||||
$('downButton').addEvent('click', function(e){
|
||||
new Event(e).stop();
|
||||
new Request({url: 'command/download', method: 'post', data: {urls: $('urls').value},
|
||||
onComplete: function() {
|
||||
window.parent.document.getElementById('downloadPage').parentNode.removeChild(window.parent.document.getElementById('downloadPage'));
|
||||
}
|
||||
}).send();
|
||||
});
|
||||
});
|
||||
window.addEvent('domready', function() {
|
||||
$('urls').focus();
|
||||
$('downButton').addEvent('click', function(e) {
|
||||
new Event(e).stop();
|
||||
new Request({
|
||||
url: 'command/download',
|
||||
method: 'post',
|
||||
data: {
|
||||
urls: $('urls').value
|
||||
},
|
||||
onComplete: function() {
|
||||
window.parent.document.getElementById('downloadPage').parentNode.removeChild(window.parent.document.getElementById('downloadPage'));
|
||||
}
|
||||
}).send();
|
||||
});
|
||||
});
|
@ -63,6 +63,9 @@ var dynamicTable = new Class({
|
||||
},
|
||||
|
||||
altRow : function () {
|
||||
if (!MUI.ieLegacySupport)
|
||||
return;
|
||||
|
||||
var trs = this.table.getElements('tr');
|
||||
trs.each(function (el, i) {
|
||||
if (i % 2) {
|
||||
|
@ -2,74 +2,74 @@
|
||||
* JS counterpart of the function in src/misc.cpp
|
||||
*/
|
||||
function friendlyUnit(value, isSpeed) {
|
||||
units = [
|
||||
"_(B)",
|
||||
"_(KiB)",
|
||||
"_(MiB)",
|
||||
"_(GiB)",
|
||||
"_(TiB)",
|
||||
];
|
||||
units = [
|
||||
"_(B)",
|
||||
"_(KiB)",
|
||||
"_(MiB)",
|
||||
"_(GiB)",
|
||||
"_(TiB)",
|
||||
];
|
||||
|
||||
if (value < 0)
|
||||
return "_(Unknown)";
|
||||
var i = 0;
|
||||
while (value >= 1024. && i++ < 6)
|
||||
value /= 1024.;
|
||||
var ret;
|
||||
ret = value.toFixed(1) + " " + units[i];
|
||||
if (isSpeed)
|
||||
ret += "_(/s)";
|
||||
return ret;
|
||||
if (value < 0)
|
||||
return "_(Unknown)";
|
||||
var i = 0;
|
||||
while (value >= 1024. && i++ < 6)
|
||||
value /= 1024.;
|
||||
var ret;
|
||||
ret = value.toFixed(1) + " " + units[i];
|
||||
if (isSpeed)
|
||||
ret += "_(/s)";
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* JS counterpart of the function in src/misc.cpp
|
||||
*/
|
||||
function friendlyDuration(seconds) {
|
||||
var MAX_ETA = 8640000;
|
||||
if (seconds < 0 || seconds >= MAX_ETA)
|
||||
var MAX_ETA = 8640000;
|
||||
if (seconds < 0 || seconds >= MAX_ETA)
|
||||
return "∞";
|
||||
if (seconds == 0)
|
||||
return "0";
|
||||
if (seconds < 60)
|
||||
return "< " + "_(%1m)".replace("%1", "1"); //translation of "< 1m" not working
|
||||
var minutes = seconds / 60;
|
||||
if (minutes < 60)
|
||||
return "_(%1m)".replace("%1", parseInt(minutes));
|
||||
var hours = minutes / 60;
|
||||
minutes = minutes - hours * 60;
|
||||
if (hours < 24)
|
||||
return "_(%1h %2m)".replace("%1", parseInt(hours)).replace("%2", parseInt(minutes))
|
||||
var days = hours / 24;
|
||||
hours = hours - days * 24;
|
||||
if (days < 100)
|
||||
return "_(%1d %2h)".replace("%1", parseInt(days)).replace("%2", parseInt(hours))
|
||||
return "∞";
|
||||
if (seconds == 0)
|
||||
return "0";
|
||||
if (seconds < 60)
|
||||
return "< " + "_(%1m)".replace("%1", "1"); //translation of "< 1m" not working
|
||||
var minutes = seconds / 60;
|
||||
if (minutes < 60)
|
||||
return "_(%1m)".replace("%1", parseInt(minutes));
|
||||
var hours = minutes / 60;
|
||||
minutes = minutes - hours*60;
|
||||
if (hours < 24)
|
||||
return "_(%1h %2m)".replace("%1", parseInt(hours)).replace("%2", parseInt(minutes))
|
||||
var days = hours / 24;
|
||||
hours = hours - days * 24;
|
||||
if (days < 100)
|
||||
return "_(%1d %2h)".replace("%1", parseInt(days)).replace("%2", parseInt(hours))
|
||||
return "∞";
|
||||
}
|
||||
|
||||
/*
|
||||
* From: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
|
||||
*/
|
||||
if (!Date.prototype.toISOString) {
|
||||
(function() {
|
||||
(function() {
|
||||
|
||||
function pad(number) {
|
||||
if (number < 10) {
|
||||
return '0' + number;
|
||||
}
|
||||
return number;
|
||||
}
|
||||
function pad(number) {
|
||||
if (number < 10) {
|
||||
return '0' + number;
|
||||
}
|
||||
return number;
|
||||
}
|
||||
|
||||
Date.prototype.toISOString = function() {
|
||||
return this.getUTCFullYear() +
|
||||
'-' + pad(this.getUTCMonth() + 1) +
|
||||
'-' + pad(this.getUTCDate()) +
|
||||
'T' + pad(this.getUTCHours()) +
|
||||
':' + pad(this.getUTCMinutes()) +
|
||||
':' + pad(this.getUTCSeconds()) +
|
||||
'.' + (this.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) +
|
||||
'Z';
|
||||
};
|
||||
Date.prototype.toISOString = function() {
|
||||
return this.getUTCFullYear() +
|
||||
'-' + pad(this.getUTCMonth() + 1) +
|
||||
'-' + pad(this.getUTCDate()) +
|
||||
'T' + pad(this.getUTCHours()) +
|
||||
':' + pad(this.getUTCMinutes()) +
|
||||
':' + pad(this.getUTCSeconds()) +
|
||||
'.' + (this.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) +
|
||||
'Z';
|
||||
};
|
||||
|
||||
}());
|
||||
}());
|
||||
}
|
@ -8,7 +8,6 @@
|
||||
it in the onContentLoaded function of the new window.
|
||||
|
||||
----------------------------------------------------------------- */
|
||||
|
||||
/* Define localStorage object for older browsers */
|
||||
if (typeof localStorage == 'undefined') {
|
||||
window['localStorage'] = {
|
||||
@ -16,250 +15,284 @@ if (typeof localStorage == 'undefined') {
|
||||
return Cookie.read(name);
|
||||
},
|
||||
setItem: function(name, value) {
|
||||
Cookie.write(name, value, {duration: 365 * 10});
|
||||
Cookie.write(name, value, {
|
||||
duration: 365 * 10
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
initializeWindows = function(){
|
||||
initializeWindows = function() {
|
||||
|
||||
function addClickEvent(el, fn){
|
||||
['Link','Button'].each(function(item) {
|
||||
if ($(el+item)){
|
||||
$(el+item).addEvent('click', fn);
|
||||
}
|
||||
});
|
||||
}
|
||||
function addClickEvent(el, fn) {
|
||||
['Link', 'Button'].each(function(item) {
|
||||
if ($(el + item)) {
|
||||
$(el + item).addEvent('click', fn);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
addClickEvent('download', function(e){
|
||||
new Event(e).stop();
|
||||
new MochaUI.Window({
|
||||
id: 'downloadPage',
|
||||
title: "_(Download from urls)",
|
||||
loadMethod: 'iframe',
|
||||
contentURL:'download.html',
|
||||
scrollbars: true,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
closable: true,
|
||||
paddingVertical: 0,
|
||||
paddingHorizontal: 0,
|
||||
width: 500,
|
||||
height: 300
|
||||
});
|
||||
});
|
||||
addClickEvent('download', function(e) {
|
||||
new Event(e).stop();
|
||||
new MochaUI.Window({
|
||||
id: 'downloadPage',
|
||||
title: "_(Download from urls)",
|
||||
loadMethod: 'iframe',
|
||||
contentURL: 'download.html',
|
||||
scrollbars: true,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
closable: true,
|
||||
paddingVertical: 0,
|
||||
paddingHorizontal: 0,
|
||||
width: 500,
|
||||
height: 300
|
||||
});
|
||||
});
|
||||
|
||||
addClickEvent('preferences', function(e) {
|
||||
new Event(e).stop();
|
||||
new MochaUI.Window({
|
||||
id: 'preferencesPage',
|
||||
title: "_(Options)",
|
||||
loadMethod: 'xhr',
|
||||
toolbar: true,
|
||||
contentURL: 'preferences_content.html',
|
||||
require: {
|
||||
css: ['css/Tabs.css']
|
||||
},
|
||||
toolbarURL: 'preferences.html',
|
||||
resizable: true,
|
||||
maximizable: false,
|
||||
closable: true,
|
||||
paddingVertical: 0,
|
||||
paddingHorizontal: 0,
|
||||
width: 700,
|
||||
height: 300
|
||||
});
|
||||
});
|
||||
addClickEvent('preferences', function(e) {
|
||||
new Event(e).stop();
|
||||
new MochaUI.Window({
|
||||
id: 'preferencesPage',
|
||||
title: "_(Options)",
|
||||
loadMethod: 'xhr',
|
||||
toolbar: true,
|
||||
contentURL: 'preferences_content.html',
|
||||
require: {
|
||||
css: ['css/Tabs.css']
|
||||
},
|
||||
toolbarURL: 'preferences.html',
|
||||
resizable: true,
|
||||
maximizable: false,
|
||||
closable: true,
|
||||
paddingVertical: 0,
|
||||
paddingHorizontal: 0,
|
||||
width: 700,
|
||||
height: 300
|
||||
});
|
||||
});
|
||||
|
||||
addClickEvent('upload', function(e){
|
||||
new Event(e).stop();
|
||||
new MochaUI.Window({
|
||||
id: 'uploadPage',
|
||||
title: "_(Download local torrent)",
|
||||
loadMethod: 'iframe',
|
||||
contentURL:'upload.html',
|
||||
scrollbars: true,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
paddingVertical: 0,
|
||||
paddingHorizontal: 0,
|
||||
width: 600,
|
||||
height: 130
|
||||
});
|
||||
});
|
||||
addClickEvent('upload', function(e) {
|
||||
new Event(e).stop();
|
||||
new MochaUI.Window({
|
||||
id: 'uploadPage',
|
||||
title: "_(Download local torrent)",
|
||||
loadMethod: 'iframe',
|
||||
contentURL: 'upload.html',
|
||||
scrollbars: true,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
paddingVertical: 0,
|
||||
paddingHorizontal: 0,
|
||||
width: 600,
|
||||
height: 130
|
||||
});
|
||||
});
|
||||
|
||||
globalUploadLimitFN = function() {
|
||||
new MochaUI.Window({
|
||||
id: 'uploadLimitPage',
|
||||
title: "_(Global Upload Speed Limiting)",
|
||||
loadMethod: 'iframe',
|
||||
contentURL:'uploadlimit.html?hash=global',
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
paddingVertical: 0,
|
||||
paddingHorizontal: 0,
|
||||
width: 424,
|
||||
height: 80
|
||||
});
|
||||
}
|
||||
globalUploadLimitFN = function() {
|
||||
new MochaUI.Window({
|
||||
id: 'uploadLimitPage',
|
||||
title: "_(Global Upload Speed Limiting)",
|
||||
loadMethod: 'iframe',
|
||||
contentURL: 'uploadlimit.html?hash=global',
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
paddingVertical: 0,
|
||||
paddingHorizontal: 0,
|
||||
width: 424,
|
||||
height: 80
|
||||
});
|
||||
}
|
||||
|
||||
uploadLimitFN = function() {
|
||||
var h = myTable.selectedIds();
|
||||
if(h.length){
|
||||
var hash = h[0];
|
||||
new MochaUI.Window({
|
||||
id: 'uploadLimitPage',
|
||||
title: "_(Torrent Upload Speed Limiting)",
|
||||
loadMethod: 'iframe',
|
||||
contentURL:'uploadlimit.html?hash='+hash,
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
paddingVertical: 0,
|
||||
paddingHorizontal: 0,
|
||||
width: 424,
|
||||
height: 80
|
||||
});
|
||||
}
|
||||
};
|
||||
uploadLimitFN = function() {
|
||||
var h = myTable.selectedIds();
|
||||
if (h.length) {
|
||||
var hash = h[0];
|
||||
new MochaUI.Window({
|
||||
id: 'uploadLimitPage',
|
||||
title: "_(Torrent Upload Speed Limiting)",
|
||||
loadMethod: 'iframe',
|
||||
contentURL: 'uploadlimit.html?hash=' + hash,
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
paddingVertical: 0,
|
||||
paddingHorizontal: 0,
|
||||
width: 424,
|
||||
height: 80
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
globalDownloadLimitFN = function() {
|
||||
new MochaUI.Window({
|
||||
id: 'downloadLimitPage',
|
||||
title: "_(Global Download Speed Limiting)",
|
||||
loadMethod: 'iframe',
|
||||
contentURL:'downloadlimit.html?hash=global',
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
paddingVertical: 0,
|
||||
paddingHorizontal: 0,
|
||||
width: 424,
|
||||
height: 80
|
||||
});
|
||||
}
|
||||
globalDownloadLimitFN = function() {
|
||||
new MochaUI.Window({
|
||||
id: 'downloadLimitPage',
|
||||
title: "_(Global Download Speed Limiting)",
|
||||
loadMethod: 'iframe',
|
||||
contentURL: 'downloadlimit.html?hash=global',
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
paddingVertical: 0,
|
||||
paddingHorizontal: 0,
|
||||
width: 424,
|
||||
height: 80
|
||||
});
|
||||
}
|
||||
|
||||
downloadLimitFN = function() {
|
||||
var h = myTable.selectedIds();
|
||||
if(h.length){
|
||||
var hash = h[0];
|
||||
new MochaUI.Window({
|
||||
id: 'downloadLimitPage',
|
||||
title: "_(Torrent Download Speed Limiting)",
|
||||
loadMethod: 'iframe',
|
||||
contentURL:'downloadlimit.html?hash='+hash,
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
paddingVertical: 0,
|
||||
paddingHorizontal: 0,
|
||||
width: 424,
|
||||
height: 80
|
||||
});
|
||||
}
|
||||
};
|
||||
downloadLimitFN = function() {
|
||||
var h = myTable.selectedIds();
|
||||
if (h.length) {
|
||||
var hash = h[0];
|
||||
new MochaUI.Window({
|
||||
id: 'downloadLimitPage',
|
||||
title: "_(Torrent Download Speed Limiting)",
|
||||
loadMethod: 'iframe',
|
||||
contentURL: 'downloadlimit.html?hash=' + hash,
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
paddingVertical: 0,
|
||||
paddingHorizontal: 0,
|
||||
width: 424,
|
||||
height: 80
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
deleteFN = function() {
|
||||
var h = myTable.selectedIds();
|
||||
/*if(h.length && confirm('_(Are you sure you want to delete the selected torrents from the transfer list?)')) {
|
||||
deleteFN = function() {
|
||||
var h = myTable.selectedIds();
|
||||
/*if(h.length && confirm('_(Are you sure you want to delete the selected torrents from the transfer list?)')) {
|
||||
h.each(function(item, index){
|
||||
new Request({url: 'command/delete', method: 'post', data: {hash: item}}).send();
|
||||
});
|
||||
}*/
|
||||
if(h.length) {
|
||||
new MochaUI.Window({
|
||||
id: 'confirmDeletionPage',
|
||||
title: "_(Deletion confirmation - qBittorrent)",
|
||||
loadMethod: 'iframe',
|
||||
contentURL:'confirmdeletion.html?hashes='+h.join(','),
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
padding: 10,
|
||||
width: 424,
|
||||
height: 140
|
||||
});
|
||||
if (h.length) {
|
||||
new MochaUI.Window({
|
||||
id: 'confirmDeletionPage',
|
||||
title: "_(Deletion confirmation - qBittorrent)",
|
||||
loadMethod: 'iframe',
|
||||
contentURL: 'confirmdeletion.html?hashes=' + h.join(','),
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
padding: 10,
|
||||
width: 424,
|
||||
height: 140
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
addClickEvent('delete', function(e) {
|
||||
new Event(e).stop();
|
||||
deleteFN();
|
||||
});
|
||||
|
||||
pauseFN = function() {
|
||||
var h = myTable.selectedIds();
|
||||
if (h.length) {
|
||||
h.each(function(hash, index) {
|
||||
new Request({
|
||||
url: 'command/pause',
|
||||
method: 'post',
|
||||
data: {
|
||||
hash: hash
|
||||
}
|
||||
}).send();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
startFN = function() {
|
||||
var h = myTable.selectedIds();
|
||||
if (h.length) {
|
||||
h.each(function(hash, index) {
|
||||
new Request({
|
||||
url: 'command/resume',
|
||||
method: 'post',
|
||||
data: {
|
||||
hash: hash
|
||||
}
|
||||
}).send();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
recheckFN = function() {
|
||||
var h = myTable.selectedIds();
|
||||
if (h.length) {
|
||||
h.each(function(hash, index) {
|
||||
new Request({
|
||||
url: 'command/recheck',
|
||||
method: 'post',
|
||||
data: {
|
||||
hash: hash
|
||||
}
|
||||
}).send();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
['pause', 'resume', 'recheck'].each(function(item) {
|
||||
addClickEvent(item, function(e) {
|
||||
new Event(e).stop();
|
||||
var h = myTable.selectedIds();
|
||||
if (h.length) {
|
||||
h.each(function(hash, index) {
|
||||
new Request({
|
||||
url: 'command/' + item,
|
||||
method: 'post',
|
||||
data: {
|
||||
hash: hash
|
||||
}
|
||||
}).send();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
addClickEvent(item + 'All', function(e) {
|
||||
new Event(e).stop();
|
||||
new Request({
|
||||
url: 'command/' + item + 'all'
|
||||
}).send();
|
||||
});
|
||||
});
|
||||
|
||||
['decreasePrio', 'increasePrio', 'topPrio', 'bottomPrio'].each(function(item) {
|
||||
addClickEvent(item, function(e) {
|
||||
new Event(e).stop();
|
||||
setPriorityFN(item);
|
||||
});
|
||||
});
|
||||
|
||||
setPriorityFN = function(cmd) {
|
||||
var h = myTable.selectedIds();
|
||||
if (h.length) {
|
||||
new Request({
|
||||
url: 'command/' + cmd,
|
||||
method: 'post',
|
||||
data: {
|
||||
hashes: h.join("|")
|
||||
}
|
||||
};
|
||||
}).send();
|
||||
}
|
||||
}
|
||||
|
||||
addClickEvent('delete', function(e){
|
||||
new Event(e).stop();
|
||||
deleteFN();
|
||||
});
|
||||
addClickEvent('about', function(e) {
|
||||
new Event(e).stop();
|
||||
new MochaUI.Window({
|
||||
id: 'aboutpage',
|
||||
title: 'About',
|
||||
loadMethod: 'xhr',
|
||||
contentURL: 'about.html',
|
||||
width: 650,
|
||||
height: 200,
|
||||
padding: 10
|
||||
});
|
||||
});
|
||||
|
||||
pauseFN = function() {
|
||||
var h = myTable.selectedIds();
|
||||
if(h.length){
|
||||
h.each(function(hash, index){
|
||||
new Request({url: 'command/pause', method: 'post', data: {hash: hash}}).send();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
startFN = function() {
|
||||
var h = myTable.selectedIds();
|
||||
if(h.length){
|
||||
h.each(function(hash, index){
|
||||
new Request({url: 'command/resume', method: 'post', data: {hash: hash}}).send();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
recheckFN = function() {
|
||||
var h = myTable.selectedIds();
|
||||
if(h.length){
|
||||
h.each(function(hash, index){
|
||||
new Request({url: 'command/recheck', method: 'post', data: {hash: hash}}).send();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
['pause','resume', 'recheck'].each(function(item) {
|
||||
addClickEvent(item, function(e){
|
||||
new Event(e).stop();
|
||||
var h = myTable.selectedIds();
|
||||
if(h.length){
|
||||
h.each(function(hash, index){
|
||||
new Request({url: 'command/'+item, method: 'post', data: {hash: hash}}).send();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
addClickEvent(item+'All', function(e){
|
||||
new Event(e).stop();
|
||||
new Request({url: 'command/'+item+'all'}).send();
|
||||
});
|
||||
});
|
||||
|
||||
['decreasePrio','increasePrio', 'topPrio', 'bottomPrio'].each(function(item) {
|
||||
addClickEvent(item, function(e){
|
||||
new Event(e).stop();
|
||||
setPriorityFN(item);
|
||||
});
|
||||
});
|
||||
|
||||
setPriorityFN = function(cmd) {
|
||||
var h = myTable.selectedIds();
|
||||
if(h.length) {
|
||||
new Request({url: 'command/'+cmd, method: 'post', data: {hashes: h.join("|")}}).send();
|
||||
}
|
||||
}
|
||||
|
||||
addClickEvent('about', function(e){
|
||||
new Event(e).stop();
|
||||
new MochaUI.Window({
|
||||
id: 'aboutpage',
|
||||
title: 'About',
|
||||
loadMethod: 'xhr',
|
||||
contentURL: 'about.html',
|
||||
width: 650,
|
||||
height: 200,
|
||||
padding: 10
|
||||
});
|
||||
});
|
||||
|
||||
addClickEvent('logout', function(e){
|
||||
addClickEvent('logout', function(e) {
|
||||
new Event(e).stop();
|
||||
new Request({
|
||||
url: '/logout',
|
||||
@ -270,8 +303,8 @@ initializeWindows = function(){
|
||||
}).send();
|
||||
});
|
||||
|
||||
addClickEvent('shutdown', function(e){
|
||||
new Event(e).stop();
|
||||
addClickEvent('shutdown', function(e) {
|
||||
new Event(e).stop();
|
||||
new Request({
|
||||
url: 'command/shutdown',
|
||||
onSuccess: function() {
|
||||
@ -279,30 +312,12 @@ initializeWindows = function(){
|
||||
stop();
|
||||
}
|
||||
}).send();
|
||||
});
|
||||
});
|
||||
|
||||
updateSpeedInBrowserTitleBarLinkCheckState = function()
|
||||
{
|
||||
if (localStorage.getItem('speed_in_browser_title_bar') == 'true')
|
||||
$(speedInBrowserTitleBarLink).firstChild.style.opacity = '1';
|
||||
else
|
||||
$(speedInBrowserTitleBarLink).firstChild.style.opacity = '0';
|
||||
}
|
||||
|
||||
updateSpeedInBrowserTitleBarLinkCheckState();
|
||||
|
||||
addClickEvent('speedInBrowserTitleBar', function(e){
|
||||
new Event(e).stop();
|
||||
var speed_in_browser_title_bar = localStorage.getItem('speed_in_browser_title_bar');
|
||||
speed_in_browser_title_bar = speed_in_browser_title_bar == 'true' ? 'false' : 'true';
|
||||
localStorage.setItem('speed_in_browser_title_bar', speed_in_browser_title_bar);
|
||||
updateSpeedInBrowserTitleBarLinkCheckState();
|
||||
});
|
||||
|
||||
// Deactivate menu header links
|
||||
$$('a.returnFalse').each(function(el){
|
||||
el.addEvent('click', function(e){
|
||||
new Event(e).stop();
|
||||
});
|
||||
});
|
||||
}
|
||||
// Deactivate menu header links
|
||||
$$('a.returnFalse').each(function(el) {
|
||||
el.addEvent('click', function(e) {
|
||||
new Event(e).stop();
|
||||
});
|
||||
});
|
||||
}
|
@ -13,179 +13,194 @@ Requires:
|
||||
Core.js, Window.js
|
||||
|
||||
*/
|
||||
|
||||
MochaUI.extend({
|
||||
addUpLimitSlider: function(hash){
|
||||
if ($('uplimitSliderarea')) {
|
||||
var windowOptions = MochaUI.Windows.windowOptions;
|
||||
var sliderFirst = true;
|
||||
// Get global upload limit
|
||||
var maximum = 500;
|
||||
var req = new Request({
|
||||
url: 'command/getGlobalUpLimit',
|
||||
method: 'post',
|
||||
data: {},
|
||||
onSuccess: function(data) {
|
||||
if(data){
|
||||
var tmp = data.toInt();
|
||||
if(tmp > 0) {
|
||||
maximum = tmp / 1024.
|
||||
} else {
|
||||
maximum = 1000
|
||||
}
|
||||
}
|
||||
// Get torrent upload limit
|
||||
// And create slider
|
||||
if(hash == 'global') {
|
||||
var up_limit = maximum;
|
||||
if(up_limit < 0) up_limit = 0;
|
||||
maximum = 1000;
|
||||
var mochaSlide = new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), {
|
||||
steps: maximum,
|
||||
offset: 0,
|
||||
initialStep: up_limit.round(),
|
||||
onChange: function(pos){
|
||||
if(pos > 0) {
|
||||
$('uplimitUpdatevalue').set('html', pos);
|
||||
$('upLimitUnit').set('html', "_(KiB/s)");
|
||||
} else {
|
||||
$('uplimitUpdatevalue').set('html', '∞');
|
||||
$('upLimitUnit').set('html', "");
|
||||
}
|
||||
}.bind(this)
|
||||
});
|
||||
// Set default value
|
||||
if(up_limit == 0) {
|
||||
$('uplimitUpdatevalue').set('html', '∞');
|
||||
$('upLimitUnit').set('html', "");
|
||||
} else {
|
||||
$('uplimitUpdatevalue').set('html', up_limit.round());
|
||||
$('upLimitUnit').set('html', "_(KiB/s)");
|
||||
}
|
||||
} else {
|
||||
var req = new Request({
|
||||
url: 'command/getTorrentUpLimit',
|
||||
method: 'post',
|
||||
data: {hash: hash},
|
||||
onSuccess: function(data) {
|
||||
if(data){
|
||||
var up_limit = data.toInt();
|
||||
if(up_limit < 0) up_limit = 0;
|
||||
var mochaSlide = new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), {
|
||||
steps: maximum,
|
||||
offset: 0,
|
||||
initialStep: (up_limit/1024.).round(),
|
||||
onChange: function(pos){
|
||||
if(pos > 0) {
|
||||
$('uplimitUpdatevalue').set('html', pos);
|
||||
$('upLimitUnit').set('html', "_(KiB/s)");
|
||||
} else {
|
||||
$('uplimitUpdatevalue').set('html', '∞');
|
||||
$('upLimitUnit').set('html', "");
|
||||
}
|
||||
}.bind(this)
|
||||
});
|
||||
// Set default value
|
||||
if(up_limit == 0) {
|
||||
$('uplimitUpdatevalue').set('html', '∞');
|
||||
$('upLimitUnit').set('html', "");
|
||||
} else {
|
||||
$('uplimitUpdatevalue').set('html', (up_limit/1024.).round());
|
||||
$('upLimitUnit').set('html', "_(KiB/s)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
},
|
||||
|
||||
addDlLimitSlider: function(hash){
|
||||
if ($('dllimitSliderarea')) {
|
||||
var windowOptions = MochaUI.Windows.windowOptions;
|
||||
var sliderFirst = true;
|
||||
// Get global upload limit
|
||||
var maximum = 500;
|
||||
var req = new Request({
|
||||
url: 'command/getGlobalDlLimit',
|
||||
method: 'post',
|
||||
data: {},
|
||||
onSuccess: function(data) {
|
||||
if(data){
|
||||
var tmp = data.toInt();
|
||||
if(tmp > 0) {
|
||||
maximum = tmp / 1024.
|
||||
} else {
|
||||
maximum = 1000
|
||||
}
|
||||
}
|
||||
// Get torrent download limit
|
||||
// And create slider
|
||||
if(hash == "global") {
|
||||
var dl_limit = maximum;
|
||||
if(dl_limit < 0) dl_limit = 0;
|
||||
maximum = 10000;
|
||||
var mochaSlide = new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), {
|
||||
steps: maximum,
|
||||
offset: 0,
|
||||
initialStep: dl_limit.round(),
|
||||
onChange: function(pos){
|
||||
if(pos > 0) {
|
||||
$('dllimitUpdatevalue').set('html', pos);
|
||||
$('dlLimitUnit').set('html', "_(KiB/s)");
|
||||
} else {
|
||||
$('dllimitUpdatevalue').set('html', '∞');
|
||||
$('dlLimitUnit').set('html', "");
|
||||
}
|
||||
}.bind(this)
|
||||
});
|
||||
// Set default value
|
||||
if(dl_limit == 0) {
|
||||
$('dllimitUpdatevalue').set('html', '∞');
|
||||
$('dlLimitUnit').set('html', "");
|
||||
} else {
|
||||
$('dllimitUpdatevalue').set('html', dl_limit.round());
|
||||
$('dlLimitUnit').set('html', "_(KiB/s)");
|
||||
}
|
||||
} else {
|
||||
var req = new Request({
|
||||
url: 'command/getTorrentDlLimit',
|
||||
method: 'post',
|
||||
data: {hash: hash},
|
||||
onSuccess: function(data) {
|
||||
if(data){
|
||||
var dl_limit = data.toInt();
|
||||
if(dl_limit < 0) dl_limit = 0;
|
||||
var mochaSlide = new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), {
|
||||
steps: maximum,
|
||||
offset: 0,
|
||||
initialStep: (dl_limit/1024.).round(),
|
||||
onChange: function(pos){
|
||||
if(pos > 0) {
|
||||
$('dllimitUpdatevalue').set('html', pos);
|
||||
$('dlLimitUnit').set('html', "_(KiB/s)");
|
||||
} else {
|
||||
$('dllimitUpdatevalue').set('html', '∞');
|
||||
$('dlLimitUnit').set('html', "");
|
||||
}
|
||||
}.bind(this)
|
||||
});
|
||||
// Set default value
|
||||
if(dl_limit == 0) {
|
||||
$('dllimitUpdatevalue').set('html', '∞');
|
||||
$('dlLimitUnit').set('html', "");
|
||||
} else {
|
||||
$('dllimitUpdatevalue').set('html', (dl_limit/1024.).round());
|
||||
$('dlLimitUnit').set('html', "_(KiB/s)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
}
|
||||
});
|
||||
addUpLimitSlider: function(hash) {
|
||||
if ($('uplimitSliderarea')) {
|
||||
var windowOptions = MochaUI.Windows.windowOptions;
|
||||
var sliderFirst = true;
|
||||
// Get global upload limit
|
||||
var maximum = 500;
|
||||
var req = new Request({
|
||||
url: 'command/getGlobalUpLimit',
|
||||
method: 'post',
|
||||
data: {},
|
||||
onSuccess: function(data) {
|
||||
if (data) {
|
||||
var tmp = data.toInt();
|
||||
if (tmp > 0) {
|
||||
maximum = tmp / 1024.
|
||||
}
|
||||
else {
|
||||
maximum = 1000
|
||||
}
|
||||
}
|
||||
// Get torrent upload limit
|
||||
// And create slider
|
||||
if (hash == 'global') {
|
||||
var up_limit = maximum;
|
||||
if (up_limit < 0) up_limit = 0;
|
||||
maximum = 1000;
|
||||
var mochaSlide = new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), {
|
||||
steps: maximum,
|
||||
offset: 0,
|
||||
initialStep: up_limit.round(),
|
||||
onChange: function(pos) {
|
||||
if (pos > 0) {
|
||||
$('uplimitUpdatevalue').set('html', pos);
|
||||
$('upLimitUnit').set('html', "_(KiB/s)");
|
||||
}
|
||||
else {
|
||||
$('uplimitUpdatevalue').set('html', '∞');
|
||||
$('upLimitUnit').set('html', "");
|
||||
}
|
||||
}.bind(this)
|
||||
});
|
||||
// Set default value
|
||||
if (up_limit == 0) {
|
||||
$('uplimitUpdatevalue').set('html', '∞');
|
||||
$('upLimitUnit').set('html', "");
|
||||
}
|
||||
else {
|
||||
$('uplimitUpdatevalue').set('html', up_limit.round());
|
||||
$('upLimitUnit').set('html', "_(KiB/s)");
|
||||
}
|
||||
}
|
||||
else {
|
||||
var req = new Request({
|
||||
url: 'command/getTorrentUpLimit',
|
||||
method: 'post',
|
||||
data: {
|
||||
hash: hash
|
||||
},
|
||||
onSuccess: function(data) {
|
||||
if (data) {
|
||||
var up_limit = data.toInt();
|
||||
if (up_limit < 0) up_limit = 0;
|
||||
var mochaSlide = new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), {
|
||||
steps: maximum,
|
||||
offset: 0,
|
||||
initialStep: (up_limit / 1024.).round(),
|
||||
onChange: function(pos) {
|
||||
if (pos > 0) {
|
||||
$('uplimitUpdatevalue').set('html', pos);
|
||||
$('upLimitUnit').set('html', "_(KiB/s)");
|
||||
}
|
||||
else {
|
||||
$('uplimitUpdatevalue').set('html', '∞');
|
||||
$('upLimitUnit').set('html', "");
|
||||
}
|
||||
}.bind(this)
|
||||
});
|
||||
// Set default value
|
||||
if (up_limit == 0) {
|
||||
$('uplimitUpdatevalue').set('html', '∞');
|
||||
$('upLimitUnit').set('html', "");
|
||||
}
|
||||
else {
|
||||
$('uplimitUpdatevalue').set('html', (up_limit / 1024.).round());
|
||||
$('upLimitUnit').set('html', "_(KiB/s)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
},
|
||||
|
||||
addDlLimitSlider: function(hash) {
|
||||
if ($('dllimitSliderarea')) {
|
||||
var windowOptions = MochaUI.Windows.windowOptions;
|
||||
var sliderFirst = true;
|
||||
// Get global upload limit
|
||||
var maximum = 500;
|
||||
var req = new Request({
|
||||
url: 'command/getGlobalDlLimit',
|
||||
method: 'post',
|
||||
data: {},
|
||||
onSuccess: function(data) {
|
||||
if (data) {
|
||||
var tmp = data.toInt();
|
||||
if (tmp > 0) {
|
||||
maximum = tmp / 1024.
|
||||
}
|
||||
else {
|
||||
maximum = 1000
|
||||
}
|
||||
}
|
||||
// Get torrent download limit
|
||||
// And create slider
|
||||
if (hash == "global") {
|
||||
var dl_limit = maximum;
|
||||
if (dl_limit < 0) dl_limit = 0;
|
||||
maximum = 10000;
|
||||
var mochaSlide = new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), {
|
||||
steps: maximum,
|
||||
offset: 0,
|
||||
initialStep: dl_limit.round(),
|
||||
onChange: function(pos) {
|
||||
if (pos > 0) {
|
||||
$('dllimitUpdatevalue').set('html', pos);
|
||||
$('dlLimitUnit').set('html', "_(KiB/s)");
|
||||
}
|
||||
else {
|
||||
$('dllimitUpdatevalue').set('html', '∞');
|
||||
$('dlLimitUnit').set('html', "");
|
||||
}
|
||||
}.bind(this)
|
||||
});
|
||||
// Set default value
|
||||
if (dl_limit == 0) {
|
||||
$('dllimitUpdatevalue').set('html', '∞');
|
||||
$('dlLimitUnit').set('html', "");
|
||||
}
|
||||
else {
|
||||
$('dllimitUpdatevalue').set('html', dl_limit.round());
|
||||
$('dlLimitUnit').set('html', "_(KiB/s)");
|
||||
}
|
||||
}
|
||||
else {
|
||||
var req = new Request({
|
||||
url: 'command/getTorrentDlLimit',
|
||||
method: 'post',
|
||||
data: {
|
||||
hash: hash
|
||||
},
|
||||
onSuccess: function(data) {
|
||||
if (data) {
|
||||
var dl_limit = data.toInt();
|
||||
if (dl_limit < 0) dl_limit = 0;
|
||||
var mochaSlide = new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), {
|
||||
steps: maximum,
|
||||
offset: 0,
|
||||
initialStep: (dl_limit / 1024.).round(),
|
||||
onChange: function(pos) {
|
||||
if (pos > 0) {
|
||||
$('dllimitUpdatevalue').set('html', pos);
|
||||
$('dlLimitUnit').set('html', "_(KiB/s)");
|
||||
}
|
||||
else {
|
||||
$('dllimitUpdatevalue').set('html', '∞');
|
||||
$('dlLimitUnit').set('html', "");
|
||||
}
|
||||
}.bind(this)
|
||||
});
|
||||
// Set default value
|
||||
if (dl_limit == 0) {
|
||||
$('dllimitUpdatevalue').set('html', '∞');
|
||||
$('dlLimitUnit').set('html', "");
|
||||
}
|
||||
else {
|
||||
$('dllimitUpdatevalue').set('html', (dl_limit / 1024.).round());
|
||||
$('dlLimitUnit').set('html', "_(KiB/s)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
}
|
||||
});
|
@ -1,96 +1,98 @@
|
||||
var ProgressBar=new Class({
|
||||
initialize:function(value,parameters){
|
||||
var vals={
|
||||
'id':'progressbar_'+(ProgressBars++),
|
||||
'value':$pick(value,0),
|
||||
'width':0,
|
||||
'height':0,
|
||||
'darkbg':'#006',
|
||||
'darkfg':'#fff',
|
||||
'lightbg':'#fff',
|
||||
'lightfg':'#000'
|
||||
var ProgressBar = new Class({
|
||||
initialize: function(value, parameters) {
|
||||
var vals = {
|
||||
'id': 'progressbar_' + (ProgressBars++),
|
||||
'value': $pick(value, 0),
|
||||
'width': 0,
|
||||
'height': 0,
|
||||
'darkbg': '#006',
|
||||
'darkfg': '#fff',
|
||||
'lightbg': '#fff',
|
||||
'lightfg': '#000'
|
||||
};
|
||||
if(parameters && $type(parameters)=='object')$extend(vals,parameters);
|
||||
if(vals.height<12)vals.height=12;
|
||||
var obj=new Element('div',{
|
||||
'id':vals.id,
|
||||
'class':'progressbar_wrapper',
|
||||
'styles':{
|
||||
'border':'1px solid #000',
|
||||
'width':vals.width,
|
||||
'height':vals.height,
|
||||
'position':'relative'
|
||||
if (parameters && $type(parameters) == 'object') $extend(vals, parameters);
|
||||
if (vals.height < 12) vals.height = 12;
|
||||
var obj = new Element('div', {
|
||||
'id': vals.id,
|
||||
'class': 'progressbar_wrapper',
|
||||
'styles': {
|
||||
'border': '1px solid #000',
|
||||
'width': vals.width,
|
||||
'height': vals.height,
|
||||
'position': 'relative'
|
||||
}
|
||||
});
|
||||
obj.vals=vals;
|
||||
obj.vals = vals;
|
||||
obj.vals.value = $pick(value, 0); // Fix by Chris
|
||||
obj.vals.dark=new Element('div',{
|
||||
'id':vals.id+'_dark',
|
||||
'class':'progressbar_dark',
|
||||
'styles':{
|
||||
'width':vals.width,
|
||||
'height':vals.height,
|
||||
'background':vals.darkbg,
|
||||
'color':vals.darkfg,
|
||||
'position':'absolute',
|
||||
'text-align':'center',
|
||||
'left':0,
|
||||
'top':0,
|
||||
'line-height':vals.height-2
|
||||
obj.vals.dark = new Element('div', {
|
||||
'id': vals.id + '_dark',
|
||||
'class': 'progressbar_dark',
|
||||
'styles': {
|
||||
'width': vals.width,
|
||||
'height': vals.height,
|
||||
'background': vals.darkbg,
|
||||
'color': vals.darkfg,
|
||||
'position': 'absolute',
|
||||
'text-align': 'center',
|
||||
'left': 0,
|
||||
'top': 0,
|
||||
'line-height': vals.height - 2
|
||||
}
|
||||
});
|
||||
obj.vals.light=new Element('div',{
|
||||
'id':vals.id+'_light',
|
||||
'class':'progressbar_light',
|
||||
'styles':{
|
||||
'width':vals.width,
|
||||
'height':vals.height,
|
||||
'background':vals.lightbg,
|
||||
'color':vals.lightfg,
|
||||
'position':'absolute',
|
||||
'text-align':'center',
|
||||
'left':0,
|
||||
'top':0,
|
||||
'line-height':vals.height-2
|
||||
obj.vals.light = new Element('div', {
|
||||
'id': vals.id + '_light',
|
||||
'class': 'progressbar_light',
|
||||
'styles': {
|
||||
'width': vals.width,
|
||||
'height': vals.height,
|
||||
'background': vals.lightbg,
|
||||
'color': vals.lightfg,
|
||||
'position': 'absolute',
|
||||
'text-align': 'center',
|
||||
'left': 0,
|
||||
'top': 0,
|
||||
'line-height': vals.height - 2
|
||||
}
|
||||
});
|
||||
obj.appendChild(obj.vals.dark);
|
||||
obj.appendChild(obj.vals.light);
|
||||
obj.getValue=ProgressBar_getValue;
|
||||
obj.setValue=ProgressBar_setValue;
|
||||
if(vals.width)obj.setValue(vals.value);
|
||||
else setTimeout('ProgressBar_checkForParent("'+obj.id+'")',1);
|
||||
obj.getValue = ProgressBar_getValue;
|
||||
obj.setValue = ProgressBar_setValue;
|
||||
if (vals.width) obj.setValue(vals.value);
|
||||
else setTimeout('ProgressBar_checkForParent("' + obj.id + '")', 1);
|
||||
return obj;
|
||||
}
|
||||
});
|
||||
|
||||
function ProgressBar_getValue(){
|
||||
function ProgressBar_getValue() {
|
||||
return this.vals.value;
|
||||
}
|
||||
|
||||
function ProgressBar_setValue(value){
|
||||
value=parseFloat(value);
|
||||
if(isNaN(value))value=0;
|
||||
if(value>100)value=100;
|
||||
if(value<0)value=0;
|
||||
this.vals.value=value;
|
||||
function ProgressBar_setValue(value) {
|
||||
value = parseFloat(value);
|
||||
if (isNaN(value)) value = 0;
|
||||
if (value > 100) value = 100;
|
||||
if (value < 0) value = 0;
|
||||
this.vals.value = value;
|
||||
this.vals.dark.empty();
|
||||
this.vals.light.empty();
|
||||
this.vals.dark.appendText(value+'%');
|
||||
this.vals.light.appendText(value+'%');
|
||||
var r=parseInt(this.vals.width*(value/100));
|
||||
this.vals.dark.setStyle('clip','rect(0,'+r+'px,'+this.vals.height+'px,0)');
|
||||
this.vals.light.setStyle('clip','rect(0,'+this.vals.width+'px,'+this.vals.height+'px,'+r+'px)');
|
||||
this.vals.dark.appendText(value + '%');
|
||||
this.vals.light.appendText(value + '%');
|
||||
var r = parseInt(this.vals.width * (value / 100));
|
||||
this.vals.dark.setStyle('clip', 'rect(0,' + r + 'px,' + this.vals.height + 'px,0)');
|
||||
this.vals.light.setStyle('clip', 'rect(0,' + this.vals.width + 'px,' + this.vals.height + 'px,' + r + 'px)');
|
||||
}
|
||||
function ProgressBar_checkForParent(id){
|
||||
var obj=$(id);
|
||||
if(!obj)return;
|
||||
if(!obj.parentNode)return setTimeout('ProgressBar_checkForParent("'+id+'")',1);
|
||||
obj.setStyle('width','100%');
|
||||
var w=obj.offsetWidth;
|
||||
obj.vals.dark.setStyle('width',w);
|
||||
obj.vals.light.setStyle('width',w);
|
||||
obj.vals.width=w;
|
||||
|
||||
function ProgressBar_checkForParent(id) {
|
||||
var obj = $(id);
|
||||
if (!obj) return;
|
||||
if (!obj.parentNode) return setTimeout('ProgressBar_checkForParent("' + id + '")', 1);
|
||||
obj.setStyle('width', '100%');
|
||||
var w = obj.offsetWidth;
|
||||
obj.vals.dark.setStyle('width', w);
|
||||
obj.vals.light.setStyle('width', w);
|
||||
obj.vals.width = w;
|
||||
obj.setValue(obj.vals.value);
|
||||
}
|
||||
var ProgressBars=0;
|
||||
|
||||
var ProgressBars = 0;
|
Loading…
Reference in New Issue
Block a user