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 WL = 'http://www.wolnelektury.pl';
10 //debug = function(text) {};
11 debug = function(text) {console.log(text);};
16 document.addEventListener("deviceready", onDeviceReady, false);
19 function onDeviceReady() {
20 debug('onDeviceReady');
22 var error = function(err) { alert(err); };
24 FileRepo.init(function() {
25 debug('after FileRepo.init');
26 Catalogue.init(function() {
27 debug('after catalogue.init');
28 History.init(function() {
29 debug('after history.init');
30 View.init(function() {
31 Menu.init(function() {
33 Catalogue.sync(function() {
34 Catalogue.updateLocal();
44 var currentOffset = function() {
45 var scr = document.body.scrollTop;
46 var h = document.getElementById('nothing').offsetTop;
50 var setOffset = function(offset) {
51 var h = document.getElementById('nothing').offsetTop;
52 setTimeout(function() {scroll(0, h*offset); }, 10);
56 var prettySize = function(size) {
58 var units = ['B', 'KiB', 'MiB', 'GiB'];
60 var unit = units.shift();
61 while (size > 1000 && units.length) {
66 return Math.round(size*10)/10 + ' ' + unit;
68 return Math.round(size) + ' ' + unit;