1
0
mirror of https://github.com/24eme/signaturepdf.git synced 2023-08-25 09:33:08 +02:00

location modal hash remove when modal is hidden

This commit is contained in:
Vincent LAURENT 2022-04-01 14:52:30 +02:00
parent 85d9250d1b
commit 621e8b8145

View File

@ -934,6 +934,26 @@ async function uploadFromUrl(url) {
document.getElementById('input_pdf_upload').dispatchEvent(new Event("change")); document.getElementById('input_pdf_upload').dispatchEvent(new Event("change"));
} }
var modalSharing = function() {
if(window.location.hash == '#informations') {
let modalInformationsEl = document.getElementById('modal-share-informations');
let modalInformations = bootstrap.Modal.getOrCreateInstance(modalInformationsEl);
modalInformations.show();
modalInformationsEl.addEventListener('hidden.bs.modal', function (event) {
history.pushState({}, '', window.location.href.replace(/#.*$/, ''));
})
}
if(window.location.hash == '#signed') {
let modalSignedEl = document.getElementById('modal-signed');
let modalSigned = bootstrap.Modal.getOrCreateInstance(modalSignedEl);
modalSigned.show();
modalSignedEl.addEventListener('hidden.bs.modal', function (event) {
history.pushState({}, '', window.location.href.replace(/#.*$/, ''));
})
}
}
var pageUpload = async function() { var pageUpload = async function() {
document.getElementById('input_pdf_upload').value = ''; document.getElementById('input_pdf_upload').value = '';
document.getElementById('page-upload').classList.remove('d-none'); document.getElementById('page-upload').classList.remove('d-none');
@ -957,17 +977,7 @@ var pageUpload = async function() {
} }
var pageSignature = async function(url) { var pageSignature = async function(url) {
modalSharing();
if(window.location.hash == '#informations') {
let modalInformations = new bootstrap.Modal(document.getElementById('modal-share-informations'));
modalInformations.show();
}
if(window.location.hash == '#signed') {
let modalSigned = new bootstrap.Modal(document.getElementById('modal-signed'));
modalSigned.show();
}
document.getElementById('page-upload').classList.add('d-none'); document.getElementById('page-upload').classList.add('d-none');
document.getElementById('page-signature').classList.remove('d-none'); document.getElementById('page-signature').classList.remove('d-none');
fabric.Textbox.prototype._wordJoiners = /[]/; fabric.Textbox.prototype._wordJoiners = /[]/;
@ -1018,6 +1028,9 @@ var pageSignature = async function(url) {
(function () { (function () {
if(hash) { if(hash) {
pageSignature('/signature/'+hash+'/pdf'); pageSignature('/signature/'+hash+'/pdf');
window.addEventListener('hashchange', function() {
window.location.reload();
})
return; return;
} }