summaryrefslogtreecommitdiffstats
path: root/pyload/web
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-07-10 21:15:37 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-07-10 21:15:37 +0200
commit649b6d83843c9f7b1716e7b284514f9fe13882d6 (patch)
tree6ba9c4d66e4c990a1877517f30ff39e21f0d5bc1 /pyload/web
parentrender progress correctly again (diff)
downloadpyload-649b6d83843c9f7b1716e7b284514f9fe13882d6.tar.xz
new hoster links, fixed manifest
Diffstat (limited to 'pyload/web')
-rw-r--r--pyload/web/app/scripts/helpers/truncate.js25
-rw-r--r--pyload/web/app/scripts/views/headerView.js2
-rw-r--r--pyload/web/app/templates/default/header/progressbar.html38
3 files changed, 44 insertions, 21 deletions
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}}
- <i class="icon-list pull-right"></i>
- <!-- TODO active animation -->
- <div class="progress" id="globalprogress">
- {{#if single }}
- <div class="bar" style="width: {{ percent }}%">
- {{ else }}
- <div class="bar {{#if downloads }}running{{/if}}">
- {{/if}}
- </div>
- </div>
- <div class="sub">
- {{#if linksqueue }}
- {{ linksqueue }} downloads left ({{ formatSize sizequeue }})
+{{/if}}
+<i class="icon-list pull-right"></i>
+<!-- TODO active animation -->
+<div class="progress" id="globalprogress">
+ {{#if single }}
+ <div class="bar" style="width: {{ percent }}%">
+ {{ else }}
+ <div class="bar {{#if downloads }}running{{/if}}">
{{/if}}
+ </div>
+ </div>
+ <div class="sub">
+ {{#if linksqueue }}
+ {{ linksqueue }} downloads left ({{ formatSize sizequeue }})
+ {{/if}}
<span class="pull-right">
{{ formatTime etaqueue }}
</span>