2016-07-16 01:44:47 -07:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html class="no-js">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
2021-07-11 03:52:35 -07:00
|
|
|
|
<title>{{_('txt Reader')}} | {{title}}</title>
|
2016-07-16 01:44:47 -07:00
|
|
|
|
<meta name="description" content="">
|
|
|
|
|
<meta name="viewport" content="width=device-width">
|
|
|
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
2019-12-22 06:24:22 -08:00
|
|
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}" type="text/css"/>
|
2016-07-16 01:44:47 -07:00
|
|
|
|
|
|
|
|
|
<!-- EPUBJS Renderer -->
|
|
|
|
|
<!--<script src="../build/epub.js"></script>-->
|
|
|
|
|
<script src="{{ url_for('static', filename='js/libs/jquery.min.js') }}"></script>
|
2021-01-24 02:16:57 -08:00
|
|
|
|
<script src="{{ url_for('static', filename='js/libs/plugins.js') }}"></script>
|
2016-07-16 01:44:47 -07:00
|
|
|
|
|
|
|
|
|
<style type="text/css">
|
|
|
|
|
|
|
|
|
|
body {
|
2019-12-22 06:24:22 -08:00
|
|
|
|
background: white;
|
2016-07-16 01:44:47 -07:00
|
|
|
|
}
|
|
|
|
|
|
2019-12-22 06:24:22 -08:00
|
|
|
|
#readmain {
|
2016-07-16 01:44:47 -07:00
|
|
|
|
position: absolute;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#area {
|
|
|
|
|
width: 80%;
|
|
|
|
|
height: 80%;
|
|
|
|
|
margin: 5% auto;
|
|
|
|
|
max-width: 1250px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#area iframe {
|
|
|
|
|
border: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xmp, pre, plaintext {
|
|
|
|
|
display: block;
|
|
|
|
|
font-family: -moz-fixed;
|
|
|
|
|
white-space: pre;
|
|
|
|
|
margin: 1em 0;
|
|
|
|
|
}
|
|
|
|
|
#area{
|
|
|
|
|
overflow:hidden;
|
|
|
|
|
}
|
|
|
|
|
pre {
|
|
|
|
|
white-space: pre-wrap;
|
|
|
|
|
word-wrap: break-word;
|
|
|
|
|
font-family: -moz-fixed;
|
|
|
|
|
column-count:2;
|
|
|
|
|
-webkit-columns:2;
|
|
|
|
|
-moz-columns:2;
|
|
|
|
|
column-gap:20px;
|
|
|
|
|
-moz-column-gap:20px;
|
|
|
|
|
-webkit-column-gap:20px;
|
|
|
|
|
position:relative;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
"use strict";
|
|
|
|
|
</script>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
2019-12-22 06:24:22 -08:00
|
|
|
|
<div id="readmain">
|
|
|
|
|
<div id="left" class="arrow" >‹</div>
|
2016-07-16 01:44:47 -07:00
|
|
|
|
<div id="area"><pre id="content" class="content"></pre></div>
|
2019-12-22 06:24:22 -08:00
|
|
|
|
<div id="right" class="arrow">›</div>
|
2016-07-16 01:44:47 -07:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
//to int
|
|
|
|
|
$("#area").width($("#area").width());
|
|
|
|
|
$("#content").width($("#content").width());
|
|
|
|
|
//bind text
|
2019-07-13 11:45:48 -07:00
|
|
|
|
$("#content").load("{{ url_for('web.serve_book', book_id=txtfile,book_format='txt') }}",function(textStr) {
|
2016-07-16 01:44:47 -07:00
|
|
|
|
$(this).height($(this).parent().height()*0.95);
|
|
|
|
|
$(this).text(textStr);
|
|
|
|
|
});
|
|
|
|
|
//keybind
|
2019-07-13 11:45:48 -07:00
|
|
|
|
$(document).keydown(function(event){
|
2016-07-16 01:44:47 -07:00
|
|
|
|
if(event.keyCode == 37){
|
|
|
|
|
prevPage();
|
|
|
|
|
}
|
|
|
|
|
if(event.keyCode == 39){
|
|
|
|
|
nextPage();
|
|
|
|
|
}
|
|
|
|
|
});
|
2016-07-18 19:59:46 -07:00
|
|
|
|
//click
|
2019-12-22 06:24:22 -08:00
|
|
|
|
$( "#left" ).click(function() {
|
2016-07-18 19:59:46 -07:00
|
|
|
|
prevPage();
|
|
|
|
|
});
|
2019-12-22 06:24:22 -08:00
|
|
|
|
$( "#right" ).click(function() {
|
2016-07-18 19:59:46 -07:00
|
|
|
|
nextPage();
|
|
|
|
|
});
|
2021-01-24 02:16:57 -08:00
|
|
|
|
$("#readmain").swipe( {
|
|
|
|
|
swipeRight:function() {
|
|
|
|
|
prevPage();
|
|
|
|
|
},
|
|
|
|
|
swipeLeft:function() {
|
|
|
|
|
nextPage();
|
|
|
|
|
},
|
|
|
|
|
});
|
2016-07-16 01:44:47 -07:00
|
|
|
|
//bind mouse
|
2016-07-18 19:59:46 -07:00
|
|
|
|
$(window).bind('DOMMouseScroll mousewheel', function(event) {
|
|
|
|
|
var delta = 0;
|
|
|
|
|
if (event.originalEvent.wheelDelta) {
|
|
|
|
|
delta = event.originalEvent.wheelDelta;
|
|
|
|
|
}else if (event.originalEvent.detail) {
|
|
|
|
|
delta = event.originalEvent.detail*-1;
|
|
|
|
|
}
|
|
|
|
|
if (delta >= 0) {
|
2016-07-16 01:44:47 -07:00
|
|
|
|
prevPage();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
nextPage();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
//page animate
|
|
|
|
|
var origwidth = $("#content")[0].getBoundingClientRect().width;
|
|
|
|
|
var gap = 20;
|
|
|
|
|
function prevPage(){
|
|
|
|
|
if($("#content").offset().left > 0){ return;}
|
|
|
|
|
leftoff = $("#content").offset().left;
|
|
|
|
|
leftoff = leftoff+origwidth+gap;
|
|
|
|
|
$("#content").offset({left:leftoff});
|
|
|
|
|
}
|
|
|
|
|
function nextPage(){
|
|
|
|
|
leftoff = $("#content").offset().left;
|
|
|
|
|
leftoff = leftoff-origwidth-gap;
|
2019-12-22 06:24:22 -08:00
|
|
|
|
if ( leftoff + $("#content")[0].scrollWidth < 0) { return;}
|
2016-07-16 01:44:47 -07:00
|
|
|
|
$("#content").offset({left:leftoff});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
2019-07-13 11:45:48 -07:00
|
|
|
|
</html>
|