From afd4f8969319aad74f4cdf9fa38d9181ca2bf84c Mon Sep 17 00:00:00 2001 From: buinsky Date: Sat, 16 Jul 2016 13:23:59 +0300 Subject: [PATCH 01/18] Rename variables in DynamicTable class --- src/webui/www/public/scripts/dynamicTable.js | 54 ++++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/webui/www/public/scripts/dynamicTable.js b/src/webui/www/public/scripts/dynamicTable.js index 15f30fb9c..cf5505b3b 100644 --- a/src/webui/www/public/scripts/dynamicTable.js +++ b/src/webui/www/public/scripts/dynamicTable.js @@ -35,14 +35,14 @@ var DynamicTable = new Class({ initialize : function () {}, - setup : function (tableId, tableHeaderId, context_menu) { + setup : function (tableId, tableHeaderId, contextMenu) { this.tableId = tableId; this.tableHeaderId = tableHeaderId; this.table = $(tableId); this.rows = new Hash(); - this.cur = new Array(); + this.selectedRows = new Array(); this.columns = new Array(); - this.context_menu = context_menu; + this.contextMenu = contextMenu; this.sortedColumn = getLocalStorageItem('sorted_column_' + this.tableId, 0); this.reverseSort = getLocalStorageItem('reverse_sort_' + this.tableId, '0'); this.initColumns(); @@ -163,8 +163,8 @@ var DynamicTable = new Class({ }, getSelectedRowId : function () { - if (this.cur.length > 0) - return this.cur[0]; + if (this.selectedRows.length > 0) + return this.selectedRows[0]; return ''; }, @@ -183,24 +183,24 @@ var DynamicTable = new Class({ }, selectAll : function () { - this.cur.empty(); + this.selectedRows.empty(); var trs = this.table.getElements('tr'); for (var i = 0; i < trs.length; i++) { var tr = trs[i]; - this.cur.push(tr.rowId); + this.selectedRows.push(tr.rowId); if (!tr.hasClass('selected')) tr.addClass('selected'); } }, deselectAll : function () { - this.cur.empty(); + this.selectedRows.empty(); }, selectRow : function (rowId) { - this.cur.empty(); - this.cur.push(rowId); + this.selectedRows.empty(); + this.selectedRows.push(rowId); var trs = this.table.getElements('tr'); for (var i = 0; i < trs.length; i++) { var tr = trs[i]; @@ -272,9 +272,9 @@ var DynamicTable = new Class({ var rows = this.getFilteredAndSortedRows(); - for (var i = 0; i < this.cur.length; i++) - if (!(this.cur[i] in rows)) { - this.cur.splice(i, 1); + for (var i = 0; i < this.selectedRows.length; i++) + if (!(this.selectedRows[i] in rows)) { + this.selectedRows.splice(i, 1); i--; } @@ -304,7 +304,7 @@ var DynamicTable = new Class({ tr._this = this; tr.addEvent('contextmenu', function (e) { - if (!this._this.cur.contains(this.rowId)) + if (!this._this.selectedRows.contains(this.rowId)) this._this.selectRow(this.rowId); return true; }); @@ -312,37 +312,37 @@ var DynamicTable = new Class({ e.stop(); if (e.control) { // CTRL key was pressed - if (this._this.cur.contains(this.rowId)) { + if (this._this.selectedRows.contains(this.rowId)) { // remove it - this._this.cur.erase(this.rowId); + this._this.selectedRows.erase(this.rowId); // Remove selected style this.removeClass('selected'); } else { - this._this.cur.push(this.rowId); + this._this.selectedRows.push(this.rowId); // Add selected style this.addClass('selected'); } } else { - if (e.shift && this._this.cur.length == 1) { + if (e.shift && this._this.selectedRows.length == 1) { // Shift key was pressed - var first_row_id = this._this.cur[0]; + var first_row_id = this._this.selectedRows[0]; var last_row_id = this.rowId; - this._this.cur.empty(); + this._this.selectedRows.empty(); var trs = this._this.table.getElements('tr'); var select = false; for (var i = 0; i < trs.length; i++) { var tr = trs[i]; if ((tr.rowId == first_row_id) || (tr.rowId == last_row_id)) { - this._this.cur.push(tr.rowId); + this._this.selectedRows.push(tr.rowId); tr.addClass('selected'); select = !select; } else { if (select) { - this._this.cur.push(tr.rowId); + this._this.selectedRows.push(tr.rowId); tr.addClass('selected'); } else @@ -377,8 +377,8 @@ var DynamicTable = new Class({ } // Update context menu - if (this.context_menu) - this.context_menu.addTarget(tr); + if (this.contextMenu) + this.contextMenu.addTarget(tr); this.updateRow(tr, true); } @@ -407,7 +407,7 @@ var DynamicTable = new Class({ }, removeRow : function (rowId) { - this.cur.erase(rowId); + this.selectedRows.erase(rowId); var tr = this.getTrByRowId(rowId); if (tr != null) { tr.dispose(); @@ -418,7 +418,7 @@ var DynamicTable = new Class({ }, clear : function () { - this.cur.empty(); + this.selectedRows.empty(); this.rows.empty(); var trs = this.table.getElements('tr'); while (trs.length > 0) { @@ -428,7 +428,7 @@ var DynamicTable = new Class({ }, selectedRowsIds : function () { - return this.cur.slice(); + return this.selectedRows.slice(); }, getRowIds : function () { From 7aadf644e0a0abd47b3f5fc749c2ea96b4ed45e3 Mon Sep 17 00:00:00 2001 From: buinsky Date: Sat, 16 Jul 2016 22:21:14 +0300 Subject: [PATCH 02/18] Make torrents table scrollable horizontally --- src/webui/www/public/css/dynamicTable.css | 59 ++++++--- src/webui/www/public/css/style.css | 16 +-- src/webui/www/public/properties_content.html | 10 +- src/webui/www/public/scripts/dynamicTable.js | 123 ++++++++++++++----- src/webui/www/public/transferlist.html | 25 ++-- 5 files changed, 158 insertions(+), 75 deletions(-) diff --git a/src/webui/www/public/css/dynamicTable.css b/src/webui/www/public/css/dynamicTable.css index 55a024ab7..270a1dafc 100644 --- a/src/webui/www/public/css/dynamicTable.css +++ b/src/webui/www/public/css/dynamicTable.css @@ -8,8 +8,7 @@ **************************************************************/ #properties #torrentFiles table, -#properties #trackers table, -#transferList table { +#properties #trackers table { border: 1px solid #ccc; width: 100%; } @@ -78,18 +77,50 @@ vertical-align: middle; } -#trackers th, -#trackers td, -#torrentFiles th, -#torrentFiles td, -#transferList th, -#transferList td { - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - max-width: 300px; -} - tr.dynamicTableHeader { cursor: pointer; } + +.dynamicTable { + table-layout: fixed; + width :1%; + padding: 0; + border-spacing: 0; +} + +.dynamicTable th { + padding: 5px 10px; + white-space: nowrap; +} + +.dynamicTable td { + padding: 0px 3px; + white-space: nowrap; +} + +.dynamicTable thead tr { + background-color: #eee; +} + +.dynamicTable th, +.dynamicTable td { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + max-width: 300px; +} + +.dynamicTableFixedHeaderDiv { + overflow: hidden; +} + +.dynamicTableDiv { + overflow: auto; +} + +.dynamicTableDiv thead th { + line-height: 0px !important; + height: 0px !important; + padding-top: 0px !important; + padding-bottom: 0px !important; +} diff --git a/src/webui/www/public/css/style.css b/src/webui/www/public/css/style.css index f99d60a54..e101065fb 100644 --- a/src/webui/www/public/css/style.css +++ b/src/webui/www/public/css/style.css @@ -389,7 +389,7 @@ td.generalLabel { margin-bottom: -3px; } -.torrentTable { +.unselectable { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; @@ -398,20 +398,6 @@ td.generalLabel { user-select: none; } -.torrentTable th { - padding: 5px 10px; - white-space: nowrap; -} - -.torrentTable td { - padding: 0px 3px; - white-space: nowrap; -} - -.torrentTable thead tr { - background-color: #eee; -} - #prop_general { padding: 2px; } diff --git a/src/webui/www/public/properties_content.html b/src/webui/www/public/properties_content.html index 60b3dca83..624922062 100644 --- a/src/webui/www/public/properties_content.html +++ b/src/webui/www/public/properties_content.html @@ -49,7 +49,7 @@