X-Git-Url: https://git.mdrn.pl/wl-mobile.git/blobdiff_plain/8b7b42d45674861437a31e9f9125a277ce998721..065d23f9494e1afb7f61ada08b728405b1b7a0cf:/assets/www/js/links.js diff --git a/assets/www/js/links.js b/assets/www/js/links.js new file mode 100644 index 0000000..ff2bb12 --- /dev/null +++ b/assets/www/js/links.js @@ -0,0 +1,49 @@ + +var Links = new function() { + var self = this; + + self.href = function(view, par) { + return view+"/"+par; + }; + + self.button = function(view, par, text, offset) { + offset = offset || 0; + var html = "
"; + icon = view; + if (icon != 'Book' && icon != 'Bookmarks' && icon != 'BookText' && + icon != 'Last' && icon != 'Tag') { + icon = 'Tag'; + } + html += ""; + html += "
" + text + "
"; + html += "
"; + html += "
\n"; + return html; + }; + + self.bookLink = function(book) { + var target = 'Book'; + var note = ''; + + if (book.html_file) { + // this assumes that either book has a html XOR it has children + target = 'BookText'; + note = "
"; + if (book._local) + note += 'Pobrane'; + else { + note += book.pretty_size; + } + note += "
"; + } + + return self.button(target, book.id, + "
" + book.authors + "
" + + book.title + note); + }; + + self.deleteButton = function(id) { + return "
x
"; + }; +}