Skip to content

Commit 651f49f

Browse files
[bug] Links when hovering book covers in dark theme don't respect X-Script-Name
Fixes #802
1 parent 22c1ed2 commit 651f49f

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

cps/static/js/caliBlur.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ $(function() {
10261026
}
10271027

10281028
if (selectedFormat) {
1029-
window.open('/read/' + bookId + '/' + selectedFormat, '_blank');
1029+
window.open(window.scriptRoot + '/read/' + bookId + '/' + selectedFormat, '_blank');
10301030
} else {
10311031
window.location.href = $link.attr('href');
10321032
}
@@ -1050,7 +1050,7 @@ $(function() {
10501050
var isCurrentlyRead = $readBadge.length > 0;
10511051

10521052
$.ajax({
1053-
url: '/ajax/toggleread/' + bookId,
1053+
url: window.scriptRoot + '/ajax/toggleread/' + bookId,
10541054
type: 'POST',
10551055
headers: {
10561056
'X-Requested-With': 'XMLHttpRequest'
@@ -1154,7 +1154,7 @@ $(function() {
11541154

11551155
// Use /send_selected endpoint but only send to primary email
11561156
$.ajax({
1157-
url: '/send_selected/' + bookId,
1157+
url: window.scriptRoot + '/send_selected/' + bookId,
11581158
type: 'POST',
11591159
headers: {
11601160
'X-Requested-With': 'XMLHttpRequest'
@@ -1215,7 +1215,7 @@ $(function() {
12151215
}
12161216

12171217
// Navigate to the edit page in the same tab
1218-
var editUrl = '/admin/book/' + bookId;
1218+
var editUrl = window.scriptRoot + '/admin/book/' + bookId;
12191219
window.location.href = editUrl;
12201220
}
12211221

cps/templates/layout.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@ <h4 class="modal-title" id="bookDetailsModalLabel">{{_('Book Details')}}</h4>
335335
<script src="{{ url_for('static', filename='js/libs/compromise.min.js') }}"></script>
336336
<script src="{{ url_for('static', filename='js/libs/readmore.min.js') }}"></script>
337337
<script>
338+
// Make script root available for JS
339+
window.scriptRoot = "{{ request.script_root }}";
338340
// Make user email data available for quick actions
339341
window.cwaUserData = {};
340342
{% if current_user.kindle_mail and current_user.kindle_mail.strip() %}

0 commit comments

Comments
 (0)