diff --git a/www/common/sframe-common-file.js b/www/common/sframe-common-file.js index 09f501df7..3d12f81ac 100644 --- a/www/common/sframe-common-file.js +++ b/www/common/sframe-common-file.js @@ -53,11 +53,17 @@ define([ var $table = File.$table = $('', { id: 'cp-fileupload-table' }); + var hover = false; var createTableContainer = function ($body) { File.$container = $('
', { id: 'cp-fileupload' }).append(tableHeader).append($table).appendTo($body); $('.cp-fileupload-header-close').click(function () { File.$container.fadeOut(); }); + File.$container.mouseenter(function () { + hover = true; + }).mouseleave(function () { + hover = false; + }); return File.$container; }; @@ -209,6 +215,11 @@ define([ window.setTimeout(function () { File.$container.show(); }); var file = queue.queue.shift(); if (file.dl) { return void file.dl(file); } + if (file.$line && file.$line[0] && !hover) { + var line = file.$line[0]; + line.scrollIntoView(false); + } + delete file.$line; upload(file); }; queue.push = function (obj) { @@ -224,7 +235,7 @@ define([ $('
', {'class':'cp-fileupload-table-progressbar'}).appendTo($progressContainer); $('', {'class':'cp-fileupload-table-progress-value'}).text(Messages.upload_pending).appendTo($progressContainer); - var $tr = $('
', {id: id}).appendTo($table); + var $tr = obj.$line = $('', {id: id}).appendTo($table); var $lines = $table.find('tr[id]'); if ($lines.length > 5) { //$lines.slice(0, $lines.length - 5).remove(); @@ -257,6 +268,15 @@ define([ // cancel $('
', {'class': 'cp-fileupload-table-cancel'}).append($cancel).appendTo($tr); + var tw = $table.width(); + var cw = File.$container.prop('clientWidth'); + var diff = tw - cw; + if (diff && diff > 0) { + $table.css('margin-right', diff+'px'); + } else { + $table.css('margin-right', ''); + } + queue.next(); };