Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix several basepath issues #103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions files_reader/templates/cbreader.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
<title>
<?php p($title);?>
</title>
<link rel="shortcut icon" href="img/book.png">
<link rel="stylesheet" href="vendor/icomoon/style.css?v=<?php p($version) ?>">
<link rel="stylesheet" href="vendor/cbrjs/css/cbr.css?v=<?php p($version) ?>">
<link rel="shortcut icon" href="<?php p($urlGenerator->linkTo('files_reader', 'img/book.png')) ?>">
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('files_reader', 'vendor/icomoon/style.css')) ?>?v=<?php p($version) ?>">
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('files_reader', 'vendor/cbrjs/css/cbr.css')) ?>?v=<?php p($version) ?>">
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'js/lib/Blob.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/libs/jquery.min.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/sindresorhus/screenfull.js')) ?>?v=<?php p($version) ?>"> </script>
Expand Down Expand Up @@ -109,7 +109,9 @@
<!-- /toolbar -->

<!-- loading overlay -->
<div id="cbr-loading-overlay" class="cbr-control control overlay" name="loadingOverlay" style="display:none"></div>
<div id="cbr-loading-overlay" class="cbr-control control overlay" name="loadingOverlay" style="display:none">
<img src="<?php p($urlGenerator->linkTo('files_reader', 'img/loading.gif')) ?>">
</div>
<!-- /loading overlay -->

<!-- busy overlay -->
Expand Down
8 changes: 4 additions & 4 deletions files_reader/templates/epubreader.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<title>
<?php p($title);?>
</title>
<link rel="shortcut icon" href="img/book.png">
<link rel="shortcut icon" href="<?php p($urlGenerator->linkTo('files_reader', 'img/book.png')) ?>">
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('files_reader', 'vendor/icomoon/style.css')) ?>?v=<?php p($version) ?>">
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/css/main.css')) ?>?v=<?php p($version) ?>">
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/css/sidebar.css')) ?>?v=<?php p($version) ?>">
Expand Down Expand Up @@ -155,7 +155,7 @@
<div class="control-group">
<input type="checkbox" id="use_custom_colors" name="use_custom_colors">
<label for="use_custom_colors">
Use custom colors
Use custom colors
</label>
<div class="center-box">
<input type="color" id="day_color" value="#0a0a0a">
Expand Down Expand Up @@ -209,7 +209,7 @@
<div class="control-group">
<input type="checkbox" id="touch_nav" name="touch_nav">
<label for="touch_nav">
disable extra-wide page turn areas
disable extra-wide page turn areas
</label>
</div>
<div class="control-group">
Expand Down Expand Up @@ -283,7 +283,7 @@
</div>
</div>
<div id="loader">
<img src="img/loading.gif">
<img src="<?php p($urlGenerator->linkTo('files_reader', 'img/loading.gif')) ?>">
</div>

<!-- /navigation + viewer -->
Expand Down
8 changes: 4 additions & 4 deletions files_reader/templates/pdfreader.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<title>
<?php p($title);?>
</title>
<link rel="shortcut icon" href="img/book.png">
<link rel="shortcut icon" href="<?php p($urlGenerator->linkTo('files_reader', 'img/book.png')) ?>">
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('files_reader', 'vendor/icomoon/style.css')) ?>?v=<?php p($version) ?>">
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('files_reader', 'vendor/pdfjs/css/main.css')) ?>?v=<?php p($version) ?>">
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('files_reader', 'vendor/pdfjs/css/sidebar.css')) ?>?v=<?php p($version) ?>">
Expand Down Expand Up @@ -113,7 +113,7 @@
<ul id="outline" class="outline">
</ul>
</div>

<!-- currently not used
<div id="notesView" class="notes-view view">
<div>
Expand Down Expand Up @@ -183,7 +183,7 @@
<div class="control-group">
<input type="checkbox" id="touch_nav" name="touch_nav">
<label for="touch_nav">
disable extra-wide page turn areas
disable extra-wide page turn areas
</label>
</div>
<div class="control-group">
Expand Down Expand Up @@ -310,7 +310,7 @@
</div>
</div>
<div id="loader">
<img src="img/loading.gif">
<img src="<?php p($urlGenerator->linkTo('files_reader', 'img/loading.gif')) ?>">
</div>

<!-- /navigation + viewer -->
Expand Down
24 changes: 11 additions & 13 deletions files_reader/vendor/cbrjs/cbr.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ CBRJS.Reader = function(bookPath, _options) {
}

xhr.open('GET',url, true);

options.start(filename);

xhr.responseType = "arraybuffer";
Expand All @@ -70,10 +70,10 @@ CBRJS.Reader = function(bookPath, _options) {
reader.options.session.size = e.total;
};

xhr.onload = function () {
xhr.onload = function () {
if ((this.status === 200) && this.response) {
var done = false;
var ua = new bitjs.archive[archive_class](this.response, 'vendor/bitjs/');
var ua = new bitjs.archive[archive_class](this.response, document.head.dataset.basepath + 'vendor/bitjs/');

ua.addEventListener(bitjs.archive.UnarchiveEvent.Type.START, function (e) {
$progressbar.css('width', '0%');
Expand Down Expand Up @@ -120,9 +120,9 @@ CBRJS.Reader = function(bookPath, _options) {
$('.icon-unarchive').removeClass('active');
$('.icon-unarchive').addClass('error');
$('#message').text('Failed to extract images from archive, file corrupted?');

});
}
}

ua.start();
};
Expand Down Expand Up @@ -261,7 +261,7 @@ ComicBook = (function ($) {
thumbnails: true, // true / false (use thumbnails in index)
thumbnailWidth: 200, // width of thumbnail
sidebarWide: false, // use wide sidbar
currentPage: 0, // current page
currentPage: 0, // current page
keyboard: {
32: 'next', // space
34: 'next', // page-down
Expand All @@ -276,7 +276,7 @@ ComicBook = (function ($) {
70: 'toggleFullscreen', // f
27: 'closeSidebar' // esc
},
vendorPath: 'vendor/',
vendorPath: document.head.dataset.basepath + 'vendor/',
forward_buffer: 3,
session: {
getCursor: function() {},
Expand Down Expand Up @@ -442,7 +442,7 @@ ComicBook = (function ($) {
break;
default:
console.log("unknown enhancement: " + JSON.stringify(prop));
}
}
}
};

Expand Down Expand Up @@ -570,15 +570,15 @@ ComicBook = (function ($) {
};

/**
* Insert thumbnail into TOC
* Insert thumbnail into TOC
*/
ComicBook.prototype.tocInsert = function (image, page, replace) {
var placeholder = toc.children[page].firstChild;
if (replace === true) {
placeholder.parentNode.replaceChild(
self.getThumb(image),
placeholder
);
);
}

toc.children[page].addEventListener('click', function (e) {
Expand Down Expand Up @@ -1407,7 +1407,7 @@ ComicBook = (function ($) {
page = options.currentPage;
}

document.getElementById('toc').parentNode.scrollTop =
document.getElementById('toc').parentNode.scrollTop =
document.getElementById('page-' + String(page + 1)).offsetTop
- Math.floor($('.panels').height() * 1.5);
};
Expand Down Expand Up @@ -1474,5 +1474,3 @@ ComicBook = (function ($) {
}

})(window, jQuery);


8 changes: 7 additions & 1 deletion files_reader/vendor/cbrjs/css/cbr.css
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,13 @@ body:not(.mobile) .navigate:hover {

#cbr-loading-overlay {
z-index: 100;
background: #000 url("img/loading.gif") no-repeat center;
padding: 0;
width: 20px;
height: 20px;
}

#cbr-loading-overlay > img {
width: 100%;
}

.overlay {
Expand Down