night mode,
[wl-mobile.git] / assets / www / js / menu.js
1 /*
2  * This file is part of WolneLektury-Mobile, licensed under GNU Affero GPLv3 or later.
3  * Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4  */
5
6 var Menu = new function() {
7         var self = this;
8         var infoView = "ProjectInfo";
9
10         self.init = function() {
11                 window.MenuInterface.setNightMode(View.getNightMode());
12         };
13
14         self.start = function() {
15                 History.visit('');
16         };
17
18         self.info = function() {
19                 History.visit(self.infoView + '/' + View.currentPar);
20         };
21
22         self.bookmark = function() {
23                 var name = prompt('Nazwa zakładki');
24                 if (name != null)
25                         History.addBookmark(name);
26         };
27
28         self.toggleNightMode = function() {
29                 View.toggleNightMode();
30                 window.MenuInterface.setNightMode(View.getNightMode());
31         };
32
33         self.setInfoButton = function(view, label, enabled) {
34                 self.infoView = view;
35                 window.MenuInterface.setInfoButton(label, enabled);
36         };
37 }