diff options
| author | 2013-07-10 21:15:37 +0200 | |
|---|---|---|
| committer | 2013-07-10 21:15:37 +0200 | |
| commit | 649b6d83843c9f7b1716e7b284514f9fe13882d6 (patch) | |
| tree | 6ba9c4d66e4c990a1877517f30ff39e21f0d5bc1 /pyload/web/app/scripts | |
| parent | render progress correctly again (diff) | |
| download | pyload-649b6d83843c9f7b1716e7b284514f9fe13882d6.tar.xz | |
new hoster links, fixed manifest
Diffstat (limited to 'pyload/web/app/scripts')
| -rw-r--r-- | pyload/web/app/scripts/helpers/truncate.js | 25 | ||||
| -rw-r--r-- | pyload/web/app/scripts/views/headerView.js | 2 | 
2 files changed, 25 insertions, 2 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');                          }                      }  | 
