Файловый менеджер - Редактировать - /var/www/readzy/app/www/assets/js/read.js
Назад
var read = { running : false, slider : null, speed : 250, tick : null, index : 0, words : null, word_count : 0, words_rendered : 0, text : null, init : () => { read.slider = document.getElementById("slider"); $('.read footer .cover img').attr('src','https://s3.amazonaws.com/cdn.readzy.com.au/book/'+route.data.sid+'/cover.jpg'); $('.read footer .info .title').html(route.data.title); $('.read footer .info .words').html(route.data.words+" Words"); $('.read footer .info .time').html(Math.ceil(route.data.words / read.speed)+" Minutes at "+read.speed+" WPM"); $('.read footer .speed_buttons .button[data-speed="'+read.speed+'"]').addClass('active'); if(read.tick){ clearInterval(read.tick); } if(home.tick){ clearInterval(home.tick); } Promise.all([ fetch('https://s3.amazonaws.com/cdn.readzy.com.au/book/'+route.data.sid+'/data.txt').then(x => x.text()) ]).then(([data]) => { read.text = data; read.process(read.text); }); app.tap('.read section', (e) => { if(read.running){ $('.read header').css('display','flex'); $('.read footer').css('display','flex'); read.running = false; if(read.tick){ clearInterval(read.tick); } }else{ if(!$('.read footer').hasClass('animated')){ $('.read footer').addClass('animated').addClass('bounceInUp') $('.read header').addClass('animated').addClass('bounceInDown') } $('.read header').css('display','none'); $('.read footer').css('display','none'); setTimeout(() => { read.running = true; read.start(); },600); } }); }, process : (text) => { if(localStorage.getItem(route.data.sid+"_bookmark")){ read.index = localStorage.getItem(route.data.sid+"_bookmark"); read.words_rendered = localStorage.getItem(route.data.sid+"_bookmark"); if(read.index >= 5){ app.confirm('Bookmark','Do you want to continue reading from where you left off?',['Start Again','Continue Reading'],(c) => { if(c == 1){ localStorage.setItem(route.data.sid+"_bookmark",0); read.index = 0; read.words_rendered = 0; read.slider.value = 0; $('.read section').html(read.words[read.index]); } }); } }else{ localStorage.setItem(route.data.sid+"_bookmark",0); read.index = 0; read.words_rendered = 0; } read.words = text.split(' '); read.word_count = read.words.length; $('.read footer').removeClass('disabled'); $('.read section').html(read.words[read.index]); $('.read footer .info .words').html(read.word_count+" Words"); $('.read footer .info .time').html(Math.ceil(read.word_count / read.speed)+" Minutes at "+read.speed+" WPM"); read.slider.max = read.word_count; read.slider.value = read.index; read.slider.oninput = function() { read.index = this.value; $('.read section').html(read.words[read.index]); } app.tap('.read footer .speed_buttons .button', (ele) => { $('.read footer .speed_buttons .button.active').removeClass('active'); $(ele).addClass('active'); read.speed = $(ele).attr('data-speed'); $('.read footer .info .time').html(Math.ceil(read.word_count / read.speed)+" Minutes at "+read.speed+" WPM"); }); }, start : () => { read.tick = setInterval(() => { if(read.running){ if(read.words_rendered < read.word_count){ localStorage.setItem(route.data.sid+"_bookmark",read.index); read.words_rendered++; $('.read section').html(read.words[read.index]); document.getElementById("slider").value = read.index; read.slider.value = read.index; read.index++; }else{ clearInterval(read.tick); } } }, (60000 / read.speed)); } }
| ver. 1.4 |
Github
|
.
| PHP 7.0.33-0ubuntu0.16.04.16 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка