Apply formatting to Web UI files

This commit is contained in:
Chocobo1
2018-04-05 11:59:31 +08:00
parent 208d21ff73
commit cf2c0bd47e
34 changed files with 3534 additions and 3379 deletions

View File

@@ -25,15 +25,15 @@
torrentsTable = new TorrentsTable();
torrentPeersTable = new TorrentPeersTable();
var updatePropertiesPanel = function () {};
var updatePropertiesPanel = function() {};
var updateTorrentData = function () {};
var updateTrackersData = function () {};
var updateTorrentPeersData = function () {};
var updateWebSeedsData = function () {};
var updateTorrentFilesData = function () {};
var updateTorrentData = function() {};
var updateTrackersData = function() {};
var updateTorrentPeersData = function() {};
var updateWebSeedsData = function() {};
var updateTorrentFilesData = function() {};
var updateMainData = function () {};
var updateMainData = function() {};
var alternativeSpeedLimits = false;
var queueing_enabled = true;
var syncMainDataTimerPeriod = 1500;
@@ -46,12 +46,12 @@ var CATEGORIES_UNCATEGORIZED = 2;
var category_list = {};
var selected_category = CATEGORIES_ALL;
var setCategoryFilter = function(){};
var setCategoryFilter = function() {};
var selected_filter = getLocalStorageItem('selected_filter', 'all');
var setFilter = function(){};
var setFilter = function() {};
var loadSelectedCategory = function () {
var loadSelectedCategory = function() {
selected_category = getLocalStorageItem('selected_category', CATEGORIES_ALL);
};
loadSelectedCategory();
@@ -65,9 +65,9 @@ function genHash(string) {
return hash;
}
window.addEvent('load', function () {
window.addEvent('load', function() {
var saveColumnSizes = function () {
var saveColumnSizes = function() {
var filters_width = $('Filters').getSize().x;
var properties_height_rel = $('propertiesPanel').getSize().y / Window.getSize().y;
localStorage.setItem('filters_width', filters_width);
@@ -92,17 +92,17 @@ window.addEvent('load', function () {
else
filt_w = 120;
new MochaUI.Column({
id : 'filtersColumn',
placement : 'left',
onResize : saveColumnSizes,
width : filt_w,
resizeLimit : [100, 300]
id: 'filtersColumn',
placement: 'left',
onResize: saveColumnSizes,
width: filt_w,
resizeLimit: [100, 300]
});
new MochaUI.Column({
id : 'mainColumn',
placement : 'main',
width : null,
resizeLimit : [100, 300]
id: 'mainColumn',
placement: 'main',
width: null,
resizeLimit: [100, 300]
});
setCategoryFilter = function(hash) {
@@ -113,7 +113,7 @@ window.addEvent('load', function () {
updateMainData();
};
setFilter = function (f) {
setFilter = function(f) {
// Visually Select the right filter
$("all_filter").removeClass("selectedFilter");
$("downloading_filter").removeClass("selectedFilter");
@@ -133,22 +133,22 @@ window.addEvent('load', function () {
};
new MochaUI.Panel({
id : 'Filters',
title : 'Panel',
header : false,
padding : {
top : 0,
right : 0,
bottom : 0,
left : 0
id: 'Filters',
title: 'Panel',
header: false,
padding: {
top: 0,
right: 0,
bottom: 0,
left: 0
},
loadMethod : 'xhr',
contentURL : 'filters.html',
onContentLoaded : function () {
loadMethod: 'xhr',
contentURL: 'filters.html',
onContentLoaded: function() {
setFilter(selected_filter);
},
column : 'filtersColumn',
height : 300
column: 'filtersColumn',
height: 300
});
initializeWindows();
@@ -203,7 +203,10 @@ window.addEvent('load', function () {
}
var categoryHash = genHash(category);
if (category_list[categoryHash] === null) // This should not happen
category_list[categoryHash] = {name: category, torrents: []};
category_list[categoryHash] = {
name: category,
torrents: []
};
if (!Object.contains(category_list[categoryHash].torrents, torrent['hash'])) {
removeTorrentFromCategoryList(torrent['hash']);
category_list[categoryHash].torrents = category_list[categoryHash].torrents.combine([torrent['hash']]);
@@ -235,10 +238,13 @@ window.addEvent('load', function () {
categoryList.empty();
var create_link = function(hash, text, count) {
var html = '<a href="#" onclick="setCategoryFilter(' + hash + ');return false;">' +
'<img src="theme/inode-directory"/>' +
escapeHtml(text) + ' (' + count + ')' + '</a>';
var el = new Element('li', {id: hash, html: html});
var html = '<a href="#" onclick="setCategoryFilter(' + hash + ');return false;">'
+ '<img src="theme/inode-directory"/>'
+ escapeHtml(text) + ' (' + count + ')' + '</a>';
var el = new Element('li', {
id: hash,
html: html
});
categoriesFilterContextMenu.addTarget(el);
return el;
};
@@ -281,21 +287,21 @@ window.addEvent('load', function () {
};
var syncMainDataTimer;
var syncMainData = function () {
var syncMainData = function() {
var url = new URI('api/v2/sync/maindata');
url.setData('rid', syncMainDataLastResponseId);
var request = new Request.JSON({
url : url,
noCache : true,
method : 'get',
onFailure : function () {
url: url,
noCache: true,
method: 'get',
onFailure: function() {
var errorDiv = $('error_div');
if (errorDiv)
errorDiv.set('html', 'QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]');
clearTimeout(syncMainDataTimer);
syncMainDataTimer = syncMainData.delay(2000);
},
onSuccess : function (response) {
onSuccess: function(response) {
$('error_div').set('html', '');
if (response) {
var torrentsTableSelectedRows;
@@ -312,7 +318,10 @@ window.addEvent('load', function () {
if (response['categories']) {
response['categories'].each(function(category) {
var categoryHash = genHash(category);
category_list[categoryHash] = {name: category, torrents: []};
category_list[categoryHash] = {
name: category,
torrents: []
};
});
update_categories = true;
}
@@ -341,7 +350,7 @@ window.addEvent('load', function () {
setupCopyEventHandler();
}
if (response['torrents_removed'])
response['torrents_removed'].each(function (hash) {
response['torrents_removed'].each(function(hash) {
torrentsTable.removeRow(hash);
removeTorrentFromCategoryList(hash);
update_categories = true; // Always to update All category
@@ -350,7 +359,7 @@ window.addEvent('load', function () {
torrentsTable.altRow();
if (response['server_state']) {
var tmp = response['server_state'];
for(var k in tmp)
for (var k in tmp)
serverState[k] = tmp[k];
processServerState();
}
@@ -376,7 +385,7 @@ window.addEvent('load', function () {
syncMainDataTimer = syncMainData.delay(100);
};
var processServerState = function () {
var processServerState = function() {
var transfer_info = friendlyUnit(serverState.dl_info_speed, true);
if (serverState.dl_rate_limit > 0)
transfer_info += " [" + friendlyUnit(serverState.dl_rate_limit, true) + "]";
@@ -390,7 +399,8 @@ window.addEvent('load', function () {
if (speedInTitle) {
document.title = "QBT_TR([D: %1, U: %2] qBittorrent %3)QBT_TR[CONTEXT=MainWindow]".replace("%1", friendlyUnit(serverState.dl_info_speed, true)).replace("%2", friendlyUnit(serverState.up_info_speed, true)).replace("%3", "${VERSION}");
document.title += " QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]";
}else
}
else
document.title = "qBittorrent ${VERSION} QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]";
$('DHTNodes').set('html', 'QBT_TR(DHT: %1 nodes)QBT_TR[CONTEXT=StatusBar]'.replace("%1", serverState.dht_nodes));
@@ -460,16 +470,17 @@ window.addEvent('load', function () {
// Change icon immediately to give some feedback
updateAltSpeedIcon(!alternativeSpeedLimits);
new Request({url: 'api/v2/transfer/toggleSpeedLimitsMode',
method: 'post',
onComplete: function() {
alternativeSpeedLimits = !alternativeSpeedLimits;
updateMainData();
},
onFailure: function() {
// Restore icon in case of failure
updateAltSpeedIcon(alternativeSpeedLimits);
}
new Request({
url: 'api/v2/transfer/toggleSpeedLimitsMode',
method: 'post',
onComplete: function() {
alternativeSpeedLimits = !alternativeSpeedLimits;
updateMainData();
},
onFailure: function() {
// Restore icon in case of failure
updateAltSpeedIcon(alternativeSpeedLimits);
}
}).send();
});
@@ -517,23 +528,23 @@ window.addEvent('load', function () {
$('StatisticsLink').addEvent('click', StatisticsLinkFN);
new MochaUI.Panel({
id : 'transferList',
title : 'Panel',
header : false,
padding : {
top : 0,
right : 0,
bottom : 0,
left : 0
id: 'transferList',
title: 'Panel',
header: false,
padding: {
top: 0,
right: 0,
bottom: 0,
left: 0
},
loadMethod : 'xhr',
contentURL : 'transferlist.html',
onContentLoaded : function () {
loadMethod: 'xhr',
contentURL: 'transferlist.html',
onContentLoaded: function() {
updateMainData();
},
column : 'mainColumn',
onResize : saveColumnSizes,
height : null
column: 'mainColumn',
onResize: saveColumnSizes,
height: null
});
var prop_h = localStorage.getItem('properties_height_rel');
if ($defined(prop_h))
@@ -541,22 +552,22 @@ window.addEvent('load', function () {
else
prop_h = Window.getSize().y / 2.0;
new MochaUI.Panel({
id : 'propertiesPanel',
title : 'Panel',
header : true,
padding : {
top : 0,
right : 0,
bottom : 0,
left : 0
id: 'propertiesPanel',
title: 'Panel',
header: true,
padding: {
top: 0,
right: 0,
bottom: 0,
left: 0
},
contentURL : 'properties_content.html',
require : {
css : ['css/Tabs.css', 'css/dynamicTable.css'],
js : ['scripts/prop-general.js', 'scripts/prop-trackers.js', 'scripts/prop-webseeds.js', 'scripts/prop-files.js'],
contentURL: 'properties_content.html',
require: {
css: ['css/Tabs.css', 'css/dynamicTable.css'],
js: ['scripts/prop-general.js', 'scripts/prop-trackers.js', 'scripts/prop-webseeds.js', 'scripts/prop-files.js'],
},
tabsURL : 'properties.html',
tabsOnload : function() {
tabsURL: 'properties.html',
tabsOnload: function() {
MochaUI.initializeTabs('propertiesTabs');
updatePropertiesPanel = function() {
@@ -572,7 +583,7 @@ window.addEvent('load', function () {
updateTorrentFilesData();
};
$('PropGeneralLink').addEvent('click', function(e){
$('PropGeneralLink').addEvent('click', function(e) {
$('prop_general').removeClass("invisible");
$('prop_trackers').addClass("invisible");
$('prop_webseeds').addClass("invisible");
@@ -582,7 +593,7 @@ window.addEvent('load', function () {
localStorage.setItem('selected_tab', this.id);
});
$('PropTrackersLink').addEvent('click', function(e){
$('PropTrackersLink').addEvent('click', function(e) {
$('prop_trackers').removeClass("invisible");
$('prop_general').addClass("invisible");
$('prop_webseeds').addClass("invisible");
@@ -592,7 +603,7 @@ window.addEvent('load', function () {
localStorage.setItem('selected_tab', this.id);
});
$('PropPeersLink').addEvent('click', function(e){
$('PropPeersLink').addEvent('click', function(e) {
$('prop_peers').removeClass("invisible");
$('prop_trackers').addClass("invisible");
$('prop_general').addClass("invisible");
@@ -602,7 +613,7 @@ window.addEvent('load', function () {
localStorage.setItem('selected_tab', this.id);
});
$('PropWebSeedsLink').addEvent('click', function(e){
$('PropWebSeedsLink').addEvent('click', function(e) {
$('prop_webseeds').removeClass("invisible");
$('prop_general').addClass("invisible");
$('prop_trackers').addClass("invisible");
@@ -612,7 +623,7 @@ window.addEvent('load', function () {
localStorage.setItem('selected_tab', this.id);
});
$('PropFilesLink').addEvent('click', function(e){
$('PropFilesLink').addEvent('click', function(e) {
$('prop_files').removeClass("invisible");
$('prop_general').addClass("invisible");
$('prop_trackers').addClass("invisible");
@@ -622,12 +633,12 @@ window.addEvent('load', function () {
localStorage.setItem('selected_tab', this.id);
});
$('propertiesPanel_collapseToggle').addEvent('click', function(e){
$('propertiesPanel_collapseToggle').addEvent('click', function(e) {
updatePropertiesPanel();
});
},
column : 'mainColumn',
height : prop_h
column: 'mainColumn',
height: prop_h
});
});
@@ -679,9 +690,9 @@ keyboardEvents.activate();
var loadTorrentPeersTimer;
var syncTorrentPeersLastResponseId = 0;
var show_flags = true;
var loadTorrentPeersData = function(){
if ($('prop_peers').hasClass('invisible') ||
$('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
var loadTorrentPeersData = function() {
if ($('prop_peers').hasClass('invisible')
|| $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
syncTorrentPeersLastResponseId = 0;
torrentPeersTable.clear();
return;
@@ -727,7 +738,7 @@ var loadTorrentPeersData = function(){
}
}
if (response['peers_removed'])
response['peers_removed'].each(function (hash) {
response['peers_removed'].each(function(hash) {
torrentPeersTable.removeRow(hash);
});
torrentPeersTable.updateTable(full_update);
@@ -750,7 +761,7 @@ var loadTorrentPeersData = function(){
}).send();
};
updateTorrentPeersData = function(){
updateTorrentPeersData = function() {
clearTimeout(loadTorrentPeersTimer);
loadTorrentPeersData();
};

View File

@@ -174,10 +174,10 @@ var ContextMenu = new Class({
}.bind(this));
},
updateMenuItems: function () {},
updateMenuItems: function() {},
//show menu
show: function (trigger) {
show: function(trigger) {
if (lastShownContexMenu && lastShownContexMenu != this)
lastShownContexMenu.hide();
this.fx.start(1);
@@ -188,7 +188,7 @@ var ContextMenu = new Class({
},
//hide the menu
hide: function (trigger) {
hide: function(trigger) {
if (this.shown) {
this.fx.start(0);
//this.menu.fade('out');
@@ -198,42 +198,42 @@ var ContextMenu = new Class({
return this;
},
setItemChecked: function (item, checked) {
setItemChecked: function(item, checked) {
this.menu.getElement('a[href$=' + item + ']').firstChild.style.opacity =
checked ? '1' : '0';
checked ? '1' : '0';
return this;
},
getItemChecked: function (item) {
getItemChecked: function(item) {
return '0' != this.menu.getElement('a[href$=' + item + ']').firstChild.style.opacity;
},
//hide an item
hideItem: function (item) {
hideItem: function(item) {
this.menu.getElement('a[href$=' + item + ']').parentNode.addClass('invisible');
return this;
},
//show an item
showItem: function (item) {
showItem: function(item) {
this.menu.getElement('a[href$=' + item + ']').parentNode.removeClass('invisible');
return this;
},
//disable the entire menu
disable: function () {
disable: function() {
this.options.disabled = true;
return this;
},
//enable the entire menu
enable: function () {
enable: function() {
this.options.disabled = false;
return this;
},
//execute an action
execute: function (action, element) {
execute: function(action, element) {
if (this.options.actions[action]) {
this.options.actions[action](element, this, action);
}
@@ -244,7 +244,7 @@ var ContextMenu = new Class({
var TorrentsTableContextMenu = new Class({
Extends: ContextMenu,
updateMenuItems: function () {
updateMenuItems: function() {
all_are_seq_dl = true;
there_are_seq_dl = false;
all_are_f_l_piece_prio = true;
@@ -259,7 +259,7 @@ var TorrentsTableContextMenu = new Class({
there_are_auto_tmm = false;
var h = torrentsTable.selectedRowsIds();
h.each(function(item, index){
h.each(function(item, index) {
var data = torrentsTable.rows.get(item).full_data;
if (data['seq_dl'] !== true)
@@ -310,7 +310,8 @@ var TorrentsTableContextMenu = new Class({
this.hideItem('FirstLastPiecePrio');
this.showItem('SuperSeeding');
this.setItemChecked('SuperSeeding', all_are_super_seeding);
} else {
}
else {
if (!show_seq_dl && show_f_l_piece_prio)
this.menu.getElement('a[href$=FirstLastPiecePrio]').parentNode.addClass('separator');
else
@@ -351,22 +352,28 @@ var TorrentsTableContextMenu = new Class({
},
updateCategoriesSubMenu : function (category_list) {
updateCategoriesSubMenu: function(category_list) {
var categoryList = $('contextCategoryList');
categoryList.empty();
categoryList.appendChild(new Element('li', {html: '<a href="javascript:torrentNewCategoryFN();"><img src="theme/list-add" alt="QBT_TR(New...)QBT_TR[CONTEXT=TransferListWidget]"/> QBT_TR(New...)QBT_TR[CONTEXT=TransferListWidget]</a>'}));
categoryList.appendChild(new Element('li', {html: '<a href="javascript:torrentSetCategoryFN(0);"><img src="theme/edit-clear" alt="QBT_TR(Reset)QBT_TR[CONTEXT=TransferListWidget]"/> QBT_TR(Reset)QBT_TR[CONTEXT=TransferListWidget]</a>'}));
categoryList.appendChild(new Element('li', {
html: '<a href="javascript:torrentNewCategoryFN();"><img src="theme/list-add" alt="QBT_TR(New...)QBT_TR[CONTEXT=TransferListWidget]"/> QBT_TR(New...)QBT_TR[CONTEXT=TransferListWidget]</a>'
}));
categoryList.appendChild(new Element('li', {
html: '<a href="javascript:torrentSetCategoryFN(0);"><img src="theme/edit-clear" alt="QBT_TR(Reset)QBT_TR[CONTEXT=TransferListWidget]"/> QBT_TR(Reset)QBT_TR[CONTEXT=TransferListWidget]</a>'
}));
var sortedCategories = [];
Object.each(category_list, function (category) {
Object.each(category_list, function(category) {
sortedCategories.push(category.name);
});
sortedCategories.sort();
var first = true;
Object.each(sortedCategories, function (categoryName) {
Object.each(sortedCategories, function(categoryName) {
var categoryHash = genHash(categoryName);
var el = new Element('li', {html: '<a href="javascript:torrentSetCategoryFN(\'' + categoryHash + '\');"><img src="theme/inode-directory"/> ' + escapeHtml(categoryName) + '</a>'});
var el = new Element('li', {
html: '<a href="javascript:torrentSetCategoryFN(\'' + categoryHash + '\');"><img src="theme/inode-directory"/> ' + escapeHtml(categoryName) + '</a>'
});
if (first) {
el.addClass('separator');
first = false;
@@ -378,7 +385,7 @@ var TorrentsTableContextMenu = new Class({
var CategoriesFilterContextMenu = new Class({
Extends: ContextMenu,
updateMenuItems: function () {
updateMenuItems: function() {
var id = this.options.element.id;
if (id != CATEGORIES_ALL && id != CATEGORIES_UNCATEGORIZED)
this.showItem('DeleteCategory');

View File

@@ -38,5 +38,5 @@ getSavePath = function() {
};
$(window).addEventListener("load", function() {
getSavePath();
getSavePath();
});

File diff suppressed because it is too large Load Diff

View File

@@ -90,14 +90,14 @@ if (!Date.prototype.toISOString) {
}
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';
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';
};
}());
@@ -108,7 +108,7 @@ if (!Date.prototype.toISOString) {
*/
function parseHtmlLinks(text) {
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
return text.replace(exp,"<a target='_blank' href='$1'>$1</a>");
return text.replace(exp, "<a target='_blank' href='$1'>$1</a>");
}
function escapeHtml(str) {

View File

@@ -406,7 +406,7 @@ initializeWindows = function() {
}
};
torrentNewCategoryFN = function () {
torrentNewCategoryFN = function() {
var hashes = torrentsTable.selectedRowsIds();
if (hashes.length) {
new MochaUI.Window({
@@ -425,7 +425,7 @@ initializeWindows = function() {
}
};
torrentSetCategoryFN = function (categoryHash) {
torrentSetCategoryFN = function(categoryHash) {
var categoryName = '';
if (categoryHash != 0)
categoryName = category_list[categoryHash].name;
@@ -442,7 +442,7 @@ initializeWindows = function() {
}
};
createCategoryFN = function () {
createCategoryFN = function() {
new MochaUI.Window({
id: 'newCategoryPage',
title: "QBT_TR(New Category)QBT_TR[CONTEXT=CategoryFilterWidget]",
@@ -459,7 +459,7 @@ initializeWindows = function() {
updateMainData();
};
removeCategoryFN = function (categoryHash) {
removeCategoryFN = function(categoryHash) {
var categoryName = category_list[categoryHash].name;
new Request({
url: 'api/v2/torrents/removeCategories',
@@ -471,7 +471,7 @@ initializeWindows = function() {
setCategoryFilter(CATEGORIES_ALL);
};
deleteUnusedCategoriesFN = function () {
deleteUnusedCategoriesFN = function() {
var categories = [];
for (var hash in category_list) {
if (torrentsTable.getFilteredTorrentsNumber('all', hash) === 0)
@@ -487,7 +487,7 @@ initializeWindows = function() {
setCategoryFilter(CATEGORIES_ALL);
};
startTorrentsByCategoryFN = function (categoryHash) {
startTorrentsByCategoryFN = function(categoryHash) {
var hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash);
if (hashes.length) {
new Request({
@@ -501,7 +501,7 @@ initializeWindows = function() {
}
};
pauseTorrentsByCategoryFN = function (categoryHash) {
pauseTorrentsByCategoryFN = function(categoryHash) {
var hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash);
if (hashes.length) {
new Request({
@@ -515,7 +515,7 @@ initializeWindows = function() {
}
};
deleteTorrentsByCategoryFN = function (categoryHash) {
deleteTorrentsByCategoryFN = function(categoryHash) {
var hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash);
if (hashes.length) {
new MochaUI.Window({

View File

@@ -203,27 +203,27 @@ var filesDynTable = new Class({
var tds = tr.getElements('td');
for (var i = 0; i < row.length; i++) {
switch (i) {
case 0:
if (row[i] > 0)
tds[i].getChildren('input')[0].set('checked', 'checked');
else
tds[i].getChildren('input')[0].removeProperty('checked');
break;
case 3:
$('pbf_' + id).setValue(row[i].toFloat());
break;
case 4:
if (!is_seed && row[i] > 0) {
tds[i].getChildren('select').set('value', row[i]);
$('comboPrio' + id).removeClass("invisible");
}
else {
if (!$('comboPrio' + id).hasClass("invisible"))
$('comboPrio' + id).addClass("invisible");
}
break;
default:
tds[i].set('html', row[i]);
case 0:
if (row[i] > 0)
tds[i].getChildren('input')[0].set('checked', 'checked');
else
tds[i].getChildren('input')[0].removeProperty('checked');
break;
case 3:
$('pbf_' + id).setValue(row[i].toFloat());
break;
case 4:
if (!is_seed && row[i] > 0) {
tds[i].getChildren('select').set('value', row[i]);
$('comboPrio' + id).removeClass("invisible");
}
else {
if (!$('comboPrio' + id).hasClass("invisible"))
$('comboPrio' + id).addClass("invisible");
}
break;
default:
tds[i].set('html', row[i]);
}
}
return true;
@@ -241,29 +241,29 @@ var filesDynTable = new Class({
for (var i = 0; i < row.length; i++) {
var td = new Element('td');
switch (i) {
case 0:
var tree_img = new Element('img', {
src: 'images/L.gif',
style: 'margin-bottom: -2px'
});
td.adopt(tree_img, createDownloadedCB(id, row[i]));
break;
case 1:
td.set('html', row[i]);
td.set('title', row[i]);
break;
case 3:
td.adopt(new ProgressBar(row[i].toFloat(), {
'id': 'pbf_' + id,
'width': 80
}));
break;
case 4:
td.adopt(createPriorityCombo(id, row[i]));
break;
default:
td.set('html', row[i]);
break;
case 0:
var tree_img = new Element('img', {
src: 'images/L.gif',
style: 'margin-bottom: -2px'
});
td.adopt(tree_img, createDownloadedCB(id, row[i]));
break;
case 1:
td.set('html', row[i]);
td.set('title', row[i]);
break;
case 3:
td.adopt(new ProgressBar(row[i].toFloat(), {
'id': 'pbf_' + id,
'width': 80
}));
break;
case 4:
td.adopt(createPriorityCombo(id, row[i]));
break;
default:
td.set('html', row[i]);
break;
}
td.injectInside(tr);
}
@@ -273,8 +273,8 @@ var filesDynTable = new Class({
var loadTorrentFilesDataTimer;
var loadTorrentFilesData = function() {
if ($('prop_files').hasClass('invisible') ||
$('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
if ($('prop_files').hasClass('invisible')
|| $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
// Tab changed, don't do anything
return;
}

View File

@@ -27,8 +27,8 @@ var clearData = function() {
var loadTorrentDataTimer;
var loadTorrentData = function() {
if ($('prop_general').hasClass('invisible') ||
$('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
if ($('prop_general').hasClass('invisible')
|| $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
// Tab changed, don't do anything
return;
}
@@ -58,8 +58,8 @@ var loadTorrentData = function() {
// Update Torrent data
if (data.seeding_time > 0)
temp = "QBT_TR(%1 (%2 this session))QBT_TR[CONTEXT=PropertiesWidget]"
.replace("%1", friendlyDuration(data.time_elapsed))
.replace("%2", friendlyDuration(data.seeding_time));
.replace("%1", friendlyDuration(data.time_elapsed))
.replace("%2", friendlyDuration(data.seeding_time));
else
temp = friendlyDuration(data.time_elapsed);
$('time_elapsed').set('html', temp);
@@ -67,28 +67,28 @@ var loadTorrentData = function() {
$('eta').set('html', friendlyDuration(data.eta));
temp = "QBT_TR(%1 (%2 max))QBT_TR[CONTEXT=PropertiesWidget]"
.replace("%1", data.nb_connections)
.replace("%2", data.nb_connections_limit < 0 ? "∞" : data.nb_connections_limit);
.replace("%1", data.nb_connections)
.replace("%2", data.nb_connections_limit < 0 ? "∞" : data.nb_connections_limit);
$('nb_connections').set('html', temp);
temp = "QBT_TR(%1 (%2 this session))QBT_TR[CONTEXT=PropertiesWidget]"
.replace("%1", friendlyUnit(data.total_downloaded))
.replace("%2", friendlyUnit(data.total_downloaded_session));
.replace("%1", friendlyUnit(data.total_downloaded))
.replace("%2", friendlyUnit(data.total_downloaded_session));
$('total_downloaded').set('html', temp);
temp = "QBT_TR(%1 (%2 this session))QBT_TR[CONTEXT=PropertiesWidget]"
.replace("%1", friendlyUnit(data.total_uploaded))
.replace("%2", friendlyUnit(data.total_uploaded_session));
.replace("%1", friendlyUnit(data.total_uploaded))
.replace("%2", friendlyUnit(data.total_uploaded_session));
$('total_uploaded').set('html', temp);
temp = "QBT_TR(%1 (%2 avg.))QBT_TR[CONTEXT=PropertiesWidget]"
.replace("%1", friendlyUnit(data.dl_speed, true))
.replace("%2", friendlyUnit(data.dl_speed_avg, true));
.replace("%1", friendlyUnit(data.dl_speed, true))
.replace("%2", friendlyUnit(data.dl_speed_avg, true));
$('dl_speed').set('html', temp);
temp = "QBT_TR(%1 (%2 avg.))QBT_TR[CONTEXT=PropertiesWidget]"
.replace("%1", friendlyUnit(data.up_speed, true))
.replace("%2", friendlyUnit(data.up_speed_avg, true));
.replace("%1", friendlyUnit(data.up_speed, true))
.replace("%2", friendlyUnit(data.up_speed_avg, true));
$('up_speed').set('html', temp);
temp = (data.dl_limit == -1 ? "∞" : friendlyUnit(data.dl_limit, true));
@@ -100,13 +100,13 @@ var loadTorrentData = function() {
$('total_wasted').set('html', friendlyUnit(data.total_wasted));
temp = "QBT_TR(%1 (%2 total))QBT_TR[CONTEXT=PropertiesWidget]"
.replace("%1", data.seeds)
.replace("%2", data.seeds_total);
.replace("%1", data.seeds)
.replace("%2", data.seeds_total);
$('seeds').set('html', temp);
temp = "QBT_TR(%1 (%2 total))QBT_TR[CONTEXT=PropertiesWidget]"
.replace("%1", data.peers)
.replace("%2", data.peers_total);
.replace("%1", data.peers)
.replace("%2", data.peers_total);
$('peers').set('html', temp);
$('share_ratio').set('html', data.share_ratio.toFixed(2));
@@ -123,9 +123,9 @@ var loadTorrentData = function() {
if (data.pieces_num != -1)
temp = "QBT_TR(%1 x %2 (have %3))QBT_TR[CONTEXT=PropertiesWidget]"
.replace("%1", data.pieces_num)
.replace("%2", friendlyUnit(data.piece_size))
.replace("%3", data.pieces_have);
.replace("%1", data.pieces_num)
.replace("%2", friendlyUnit(data.piece_size))
.replace("%3", data.pieces_have);
else
temp = "QBT_TR(Unknown)QBT_TR[CONTEXT=HttpServer]";
$('pieces').set('html', temp);

View File

@@ -54,8 +54,8 @@ var current_hash = "";
var loadTrackersDataTimer;
var loadTrackersData = function() {
if ($('prop_trackers').hasClass('invisible') ||
$('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
if ($('prop_trackers').hasClass('invisible')
|| $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
// Tab changed, don't do anything
return;
}

View File

@@ -54,8 +54,8 @@ var current_hash = "";
var loadWebSeedsDataTimer;
var loadWebSeedsData = function() {
if ($('prop_webseeds').hasClass('invisible') ||
$('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
if ($('prop_webseeds').hasClass('invisible')
|| $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
// Tab changed, don't do anything
return;
}