X-Git-Url: https://git.mdrn.pl/wl-mobile.git/blobdiff_plain/bff5852b5ee1320a6eaf4256570784bbc024496f..b9acd6c8b2300a76624900cd19f9e40e59ff3f7b:/www/js/links.js diff --git a/www/js/links.js b/www/js/links.js new file mode 100644 index 0000000..3a7465a --- /dev/null +++ b/www/js/links.js @@ -0,0 +1,53 @@ +/* + * This file is part of WolneLektury-Mobile, licensed under GNU Affero GPLv3 or later. + * Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. + */ + +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
"; + }; +}