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.
7 var WL = 'http://www.wolnelektury.pl';
11 console.log = function(text) {};
15 console.log('onLoad');
16 document.addEventListener("deviceready", onDeviceReady, false);
19 function onDeviceReady() {
20 console.log('onDeviceReady');
21 var error = function(err) { alert(err); };
23 FileRepo.init(function() {
24 console.log('after FileRepo.init');
25 Catalogue.init(function() {
26 console.log('after catalogue.init');
27 History.init(function() {
28 console.log('after history.init');
29 View.init(function() {
30 Catalogue.sync(function() {
31 Catalogue.updateLocal();
40 var currentOffset = function() {
41 var scr = document.body.scrollTop;
42 var h = document.getElementById('nothing').offsetTop;
43 return scr/h;document.getElementById('nothing')
46 var setOffset = function(offset) {
47 var h = document.getElementById('nothing').offsetTop;
52 var prettySize = function(size) {
54 var units = ['B', 'KiB', 'MiB', 'GiB'];
56 var unit = units.shift();
57 while (size > 1000 && units.length) {
62 return Math.round(size*10)/10 + ' ' + unit;
64 return Math.round(size) + ' ' + unit;