From 222261cb6474e6338147b7c826bba4f7981cbff5 Mon Sep 17 00:00:00 2001 From: Daniel Lee Date: Sat, 31 Jul 2010 16:28:00 +0000 Subject: [PATCH] (web) #3456:Improve web client torrent list display --- web/javascript/common.js | 8 ++++++++ web/javascript/torrent.js | 8 ++++++++ web/javascript/transmission.js | 3 +++ web/stylesheets/common.css | 10 +++++++++- 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/web/javascript/common.js b/web/javascript/common.js index edf60a015..1775c897c 100644 --- a/web/javascript/common.js +++ b/web/javascript/common.js @@ -8,6 +8,7 @@ var transmission; var dialog; +var resizeTimer = null; // Test for a Webkit build that supports box-shadow: 521+ (release Safari 3 is // actually 523.10.3). We need 3.1 for CSS animation (dialog sheets) but as it // degrades gracefully let's not worry too much. @@ -79,6 +80,13 @@ $(document).ready( function() { $('body div#torrent_container').css('min-height', '338px'); $("label[for=torrent_upload_url]").text("URL: "); } + + // Add resize event handler with a timeout to handle browsers that fire a + // resize event for every pixel changed + $(window).bind('resize', function() { + if (resizeTimer) clearTimeout(resizeTimer); + resizeTimer = setTimeout('transmission.refreshDisplay()', 50) + }); }); /* diff --git a/web/javascript/torrent.js b/web/javascript/torrent.js index 64f518a5e..6b56b9308 100644 --- a/web/javascript/torrent.js +++ b/web/javascript/torrent.js @@ -662,6 +662,14 @@ Torrent.prototype = } setInnerHTML( root._progress_details_container, progress_details ); + if( compact ){ + var width = root._progress_details_container.offsetLeft - root._name_container.offsetLeft; + root._name_container.style.width = width + 'px'; + } + else { + root._name_container.style.width = '100%'; + } + // Update the peer details and pause/resume button e = root._pause_resume_button_image; if ( this.state() === Torrent._StatusPaused ) { diff --git a/web/javascript/transmission.js b/web/javascript/transmission.js index ba7e55883..c240e77be 100644 --- a/web/javascript/transmission.js +++ b/web/javascript/transmission.js @@ -1532,6 +1532,7 @@ Transmission.prototype = this.setPref( Prefs._ShowInspector, true ); this.updateInspector( ); + this.refreshDisplay( ); }, /* @@ -1553,6 +1554,7 @@ Transmission.prototype = } this.setPref( Prefs._ShowInspector, false ); + this.refreshDisplay( ); }, /* @@ -1961,6 +1963,7 @@ Transmission.prototype = this.setTorrentBgColors( ); this.updateStatusbar( ); this.selectionChanged( ); + this.refreshDisplay( ); }, setEnabled: function( key, flag ) diff --git a/web/stylesheets/common.css b/web/stylesheets/common.css index d42e197c2..58d310411 100644 --- a/web/stylesheets/common.css +++ b/web/stylesheets/common.css @@ -397,8 +397,9 @@ ul.torrent_list li.torrent.selected { ul.torrent_list li.torrent div.torrent_name { font-size: 1.3em; font-weight: bold; - word-wrap: break-word; overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; color: #222; margin-bottom: 2px; } @@ -407,6 +408,9 @@ ul.torrent_list li.torrent div.torrent_name.compact { float: left; z-index: 1; position: absolute; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } ul.torrent_list li.torrent.selected div.torrent_name { @@ -415,7 +419,11 @@ ul.torrent_list li.torrent.selected div.torrent_name { ul.torrent_list li.torrent div.torrent_progress_details, ul.torrent_list li.torrent div.torrent_peer_details { + clear: left; font-size: 1em; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } ul.torrent_list li.torrent div.torrent_progress_details.error { -- 2.40.0