mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-02 10:55:30 -04:00
Respect base URL
This commit is contained in:
parent
53c3798691
commit
0f3dd51d6b
@ -2,14 +2,13 @@ function showModal(encodedPath, pages, percentage, encodedeTitle, encodedEntryTi
|
||||
const zipPath = decodeURIComponent(encodedPath);
|
||||
const title = decodeURIComponent(encodedeTitle);
|
||||
const entry = decodeURIComponent(encodedEntryTitle);
|
||||
$('#modal button, #modal a').each(function(){
|
||||
$('#modal button, #modal a').each(function() {
|
||||
$(this).removeAttr('hidden');
|
||||
});
|
||||
if (percentage === 0) {
|
||||
$('#continue-btn').attr('hidden', '');
|
||||
$('#unread-btn').attr('hidden', '');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$('#continue-btn').text('Continue from ' + percentage + '%');
|
||||
}
|
||||
if (percentage === 100) {
|
||||
@ -17,7 +16,7 @@ function showModal(encodedPath, pages, percentage, encodedeTitle, encodedEntryTi
|
||||
}
|
||||
|
||||
$('#modal-title-link').text(title);
|
||||
$('#modal-title-link').attr('href', '/book/' + titleID);
|
||||
$('#modal-title-link').attr('href', `${base_url}book/${titleID}`);
|
||||
|
||||
$('#modal-entry-title').find('span').text(entry);
|
||||
$('#modal-entry-title').next().attr('data-id', titleID);
|
||||
@ -29,10 +28,10 @@ function showModal(encodedPath, pages, percentage, encodedeTitle, encodedEntryTi
|
||||
$('#beginning-btn').attr('href', `${base_url}reader/${titleID}/${entryID}/1`);
|
||||
$('#continue-btn').attr('href', `${base_url}reader/${titleID}/${entryID}`);
|
||||
|
||||
$('#read-btn').click(function(){
|
||||
$('#read-btn').click(function() {
|
||||
updateProgress(titleID, entryID, pages);
|
||||
});
|
||||
$('#unread-btn').click(function(){
|
||||
$('#unread-btn').click(function() {
|
||||
updateProgress(titleID, entryID, 0);
|
||||
});
|
||||
|
||||
@ -44,14 +43,15 @@ function showModal(encodedPath, pages, percentage, encodedeTitle, encodedEntryTi
|
||||
|
||||
const updateProgress = (tid, eid, page) => {
|
||||
let url = `${base_url}api/progress/${tid}/${page}`
|
||||
const query = $.param({entry: eid});
|
||||
const query = $.param({
|
||||
entry: eid
|
||||
});
|
||||
if (eid)
|
||||
url += `?${query}`;
|
||||
$.post(url, (data) => {
|
||||
if (data.success) {
|
||||
location.reload();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
error = data.error;
|
||||
alert('danger', error);
|
||||
}
|
||||
@ -69,27 +69,29 @@ const renameSubmit = (name, eid) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const query = $.param({ entry: eid });
|
||||
const query = $.param({
|
||||
entry: eid
|
||||
});
|
||||
let url = `${base_url}api/admin/display_name/${titleId}/${name}`;
|
||||
if (eid)
|
||||
url += `?${query}`;
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
contentType: "application/json",
|
||||
dataType: 'json'
|
||||
})
|
||||
.done(data => {
|
||||
if (data.error) {
|
||||
alert('danger', `Failed to update display name. Error: ${data.error}`);
|
||||
return;
|
||||
}
|
||||
location.reload();
|
||||
})
|
||||
.fail((jqXHR, status) => {
|
||||
alert('danger', `Failed to update display name. Error: [${jqXHR.status}] ${jqXHR.statusText}`);
|
||||
});
|
||||
type: 'POST',
|
||||
url: url,
|
||||
contentType: "application/json",
|
||||
dataType: 'json'
|
||||
})
|
||||
.done(data => {
|
||||
if (data.error) {
|
||||
alert('danger', `Failed to update display name. Error: ${data.error}`);
|
||||
return;
|
||||
}
|
||||
location.reload();
|
||||
})
|
||||
.fail((jqXHR, status) => {
|
||||
alert('danger', `Failed to update display name. Error: [${jqXHR.status}] ${jqXHR.statusText}`);
|
||||
});
|
||||
};
|
||||
|
||||
const edit = (eid) => {
|
||||
@ -102,8 +104,7 @@ const edit = (eid) => {
|
||||
url = item.find('img').attr('data-src');
|
||||
displayName = item.find('.uk-card-title').attr('data-title');
|
||||
$('#title-progress-control').attr('hidden', '');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$('#title-progress-control').removeAttr('hidden');
|
||||
}
|
||||
|
||||
@ -130,7 +131,9 @@ const setupUpload = (eid) => {
|
||||
const upload = $('.upload-field');
|
||||
const bar = $('#upload-progress').get(0);
|
||||
const titleId = upload.attr('data-title-id');
|
||||
const queryObj = {title: titleId};
|
||||
const queryObj = {
|
||||
title: titleId
|
||||
};
|
||||
if (eid)
|
||||
queryObj['entry'] = eid;
|
||||
const query = $.param(queryObj);
|
||||
|
@ -11,7 +11,7 @@
|
||||
<dd>Update <code>config.yml</code> located at: <code><%= Config.current.path %></code></dd>
|
||||
<dt style="font-weight: 500;">Can't see your files yet?</dt>
|
||||
<dd>You must wait <%= Config.current.scan_interval %> minutes for the library scan to complete
|
||||
<% if is_admin %>, or manually re-scan from <a href="/admin">Admin</a><% end %>.</dd>
|
||||
<% if is_admin %>, or manually re-scan from <a href="<%= base_url %>admin">Admin</a><% end %>.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@ -22,16 +22,16 @@
|
||||
<h2>Read your first manga</h2>
|
||||
<p>Once you start reading, Mango will remember where you left off
|
||||
and show your entries here.</p>
|
||||
<a href="/library" class="uk-button uk-button-default">View library</a>
|
||||
<a href="<%= base_url %>library" class="uk-button uk-button-default">View library</a>
|
||||
</div>
|
||||
|
||||
<%- elsif new_user == false && empty_library == false -%>
|
||||
|
||||
<%- if continue_reading.empty? && recently_added.empty? -%>
|
||||
<div class="uk-container uk-text-center">
|
||||
<img src="/img/banner.png" style="max-width: 400px; padding: 0 20px;">
|
||||
<img src="<%= base_url %>img/banner.png" style="max-width: 400px; padding: 0 20px;">
|
||||
<p>A self-hosted manga server and reader</p>
|
||||
<a href="/library" class="uk-button uk-button-default">View library</a>
|
||||
<a href="<%= base_url %>library" class="uk-button uk-button-default">View library</a>
|
||||
</div>
|
||||
<%- end -%>
|
||||
|
||||
@ -78,7 +78,7 @@
|
||||
</div>
|
||||
<%- else -%>
|
||||
<div class="item">
|
||||
<a class="acard" href="/book/<%= ra[:entry].book.id %>">
|
||||
<a class="acard" href="<%= base_url %>book/<%= ra[:entry].book.id %>">
|
||||
<div class="uk-card uk-card-default">
|
||||
<div class="uk-card-media-top">
|
||||
<img data-src="<%= ra[:entry].cover_url %>" data-width data-height alt="" uk-img>
|
||||
@ -126,7 +126,7 @@
|
||||
|
||||
<% content_for "script" do %>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jQuery.dotdotdot/4.0.11/dotdotdot.js"></script>
|
||||
<script src="/js/dots.js"></script>
|
||||
<script src="/js/alert.js"></script>
|
||||
<script src="/js/title.js"></script>
|
||||
<script src="<%= base_url %>js/dots.js"></script>
|
||||
<script src="<%= base_url %>js/alert.js"></script>
|
||||
<script src="<%= base_url %>js/title.js"></script>
|
||||
<% end %>
|
||||
|
Loading…
x
Reference in New Issue
Block a user