Browse Source

Merge pull request #9060 from Chocobo1/preinc

Replace post-increment with pre-increment
adaptive-webui-19844
Mike Tzou 7 years ago committed by GitHub
parent
commit
da87c2d9ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/base/net/smtp.cpp
  2. 2
      src/base/preferences.cpp
  3. 2
      src/base/utils/string.cpp
  4. 8
      src/gui/properties/peerlistwidget.cpp
  5. 2
      src/gui/search/pluginselectdlg.cpp
  6. 8
      src/gui/search/searchtab.cpp
  7. 2
      src/gui/torrentcontentfiltermodel.cpp
  8. 8
      src/gui/transferlistwidget.cpp
  9. 2
      src/webui/www/private/preferences_content.html
  10. 2
      src/webui/www/private/scripts/client.js
  11. 2
      src/webui/www/private/scripts/contextmenu.js
  12. 56
      src/webui/www/private/scripts/dynamicTable.js
  13. 6
      src/webui/www/private/scripts/mocha-init.js
  14. 6
      src/webui/www/private/scripts/prop-files.js
  15. 4
      src/webui/www/private/scripts/prop-trackers.js
  16. 4
      src/webui/www/private/scripts/prop-webseeds.js

2
src/base/net/smtp.cpp

@ -67,7 +67,7 @@ namespace
// ascii characters 0x36 ("6") and 0x5c ("\") are selected because they have large // ascii characters 0x36 ("6") and 0x5c ("\") are selected because they have large
// Hamming distance (http://en.wikipedia.org/wiki/Hamming_distance) // Hamming distance (http://en.wikipedia.org/wiki/Hamming_distance)
for (int i = 0; i < key.length(); i++) { for (int i = 0; i < key.length(); ++i) {
innerPadding[i] = innerPadding[i] ^ key.at(i); // XOR operation between every byte in key and innerpadding, of key length innerPadding[i] = innerPadding[i] ^ key.at(i); // XOR operation between every byte in key and innerpadding, of key length
outerPadding[i] = outerPadding[i] ^ key.at(i); // XOR operation between every byte in key and outerpadding, of key length outerPadding[i] = outerPadding[i] ^ key.at(i); // XOR operation between every byte in key and outerpadding, of key length
} }

2
src/base/preferences.cpp

@ -867,7 +867,7 @@ namespace
LONG res = ::RegQueryInfoKeyW(handle, NULL, NULL, NULL, &cSubKeys, &cMaxSubKeyLen, NULL, NULL, NULL, NULL, NULL, NULL); LONG res = ::RegQueryInfoKeyW(handle, NULL, NULL, NULL, &cSubKeys, &cMaxSubKeyLen, NULL, NULL, NULL, NULL, NULL, NULL);
if (res == ERROR_SUCCESS) { if (res == ERROR_SUCCESS) {
cMaxSubKeyLen++; // For null character ++cMaxSubKeyLen; // For null character
LPWSTR lpName = new WCHAR[cMaxSubKeyLen]; LPWSTR lpName = new WCHAR[cMaxSubKeyLen];
DWORD cName; DWORD cName;

2
src/base/utils/string.cpp

@ -172,7 +172,7 @@ bool Utils::String::slowEquals(const QByteArray &a, const QByteArray &b)
int lengthB = b.length(); int lengthB = b.length();
int diff = lengthA ^ lengthB; int diff = lengthA ^ lengthB;
for (int i = 0; (i < lengthA) && (i < lengthB); i++) for (int i = 0; (i < lengthA) && (i < lengthB); ++i)
diff |= a[i] ^ b[i]; diff |= a[i] ^ b[i];
return (diff == 0); return (diff == 0);

8
src/gui/properties/peerlistwidget.cpp

@ -102,7 +102,7 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent)
hideColumn(PeerListDelegate::COUNTRY); hideColumn(PeerListDelegate::COUNTRY);
// Ensure that at least one column is visible at all times // Ensure that at least one column is visible at all times
bool atLeastOne = false; bool atLeastOne = false;
for (unsigned int i = 0; i < PeerListDelegate::IP_HIDDEN; i++) { for (unsigned int i = 0; i < PeerListDelegate::IP_HIDDEN; ++i) {
if (!isColumnHidden(i)) { if (!isColumnHidden(i)) {
atLeastOne = true; atLeastOne = true;
break; break;
@ -113,7 +113,7 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent)
// To also mitigate the above issue, we have to resize each column when // To also mitigate the above issue, we have to resize each column when
// its size is 0, because explicitly 'showing' the column isn't enough // its size is 0, because explicitly 'showing' the column isn't enough
// in the above scenario. // in the above scenario.
for (unsigned int i = 0; i < PeerListDelegate::IP_HIDDEN; i++) for (unsigned int i = 0; i < PeerListDelegate::IP_HIDDEN; ++i)
if ((columnWidth(i) <= 0) && !isColumnHidden(i)) if ((columnWidth(i) <= 0) && !isColumnHidden(i))
resizeColumnToContents(i); resizeColumnToContents(i);
// Context menu // Context menu
@ -168,9 +168,9 @@ void PeerListWidget::displayToggleColumnsMenu(const QPoint &)
actions.append(myAct); actions.append(myAct);
} }
int visibleCols = 0; int visibleCols = 0;
for (unsigned int i = 0; i < PeerListDelegate::IP_HIDDEN; i++) { for (unsigned int i = 0; i < PeerListDelegate::IP_HIDDEN; ++i) {
if (!isColumnHidden(i)) if (!isColumnHidden(i))
visibleCols++; ++visibleCols;
if (visibleCols > 1) if (visibleCols > 1)
break; break;

2
src/gui/search/pluginselectdlg.cpp

@ -424,7 +424,7 @@ void PluginSelectDlg::checkForUpdatesFinished(const QHash<QString, PluginVersion
for (auto i = updateInfo.cbegin(); i != updateInfo.cend(); ++i) { for (auto i = updateInfo.cbegin(); i != updateInfo.cend(); ++i) {
startAsyncOp(); startAsyncOp();
m_pendingUpdates++; ++m_pendingUpdates;
m_pluginManager->updatePlugin(i.key()); m_pluginManager->updatePlugin(i.key());
} }
} }

8
src/gui/search/searchtab.cpp

@ -104,7 +104,7 @@ SearchTab::SearchTab(SearchHandler *searchHandler, QWidget *parent)
// Ensure that at least one column is visible at all times // Ensure that at least one column is visible at all times
bool atLeastOne = false; bool atLeastOne = false;
for (unsigned int i = 0; i < SearchSortModel::DL_LINK; i++) { for (unsigned int i = 0; i < SearchSortModel::DL_LINK; ++i) {
if (!m_ui->resultsBrowser->isColumnHidden(i)) { if (!m_ui->resultsBrowser->isColumnHidden(i)) {
atLeastOne = true; atLeastOne = true;
break; break;
@ -115,7 +115,7 @@ SearchTab::SearchTab(SearchHandler *searchHandler, QWidget *parent)
// To also mitigate the above issue, we have to resize each column when // To also mitigate the above issue, we have to resize each column when
// its size is 0, because explicitly 'showing' the column isn't enough // its size is 0, because explicitly 'showing' the column isn't enough
// in the above scenario. // in the above scenario.
for (unsigned int i = 0; i < SearchSortModel::DL_LINK; i++) for (unsigned int i = 0; i < SearchSortModel::DL_LINK; ++i)
if ((m_ui->resultsBrowser->columnWidth(i) <= 0) && !m_ui->resultsBrowser->isColumnHidden(i)) if ((m_ui->resultsBrowser->columnWidth(i) <= 0) && !m_ui->resultsBrowser->isColumnHidden(i))
m_ui->resultsBrowser->resizeColumnToContents(i); m_ui->resultsBrowser->resizeColumnToContents(i);
@ -375,9 +375,9 @@ void SearchTab::displayToggleColumnsMenu(const QPoint&)
actions.append(myAct); actions.append(myAct);
} }
int visibleCols = 0; int visibleCols = 0;
for (unsigned int i = 0; i < SearchSortModel::DL_LINK; i++) { for (unsigned int i = 0; i < SearchSortModel::DL_LINK; ++i) {
if (!m_ui->resultsBrowser->isColumnHidden(i)) if (!m_ui->resultsBrowser->isColumnHidden(i))
visibleCols++; ++visibleCols;
if (visibleCols > 1) if (visibleCols > 1)
break; break;

2
src/gui/torrentcontentfiltermodel.cpp

@ -131,7 +131,7 @@ bool TorrentContentFilterModel::hasFiltered(const QModelIndex &folder) const
QString name = folder.data().toString(); QString name = folder.data().toString();
if (name.contains(filterRegExp())) if (name.contains(filterRegExp()))
return true; return true;
for (int child = 0; child < m_model->rowCount(folder); child++) { for (int child = 0; child < m_model->rowCount(folder); ++child) {
QModelIndex childIndex = m_model->index(child, 0, folder); QModelIndex childIndex = m_model->index(child, 0, folder);
if (m_model->hasChildren(childIndex)) { if (m_model->hasChildren(childIndex)) {
if (hasFiltered(childIndex)) if (hasFiltered(childIndex))

8
src/gui/transferlistwidget.cpp

@ -260,7 +260,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow)
//Ensure that at least one column is visible at all times //Ensure that at least one column is visible at all times
bool atLeastOne = false; bool atLeastOne = false;
for (unsigned int i = 0; i<TorrentModel::NB_COLUMNS; i++) { for (unsigned int i = 0; i < TorrentModel::NB_COLUMNS; ++i) {
if (!isColumnHidden(i)) { if (!isColumnHidden(i)) {
atLeastOne = true; atLeastOne = true;
break; break;
@ -272,7 +272,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow)
//When adding/removing columns between versions some may //When adding/removing columns between versions some may
//end up being size 0 when the new version is launched with //end up being size 0 when the new version is launched with
//a conf file from the previous version. //a conf file from the previous version.
for (unsigned int i = 0; i<TorrentModel::NB_COLUMNS; i++) for (unsigned int i = 0; i < TorrentModel::NB_COLUMNS; ++i)
if ((columnWidth(i) <= 0) && (!isColumnHidden(i))) if ((columnWidth(i) <= 0) && (!isColumnHidden(i)))
resizeColumnToContents(i); resizeColumnToContents(i);
@ -713,9 +713,9 @@ void TransferListWidget::displayDLHoSMenu(const QPoint&)
actions.append(myAct); actions.append(myAct);
} }
int visibleCols = 0; int visibleCols = 0;
for (unsigned int i = 0; i<TorrentModel::NB_COLUMNS; i++) { for (unsigned int i = 0; i < TorrentModel::NB_COLUMNS; ++i) {
if (!isColumnHidden(i)) if (!isColumnHidden(i))
visibleCols++; ++visibleCols;
if (visibleCols > 1) if (visibleCols > 1)
break; break;

2
src/webui/www/private/preferences_content.html

@ -559,7 +559,7 @@
getWatchedFolders = function() { getWatchedFolders = function() {
var nb_folders = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length; var nb_folders = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length;
var folders = new Hash(); var folders = new Hash();
for (var i = 0; i < nb_folders; i++) { for (var i = 0; i < nb_folders; ++i) {
var fpath = $('text_watch_' + i).getProperty('value').trim(); var fpath = $('text_watch_' + i).getProperty('value').trim();
if (fpath.length > 0) { if (fpath.length > 0) {
var other; var other;

2
src/webui/www/private/scripts/client.js

@ -58,7 +58,7 @@ loadSelectedCategory();
function genHash(string) { function genHash(string) {
var hash = 0; var hash = 0;
for (var i = 0; i < string.length; i++) { for (var i = 0; i < string.length; ++i) {
var c = string.charCodeAt(i); var c = string.charCodeAt(i);
hash = (c + hash * 31) | 0; hash = (c + hash * 31) | 0;
} }

2
src/webui/www/private/scripts/contextmenu.js

@ -88,7 +88,7 @@ var ContextMenu = new Class({
// position the sub-menu // position the sub-menu
var uls = this.menu.getElementsByTagName('ul'); var uls = this.menu.getElementsByTagName('ul');
for (var i = 0; i < uls.length; i++) { for (var i = 0; i < uls.length; ++i) {
var ul = uls[i]; var ul = uls[i];
if (ul.hasClass('scrollableMenu')) if (ul.hasClass('scrollableMenu'))
ul.setStyle('max-height', scrollableMenuMaxHeight); ul.setStyle('max-height', scrollableMenuMaxHeight);

56
src/webui/www/private/scripts/dynamicTable.js

@ -75,7 +75,7 @@ var DynamicTable = new Class({
var n = 2; var n = 2;
while (panel.clientWidth != panel.offsetWidth && n > 0) { // is panel vertical scrollbar visible ? while (panel.clientWidth != panel.offsetWidth && n > 0) { // is panel vertical scrollbar visible ?
n--; --n;
h -= 0.5; h -= 0.5;
$(this.dynamicTableDivId).style.height = h + 'px'; $(this.dynamicTableDivId).style.height = h + 'px';
} }
@ -214,7 +214,7 @@ var DynamicTable = new Class({
var val = localStorage.getItem('columns_order_' + this.dynamicTableDivId).split(','); var val = localStorage.getItem('columns_order_' + this.dynamicTableDivId).split(',');
val.erase(el.columnName); val.erase(el.columnName);
var pos = val.indexOf(this.lastHoverTh.columnName); var pos = val.indexOf(this.lastHoverTh.columnName);
if (this.dropSide === 'right') pos++; if (this.dropSide === 'right') ++pos;
val.splice(pos, 0, el.columnName); val.splice(pos, 0, el.columnName);
localStorage.setItem('columns_order_' + this.dynamicTableDivId, val.join(',')); localStorage.setItem('columns_order_' + this.dynamicTableDivId, val.join(','));
this.loadColumnsOrder(); this.loadColumnsOrder();
@ -239,7 +239,7 @@ var DynamicTable = new Class({
var ths = this.fixedTableHeader.getElements('th'); var ths = this.fixedTableHeader.getElements('th');
for (var i = 0; i < ths.length; i++) { for (var i = 0; i < ths.length; ++i) {
var th = ths[i]; var th = ths[i];
th.addEvent('mousemove', mouseMoveFn); th.addEvent('mousemove', mouseMoveFn);
th.addEvent('mouseout', mouseOutFn); th.addEvent('mouseout', mouseOutFn);
@ -262,7 +262,7 @@ var DynamicTable = new Class({
DynamicTableHeaderContextMenuClass = new Class({ DynamicTableHeaderContextMenuClass = new Class({
Extends: ContextMenu, Extends: ContextMenu,
updateMenuItems: function() { updateMenuItems: function() {
for (var i = 0; i < this.dynamicTable.columns.length; i++) { for (var i = 0; i < this.dynamicTable.columns.length; ++i) {
if (this.dynamicTable.columns[i].caption === '') if (this.dynamicTable.columns[i].caption === '')
continue; continue;
if (this.dynamicTable.columns[i].visible !== '0') if (this.dynamicTable.columns[i].visible !== '0')
@ -304,7 +304,7 @@ var DynamicTable = new Class({
this.showColumn(action, this.columns[action].visible === '0'); this.showColumn(action, this.columns[action].visible === '0');
}.bind(this); }.bind(this);
for (var i = 0; i < this.columns.length; i++) { for (var i = 0; i < this.columns.length; ++i) {
var text = this.columns[i].caption; var text = this.columns[i].caption;
if (text === '') if (text === '')
continue; continue;
@ -370,17 +370,17 @@ var DynamicTable = new Class({
columnsOrder.push(v); columnsOrder.push(v);
}.bind(this)); }.bind(this));
for (i = 0; i < this.columns.length; i++) for (i = 0; i < this.columns.length; ++i)
if (!columnsOrder.contains(this.columns[i].name)) if (!columnsOrder.contains(this.columns[i].name))
columnsOrder.push(this.columns[i].name); columnsOrder.push(this.columns[i].name);
for (i = 0; i < this.columns.length; i++) for (i = 0; i < this.columns.length; ++i)
this.columns[i] = this.columns[columnsOrder[i]]; this.columns[i] = this.columns[columnsOrder[i]];
}, },
saveColumnsOrder: function() { saveColumnsOrder: function() {
val = ''; val = '';
for (i = 0; i < this.columns.length; i++) { for (i = 0; i < this.columns.length; ++i) {
if (i > 0) if (i > 0)
val += ','; val += ',';
val += this.columns[i].name; val += this.columns[i].name;
@ -396,7 +396,7 @@ var DynamicTable = new Class({
updateHeader: function(header) { updateHeader: function(header) {
var ths = header.getElements('th'); var ths = header.getElements('th');
for (var i = 0; i < ths.length; i++) { for (var i = 0; i < ths.length; ++i) {
th = ths[i]; th = ths[i];
th._this = this; th._this = this;
th.setAttribute('title', this.columns[i].caption); th.setAttribute('title', this.columns[i].caption);
@ -411,7 +411,7 @@ var DynamicTable = new Class({
}, },
getColumnPos: function(columnName) { getColumnPos: function(columnName) {
for (var i = 0; i < this.columns.length; i++) for (var i = 0; i < this.columns.length; ++i)
if (this.columns[i].name == columnName) if (this.columns[i].name == columnName)
return i; return i;
return -1; return -1;
@ -431,13 +431,13 @@ var DynamicTable = new Class({
if (visible) { if (visible) {
ths[pos].removeClass('invisible'); ths[pos].removeClass('invisible');
fths[pos].removeClass('invisible'); fths[pos].removeClass('invisible');
for (var i = 0; i < trs.length; i++) for (var i = 0; i < trs.length; ++i)
trs[i].getElements('td')[pos].removeClass('invisible'); trs[i].getElements('td')[pos].removeClass('invisible');
} }
else { else {
ths[pos].addClass('invisible'); ths[pos].addClass('invisible');
fths[pos].addClass('invisible'); fths[pos].addClass('invisible');
for (var j = 0; j < trs.length; j++) for (var j = 0; j < trs.length; ++j)
trs[j].getElements('td')[pos].addClass('invisible'); trs[j].getElements('td')[pos].addClass('invisible');
} }
if (this.columns[pos].onResize !== null) { if (this.columns[pos].onResize !== null) {
@ -484,7 +484,7 @@ var DynamicTable = new Class({
this.selectedRows.empty(); this.selectedRows.empty();
var trs = this.tableBody.getElements('tr'); var trs = this.tableBody.getElements('tr');
for (var i = 0; i < trs.length; i++) { for (var i = 0; i < trs.length; ++i) {
var tr = trs[i]; var tr = trs[i];
this.selectedRows.push(tr.rowId); this.selectedRows.push(tr.rowId);
if (!tr.hasClass('selected')) if (!tr.hasClass('selected'))
@ -543,7 +543,7 @@ var DynamicTable = new Class({
var rows = this.rows.getValues(); var rows = this.rows.getValues();
for (i = 0; i < rows.length; i++) { for (i = 0; i < rows.length; ++i) {
filteredRows.push(rows[i]); filteredRows.push(rows[i]);
filteredRows[rows[i].rowId] = rows[i]; filteredRows[rows[i].rowId] = rows[i];
} }
@ -561,7 +561,7 @@ var DynamicTable = new Class({
getTrByRowId: function(rowId) { getTrByRowId: function(rowId) {
trs = this.tableBody.getElements('tr'); trs = this.tableBody.getElements('tr');
for (var i = 0; i < trs.length; i++) for (var i = 0; i < trs.length; ++i)
if (trs[i].rowId == rowId) if (trs[i].rowId == rowId)
return trs[i]; return trs[i];
return null; return null;
@ -573,18 +573,18 @@ var DynamicTable = new Class({
var rows = this.getFilteredAndSortedRows(); var rows = this.getFilteredAndSortedRows();
for (var i = 0; i < this.selectedRows.length; i++) for (var i = 0; i < this.selectedRows.length; ++i)
if (!(this.selectedRows[i] in rows)) { if (!(this.selectedRows[i] in rows)) {
this.selectedRows.splice(i, 1); this.selectedRows.splice(i, 1);
i--; --i;
} }
var trs = this.tableBody.getElements('tr'); var trs = this.tableBody.getElements('tr');
for (var rowPos = 0; rowPos < rows.length; rowPos++) { for (var rowPos = 0; rowPos < rows.length; ++rowPos) {
var rowId = rows[rowPos]['rowId']; var rowId = rows[rowPos]['rowId'];
tr_found = false; tr_found = false;
for (var j = rowPos; j < trs.length; j++) for (var j = rowPos; j < trs.length; ++j)
if (trs[j]['rowId'] == rowId) { if (trs[j]['rowId'] == rowId) {
tr_found = true; tr_found = true;
if (rowPos == j) if (rowPos == j)
@ -632,7 +632,7 @@ var DynamicTable = new Class({
this._this.selectedRows.empty(); this._this.selectedRows.empty();
var trs = this._this.tableBody.getElements('tr'); var trs = this._this.tableBody.getElements('tr');
var select = false; var select = false;
for (var i = 0; i < trs.length; i++) { for (var i = 0; i < trs.length; ++i) {
var tr = trs[i]; var tr = trs[i];
if ((tr.rowId == first_row_id) || (tr.rowId == last_row_id)) { if ((tr.rowId == first_row_id) || (tr.rowId == last_row_id)) {
@ -660,7 +660,7 @@ var DynamicTable = new Class({
this.setupTr(tr); this.setupTr(tr);
for (var k = 0; k < this.columns.length; k++) { for (var k = 0; k < this.columns.length; ++k) {
var td = new Element('td'); var td = new Element('td');
if ((this.columns[k].visible == '0') || this.columns[k].force_hide) if ((this.columns[k].visible == '0') || this.columns[k].force_hide)
td.addClass('invisible'); td.addClass('invisible');
@ -700,7 +700,7 @@ var DynamicTable = new Class({
data = row[fullUpdate ? 'full_data' : 'data']; data = row[fullUpdate ? 'full_data' : 'data'];
tds = tr.getElements('td'); tds = tr.getElements('td');
for (var i = 0; i < this.columns.length; i++) { for (var i = 0; i < this.columns.length; ++i) {
if (data.hasOwnProperty(this.columns[i].dataProperties[0])) if (data.hasOwnProperty(this.columns[i].dataProperties[0]))
this.columns[i].updateTd(tds[i], row); this.columns[i].updateTd(tds[i], row);
} }
@ -966,7 +966,7 @@ var TorrentsTable = new Class({
var pos = this.getColumnPos(columnName); var pos = this.getColumnPos(columnName);
var trs = this.tableBody.getElements('tr'); var trs = this.tableBody.getElements('tr');
ProgressColumnWidth = -1; ProgressColumnWidth = -1;
for (var i = 0; i < trs.length; i++) { for (var i = 0; i < trs.length; ++i) {
var td = trs[i].getElements('td')[pos]; var td = trs[i].getElements('td')[pos];
if (ProgressColumnWidth < 0) if (ProgressColumnWidth < 0)
ProgressColumnWidth = td.offsetWidth; ProgressColumnWidth = td.offsetWidth;
@ -1158,8 +1158,8 @@ var TorrentsTable = new Class({
var cnt = 0; var cnt = 0;
var rows = this.rows.getValues(); var rows = this.rows.getValues();
for (i = 0; i < rows.length; i++) for (i = 0; i < rows.length; ++i)
if (this.applyFilter(rows[i], filterName, categoryHash)) cnt++; if (this.applyFilter(rows[i], filterName, categoryHash)) ++cnt;
return cnt; return cnt;
}, },
@ -1167,7 +1167,7 @@ var TorrentsTable = new Class({
var rowsHashes = []; var rowsHashes = [];
var rows = this.rows.getValues(); var rows = this.rows.getValues();
for (i = 0; i < rows.length; i++) for (i = 0; i < rows.length; ++i)
if (this.applyFilter(rows[i], filterName, categoryHash)) if (this.applyFilter(rows[i], filterName, categoryHash))
rowsHashes.push(rows[i]['rowId']); rowsHashes.push(rows[i]['rowId']);
@ -1179,7 +1179,7 @@ var TorrentsTable = new Class({
var rows = this.rows.getValues(); var rows = this.rows.getValues();
for (i = 0; i < rows.length; i++) for (i = 0; i < rows.length; ++i)
if (this.applyFilter(rows[i], selected_filter, selected_category)) { if (this.applyFilter(rows[i], selected_filter, selected_category)) {
filteredRows.push(rows[i]); filteredRows.push(rows[i]);
filteredRows[rows[i].rowId] = rows[i]; filteredRows[rows[i].rowId] = rows[i];
@ -1284,7 +1284,7 @@ var TorrentPeersTable = new Class({
var a = ip1.split("."); var a = ip1.split(".");
var b = ip2.split("."); var b = ip2.split(".");
for (var i = 0; i < 4; i++) { for (var i = 0; i < 4; ++i) {
if (a[i] != b[i]) if (a[i] != b[i])
return a[i] - b[i]; return a[i] - b[i];
} }

6
src/webui/www/private/scripts/mocha-init.js

@ -169,7 +169,7 @@ initializeWindows = function() {
var torrentsHaveSameShareRatio = true; var torrentsHaveSameShareRatio = true;
// check if all selected torrents have same share ratio // check if all selected torrents have same share ratio
for (var i = 0; i < hashes.length; i++) { for (var i = 0; i < hashes.length; ++i) {
var hash = hashes[i]; var hash = hashes[i];
var row = torrentsTable.rows[hash].full_data; var row = torrentsTable.rows[hash].full_data;
var origValues = row.ratio_limit + "|" + row.seeding_time_limit + "|" + row.max_ratio + "|" + row.max_seeding_time; var origValues = row.ratio_limit + "|" + row.seeding_time_limit + "|" + row.max_ratio + "|" + row.max_seeding_time;
@ -575,7 +575,7 @@ initializeWindows = function() {
var names = []; var names = [];
if (selectedRows.length) { if (selectedRows.length) {
var rows = torrentsTable.getFilteredAndSortedRows(); var rows = torrentsTable.getFilteredAndSortedRows();
for (var i = 0; i < selectedRows.length; i++) { for (var i = 0; i < selectedRows.length; ++i) {
var hash = selectedRows[i]; var hash = selectedRows[i];
names.push(rows[hash].full_data.name); names.push(rows[hash].full_data.name);
} }
@ -588,7 +588,7 @@ initializeWindows = function() {
var magnets = []; var magnets = [];
if (selectedRows.length) { if (selectedRows.length) {
var rows = torrentsTable.getFilteredAndSortedRows(); var rows = torrentsTable.getFilteredAndSortedRows();
for (var i = 0; i < selectedRows.length; i++) { for (var i = 0; i < selectedRows.length; ++i) {
var hash = selectedRows[i]; var hash = selectedRows[i];
magnets.push(rows[hash].full_data.magnet_uri); magnets.push(rows[hash].full_data.magnet_uri);
} }

6
src/webui/www/private/scripts/prop-files.js

@ -201,7 +201,7 @@ var filesDynTable = new Class({
updateRow: function(tr, row, id) { updateRow: function(tr, row, id) {
var tds = tr.getElements('td'); var tds = tr.getElements('td');
for (var i = 0; i < row.length; i++) { for (var i = 0; i < row.length; ++i) {
switch (i) { switch (i) {
case 0: case 0:
if (row[i] > 0) if (row[i] > 0)
@ -238,7 +238,7 @@ var filesDynTable = new Class({
//this.removeRow(id); //this.removeRow(id);
var tr = new Element('tr'); var tr = new Element('tr');
this.rows.set(id, tr); this.rows.set(id, tr);
for (var i = 0; i < row.length; i++) { for (var i = 0; i < row.length; ++i) {
var td = new Element('td'); var td = new Element('td');
switch (i) { switch (i) {
case 0: case 0:
@ -321,7 +321,7 @@ var loadTorrentFilesData = function() {
row[6] = friendlyPercentage(file.availability); row[6] = friendlyPercentage(file.availability);
fTable.insertRow(i, row); fTable.insertRow(i, row);
i++; ++i;
}.bind(this)); }.bind(this));
// Set global CB state // Set global CB state
if (allCBChecked()) { if (allCBChecked()) {

4
src/webui/www/private/scripts/prop-trackers.js

@ -25,7 +25,7 @@ var trackersDynTable = new Class({
updateRow: function(tr, row) { updateRow: function(tr, row) {
var tds = tr.getElements('td'); var tds = tr.getElements('td');
for (var i = 0; i < row.length; i++) { for (var i = 0; i < row.length; ++i) {
tds[i].set('html', row[i]); tds[i].set('html', row[i]);
} }
return true; return true;
@ -41,7 +41,7 @@ var trackersDynTable = new Class({
//this.removeRow(id); //this.removeRow(id);
var tr = new Element('tr'); var tr = new Element('tr');
this.rows.set(url, tr); this.rows.set(url, tr);
for (var i = 0; i < row.length; i++) { for (var i = 0; i < row.length; ++i) {
var td = new Element('td'); var td = new Element('td');
td.set('html', row[i]); td.set('html', row[i]);
td.injectInside(tr); td.injectInside(tr);

4
src/webui/www/private/scripts/prop-webseeds.js

@ -25,7 +25,7 @@ var webseedsDynTable = new Class({
updateRow: function(tr, row) { updateRow: function(tr, row) {
var tds = tr.getElements('td'); var tds = tr.getElements('td');
for (var i = 0; i < row.length; i++) { for (var i = 0; i < row.length; ++i) {
tds[i].set('html', row[i]); tds[i].set('html', row[i]);
} }
return true; return true;
@ -41,7 +41,7 @@ var webseedsDynTable = new Class({
//this.removeRow(id); //this.removeRow(id);
var tr = new Element('tr'); var tr = new Element('tr');
this.rows.set(url, tr); this.rows.set(url, tr);
for (var i = 0; i < row.length; i++) { for (var i = 0; i < row.length; ++i) {
var td = new Element('td'); var td = new Element('td');
td.set('html', row[i]); td.set('html', row[i]);
td.injectInside(tr); td.injectInside(tr);

Loading…
Cancel
Save