Skip to content

Commit 4bdc0fd

Browse files
authored
Merge pull request #7344 from dkanada/book-player-layout
2 parents 1686788 + 9af155b commit 4bdc0fd

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

src/plugins/bookPlayer/plugin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export class BookPlayer {
3232
this.type = PluginType.MediaPlayer;
3333
this.id = 'bookplayer';
3434
this.priority = 1;
35+
this.THEMES = THEMES;
3536
if (!userSettings.theme() || userSettings.theme() === 'dark') {
3637
this.theme = 'dark';
3738
} else {

src/plugins/bookPlayer/style.scss

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222

2323
#btnBookplayerToc {
2424
float: left;
25-
margin-left: 2vw;
25+
margin: 0.5vh 0.5vh 0.5vh 2vw;
2626
}
2727

2828
#btnBookplayerExit {
2929
float: right;
30-
margin-right: 2vw;
30+
margin: 0.5vh 2vw 0.5vh 0.5vh;
3131
}
3232

3333
.bookplayerErrorMsg {
@@ -46,13 +46,20 @@
4646
width: fit-content;
4747
max-height: 80%;
4848
max-width: 60%;
49-
padding-right: 50px;
50-
padding-bottom: 15px;
5149

5250
.bookplayerButtonIcon {
5351
color: black;
5452
}
5553

54+
.bookplayerButton {
55+
margin: 0.5vh;
56+
}
57+
58+
.toc {
59+
margin: 0;
60+
padding: 30px;
61+
}
62+
5663
.toc li {
5764
margin-bottom: 5px;
5865

@@ -80,3 +87,10 @@
8087
}
8188
}
8289
}
90+
91+
@media (max-width: 60em) {
92+
#dialogToc {
93+
max-width: 100%;
94+
max-height: 100%;
95+
}
96+
}

src/plugins/bookPlayer/tableOfContents.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import escapeHTML from 'escape-html';
22
import dialogHelper from '../../components/dialogHelper/dialogHelper';
3+
import layoutManager from 'components/layoutManager';
34

45
export default class TableOfContents {
56
constructor(bookPlayer) {
@@ -57,7 +58,7 @@ export default class TableOfContents {
5758

5859
// remove parent directory reference from href to fix certain books
5960
const link = chapter.href.startsWith('../') ? chapter.href.slice(3) : chapter.href;
60-
itemHtml += `<a href="${escapeHTML(book.path.directory + link)}">${escapeHTML(chapter.label)}</a>`;
61+
itemHtml += `<a style="color: ${layoutManager.mobile ? this.bookPlayer.THEMES[this.bookPlayer.theme].body.color : 'inherit'}" href="${escapeHTML(book.path.directory + link)}">${escapeHTML(chapter.label)}</a>`;
6162

6263
if (chapter.subitems?.length) {
6364
const subHtml = chapter.subitems
@@ -85,7 +86,7 @@ export default class TableOfContents {
8586
let tocHtml = '<div class="topRightActionButtons">';
8687
tocHtml += '<button is="paper-icon-button-light" class="autoSize bookplayerButton btnBookplayerTocClose hide-mouse-idle-tv" tabindex="-1"><span class="material-icons bookplayerButtonIcon close" aria-hidden="true"></span></button>';
8788
tocHtml += '</div>';
88-
tocHtml += '<ul class="toc">';
89+
tocHtml += `<ul style="background-color: ${layoutManager.mobile ? this.bookPlayer.THEMES[this.bookPlayer.theme].body.background : 'inherit'}" class="toc">`;
8990
rendition.book.navigation.forEach((chapter) => {
9091
tocHtml += this.chapterTocItem(rendition.book, chapter);
9192
});

0 commit comments

Comments
 (0)