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.
6 var Menu = new function() {
8 var infoView = 'ProjectInfo';
11 self.init = function(success) {
12 window.plugins.nativeControls.createTabBar();
13 window.plugins.nativeControls.createTabBarItem("start", "Początek","/www/img/icon-Last.png", {onSelect: Menu.start});
14 window.plugins.nativeControls.createTabBarItem("addmark","Dodaj zakładkę","/www/img/icon-Bookmarks.png", {onSelect: Menu.bookmark});
16 //window.plugins.nativeControls.createTabBarItem("info",self.infoLabel,"/www/img/icon-Tag.png", {onSelect: Menu.info});
17 //window.plugins.nativeControls.createTabBarItem("night","Tryb nocny","", {onSelect: Menu.toggleNightMode});
18 //window.plugins.nativeControls.showTabBarItems("start", "addmark", "info", "night");
19 //window.plugins.nativeControls.showTabBar();
20 self.setInfoButton(self.infoView, 'O projekcie', self.showInfo);
21 self.setNightModeLabel();
25 self.start = function() {
27 window.plugins.nativeControls.selectTabBarItem('');
30 self.info = function() {
31 History.visit(self.infoView + '/' + View.currentPar);
32 window.plugins.nativeControls.selectTabBarItem('');
35 self.bookmark = function() {
36 var name = prompt('Nazwa zakładki');
38 History.addBookmark(name);
39 window.plugins.nativeControls.selectTabBarItem('');
42 self.setNightModeLabel = function() {
43 var label = 'Tryb nocny';
44 if (View.getNightMode()) label = 'Tryb dzienny';
45 window.plugins.nativeControls.createTabBarItem("night",label,"/www/img/icon-Tag.png", {onSelect: Menu.toggleNightMode});
48 self.refresh = function() {
49 var items = new Array();
50 if (View.currentView != 'Index')
52 items.push("addmark");
56 window.plugins.nativeControls.showTabBarItems.apply(this, items);
57 window.plugins.nativeControls.showTabBar();
60 self.toggleNightMode = function() {
61 View.toggleNightMode();
62 self.setNightModeLabel();
65 self.setInfoButton = function(view, label, enabled) {
67 self.showInfo = enabled;
68 window.plugins.nativeControls.createTabBarItem("info",label,"/www/img/icon-Tag.png", {onSelect: Menu.info});