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 -- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 pyload/web/app/scripts/helpers/truncate.js (limited to 'pyload/web/app/scripts') 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'); } } -- cgit v1.2.3