X-Git-Url: https://git.mdrn.pl/wl-mobile.git/blobdiff_plain/d947c00d92691df552a793f8d9c2991c931ad244..e02aa48b6f2b7ddca9b55c56288cd2512702da6d:/assets/www/js/menu.js diff --git a/assets/www/js/menu.js b/assets/www/js/menu.js new file mode 100644 index 0000000..9fea371 --- /dev/null +++ b/assets/www/js/menu.js @@ -0,0 +1,37 @@ +/* + * This file is part of WolneLektury-Mobile, licensed under GNU Affero GPLv3 or later. + * Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. + */ + +var Menu = new function() { + var self = this; + var infoView = "ProjectInfo"; + + self.init = function() { + window.MenuInterface.setNightMode(View.getNightMode()); + }; + + self.start = function() { + History.visit(''); + }; + + self.info = function() { + History.visit(self.infoView + '/' + View.currentPar); + }; + + self.bookmark = function() { + var name = prompt('Nazwa zakładki'); + if (name != null) + History.addBookmark(name); + }; + + self.toggleNightMode = function() { + View.toggleNightMode(); + window.MenuInterface.setNightMode(View.getNightMode()); + }; + + self.setInfoButton = function(view, label, enabled) { + self.infoView = view; + window.MenuInterface.setInfoButton(label, enabled); + }; +}