From 649b6d83843c9f7b1716e7b284514f9fe13882d6 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Wed, 10 Jul 2013 21:15:37 +0200 Subject: new hoster links, fixed manifest --- pyload/web/app/scripts/helpers/truncate.js | 25 ++++++++++++++ pyload/web/app/scripts/views/headerView.js | 2 -- .../app/templates/default/header/progressbar.html | 38 +++++++++++----------- 3 files changed, 44 insertions(+), 21 deletions(-) create mode 100644 pyload/web/app/scripts/helpers/truncate.js (limited to 'pyload/web') diff --git a/pyload/web/app/scripts/helpers/truncate.js b/pyload/web/app/scripts/helpers/truncate.js new file mode 100644 index 000000000..fb351b776 --- /dev/null +++ b/pyload/web/app/scripts/helpers/truncate.js @@ -0,0 +1,25 @@ +require(['underscore','handlebars'], function(_, Handlebars) { + 'use strict'; + + function truncate(fullStr, options) { + var strLen = 30; + if (_.isNumber(options)) + strLen = options; + + if (fullStr.length <= strLen) return fullStr; + + var separator = options.separator || '…'; + + var sepLen = separator.length, + charsToShow = strLen - sepLen, + frontChars = Math.ceil(charsToShow / 2), + backChars = Math.floor(charsToShow / 2); + + return fullStr.substr(0, frontChars) + + separator + + fullStr.substr(fullStr.length - backChars); + } + + Handlebars.registerHelper('truncate', truncate); + return truncate; +}); \ No newline at end of file diff --git a/pyload/web/app/scripts/views/headerView.js b/pyload/web/app/scripts/views/headerView.js index 10e4dfaf9..991f0f32e 100644 --- a/pyload/web/app/scripts/views/headerView.js +++ b/pyload/web/app/scripts/views/headerView.js @@ -165,7 +165,6 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'colle if (data === null) return; if (data['@class'] === 'ServerStatus') { - // TODO: load interaction when none available this.status.set(data); // There tasks at the server, but not in queue: so fetch them @@ -213,7 +212,6 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'colle eta: prog.get('eta') }, {silent: true}); file.setDownloadStatus(prog.get('download').status); - file.trigger('change:progress'); } } diff --git a/pyload/web/app/templates/default/header/progressbar.html b/pyload/web/app/templates/default/header/progressbar.html index e32edb335..a36fb5684 100644 --- a/pyload/web/app/templates/default/header/progressbar.html +++ b/pyload/web/app/templates/default/header/progressbar.html @@ -1,26 +1,26 @@ - {{#if single }} - {{ name }} ({{ statusmsg }}) - {{ else }} +{{#if single }} + {{ truncate name 32}} ({{ statusmsg }}) +{{ else }} {{#if downloads }} - {{ downloads }} downloads running {{#if speed }}({{ formatSize speed }}/s){{/if}} + {{ downloads }} downloads running {{#if speed }}({{ formatSize speed }}/s){{/if}} {{ else }} - No running tasks - {{/if}} + No running tasks {{/if}} - - -
- {{#if single }} -
- {{ else }} -
- {{/if}} -
-
-
- {{#if linksqueue }} - {{ linksqueue }} downloads left ({{ formatSize sizequeue }}) +{{/if}} + + +
+ {{#if single }} +
+ {{ else }} +
{{/if}} +
+
+
+ {{#if linksqueue }} + {{ linksqueue }} downloads left ({{ formatSize sizequeue }}) + {{/if}} {{ formatTime etaqueue }} -- cgit v1.2.3