2008-07-03 14:59:31 +00:00
|
|
|
/*
|
|
|
|
* MIT License
|
2008-09-28 11:57:09 +00:00
|
|
|
* Copyright (c) 2008 Ishan Arora <ishan@qbittorrent.org>,
|
|
|
|
* Christophe Dumez <chris@qbittorrent.org>
|
2008-07-03 14:59:31 +00:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* 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:
|
2012-07-01 14:44:14 +03:00
|
|
|
*
|
2008-07-03 14:59:31 +00:00
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
2012-07-01 14:44:14 +03:00
|
|
|
*
|
2008-07-03 14:59:31 +00:00
|
|
|
* 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
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
2008-07-04 07:48:15 +00:00
|
|
|
*/
|
2008-07-03 14:59:31 +00:00
|
|
|
|
2015-11-11 22:58:30 +03:00
|
|
|
torrentsTable = new TorrentsTable();
|
2015-11-13 15:02:38 +03:00
|
|
|
torrentPeersTable = new TorrentPeersTable();
|
2008-12-24 11:28:02 +00:00
|
|
|
|
2016-01-24 12:50:45 +03:00
|
|
|
var updatePropertiesPanel = function () {};
|
|
|
|
|
|
|
|
var updateTorrentData = function () {};
|
|
|
|
var updateTrackersData = function () {};
|
|
|
|
var updateTorrentPeersData = function () {};
|
|
|
|
var updateWebSeedsData = function () {};
|
|
|
|
var updateTorrentFilesData = function () {};
|
|
|
|
|
|
|
|
var updateMainData = function () {};
|
2014-12-19 17:24:56 +01:00
|
|
|
var alternativeSpeedLimits = false;
|
2015-01-29 16:42:04 +03:00
|
|
|
var queueing_enabled = true;
|
2015-01-30 01:01:41 +03:00
|
|
|
var syncMainDataTimerPeriod = 1500;
|
2014-12-11 00:01:04 +01:00
|
|
|
|
2016-02-09 11:56:48 +03:00
|
|
|
var CATEGORIES_ALL = 1;
|
|
|
|
var CATEGORIES_UNCATEGORIZED = 2;
|
2015-02-14 18:19:54 -03:00
|
|
|
|
2016-02-09 11:56:48 +03:00
|
|
|
var category_list = {};
|
2015-02-14 18:19:54 -03:00
|
|
|
|
2016-02-09 11:56:48 +03:00
|
|
|
var selected_category = CATEGORIES_ALL;
|
|
|
|
var setCategoryFilter = function(){};
|
2015-02-14 18:19:54 -03:00
|
|
|
|
|
|
|
var selected_filter = getLocalStorageItem('selected_filter', 'all');
|
|
|
|
var setFilter = function(){};
|
2014-12-24 04:39:18 +03:00
|
|
|
|
2016-02-09 11:56:48 +03:00
|
|
|
var loadSelectedCategory = function () {
|
|
|
|
selected_category = getLocalStorageItem('selected_category', CATEGORIES_ALL);
|
2015-02-14 18:19:54 -03:00
|
|
|
};
|
2016-02-09 11:56:48 +03:00
|
|
|
loadSelectedCategory();
|
2014-12-24 04:39:18 +03:00
|
|
|
|
2015-02-14 18:19:54 -03:00
|
|
|
function genHash(string) {
|
|
|
|
var hash = 0;
|
|
|
|
for (var i = 0; i < string.length; i++) {
|
|
|
|
var c = string.charCodeAt(i);
|
|
|
|
hash = (c + hash * 31) | 0;
|
2014-12-08 02:15:31 +03:00
|
|
|
}
|
2015-02-14 18:19:54 -03:00
|
|
|
return hash;
|
2014-12-24 04:39:18 +03:00
|
|
|
}
|
2014-12-08 02:15:31 +03:00
|
|
|
|
2014-11-22 09:35:56 +03:00
|
|
|
window.addEvent('load', function () {
|
2012-07-01 14:44:14 +03:00
|
|
|
|
2014-11-22 09:35:56 +03:00
|
|
|
var saveColumnSizes = function () {
|
|
|
|
var filters_width = $('Filters').getSize().x;
|
2014-12-14 10:00:00 +01:00
|
|
|
var properties_height_rel = $('propertiesPanel').getSize().y / Window.getSize().y;
|
2014-11-22 09:35:56 +03:00
|
|
|
localStorage.setItem('filters_width', filters_width);
|
2014-12-14 10:00:00 +01:00
|
|
|
localStorage.setItem('properties_height_rel', properties_height_rel);
|
2014-11-22 09:35:56 +03:00
|
|
|
}
|
2012-07-01 14:44:14 +03:00
|
|
|
|
2014-12-14 10:00:00 +01:00
|
|
|
window.addEvent('resize', function() {
|
|
|
|
// Resizing might takes some time.
|
|
|
|
saveColumnSizes.delay(200);
|
|
|
|
});
|
|
|
|
|
2014-11-22 09:35:56 +03:00
|
|
|
/*MochaUI.Desktop = new MochaUI.Desktop();
|
|
|
|
MochaUI.Desktop.desktop.setStyles({
|
|
|
|
'background': '#fff',
|
|
|
|
'visibility': 'visible'
|
|
|
|
});*/
|
|
|
|
MochaUI.Desktop.initialize();
|
2009-12-05 14:19:37 +00:00
|
|
|
|
2014-11-22 09:35:56 +03:00
|
|
|
var filt_w = localStorage.getItem('filters_width');
|
|
|
|
if ($defined(filt_w))
|
|
|
|
filt_w = filt_w.toInt();
|
|
|
|
else
|
|
|
|
filt_w = 120;
|
|
|
|
new MochaUI.Column({
|
|
|
|
id : 'filtersColumn',
|
|
|
|
placement : 'left',
|
|
|
|
onResize : saveColumnSizes,
|
|
|
|
width : filt_w,
|
|
|
|
resizeLimit : [100, 300]
|
|
|
|
});
|
|
|
|
new MochaUI.Column({
|
|
|
|
id : 'mainColumn',
|
|
|
|
placement : 'main',
|
|
|
|
width : null,
|
|
|
|
resizeLimit : [100, 300]
|
|
|
|
});
|
2014-12-08 04:31:04 +03:00
|
|
|
|
2016-02-09 11:56:48 +03:00
|
|
|
setCategoryFilter = function(hash) {
|
|
|
|
selected_category = hash;
|
|
|
|
localStorage.setItem('selected_category', selected_category);
|
|
|
|
highlightSelectedCategory();
|
2017-05-21 18:19:29 -04:00
|
|
|
if (typeof torrentsTable.tableBody != 'undefined')
|
2015-02-14 18:19:54 -03:00
|
|
|
updateMainData();
|
|
|
|
};
|
|
|
|
|
2014-12-08 04:31:04 +03:00
|
|
|
setFilter = function (f) {
|
|
|
|
// Visually Select the right filter
|
|
|
|
$("all_filter").removeClass("selectedFilter");
|
|
|
|
$("downloading_filter").removeClass("selectedFilter");
|
2015-03-29 11:57:36 +01:00
|
|
|
$("seeding_filter").removeClass("selectedFilter");
|
2014-12-08 04:31:04 +03:00
|
|
|
$("completed_filter").removeClass("selectedFilter");
|
|
|
|
$("paused_filter").removeClass("selectedFilter");
|
2015-01-29 20:30:54 +03:00
|
|
|
$("resumed_filter").removeClass("selectedFilter");
|
2014-12-08 04:31:04 +03:00
|
|
|
$("active_filter").removeClass("selectedFilter");
|
|
|
|
$("inactive_filter").removeClass("selectedFilter");
|
2015-12-07 04:05:52 +03:00
|
|
|
$("errored_filter").removeClass("selectedFilter");
|
2014-12-08 04:31:04 +03:00
|
|
|
$(f + "_filter").addClass("selectedFilter");
|
2014-12-24 04:39:18 +03:00
|
|
|
selected_filter = f;
|
2014-12-08 04:31:04 +03:00
|
|
|
localStorage.setItem('selected_filter', f);
|
|
|
|
// Reload torrents
|
2017-05-21 18:19:29 -04:00
|
|
|
if (typeof torrentsTable.tableBody != 'undefined')
|
2015-01-06 23:24:54 +03:00
|
|
|
updateMainData();
|
2014-12-08 04:31:04 +03:00
|
|
|
}
|
|
|
|
|
2014-11-22 09:35:56 +03:00
|
|
|
new MochaUI.Panel({
|
|
|
|
id : 'Filters',
|
|
|
|
title : 'Panel',
|
|
|
|
header : false,
|
|
|
|
padding : {
|
|
|
|
top : 0,
|
|
|
|
right : 0,
|
|
|
|
bottom : 0,
|
|
|
|
left : 0
|
|
|
|
},
|
|
|
|
loadMethod : 'xhr',
|
|
|
|
contentURL : 'filters.html',
|
2014-12-08 04:31:04 +03:00
|
|
|
onContentLoaded : function () {
|
2014-12-24 04:39:18 +03:00
|
|
|
setFilter(selected_filter);
|
2014-12-08 04:31:04 +03:00
|
|
|
},
|
2014-11-22 09:35:56 +03:00
|
|
|
column : 'filtersColumn',
|
|
|
|
height : 300
|
|
|
|
});
|
|
|
|
initializeWindows();
|
2014-11-30 21:13:02 +01:00
|
|
|
|
2015-06-17 01:01:57 +02:00
|
|
|
// Show Top Toolbar is enabled by default
|
|
|
|
if (localStorage.getItem('show_top_toolbar') == null)
|
|
|
|
var showTopToolbar = true;
|
|
|
|
else
|
|
|
|
var showTopToolbar = localStorage.getItem('show_top_toolbar') == "true";
|
|
|
|
if (!showTopToolbar) {
|
|
|
|
$('showTopToolbarLink').firstChild.style.opacity = '0';
|
|
|
|
$('mochaToolbar').addClass('invisible');
|
|
|
|
}
|
|
|
|
|
2014-11-30 21:13:02 +01:00
|
|
|
var speedInTitle = localStorage.getItem('speed_in_browser_title_bar') == "true";
|
|
|
|
if (!speedInTitle)
|
|
|
|
$('speedInBrowserTitleBarLink').firstChild.style.opacity = '0';
|
|
|
|
|
2015-06-17 01:01:57 +02:00
|
|
|
// After Show Top Toolbar
|
|
|
|
MochaUI.Desktop.setDesktopSize();
|
|
|
|
|
2015-01-06 23:24:54 +03:00
|
|
|
var syncMainDataLastResponseId = 0;
|
|
|
|
var serverState = {};
|
|
|
|
|
2016-02-09 11:56:48 +03:00
|
|
|
var removeTorrentFromCategoryList = function(hash) {
|
2015-07-16 01:04:53 +02:00
|
|
|
if (hash == null || hash == "")
|
|
|
|
return false;
|
2015-02-14 18:19:54 -03:00
|
|
|
var removed = false;
|
2016-02-09 11:56:48 +03:00
|
|
|
Object.each(category_list, function(category) {
|
|
|
|
if (Object.contains(category.torrents, hash)) {
|
2015-02-14 18:19:54 -03:00
|
|
|
removed = true;
|
2016-02-09 11:56:48 +03:00
|
|
|
category.torrents.splice(category.torrents.indexOf(hash), 1);
|
2015-02-14 18:19:54 -03:00
|
|
|
}
|
|
|
|
});
|
|
|
|
return removed;
|
|
|
|
};
|
|
|
|
|
2016-02-09 11:56:48 +03:00
|
|
|
var addTorrentToCategoryList = function(torrent) {
|
|
|
|
var category = torrent['category'];
|
|
|
|
if (category == null)
|
2015-02-14 18:19:54 -03:00
|
|
|
return false;
|
2016-02-09 11:56:48 +03:00
|
|
|
if (category.length === 0) { // Empty category
|
|
|
|
removeTorrentFromCategoryList(torrent['hash']);
|
2015-07-16 01:04:53 +02:00
|
|
|
return true;
|
2015-02-14 18:19:54 -03:00
|
|
|
}
|
2016-02-09 11:56:48 +03:00
|
|
|
var categoryHash = genHash(category);
|
|
|
|
if (category_list[categoryHash] == null) // This should not happen
|
|
|
|
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']]);
|
2015-02-14 18:19:54 -03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
2015-12-07 04:05:52 +03:00
|
|
|
var updateFilter = function(filter, filterTitle) {
|
2016-01-21 18:58:08 +03:00
|
|
|
$(filter + '_filter').firstChild.childNodes[1].nodeValue = filterTitle.replace('%1', torrentsTable.getFilteredTorrentsNumber(filter, CATEGORIES_ALL));
|
2015-12-07 04:05:52 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
var updateFiltersList = function() {
|
2017-05-01 01:45:02 +03:00
|
|
|
updateFilter('all', 'QBT_TR(All (%1))QBT_TR[CONTEXT=StatusFiltersWidget]');
|
|
|
|
updateFilter('downloading', 'QBT_TR(Downloading (%1))QBT_TR[CONTEXT=StatusFiltersWidget]');
|
|
|
|
updateFilter('seeding', 'QBT_TR(Seeding (%1))QBT_TR[CONTEXT=StatusFiltersWidget]');
|
|
|
|
updateFilter('completed', 'QBT_TR(Completed (%1))QBT_TR[CONTEXT=StatusFiltersWidget]');
|
|
|
|
updateFilter('resumed', 'QBT_TR(Resumed (%1))QBT_TR[CONTEXT=StatusFiltersWidget]');
|
|
|
|
updateFilter('paused', 'QBT_TR(Paused (%1))QBT_TR[CONTEXT=StatusFiltersWidget]');
|
|
|
|
updateFilter('active', 'QBT_TR(Active (%1))QBT_TR[CONTEXT=StatusFiltersWidget]');
|
|
|
|
updateFilter('inactive', 'QBT_TR(Inactive (%1))QBT_TR[CONTEXT=StatusFiltersWidget]');
|
|
|
|
updateFilter('errored', 'QBT_TR(Errored (%1))QBT_TR[CONTEXT=StatusFiltersWidget]');
|
2015-12-07 04:05:52 +03:00
|
|
|
};
|
|
|
|
|
2016-02-09 11:56:48 +03:00
|
|
|
var updateCategoryList = function() {
|
|
|
|
var categoryList = $('filterCategoryList');
|
|
|
|
if (!categoryList)
|
2015-02-14 18:19:54 -03:00
|
|
|
return;
|
2016-02-09 11:56:48 +03:00
|
|
|
categoryList.empty();
|
2015-02-14 18:19:54 -03:00
|
|
|
|
2015-07-16 01:04:53 +02:00
|
|
|
var create_link = function(hash, text, count) {
|
2016-02-09 11:56:48 +03:00
|
|
|
var html = '<a href="#" onclick="setCategoryFilter(' + hash + ');return false;">' +
|
2015-07-16 01:04:53 +02:00
|
|
|
'<img src="theme/inode-directory"/>' +
|
2016-01-20 16:13:54 +03:00
|
|
|
escapeHtml(text) + ' (' + count + ')' + '</a>';
|
2016-01-20 22:57:42 +03:00
|
|
|
var el = new Element('li', {id: hash, html: html});
|
|
|
|
categoriesFilterContextMenu.addTarget(el);
|
|
|
|
return el;
|
2015-02-14 18:19:54 -03:00
|
|
|
};
|
|
|
|
|
2015-11-11 22:58:30 +03:00
|
|
|
var all = torrentsTable.getRowIds().length;
|
2016-02-09 11:56:48 +03:00
|
|
|
var uncategorized = 0;
|
2015-11-11 22:58:30 +03:00
|
|
|
Object.each(torrentsTable.rows, function(row) {
|
2016-02-09 11:56:48 +03:00
|
|
|
if (row['full_data'].category.length === 0)
|
|
|
|
uncategorized += 1;
|
2015-07-16 01:04:53 +02:00
|
|
|
});
|
2017-05-01 01:45:02 +03:00
|
|
|
categoryList.appendChild(create_link(CATEGORIES_ALL, 'QBT_TR(All)QBT_TR[CONTEXT=CategoryFilterModel]', all));
|
|
|
|
categoryList.appendChild(create_link(CATEGORIES_UNCATEGORIZED, 'QBT_TR(Uncategorized)QBT_TR[CONTEXT=CategoryFilterModel]', uncategorized));
|
2015-07-16 01:04:53 +02:00
|
|
|
|
2016-02-09 11:56:48 +03:00
|
|
|
var sortedCategories = []
|
|
|
|
Object.each(category_list, function(category) {
|
|
|
|
sortedCategories.push(category.name);
|
2015-02-14 18:19:54 -03:00
|
|
|
});
|
2016-02-09 11:56:48 +03:00
|
|
|
sortedCategories.sort();
|
2015-02-14 18:19:54 -03:00
|
|
|
|
2016-02-09 11:56:48 +03:00
|
|
|
Object.each(sortedCategories, function(categoryName) {
|
|
|
|
var categoryHash = genHash(categoryName);
|
|
|
|
var categoryCount = category_list[categoryHash].torrents.length;
|
|
|
|
categoryList.appendChild(create_link(categoryHash, categoryName, categoryCount));
|
2015-07-16 01:04:53 +02:00
|
|
|
});
|
2015-02-14 18:19:54 -03:00
|
|
|
|
2016-02-09 11:56:48 +03:00
|
|
|
highlightSelectedCategory();
|
2015-07-16 01:04:53 +02:00
|
|
|
};
|
2015-02-14 18:19:54 -03:00
|
|
|
|
2016-02-09 11:56:48 +03:00
|
|
|
var highlightSelectedCategory = function() {
|
|
|
|
var categoryList = $('filterCategoryList');
|
|
|
|
if (!categoryList)
|
2015-07-16 01:04:53 +02:00
|
|
|
return;
|
2016-02-09 11:56:48 +03:00
|
|
|
var childrens = categoryList.childNodes;
|
2015-02-14 18:19:54 -03:00
|
|
|
for (var i in childrens) {
|
2016-02-09 11:56:48 +03:00
|
|
|
if (childrens[i].id == selected_category)
|
2015-02-14 18:19:54 -03:00
|
|
|
childrens[i].className = "selectedFilter";
|
2015-07-16 01:04:53 +02:00
|
|
|
else
|
|
|
|
childrens[i].className = "";
|
2015-02-14 18:19:54 -03:00
|
|
|
}
|
2015-07-16 01:04:53 +02:00
|
|
|
}
|
2015-02-14 18:19:54 -03:00
|
|
|
|
2015-01-06 23:24:54 +03:00
|
|
|
var syncMainDataTimer;
|
|
|
|
var syncMainData = function () {
|
|
|
|
var url = new URI('sync/maindata');
|
|
|
|
url.setData('rid', syncMainDataLastResponseId);
|
2014-12-14 10:00:00 +01:00
|
|
|
var request = new Request.JSON({
|
|
|
|
url : url,
|
|
|
|
noCache : true,
|
|
|
|
method : 'get',
|
|
|
|
onFailure : function () {
|
2017-05-01 01:45:02 +03:00
|
|
|
$('error_div').set('html', 'QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]');
|
2015-01-06 23:24:54 +03:00
|
|
|
clearTimeout(syncMainDataTimer);
|
|
|
|
syncMainDataTimer = syncMainData.delay(2000);
|
2014-12-14 10:00:00 +01:00
|
|
|
},
|
2014-12-24 04:39:18 +03:00
|
|
|
onSuccess : function (response) {
|
2014-12-14 10:00:00 +01:00
|
|
|
$('error_div').set('html', '');
|
2014-12-24 04:39:18 +03:00
|
|
|
if (response) {
|
2016-02-09 11:56:48 +03:00
|
|
|
var update_categories = false;
|
2015-01-06 23:24:54 +03:00
|
|
|
var full_update = (response['full_update'] == true);
|
2015-02-14 18:19:54 -03:00
|
|
|
if (full_update) {
|
2015-11-13 15:02:38 +03:00
|
|
|
torrentsTable.clear();
|
2016-02-09 11:56:48 +03:00
|
|
|
category_list = {};
|
2015-02-14 18:19:54 -03:00
|
|
|
}
|
|
|
|
if (response['rid']) {
|
2015-01-06 23:24:54 +03:00
|
|
|
syncMainDataLastResponseId = response['rid'];
|
2015-02-14 18:19:54 -03:00
|
|
|
}
|
2016-02-09 11:56:48 +03:00
|
|
|
if (response['categories']) {
|
|
|
|
response['categories'].each(function(category) {
|
|
|
|
var categoryHash = genHash(category);
|
|
|
|
category_list[categoryHash] = {name: category, torrents: []};
|
2015-07-16 01:04:53 +02:00
|
|
|
});
|
2016-02-09 11:56:48 +03:00
|
|
|
update_categories = true;
|
2015-07-16 01:04:53 +02:00
|
|
|
}
|
2016-02-09 11:56:48 +03:00
|
|
|
if (response['categories_removed']) {
|
|
|
|
response['categories_removed'].each(function(category) {
|
|
|
|
var categoryHash = genHash(category);
|
|
|
|
delete category_list[categoryHash];
|
2015-07-16 01:04:53 +02:00
|
|
|
});
|
2016-02-09 11:56:48 +03:00
|
|
|
update_categories = true;
|
2015-07-16 01:04:53 +02:00
|
|
|
}
|
2015-02-14 18:19:54 -03:00
|
|
|
if (response['torrents']) {
|
2015-01-06 23:24:54 +03:00
|
|
|
for (var key in response['torrents']) {
|
|
|
|
response['torrents'][key]['hash'] = key;
|
2015-11-11 22:50:14 +03:00
|
|
|
response['torrents'][key]['rowId'] = key;
|
2015-11-11 22:58:30 +03:00
|
|
|
torrentsTable.updateRowData(response['torrents'][key]);
|
2016-02-09 11:56:48 +03:00
|
|
|
if (addTorrentToCategoryList(response['torrents'][key]))
|
|
|
|
update_categories = true;
|
2015-01-06 23:24:54 +03:00
|
|
|
}
|
2015-02-14 18:19:54 -03:00
|
|
|
}
|
2015-01-06 23:24:54 +03:00
|
|
|
if (response['torrents_removed'])
|
|
|
|
response['torrents_removed'].each(function (hash) {
|
2015-11-11 22:58:30 +03:00
|
|
|
torrentsTable.removeRow(hash);
|
2016-02-09 11:56:48 +03:00
|
|
|
removeTorrentFromCategoryList(hash);
|
|
|
|
update_categories = true; // Allways to update All category
|
2015-01-06 23:24:54 +03:00
|
|
|
});
|
2015-11-11 22:58:30 +03:00
|
|
|
torrentsTable.updateTable(full_update);
|
|
|
|
torrentsTable.altRow();
|
2015-01-06 23:24:54 +03:00
|
|
|
if (response['server_state']) {
|
|
|
|
var tmp = response['server_state'];
|
|
|
|
for(var key in tmp)
|
|
|
|
serverState[key] = tmp[key];
|
|
|
|
processServerState();
|
|
|
|
}
|
2015-12-07 04:05:52 +03:00
|
|
|
updateFiltersList();
|
2016-02-09 11:56:48 +03:00
|
|
|
if (update_categories) {
|
|
|
|
updateCategoryList();
|
2016-01-20 16:13:54 +03:00
|
|
|
torrentsTableContextMenu.updateCategoriesSubMenu(category_list);
|
2015-07-16 01:04:53 +02:00
|
|
|
}
|
2014-12-14 10:00:00 +01:00
|
|
|
}
|
2015-01-06 23:24:54 +03:00
|
|
|
clearTimeout(syncMainDataTimer);
|
2015-01-30 01:01:41 +03:00
|
|
|
syncMainDataTimer = syncMainData.delay(syncMainDataTimerPeriod);
|
2014-12-14 10:00:00 +01:00
|
|
|
}
|
|
|
|
}).send();
|
|
|
|
};
|
|
|
|
|
2015-01-06 23:24:54 +03:00
|
|
|
updateMainData = function() {
|
2015-11-11 22:58:30 +03:00
|
|
|
torrentsTable.updateTable();
|
2015-01-06 23:24:54 +03:00
|
|
|
clearTimeout(syncMainDataTimer);
|
|
|
|
syncMainDataTimer = syncMainData.delay(100);
|
2014-12-14 10:00:00 +01:00
|
|
|
}
|
|
|
|
|
2015-01-06 23:24:54 +03:00
|
|
|
var processServerState = function () {
|
2016-01-13 23:12:28 +03:00
|
|
|
var transfer_info = friendlyUnit(serverState.dl_info_speed, true);
|
2015-01-06 23:24:54 +03:00
|
|
|
if (serverState.dl_rate_limit > 0)
|
2016-01-13 23:12:28 +03:00
|
|
|
transfer_info += " [" + friendlyUnit(serverState.dl_rate_limit, true) + "]";
|
|
|
|
transfer_info += " (" + friendlyUnit(serverState.dl_info_data, false) + ")";
|
2015-01-06 23:24:54 +03:00
|
|
|
$("DlInfos").set('html', transfer_info);
|
2016-01-13 23:12:28 +03:00
|
|
|
transfer_info = friendlyUnit(serverState.up_info_speed, true);
|
2015-01-06 23:24:54 +03:00
|
|
|
if (serverState.up_rate_limit > 0)
|
2016-01-13 23:12:28 +03:00
|
|
|
transfer_info += " [" + friendlyUnit(serverState.up_rate_limit, true) + "]";
|
|
|
|
transfer_info += " (" + friendlyUnit(serverState.up_info_data, false) + ")";
|
2015-01-06 23:24:54 +03:00
|
|
|
$("UpInfos").set('html', transfer_info);
|
2015-05-23 19:20:04 +02:00
|
|
|
if (speedInTitle) {
|
2017-05-05 03:19:59 +03:00
|
|
|
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}");
|
2017-05-01 01:45:02 +03:00
|
|
|
document.title += " QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]";
|
2015-05-23 19:20:04 +02:00
|
|
|
}else
|
2017-05-01 01:45:02 +03:00
|
|
|
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));
|
2017-03-06 03:05:18 +00:00
|
|
|
|
|
|
|
<!-- Statistics dialog -->
|
|
|
|
if (document.getElementById("statisticspage")) {
|
2017-05-05 03:19:59 +03:00
|
|
|
$('AlltimeDL').set('html', 'QBT_TR(Alltime download:)QBT_TR[CONTEXT=StatsDialog]' + " " + friendlyUnit(serverState.alltime_dl, false));
|
|
|
|
$('AlltimeUL').set('html', 'QBT_TR(Alltime upload:)QBT_TR[CONTEXT=StatsDialog]' + " " + friendlyUnit(serverState.alltime_ul, false));
|
|
|
|
$('TotalWastedSession').set('html', 'QBT_TR(Total wasted (this session):)QBT_TR[CONTEXT=StatsDialog]' + " " + friendlyUnit(serverState.total_wasted_session, false));
|
|
|
|
$('GlobalRatio').set('html', 'QBT_TR(Global ratio:)QBT_TR[CONTEXT=StatsDialog]' + " " + serverState.global_ratio);
|
|
|
|
$('TotalPeerConnections').set('html', 'QBT_TR(Total peer connections:)QBT_TR[CONTEXT=StatsDialog]' + " " + serverState.total_peer_connections);
|
|
|
|
$('ReadCacheHits').set('html', 'QBT_TR(Read cache hits:)QBT_TR[CONTEXT=StatsDialog]' + " " + serverState.read_cache_hits);
|
|
|
|
$('TotalBuffersSize').set('html', 'QBT_TR(Total buffers size:)QBT_TR[CONTEXT=StatsDialog]' + " " + friendlyUnit(serverState.total_buffers_size, false));
|
|
|
|
$('WriteCacheOverload').set('html', 'QBT_TR(Write cache overload:)QBT_TR[CONTEXT=StatsDialog]' + " " + serverState.write_cache_overload);
|
|
|
|
$('ReadCacheOverload').set('html', 'QBT_TR(Read cache overload:)QBT_TR[CONTEXT=StatsDialog]' + " " + serverState.read_cache_overload);
|
|
|
|
$('QueuedIOJobs').set('html', 'QBT_TR(Queued I/O jobs:)QBT_TR[CONTEXT=StatsDialog]' + " " + serverState.queued_io_jobs);
|
|
|
|
$('AverageTimeInQueue').set('html', 'QBT_TR(Average time in queue:)QBT_TR[CONTEXT=StatsDialog]' + " " + serverState.average_time_queue);
|
|
|
|
$('TotalQueuedSize').set('html', 'QBT_TR(Total queued size:)QBT_TR[CONTEXT=StatsDialog]' + " " + friendlyUnit(serverState.total_queued_size, false));
|
2017-03-06 03:05:18 +00:00
|
|
|
}
|
|
|
|
|
2015-01-06 23:24:54 +03:00
|
|
|
if (serverState.connection_status == "connected")
|
|
|
|
$('connectionStatus').src = 'images/skin/connected.png';
|
|
|
|
else if (serverState.connection_status == "firewalled")
|
|
|
|
$('connectionStatus').src = 'images/skin/firewalled.png';
|
|
|
|
else
|
|
|
|
$('connectionStatus').src = 'images/skin/disconnected.png';
|
2015-01-29 16:42:04 +03:00
|
|
|
|
|
|
|
if (queueing_enabled != serverState.queueing) {
|
|
|
|
queueing_enabled = serverState.queueing;
|
2015-11-11 22:58:30 +03:00
|
|
|
torrentsTable.columns['priority'].force_hide = !queueing_enabled;
|
|
|
|
torrentsTable.updateColumn('priority');
|
2015-01-29 16:42:04 +03:00
|
|
|
if (queueing_enabled) {
|
2015-06-17 01:00:59 +02:00
|
|
|
$('queueingLinks').removeClass('invisible');
|
2015-01-29 16:42:04 +03:00
|
|
|
$('queueingButtons').removeClass('invisible');
|
|
|
|
$('queueingMenuItems').removeClass('invisible');
|
|
|
|
}
|
|
|
|
else {
|
2015-06-17 01:00:59 +02:00
|
|
|
$('queueingLinks').addClass('invisible');
|
2015-01-29 16:42:04 +03:00
|
|
|
$('queueingButtons').addClass('invisible');
|
|
|
|
$('queueingMenuItems').addClass('invisible');
|
|
|
|
}
|
|
|
|
}
|
2015-01-29 19:56:14 +03:00
|
|
|
|
|
|
|
if (alternativeSpeedLimits != serverState.use_alt_speed_limits) {
|
|
|
|
alternativeSpeedLimits = serverState.use_alt_speed_limits;
|
|
|
|
updateAltSpeedIcon(alternativeSpeedLimits);
|
|
|
|
}
|
2015-01-30 01:01:41 +03:00
|
|
|
|
|
|
|
syncMainDataTimerPeriod = serverState.refresh_interval;
|
|
|
|
if (syncMainDataTimerPeriod < 500)
|
|
|
|
syncMainDataTimerPeriod = 500;
|
2014-11-22 09:35:56 +03:00
|
|
|
};
|
2014-11-26 21:26:29 +01:00
|
|
|
|
2014-12-14 10:00:00 +01:00
|
|
|
var updateAltSpeedIcon = function(enabled) {
|
|
|
|
if (enabled)
|
|
|
|
$('alternativeSpeedLimits').src = "images/slow.png";
|
|
|
|
else
|
|
|
|
$('alternativeSpeedLimits').src = "images/slow_off.png"
|
|
|
|
}
|
|
|
|
|
|
|
|
$('alternativeSpeedLimits').addEvent('click', function() {
|
|
|
|
// Change icon immediately to give some feedback
|
2014-12-19 17:24:56 +01:00
|
|
|
updateAltSpeedIcon(!alternativeSpeedLimits);
|
2014-12-14 10:00:00 +01:00
|
|
|
|
|
|
|
new Request({url: 'command/toggleAlternativeSpeedLimits',
|
|
|
|
method: 'post',
|
|
|
|
onComplete: function() {
|
2014-12-19 17:24:56 +01:00
|
|
|
alternativeSpeedLimits = !alternativeSpeedLimits;
|
2015-01-06 23:24:54 +03:00
|
|
|
updateMainData();
|
2014-12-14 10:00:00 +01:00
|
|
|
},
|
|
|
|
onFailure: function() {
|
|
|
|
// Restore icon in case of failure
|
2014-12-19 17:24:56 +01:00
|
|
|
updateAltSpeedIcon(alternativeSpeedLimits)
|
2014-12-14 10:00:00 +01:00
|
|
|
}
|
|
|
|
}).send();
|
|
|
|
});
|
|
|
|
|
2014-11-22 09:35:56 +03:00
|
|
|
$('DlInfos').addEvent('click', globalDownloadLimitFN);
|
|
|
|
$('UpInfos').addEvent('click', globalUploadLimitFN);
|
2012-07-01 14:44:14 +03:00
|
|
|
|
2015-06-17 01:01:57 +02:00
|
|
|
$('showTopToolbarLink').addEvent('click', function(e) {
|
|
|
|
showTopToolbar = !showTopToolbar;
|
|
|
|
localStorage.setItem('show_top_toolbar', showTopToolbar.toString());
|
|
|
|
if (showTopToolbar) {
|
|
|
|
$('showTopToolbarLink').firstChild.style.opacity = '1';
|
|
|
|
$('mochaToolbar').removeClass('invisible');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('showTopToolbarLink').firstChild.style.opacity = '0';
|
|
|
|
$('mochaToolbar').addClass('invisible');
|
|
|
|
}
|
|
|
|
MochaUI.Desktop.setDesktopSize();
|
|
|
|
});
|
|
|
|
|
2014-11-30 21:13:02 +01:00
|
|
|
$('speedInBrowserTitleBarLink').addEvent('click', function(e) {
|
|
|
|
speedInTitle = !speedInTitle;
|
|
|
|
localStorage.setItem('speed_in_browser_title_bar', speedInTitle.toString());
|
|
|
|
if (speedInTitle)
|
|
|
|
$('speedInBrowserTitleBarLink').firstChild.style.opacity = '1';
|
2014-11-30 14:35:26 +01:00
|
|
|
else
|
2014-11-30 21:13:02 +01:00
|
|
|
$('speedInBrowserTitleBarLink').firstChild.style.opacity = '0';
|
2015-02-02 01:34:47 +01:00
|
|
|
processServerState();
|
2014-11-30 14:35:26 +01:00
|
|
|
});
|
|
|
|
|
2017-05-18 22:54:39 +08:00
|
|
|
$('StatisticsLink').addEvent('click', StatisticsLinkFN);
|
2017-03-06 03:05:18 +00:00
|
|
|
|
2014-11-22 09:35:56 +03:00
|
|
|
new MochaUI.Panel({
|
|
|
|
id : 'transferList',
|
|
|
|
title : 'Panel',
|
|
|
|
header : false,
|
|
|
|
padding : {
|
|
|
|
top : 0,
|
|
|
|
right : 0,
|
|
|
|
bottom : 0,
|
|
|
|
left : 0
|
|
|
|
},
|
|
|
|
loadMethod : 'xhr',
|
|
|
|
contentURL : 'transferlist.html',
|
|
|
|
onContentLoaded : function () {
|
2015-01-06 23:24:54 +03:00
|
|
|
updateMainData();
|
2014-11-22 09:35:56 +03:00
|
|
|
},
|
|
|
|
column : 'mainColumn',
|
|
|
|
onResize : saveColumnSizes,
|
|
|
|
height : null
|
|
|
|
});
|
2014-12-14 10:00:00 +01:00
|
|
|
var prop_h = localStorage.getItem('properties_height_rel');
|
2014-11-22 09:35:56 +03:00
|
|
|
if ($defined(prop_h))
|
2014-12-14 10:00:00 +01:00
|
|
|
prop_h = prop_h.toFloat() * Window.getSize().y;
|
2010-04-23 16:48:17 +00:00
|
|
|
else
|
2014-11-22 09:35:56 +03:00
|
|
|
prop_h = Window.getSize().y / 2.;
|
2010-04-23 16:48:17 +00:00
|
|
|
new MochaUI.Panel({
|
2014-11-22 09:35:56 +03:00
|
|
|
id : 'propertiesPanel',
|
|
|
|
title : 'Panel',
|
|
|
|
header : true,
|
|
|
|
padding : {
|
|
|
|
top : 0,
|
|
|
|
right : 0,
|
|
|
|
bottom : 0,
|
|
|
|
left : 0
|
|
|
|
},
|
2014-12-08 21:00:00 +01:00
|
|
|
contentURL : 'properties_content.html',
|
2014-11-22 09:35:56 +03:00
|
|
|
require : {
|
2015-11-13 15:02:38 +03:00
|
|
|
css : ['css/Tabs.css', 'css/dynamicTable.css'],
|
2015-06-12 17:52:01 +02:00
|
|
|
js : ['scripts/prop-general.js', 'scripts/prop-trackers.js', 'scripts/prop-webseeds.js', 'scripts/prop-files.js'],
|
2014-11-22 09:35:56 +03:00
|
|
|
},
|
|
|
|
tabsURL : 'properties.html',
|
2014-12-08 21:00:00 +01:00
|
|
|
tabsOnload : function() {
|
|
|
|
MochaUI.initializeTabs('propertiesTabs');
|
|
|
|
|
2014-12-11 00:01:04 +01:00
|
|
|
updatePropertiesPanel = function() {
|
|
|
|
if (!$('prop_general').hasClass('invisible'))
|
|
|
|
updateTorrentData();
|
|
|
|
else if (!$('prop_trackers').hasClass('invisible'))
|
|
|
|
updateTrackersData();
|
2015-11-13 15:02:38 +03:00
|
|
|
else if (!$('prop_peers').hasClass('invisible'))
|
|
|
|
updateTorrentPeersData();
|
2015-06-12 17:52:01 +02:00
|
|
|
else if (!$('prop_webseeds').hasClass('invisible'))
|
|
|
|
updateWebSeedsData();
|
2014-12-11 00:01:04 +01:00
|
|
|
else if (!$('prop_files').hasClass('invisible'))
|
|
|
|
updateTorrentFilesData();
|
|
|
|
}
|
|
|
|
|
2014-12-08 21:00:00 +01:00
|
|
|
$('PropGeneralLink').addEvent('click', function(e){
|
|
|
|
$('prop_general').removeClass("invisible");
|
|
|
|
$('prop_trackers').addClass("invisible");
|
2015-06-12 17:52:01 +02:00
|
|
|
$('prop_webseeds').addClass("invisible");
|
2014-12-08 21:00:00 +01:00
|
|
|
$('prop_files').addClass("invisible");
|
2015-11-04 23:03:27 +03:00
|
|
|
$('prop_peers').addClass("invisible");
|
2014-12-11 00:01:04 +01:00
|
|
|
updatePropertiesPanel();
|
2016-01-15 16:36:33 +03:00
|
|
|
localStorage.setItem('selected_tab', this.id);
|
2014-12-08 21:00:00 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
$('PropTrackersLink').addEvent('click', function(e){
|
|
|
|
$('prop_trackers').removeClass("invisible");
|
|
|
|
$('prop_general').addClass("invisible");
|
2015-06-12 17:52:01 +02:00
|
|
|
$('prop_webseeds').addClass("invisible");
|
|
|
|
$('prop_files').addClass("invisible");
|
2015-11-04 23:03:27 +03:00
|
|
|
$('prop_peers').addClass("invisible");
|
|
|
|
updatePropertiesPanel();
|
2016-01-15 16:36:33 +03:00
|
|
|
localStorage.setItem('selected_tab', this.id);
|
2015-11-04 23:03:27 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
$('PropPeersLink').addEvent('click', function(e){
|
|
|
|
$('prop_peers').removeClass("invisible");
|
|
|
|
$('prop_trackers').addClass("invisible");
|
|
|
|
$('prop_general').addClass("invisible");
|
|
|
|
$('prop_webseeds').addClass("invisible");
|
|
|
|
$('prop_files').addClass("invisible");
|
2015-06-12 17:52:01 +02:00
|
|
|
updatePropertiesPanel();
|
2016-01-15 16:36:33 +03:00
|
|
|
localStorage.setItem('selected_tab', this.id);
|
2015-06-12 17:52:01 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
$('PropWebSeedsLink').addEvent('click', function(e){
|
|
|
|
$('prop_webseeds').removeClass("invisible");
|
|
|
|
$('prop_general').addClass("invisible");
|
|
|
|
$('prop_trackers').addClass("invisible");
|
2014-12-08 21:00:00 +01:00
|
|
|
$('prop_files').addClass("invisible");
|
2015-11-04 23:03:27 +03:00
|
|
|
$('prop_peers').addClass("invisible");
|
2014-12-11 00:01:04 +01:00
|
|
|
updatePropertiesPanel();
|
2016-01-15 16:36:33 +03:00
|
|
|
localStorage.setItem('selected_tab', this.id);
|
2014-12-08 21:00:00 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
$('PropFilesLink').addEvent('click', function(e){
|
|
|
|
$('prop_files').removeClass("invisible");
|
|
|
|
$('prop_general').addClass("invisible");
|
|
|
|
$('prop_trackers').addClass("invisible");
|
2015-06-12 17:52:01 +02:00
|
|
|
$('prop_webseeds').addClass("invisible");
|
2015-11-04 23:03:27 +03:00
|
|
|
$('prop_peers').addClass("invisible");
|
2014-12-11 00:01:04 +01:00
|
|
|
updatePropertiesPanel();
|
2016-01-15 16:36:33 +03:00
|
|
|
localStorage.setItem('selected_tab', this.id);
|
2014-12-08 21:00:00 +01:00
|
|
|
});
|
2015-06-13 14:15:49 +02:00
|
|
|
|
|
|
|
$('propertiesPanel_collapseToggle').addEvent('click', function(e){
|
|
|
|
updatePropertiesPanel();
|
|
|
|
});
|
2014-12-08 21:00:00 +01:00
|
|
|
},
|
2014-11-22 09:35:56 +03:00
|
|
|
column : 'mainColumn',
|
|
|
|
height : prop_h
|
|
|
|
});
|
2008-05-17 12:44:42 +00:00
|
|
|
});
|
2008-09-28 16:23:08 +00:00
|
|
|
|
2009-11-23 14:21:07 +00:00
|
|
|
function closeWindows() {
|
2014-11-22 09:35:56 +03:00
|
|
|
MochaUI.closeAll();
|
2015-01-29 22:29:28 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
var keyboardEvents = new Keyboard({
|
|
|
|
defaultEventType: 'keydown',
|
|
|
|
events: {
|
|
|
|
'ctrl+a': function(event) {
|
2015-11-11 22:58:30 +03:00
|
|
|
torrentsTable.selectAll();
|
2015-01-29 22:29:28 +03:00
|
|
|
event.preventDefault();
|
|
|
|
},
|
|
|
|
'delete': function(event) {
|
|
|
|
deleteFN();
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
2014-11-22 09:35:56 +03:00
|
|
|
}
|
2008-10-27 20:15:17 +00:00
|
|
|
});
|
2015-01-29 22:29:28 +03:00
|
|
|
|
|
|
|
keyboardEvents.activate();
|
2015-11-13 15:02:38 +03:00
|
|
|
|
|
|
|
var loadTorrentPeersTimer;
|
|
|
|
var syncTorrentPeersLastResponseId = 0;
|
|
|
|
var show_flags = true;
|
|
|
|
var loadTorrentPeersData = function(){
|
|
|
|
if ($('prop_peers').hasClass('invisible') ||
|
|
|
|
$('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
|
|
|
|
syncTorrentPeersLastResponseId = 0;
|
|
|
|
torrentPeersTable.clear();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var current_hash = torrentsTable.getCurrentTorrentHash();
|
|
|
|
if (current_hash == "") {
|
|
|
|
syncTorrentPeersLastResponseId = 0;
|
|
|
|
torrentPeersTable.clear();
|
|
|
|
clearTimeout(loadTorrentPeersTimer);
|
|
|
|
loadTorrentPeersTimer = loadTorrentPeersData.delay(syncMainDataTimerPeriod);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var url = new URI('sync/torrent_peers');
|
|
|
|
url.setData('rid', syncTorrentPeersLastResponseId);
|
|
|
|
url.setData('hash', current_hash);
|
|
|
|
var request = new Request.JSON({
|
|
|
|
url: url,
|
|
|
|
noCache: true,
|
|
|
|
method: 'get',
|
|
|
|
onFailure: function() {
|
2017-05-01 01:45:02 +03:00
|
|
|
$('error_div').set('html', 'QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]');
|
2015-11-13 15:02:38 +03:00
|
|
|
clearTimeout(loadTorrentPeersTimer);
|
|
|
|
loadTorrentPeersTimer = loadTorrentPeersData.delay(5000);
|
|
|
|
},
|
|
|
|
onSuccess: function(response) {
|
|
|
|
$('error_div').set('html', '');
|
|
|
|
if (response) {
|
|
|
|
var full_update = (response['full_update'] == true);
|
|
|
|
if (full_update) {
|
|
|
|
torrentPeersTable.clear();
|
|
|
|
}
|
|
|
|
if (response['rid']) {
|
|
|
|
syncTorrentPeersLastResponseId = response['rid'];
|
|
|
|
}
|
|
|
|
if (response['peers']) {
|
|
|
|
for (var key in response['peers']) {
|
|
|
|
response['peers'][key]['rowId'] = key;
|
2017-02-11 15:06:15 +08:00
|
|
|
|
|
|
|
if (response['peers'][key]['client'])
|
|
|
|
response['peers'][key]['client'] = escapeHtml(response['peers'][key]['client']);
|
|
|
|
|
2015-11-13 15:02:38 +03:00
|
|
|
torrentPeersTable.updateRowData(response['peers'][key]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (response['peers_removed'])
|
|
|
|
response['peers_removed'].each(function (hash) {
|
|
|
|
torrentPeersTable.removeRow(hash);
|
|
|
|
});
|
|
|
|
torrentPeersTable.updateTable(full_update);
|
|
|
|
torrentPeersTable.altRow();
|
|
|
|
|
|
|
|
if (response['show_flags']) {
|
|
|
|
if (show_flags != response['show_flags']) {
|
|
|
|
show_flags = response['show_flags'];
|
|
|
|
torrentPeersTable.columns['country'].force_hide = !show_flags;
|
|
|
|
torrentPeersTable.updateColumn('country');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
torrentPeersTable.clear();
|
|
|
|
}
|
|
|
|
clearTimeout(loadTorrentPeersTimer);
|
|
|
|
loadTorrentPeersTimer = loadTorrentPeersData.delay(syncMainDataTimerPeriod);
|
|
|
|
}
|
|
|
|
}).send();
|
|
|
|
};
|
|
|
|
|
|
|
|
updateTorrentPeersData = function(){
|
|
|
|
clearTimeout(loadTorrentPeersTimer);
|
|
|
|
loadTorrentPeersData();
|
2016-02-09 11:56:48 +03:00
|
|
|
};
|