diff --git a/book.html b/book.html
index 4c8fd2d..dc891fb 100644
--- a/book.html
+++ b/book.html
@@ -14,17 +14,26 @@
Aucun livre sélectionné
- Auteur{{ book.authors.size > 1 ? 's' : '' }}
+ Auteur{{ book.authors.length > 1 ? 's' : '' }}
- {{ author.name }}
@@ -39,7 +48,7 @@
Langue
-
{{ book.lang }}
+
- {{ book.lang.toUpperCase() }}
diff --git a/book.js b/book.js
index ff9a98c..3fbc040 100644
--- a/book.js
+++ b/book.js
@@ -42,6 +42,16 @@ var app = new Vue({
stdError: function(code, resp) {
console.log('ERROR ' + code + ': ' + resp);
},
+ formatBytes: function(bytes) {
+ if(bytes == 0) return '0';
+ var k = 1024; // or 1024 for binary
+ var sizes = ['Octets', 'Ko', 'Mo', 'Go', 'To', 'Po', 'Eo', 'Zo', 'Yo'];
+ var i = Math.floor(Math.log(bytes) / Math.log(k));
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
+ },
+ bookLink: function(book, data) {
+ return '/calibre/' + encodeURI(book.path) + '/' + encodeURI(data.name) + '.' + data.format.toLowerCase();
+ },
bookSuccess: function(resp) {
this.book = resp;
},