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('onLoad');
12 document.addEventListener("deviceready", onDeviceReady, false);
15 function onDeviceReady() {
16 console.log('onDeviceReady');
17 var error = function(err) { alert(err); };
19 FileRepo.init(function() {
20 console.log('after FileRepo.init');
21 Catalogue.init(function() {
22 console.log('after catalogue.init');
23 History.init(function() {
24 console.log('after history.init');
25 View.init(function() {
26 Catalogue.sync(function() {
27 Catalogue.updateLocal();
36 var currentOffset = function() {
37 var scr = document.body.scrollTop;
38 var h = document.getElementById('nothing').offsetTop;
39 return scr/h;document.getElementById('nothing')
42 var setOffset = function(offset) {
43 var h = document.getElementById('nothing').offsetTop;
48 var prettySize = function(size) {
50 var units = ['B', 'KiB', 'MiB', 'GiB'];
52 var unit = units.shift();
53 while (size > 1000 && units.length) {
58 return Math.round(size*10)/10 + ' ' + unit;
60 return Math.round(size) + ' ' + unit;