X-Git-Url: http://jaekl.net/gitweb/?p=quanweb.git;a=blobdiff_plain;f=js%2FBooksView.js;fp=js%2FBooksView.js;h=0000000000000000000000000000000000000000;hp=1bbb8aed10751611a863006c170175c05e4565bf;hb=13efcb823cde095d5562ac061ef5a859d91c0f70;hpb=222a53b5def154dcc59dbaad98404ea2930e8434 diff --git a/js/BooksView.js b/js/BooksView.js deleted file mode 100644 index 1bbb8ae..0000000 --- a/js/BooksView.js +++ /dev/null @@ -1,68 +0,0 @@ -// ========= -// BooksView - -var BooksView = (function() { - var my = {}; - - // ======================== - // Private member variables - var booksModel = undefined; - - // ============== - // Public Methods - - my.init = function(linkedBooksModel) { - booksModel = linkedBooksModel; - - booksModel.listen(my); - }; - - // Called when the model changes - my.notify = function () { - var i; - var html = ''; - var limit = BooksModel.last - BooksModel.first; - for (i = 0; i <= limit; ++i) { - var book = BooksModel.cache[i]; - html += bookHtml(book); - } - - document.getElementById('books').innerHTML = html; - document.getElementById('first').innerHTML = (BooksModel.first + 1); - document.getElementById('last').innerHTML = (BooksModel.last + 1); - document.getElementById('count').innerHTML = BooksModel.count; - }; - - // =============== - // Private methods - - function bookHtml(book) { - var result = '
' - + '' - + '' - + '' - + '' - + '' - + '
'; - if (0 == book.CoverId) { - result += '(No cover available)'; - } else { - result += ''; - } - result += '' - + '

' + book.Title + '

' - + '

' - + '' + book.AuthorReading + ''; - if (typeof(book.SeriesName) !== 'undefined' && book.SeriesName.length > 0) { - result += '
' + book.SeriesName + ' ' + book.Volume + ''; - } - result += '

' - + '
' - + '
'; - return result; - } - - return my; -})();