1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-06-26 15:13:17 +00:00

Updated reader settings style

This commit is contained in:
Purbayan Chowdhury 2024-01-05 23:53:46 +05:30
parent bca9d80290
commit bc41b8ad42
No known key found for this signature in database
GPG Key ID: E54E44875F246DCB
4 changed files with 220 additions and 125 deletions

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;
} }
@ -16,7 +15,7 @@ body {
} }
.myselect { .myselect {
overflow: visible !important; overflow: visible !important;
} }
#main { #main {
@ -94,8 +93,12 @@ 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%;
@ -201,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 {
@ -238,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;
@ -379,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 {
@ -500,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;
@ -554,8 +579,14 @@ input:-moz-placeholder { color: #454545; }
height: 320px; height: 320px;
} }
.md-content label {
font-weight: 700;
font-size: 16px;
display: block;
}
.md-content > div { .md-content > div {
padding: 15px 40px 30px; padding: 8px 16px;
margin: 0; margin: 0;
font-weight: 300; font-weight: 300;
font-size: 14px; font-size: 14px;
@ -567,36 +598,6 @@ input:-moz-placeholder { color: #454545; }
font-size: 0.8em; font-size: 0.8em;
} }
.md-content .themes button {
display: inline-block;
border: none;
text-align: center;
text-decoration: none;
margin-top: 5%;
margin-right: 1%;
font-size: 16px;
}
.md-content .themes button.darkTheme {
background-color: #202124;
color: white;
}
.md-content .themes button.whiteTheme {
background-color: white;
color: black;
}
.md-content .themes button.sepiaTheme {
background-color: #ece1ca;
color: black;
}
.md-content .themes button.blackTheme {
background-color: black;
color: white;
}
/* Effect 1: Fade in and scale up */ /* Effect 1: Fade in and scale up */
.md-effect-1 .md-content { .md-effect-1 .md-content {
-webkit-transform: scale(0.7); -webkit-transform: scale(0.7);
@ -713,11 +714,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%;
@ -745,8 +742,8 @@ input:-moz-placeholder { color: #454545; }
} }
#viewer iframe { #viewer iframe {
width: 300px; width: 300px;
height: 480px; height: 480px;
} }
} }
@ -804,25 +801,69 @@ 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";
} /* '' */

View File

@ -1,29 +1,73 @@
.fontSizeWrapper { .fontSizeWrapper {
position: relative; position: relative;
} }
.slider { .slider {
position: absolute; /* position: absolute; */
top: 50%; /* top: 50%; */
transform: translate(0,-50%); /* transform: translate(0, -50%); */
width: 90%; /* width: 90%; */
height: 60px; margin-top: 10px;
background: transparent; background: transparent;
border-radius: 20px; border-radius: 20px;
display: flex; display: flex;
align-items: center; align-items: center;
box-shadow: 0px 15px 40px #7E6D5766; box-shadow: 0px 15px 40px #7e6d5766;
} }
.slider label {
font-size: 20px; /* .slider label {
font-weight: 400; font-size: 20px;
font-family: Open Sans; font-weight: 400;
padding-right: 10px; font-family: Open Sans;
color: white; padding-right: 10px;
color: white;
} */
input[type="checkbox"] {
margin-right: 10px;
} }
.slider input[type="range"] { .slider input[type="range"] {
width: 80%; display: block;
height: 5px; width: 80%;
background: black; height: 5px;
border: none; background: black;
outline: none; border: none;
outline: none;
margin-right: 10px;
}
.button-group {
display: flex;
justify-content: space-around;
margin-top: 10px;
}
.themes button {
display: inline-block;
border: none;
text-align: center;
text-decoration: none;
padding: 0.5rem;
font-size: 16px;
}
.md-content .themes button.darkTheme {
background-color: #202124;
color: white;
}
.md-content .themes button.whiteTheme {
background-color: white;
color: black;
}
.md-content .themes button.sepiaTheme {
background-color: #ece1ca;
color: black;
}
.md-content .themes button.blackTheme {
background-color: black;
color: white;
} }

View File

@ -81,4 +81,8 @@ let reader;
alert(error); alert(error);
}); });
} }
// default settings load
const theme = localStorage.getItem("calibre.reader.theme") ?? "lightTheme";
selectTheme(theme);
})(); })();

View File

@ -76,29 +76,30 @@
<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">
<h3>{{_('Settings')}}</h3> <h3>{{_('Settings')}}</h3>
<div class="themes" id="themes"> <div class="themes form-group" id="themes">
Choose a theme below: <br /> <label>{{ _('Themes') }}</label>
<!-- <small>Choose a theme below:</small> -->
<!-- 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--> <div class="button-group">
<button type="button" id="lightTheme" class="lightTheme" onclick="selectTheme(this.id)"><span <!-- 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-->
id="lightSelected">✓</span>{{_('Light')}}</button> <button type="button" id="lightTheme" class="lightTheme" onclick="selectTheme(this.id)"><span
<button type="button" id="darkTheme" class="darkTheme" onclick="selectTheme(this.id)"><span id="lightSelected">✓</span>{{_('Light')}}</button>
id="darkSelected"> </span>{{_('Dark')}}</button> <button type="button" id="darkTheme" class="darkTheme" onclick="selectTheme(this.id)"><span
<button type="button" id="sepiaTheme" class="sepiaTheme" onclick="selectTheme(this.id)"><span id="darkSelected"> </span>{{_('Dark')}}</button>
id="sepiaSelected"> </span>{{_('Sepia')}}</button> <button type="button" id="sepiaTheme" class="sepiaTheme" onclick="selectTheme(this.id)"><span
<button type="button" id="blackTheme" class="blackTheme" onclick="selectTheme(this.id)"><span id="sepiaSelected"> </span>{{_('Sepia')}}</button>
id="blackSelected"> </span>{{_('Black')}}</button> <button type="button" id="blackTheme" class="blackTheme" onclick="selectTheme(this.id)"><span
id="blackSelected"> </span>{{_('Black')}}</button>
</div>
</div> </div>
<div> <div class="form-group">
<p> <input type="checkbox" id="sidebarReflow" name="sidebarReflow">
<input type="checkbox" id="sidebarReflow" <span>{{_('Reflow text when sidebars are open.')}}</span>
name="sidebarReflow">{{_('Reflow text when sidebars are open.')}}
</p>
</div> </div>
<div class="fontSizeWrapper"> <div class="form-group fontSizeWrapper">
<label for="fader">{{ _('Font Sizes') }}</label>
<div class="slider"> <div class="slider">
<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">
<span id="fontSizeValue">1</span>
</div> </div>
</div> </div>
<div class="closer icon-cancel-circled"></div> <div class="closer icon-cancel-circled"></div>
@ -149,6 +150,9 @@
// Add tick mark to the button corresponding to the currently selected theme // Add tick mark to the button corresponding to the currently selected theme
document.getElementById(id).querySelector("span").textContent = "✓"; document.getElementById(id).querySelector("span").textContent = "✓";
// Saving theme to local storage
localStorage.setItem("calibre.reader.theme", id);
// Apply theme to epubjs iframe // Apply theme to epubjs iframe
reader.rendition.themes.select(id); reader.rendition.themes.select(id);
@ -157,9 +161,11 @@
} }
// font size settings logic // font size settings logic
let fontSizeFader = document.getElementById('fontSizeFader'); const fontSizeFader = document.getElementById('fontSizeFader'),
fontSizeValue = document.getElementById('fontSizeValue');
fontSizeFader.addEventListener("change", function () { fontSizeFader.addEventListener("change", function () {
reader.rendition.themes.fontSize(`${this.value}%`); reader.rendition.themes.fontSize(`${this.value}%`);
fontSizeValue.innerText = `${this.value / 100}`;
}); });
</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>