Skip to content
Snippets Groups Projects
Commit b47c3448 authored by Rachel Gaubil's avatar Rachel Gaubil
Browse files

[edit] finish previous commit : closes #27

parent c0cbdf53
No related branches found
No related tags found
No related merge requests found
......@@ -26,9 +26,9 @@ def page(bookNb="1", chapName="", pageNb="", visu=""):
chapName = chapter
break
chapUrl += chapName
chapName = chapName.split(".")[0]
else:
chapUrl += chapName + ".htm.j2"
chapName = chapName.split(".")[0]
return render_template('book'+bookNb+'.html.j2', chap=chapUrl, chapName=chapName, pageNb=pageNb, visu=visu)
@app.route('/<vueName>')
......
......@@ -9,23 +9,6 @@ window.onload = function() {
}
function changePath() {
var newPath = this.getCurrentPath();
var visu = document.getElementById("visu").textContent;
var page = document.getElementsByClassName("current-page-text")[0].getAttribute("data-img-id").replace("f", "p");
var chapter = document.getElementById("chapName").textContent;
newPath += "/" + chapter + "/" + page + "/" + visu;
let stateObj = {id: "url"};
window.history.replaceState(stateObj,"", newPath);
}
function getCurrentPath() {
return window.location.pathname.split("/").slice(0, 2).join("/");
}
// Suppress the highlight of verses when clicking anywhere
window.onclick = function() {
var verses = document.getElementsByClassName("highlighted-verses");
......@@ -110,17 +93,6 @@ function prevChap(chapId) {
var tabs = activeTabs();
var chosenVisu = tabs[0] + "_" + tabs[1];
var newPath = window.location.pathname.split("/").slice(0, 2).join("/");
// // ne pas le faire ici mais au clic sur un tab ?
// var pageNb = document.getElementById("pageNb");
// var ancientPath = window.location.pathname.split("/");
// if (ancientPath.length > 2){
// // If page nb
// if (ancientPath[2][0] == "p") {
//
// }
// }
window.location.pathname = newPath + "/" + chapId + "/" + chosenVisu;
}
......@@ -228,6 +200,8 @@ const imageHandler = {
thumbnail.classList.add('current');
imageHandler.display(pos, thumbnail, true);
changePath();
},
display: function(where, thumbnail, scroll) {
......@@ -280,6 +254,7 @@ const imageHandler = {
}
leftThumbnail.classList.add('current');
rightThumbnail.classList.add('current');
changePath();
},
removePageDivColor: function() {
let pageTextDivs = document.querySelectorAll('.current-page-text');
......@@ -318,3 +293,20 @@ const imageHandler = {
}
}
}
// get current path, chapter, page and visu informations to change url
function changePath() {
var newPath = this.getCurrentPath();
var visu = document.getElementById("visu").textContent;
var page = document.getElementsByClassName("current-page-text")[0].getAttribute("data-img-id").replace("f", "p");
var chapter = document.getElementById("chapName").textContent;
newPath += "/" + chapter + "/" + page + "/" + visu;
let stateObj = {id: "url"};
window.history.replaceState(stateObj,"", newPath);
}
// get current path
function getCurrentPath() {
return window.location.pathname.split("/").slice(0, 2).join("/");
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment