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 Catalogue.sync(function() {
30 Catalogue.updateLocal();
39 var currentOffset = function() {
40 var scr = document.body.scrollTop;
41 var h = document.getElementById('nothing').offsetTop;
42 return scr/h;document.getElementById('nothing')
45 var setOffset = function(offset) {
46 var h = document.getElementById('nothing').offsetTop;
51 var prettySize = function(size) {
53 var units = ['B', 'KiB', 'MiB', 'GiB'];
55 var unit = units.shift();
56 while (size > 1000 && units.length) {
61 return Math.round(size*10)/10 + ' ' + unit;
63 return Math.round(size) + ' ' + unit;