fix(js reader): adjust height to dynamic viewport height, add amber theme

This commit is contained in:
IgorKurkov
2025-10-26 18:23:07 +01:00
parent 6b11d0b4f3
commit 1ce1aee35e
4 changed files with 462 additions and 268 deletions

2
.gitignore vendored
View File

@@ -35,3 +35,5 @@ gdrive_credentials
client_secrets.json client_secrets.json
gmail.json gmail.json
/.key /.key
calibre-volume
calibre-web-env

View File

@@ -5,7 +5,7 @@
.darkTheme { .darkTheme {
background: #202124; background: #202124;
color: #fff color: #fff;
} }
.sepiaTheme { .sepiaTheme {
@@ -13,6 +13,11 @@
color: #000; color: #000;
} }
.amberTheme {
background: #e8bf5e;
color: #000;
}
.blackTheme { .blackTheme {
background: #000; background: #000;
color: #fff; color: #fff;

View File

@@ -1,11 +1,10 @@
@font-face { @font-face {
font-family: 'fontello'; font-family: "fontello";
src: url('fonts/fontello.eot?60518104'); src: url("fonts/fontello.eot?60518104");
src: src: url("fonts/fontello.eot?60518104#iefix") format("embedded-opentype"),
url('fonts/fontello.eot?60518104#iefix') format('embedded-opentype'), url("fonts/fontello.woff?60518104") format("woff"),
url('fonts/fontello.woff?60518104') format('woff'), url("fonts/fontello.ttf?60518104") format("truetype"),
url('fonts/fontello.ttf?60518104') format('truetype'), url("fonts/fontello.svg?60518104#fontello") format("svg");
url('fonts/fontello.svg?60518104#fontello') format('svg');
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@@ -48,7 +47,7 @@ body {
-webkit-transition: opacity 0.5s; -webkit-transition: opacity 0.5s;
-moz-transition: opacity 0.5s; -moz-transition: opacity 0.5s;
transition: opacity 0.5s; transition: opacity 0.5s;
z-index: 10; z-index: 100;
} }
#titlebar:hover { #titlebar:hover {
@@ -93,14 +92,18 @@ body {
box-shadow: inset 0 0 6px rgba(155, 155, 155, 0.8); box-shadow: inset 0 0 6px rgba(155, 155, 155, 0.8);
} }
#book-title { font-weight: 600; } #book-title {
#title-seperator { display: none; } font-weight: 600;
}
#title-seperator {
display: none;
}
#viewer { #viewer {
width: 80%; width: 80%;
height: 80%; height: 80%;
margin: 0 auto; margin: 0 auto;
z-index: 2; z-index: 0;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
} }
@@ -136,6 +139,7 @@ body {
user-select: none; user-select: none;
padding-top: 160px; padding-top: 160px;
padding-bottom: 160px; padding-bottom: 160px;
z-index: 10;
} }
.arrow:hover { .arrow:hover {
@@ -200,10 +204,16 @@ body {
max-width: 80%; max-width: 80%;
} }
#title-controls { float: right; } #title-controls {
float: right;
}
#panels a::before { visibility: visible; } #panels a::before {
#panels a:hover { color: #aaa; } visibility: visible;
}
#panels a:hover {
color: #aaa;
}
.list_item.currentChapter > a, .list_item.currentChapter > a,
.list_item a:hover { .list_item a:hover {
@@ -237,8 +247,12 @@ body {
margin-top: -1px; margin-top: -1px;
} }
input::-webkit-input-placeholder { color: #454545; } input::-webkit-input-placeholder {
input:-moz-placeholder { color: #454545; } color: #454545;
}
input:-moz-placeholder {
color: #454545;
}
#divider { #divider {
position: absolute; position: absolute;
@@ -378,14 +392,14 @@ input:-moz-placeholder { color: #454545; }
} }
.toc_toggle::before { .toc_toggle::before {
content: '▸'; content: "▸";
color: #fff; color: #fff;
margin-right: -4px; margin-right: -4px;
} }
.currentChapter > .toc_toggle::before, .currentChapter > .toc_toggle::before,
.openChapter > .toc_toggle::before { .openChapter > .toc_toggle::before {
content: '▾'; content: "▾";
} }
.view { .view {
@@ -499,13 +513,25 @@ input:-moz-placeholder { color: #454545; }
list-style-type: none; list-style-type: none;
} }
#settingsPanel .xsmall { font-size: x-small; } #settingsPanel .xsmall {
#settingsPanel .small { font-size: small; } font-size: x-small;
#settingsPanel .medium { font-size: medium; } }
#settingsPanel .large { font-size: large; } #settingsPanel .small {
#settingsPanel .xlarge { font-size: x-large; } font-size: small;
}
#settingsPanel .medium {
font-size: medium;
}
#settingsPanel .large {
font-size: large;
}
#settingsPanel .xlarge {
font-size: x-large;
}
.highlight { background-color: yellow; } .highlight {
background-color: yellow;
}
.modal { .modal {
position: fixed; position: fixed;
@@ -581,6 +607,7 @@ input:-moz-placeholder { color: #454545; }
color: white; color: white;
} }
.md-content .themes button.lightTheme,
.md-content .themes button.whiteTheme { .md-content .themes button.whiteTheme {
background-color: white; background-color: white;
color: black; color: black;
@@ -591,6 +618,11 @@ input:-moz-placeholder { color: #454545; }
color: black; color: black;
} }
.md-content .themes button.amberTheme {
background-color: #e8bf5e;
color: black;
}
.md-content .themes button.blackTheme { .md-content .themes button.blackTheme {
background-color: black; background-color: black;
color: white; color: white;
@@ -638,31 +670,47 @@ input:-moz-placeholder { color: #454545; }
@media only screen and (max-width: 900px) { @media only screen and (max-width: 900px) {
#viewer { #viewer {
width: 60%; width: 100%;
margin-left: 20%; height: calc(100dvh - 99px);
margin-left: 0;
}
#viewer iframe {
width: 100%;
height: 100%;
} }
#prev { #prev {
left: 20px; left: 20px;
z-index: 10;
} }
#next { #next {
right: 20px; right: 20px;
z-index: 10;
} }
} }
@media only screen and (max-width: 550px) { @media only screen and (max-width: 550px) {
#viewer { #viewer {
width: 80%; width: 100%;
margin-left: 10%; height: calc(100dvh - 99px);
margin-left: 0;
}
#viewer iframe {
width: 100%;
height: 100%;
} }
#prev { #prev {
left: 0; left: 0;
z-index: 10;
} }
#next { #next {
right: 0; right: 0;
z-index: 10;
} }
.arrow { .arrow {
@@ -712,11 +760,7 @@ input:-moz-placeholder { color: #454545; }
} }
} }
@media only screen @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) /* and (-webkit-min-device-pixel-ratio: 2) */ {
and (min-device-width: 768px)
and (max-device-width: 1024px)
and (orientation: landscape)
/* and (-webkit-min-device-pixel-ratio: 2)*/ {
#viewer { #viewer {
width: 80%; width: 80%;
margin-left: 10%; margin-left: 10%;
@@ -739,47 +783,52 @@ input:-moz-placeholder { color: #454545; }
/* For iPhone 6\6s portrait layouts only */ /* For iPhone 6\6s portrait layouts only */
@media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation: portrait) { @media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation: portrait) {
#viewer { #viewer {
width: 300px; width: 100%;
height: 480px; height: calc(100dvh - 99px);
} }
#viewer iframe { #viewer iframe {
width: 300px; width: 100%;
height: 480px; height: 100%;
} }
} }
/* For iPhone 6\6s landscape layouts only */ /* For iPhone 6\6s landscape layouts only */
@media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation: landscape) { @media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation: landscape) {
#viewer { #viewer {
width: 450px; width: 100%;
height: 300px; height: calc(100dvh - 99px);
} }
#viewer iframe { #viewer iframe {
width: 450px; width: 100%;
height: 300px; height: 100%;
} }
} }
/* For iPhone portrait layouts only */ /* For iPhone portrait layouts only */
@media only screen and (max-device-width: 374px) and (orientation: portrait) { @media only screen and (max-device-width: 374px) and (orientation: portrait) {
#viewer { #viewer {
width: 256px; width: 100%;
height: 432px; height: calc(100dvh - 99px);
} }
#viewer iframe { #viewer iframe {
width: 256px; width: 100%;
height: 432px; height: 100%;
} }
} }
/* For iPhone landscape layouts only */ /* For iPhone landscape layouts only */
@media only screen and (max-device-width: 374px) and (orientation: landscape) { @media only screen and (max-device-width: 374px) and (orientation: landscape) {
#viewer {
width: 100%;
height: calc(100dvh - 99px);
}
#viewer iframe { #viewer iframe {
width: 256px; width: 100%;
height: 124px; height: 100%;
} }
} }
@@ -803,32 +852,76 @@ input:-moz-placeholder { color: #454545; }
font-size: 112%; font-size: 112%;
} }
.icon-search::before { content: '\e807'; } /* '' */ .icon-search::before {
.icon-resize-full-1::before { content: '\e804'; } /* '' */ content: "\e807";
.icon-cancel-circled2::before { content: '\e80f'; } /* '' */ } /* '' */
.icon-link::before { content: '\e80d'; } /* '' */ .icon-resize-full-1::before {
.icon-bookmark::before { content: '\e805'; } /* '' */ content: "\e804";
.icon-bookmark-empty::before { content: '\e806'; } /* '' */ } /* '' */
.icon-download-cloud::before { content: '\e811'; } /* '' */ .icon-cancel-circled2::before {
.icon-edit::before { content: '\e814'; } /* '' */ content: "\e80f";
.icon-menu::before { content: '\e802'; } /* '' */ } /* '' */
.icon-cog::before { content: '\e813'; } /* '' */ .icon-link::before {
.icon-resize-full::before { content: '\e812'; } /* '' */ content: "\e80d";
.icon-cancel-circled::before { content: '\e80e'; } /* '' */ } /* '' */
.icon-up-dir::before { content: '\e80c'; } /* '' */ .icon-bookmark::before {
.icon-right-dir::before { content: '\e80b'; } /* '' */ content: "\e805";
.icon-angle-right::before { content: '\e809'; } /* '' */ } /* '' */
.icon-angle-down::before { content: '\e80a'; } /* '' */ .icon-bookmark-empty::before {
.icon-right::before { content: '\e815'; } /* '' */ content: "\e806";
.icon-list-1::before { content: '\e803'; } /* '' */ } /* '' */
.icon-list-numbered::before { content: '\e801'; } /* '' */ .icon-download-cloud::before {
.icon-columns::before { content: '\e810'; } /* '' */ content: "\e811";
.icon-list::before { content: '\e800'; } /* '' */ } /* '' */
.icon-resize-small::before { content: '\e808'; } /* '' */ .icon-edit::before {
content: "\e814";
} /* '' */
.icon-menu::before {
content: "\e802";
} /* '' */
.icon-cog::before {
content: "\e813";
} /* '' */
.icon-resize-full::before {
content: "\e812";
} /* '' */
.icon-cancel-circled::before {
content: "\e80e";
} /* '' */
.icon-up-dir::before {
content: "\e80c";
} /* '' */
.icon-right-dir::before {
content: "\e80b";
} /* '' */
.icon-angle-right::before {
content: "\e809";
} /* '' */
.icon-angle-down::before {
content: "\e80a";
} /* '' */
.icon-right::before {
content: "\e815";
} /* '' */
.icon-list-1::before {
content: "\e803";
} /* '' */
.icon-list-numbered::before {
content: "\e801";
} /* '' */
.icon-columns::before {
content: "\e810";
} /* '' */
.icon-list::before {
content: "\e800";
} /* '' */
.icon-resize-small::before {
content: "\e808";
} /* '' */
#progress { #progress {
right: 4rem; right: 4rem;
bottom: 4rem; bottom: 2px;
width: fit-content; width: fit-content;
position: absolute; position: absolute;
} }

View File

@@ -1,39 +1,65 @@
<!DOCTYPE html> <!DOCTYPE html>
<html class="no-js"> <html class="no-js">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>{{_('epub Reader')}} | {{title}}</title> <title>{{_('epub Reader')}} | {{title}}</title>
<meta name="description" content=""> <meta name="description" content="" />
<meta name="viewport" content="width=device-width, user-scalable=no"> <meta name="viewport" content="width=device-width, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes" />
{% if g.google_site_verification|length > 0 %} {% if g.google_site_verification|length > 0 %}
<meta name="google-site-verification" content="{{g.google_site_verification}}"> <meta
name="google-site-verification"
content="{{g.google_site_verification}}"
/>
{% endif %} {% endif %}
<link rel="apple-touch-icon" sizes="140x140" href="{{ url_for('static', filename='favicon.ico') }}"> <link
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}"> rel="apple-touch-icon"
sizes="140x140"
href="{{ url_for('static', filename='favicon.ico') }}"
/>
<link
rel="shortcut icon"
href="{{ url_for('static', filename='favicon.ico') }}"
/>
<link rel="stylesheet" href="{{ url_for('static', filename='css/libs/normalize.css') }}"> <link
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}"> rel="stylesheet"
<link rel="stylesheet" href="{{ url_for('static', filename='css/popup.css') }}"> href="{{ url_for('static', filename='css/libs/normalize.css') }}"
<link rel="stylesheet" href="{{ url_for('static', filename='css/reader.css') }}"> />
<link
rel="stylesheet"
href="{{ url_for('static', filename='css/main.css') }}"
/>
<link
rel="stylesheet"
href="{{ url_for('static', filename='css/popup.css') }}"
/>
<link
rel="stylesheet"
href="{{ url_for('static', filename='css/reader.css') }}"
/>
</head> </head>
<body> <body>
<div id="sidebar"> <div id="sidebar">
<div id="panels"> <div id="panels">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"> <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<!--input id="searchBox" placeholder="search" type="search"--> <!--input id="searchBox" placeholder="search" type="search"-->
<!--a id="show-Search" class="show_view icon-search" data-view="Search">Search</a--> <!--a id="show-Search" class="show_view icon-search" data-view="Search">Search</a-->
<a id="show-Toc" class="show_view icon-list-1 active" data-view="Toc">TOC</a> <a id="show-Toc" class="show_view icon-list-1 active" data-view="Toc"
<a id="show-Bookmarks" class="show_view icon-bookmark" data-view="Bookmarks">Bookmarks</a> >TOC</a
>
<a
id="show-Bookmarks"
class="show_view icon-bookmark"
data-view="Bookmarks"
>Bookmarks</a
>
<!--a id="show-Notes" class="show_view icon-edit" data-view="Notes">Notes</a--> <!--a id="show-Notes" class="show_view icon-edit" data-view="Notes">Notes</a-->
</div>
<div id="tocView" class="view">
</div> </div>
<div id="tocView" class="view"></div>
<!--div id="searchView" class="view"> <!--div id="searchView" class="view">
<ul id="searchResults"></ul> <ul id="searchResults"></ul>
</div--> </div-->
@@ -49,7 +75,6 @@
</div--> </div-->
</div> </div>
<div id="main"> <div id="main">
<div id="titlebar"> <div id="titlebar">
<div id="opener"> <div id="opener">
<a id="slider" class="icon-menu">Menu</a> <a id="slider" class="icon-menu">Menu</a>
@@ -71,7 +96,9 @@
<div id="viewer"></div> <div id="viewer"></div>
<div id="next" class="arrow"></div> <div id="next" class="arrow"></div>
<div id="progress">0%</div> <div id="progress">0%</div>
<div id="loader"><img src="{{ url_for('static', filename='img/loader.gif') }}"></div> <div id="loader">
<img src="{{ url_for('static', filename='img/loader.gif') }}" />
</div>
</div> </div>
<div class="modal md-effect-1" id="settings-modal"> <div class="modal md-effect-1" id="settings-modal">
<div class="md-content"> <div class="md-content">
@@ -80,83 +107,147 @@
{{_('Choose a theme below:')}}}<br /> {{_('Choose a theme below:')}}}<br />
<!-- Hardcoded a tick in the light theme button because it is the "default" theme. Need to find a way to do this dynamically on startup--> <!-- Hardcoded a tick in the light theme button because it is the "default" theme. Need to find a way to do this dynamically on startup-->
<button type="button" id="lightTheme" class="lightTheme" onclick="selectTheme(this.id)"><span <button
id="lightSelected"></span>{{_('Light')}}</button> type="button"
<button type="button" id="darkTheme" class="darkTheme" onclick="selectTheme(this.id)"><span id="lightTheme"
id="darkSelected"> </span>{{_('Dark')}}</button> class="lightTheme"
<button type="button" id="sepiaTheme" class="sepiaTheme" onclick="selectTheme(this.id)"><span onclick="selectTheme(this.id)"
id="sepiaSelected"> </span>{{_('Sepia')}}</button> >
<button type="button" id="blackTheme" class="blackTheme" onclick="selectTheme(this.id)"><span <span id="lightSelected"></span>{{_('Light')}}
id="blackSelected"> </span>{{_('Black')}}</button> </button>
<button
type="button"
id="darkTheme"
class="darkTheme"
onclick="selectTheme(this.id)"
>
<span id="darkSelected"> </span>{{_('Dark')}}
</button>
<button
type="button"
id="sepiaTheme"
class="sepiaTheme"
onclick="selectTheme(this.id)"
>
<span id="sepiaSelected"> </span>{{_('Sepia')}}
</button>
<button
type="button"
id="amberTheme"
class="amberTheme"
onclick="selectTheme(this.id)"
>
<span id="amberSelected"> </span>{{_('Amber')}}
</button>
<button
type="button"
id="blackTheme"
class="blackTheme"
onclick="selectTheme(this.id)"
>
<span id="blackSelected"> </span>{{_('Black')}}
</button>
</div> </div>
<div class="form-group"> <div class="form-group">
<p> <p>
<input type="checkbox" id="sidebarReflow" <input
name="sidebarReflow">{{_('Reflow text when sidebars are open.')}} type="checkbox"
id="sidebarReflow"
name="sidebarReflow"
/>{{_('Reflow text when sidebars are open.')}}
</p> </p>
</div> </div>
<div class="form-group fontSizeWrapper"> <div class="form-group fontSizeWrapper">
<div class="slider"> <div class="slider">
<label for="fader">{{ _('Font Sizes') }}</label> <label for="fader">{{ _('Font Sizes') }}</label>
<input type="range" min="75" max="200" value="100" id="fontSizeFader" step="25"> <input
type="range"
min="75"
max="200"
value="100"
id="fontSizeFader"
step="25"
/>
</div> </div>
</div> </div>
<div class="font" id="font"> <div class="font" id="font">
<label class="item">{{_('Font')}}:</label> <label class="item">{{_('Font')}}:</label>
<button type="button" id="default" onclick="selectFont(this.id)"><span></span>{{_('Default')}}</button> <button type="button" id="default" onclick="selectFont(this.id)">
<button type="button" id="Yahei" onclick="selectFont(this.id)"><span></span>{{_('Yahei')}}</button> <span></span>{{_('Default')}}
<button type="button" id="SimSun" onclick="selectFont(this.id)"><span></span>{{_('SimSun')}}</button> </button>
<button type="button" id="KaiTi" onclick="selectFont(this.id)"><span></span>{{_('KaiTi')}}</button> <button type="button" id="Yahei" onclick="selectFont(this.id)">
<button type="button" id="Arial" onclick="selectFont(this.id)"><span></span>{{_('Arial')}}</button> <span></span>{{_('Yahei')}}
</button>
<button type="button" id="SimSun" onclick="selectFont(this.id)">
<span></span>{{_('SimSun')}}
</button>
<button type="button" id="KaiTi" onclick="selectFont(this.id)">
<span></span>{{_('KaiTi')}}
</button>
<button type="button" id="Arial" onclick="selectFont(this.id)">
<span></span>{{_('Arial')}}
</button>
</div> </div>
<div class="layou" id="layout"> <div class="layou" id="layout">
<label class="item">{{ _('Spread') }}:</label> <label class="item">{{ _('Spread') }}:</label>
<button type="button" id="spread" onclick="spread(this.id)"><span></span>{{_('Two columns')}}</button> <button type="button" id="spread" onclick="spread(this.id)">
<button type="button" id="nonespread" onclick="spread(this.id)"><span></span>{{_('One column')}}</button> <span></span>{{_('Two columns')}}
</button>
<button type="button" id="nonespread" onclick="spread(this.id)">
<span></span>{{_('One column')}}
</button>
</div> </div>
<div class="closer icon-cancel-circled"></div> <div class="closer icon-cancel-circled"></div>
</div> </div>
</div> </div>
<div class="overlay"></div> <div class="overlay"></div>
<script src="{{ url_for('static', filename='js/libs/jquery.min.js') }}"></script> <script src="{{ url_for('static', filename='js/libs/jquery.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/compress/jszip_epub.min.js') }}"> <script src="{{ url_for('static', filename='js/compress/jszip_epub.min.js') }}"></script>
</script>
<script src="{{ url_for('static', filename='js/libs/epub.min.js') }}"></script> <script src="{{ url_for('static', filename='js/libs/epub.min.js') }}"></script>
<script type="text/javascript"> <script type="text/javascript">
window.calibre = { window.calibre = {
filePath: "{{ url_for('static', filename='js/libs/') }}", filePath: "{{ url_for('static', filename='js/libs/') }}",
cssPath: "{{ url_for('static', filename='css/') }}", cssPath: "{{ url_for('static', filename='css/') }}",
bookmarkUrl: "{{ url_for('web.set_bookmark', book_id=bookid, book_format=book_format) }}", bookmarkUrl:
bookUrl: "{{ url_for('web.serve_book', book_id=bookid, book_format=book_format, anyname='file.epub') }}", "{{ url_for('web.set_bookmark', book_id=bookid, book_format=book_format) }}",
bookUrl:
"{{ url_for('web.serve_book', book_id=bookid, book_format=book_format, anyname='file.epub') }}",
bookmark: "{{ bookmark.bookmark_key if bookmark != None }}", bookmark: "{{ bookmark.bookmark_key if bookmark != None }}",
useBookmarks: "{{ current_user.is_authenticated | tojson }}" useBookmarks: "{{ current_user.is_authenticated | tojson }}",
}; };
window.themes = { window.themes = {
"darkTheme": { darkTheme: {
"bgColor": "#202124", bgColor: "#202124",
"css_path": "{{ url_for('static', filename='css/epub_themes.css') }}", css_path: "{{ url_for('static', filename='css/epub_themes.css') }}",
"title-color": "#fff" "title-color": "#fff",
}, },
"lightTheme": { lightTheme: {
"bgColor": "white", bgColor: "white",
"css_path": "{{ url_for('static', filename='css/epub_themes.css') }}", css_path: "{{ url_for('static', filename='css/epub_themes.css') }}",
"title-color": "#4f4f4f" "title-color": "#4f4f4f",
}, },
"sepiaTheme": { sepiaTheme: {
"bgColor": "#ece1ca", bgColor: "#ece1ca",
"css_path": "{{ url_for('static', filename='css/epub_themes.css') }}", css_path: "{{ url_for('static', filename='css/epub_themes.css') }}",
"title-color": "#4f4f4f" "title-color": "#4f4f4f",
}, },
"blackTheme": { amberTheme: {
"bgColor": "black", bgColor: "#e8bf5e",
"css_path": "{{ url_for('static', filename='css/epub_themes.css') }}", css_path: "{{ url_for('static', filename='css/epub_themes.css') }}",
"title-color": "#fff" "title-color": "#4f4f4f",
},
blackTheme: {
bgColor: "black",
css_path: "{{ url_for('static', filename='css/epub_themes.css') }}",
"title-color": "#fff",
}, },
}; };
function selectTheme(id) { function selectTheme(id) {
let tickSpans = document.getElementById("themes").querySelectorAll("span"); let tickSpans = document
.getElementById("themes")
.querySelectorAll("span");
// Remove tick mark from all theme buttons // Remove tick mark from all theme buttons
tickSpans.forEach(function (tickSpan) { tickSpans.forEach(function (tickSpan) {
@@ -173,13 +264,16 @@
reader.rendition.themes.select(id); reader.rendition.themes.select(id);
// Apply theme to rest of the page. // Apply theme to rest of the page.
document.getElementById("main").style.backgroundColor = themes[id]["bgColor"]; document.getElementById("main").style.backgroundColor =
document.getElementById("titlebar").style.color = themes[id]["title-color"] || "#fff"; themes[id]["bgColor"];
document.getElementById("progress").style.color = themes[id]["title-color"] || "#fff"; document.getElementById("titlebar").style.color =
themes[id]["title-color"] || "#fff";
document.getElementById("progress").style.color =
themes[id]["title-color"] || "#fff";
} }
// font size settings logic // font size settings logic
let fontSizeFader = document.getElementById('fontSizeFader'); let fontSizeFader = document.getElementById("fontSizeFader");
fontSizeFader.addEventListener("change", function () { fontSizeFader.addEventListener("change", function () {
reader.rendition.themes.fontSize(`${this.value}%`); reader.rendition.themes.fontSize(`${this.value}%`);
}); });
@@ -188,7 +282,7 @@
function selectFont(id) { function selectFont(id) {
if (!defaultFont) { if (!defaultFont) {
defaultFont = reader.rendition.getContents()[0]?.css('font-family'); defaultFont = reader.rendition.getContents()[0]?.css("font-family");
} }
spans = document.getElementById("font").querySelectorAll("span"); spans = document.getElementById("font").querySelectorAll("span");
@@ -197,7 +291,7 @@
} }
document.getElementById(id).querySelector("span").textContent = "✓"; document.getElementById(id).querySelector("span").textContent = "✓";
if (id == 'default') { if (id == "default") {
reader.rendition.themes.font(defaultFont); reader.rendition.themes.font(defaultFont);
return; return;
} }
@@ -210,7 +304,7 @@
spans[i].textContent = ""; spans[i].textContent = "";
} }
document.getElementById(id).querySelector("span").textContent = "✓"; document.getElementById(id).querySelector("span").textContent = "✓";
reader.rendition.spread(id==='spread'?true:'none'); reader.rendition.spread(id === "spread" ? true : "none");
} }
</script> </script>
<script src="{{ url_for('static', filename='js/libs/screenfull.min.js') }}"></script> <script src="{{ url_for('static', filename='js/libs/screenfull.min.js') }}"></script>