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 console.log = function(text) {};
14 console.log('onLoad');
15 document.addEventListener("deviceready", onDeviceReady, false);
18 function onDeviceReady() {
19 console.log('onDeviceReady');
20 var error = function(err) { alert(err); };
22 FileRepo.init(function() {
23 console.log('after FileRepo.init');
24 Catalogue.init(function() {
25 console.log('after catalogue.init');
26 History.init(function() {
27 console.log('after history.init');
28 View.init(function() {
29 Menu.init(function() {
30 Catalogue.sync(function() {
31 Catalogue.updateLocal();
41 var currentOffset = function() {
42 var scr = document.body.scrollTop;
43 var h = document.getElementById('nothing').offsetTop;
44 return scr/h;document.getElementById('nothing')
47 var setOffset = function(offset) {
48 var h = document.getElementById('nothing').offsetTop;
53 var prettySize = function(size) {
55 var units = ['B', 'KiB', 'MiB', 'GiB'];
57 var unit = units.shift();
58 while (size > 1000 && units.length) {
63 return Math.round(size*10)/10 + ' ' + unit;
65 return Math.round(size) + ' ' + unit;