mirror of
https://github.com/24eme/signaturepdf.git
synced 2023-08-25 09:33:08 +02:00
Managing page history and title
This commit is contained in:
parent
61fc267e93
commit
253cc31d73
@ -890,6 +890,7 @@ async function getPDFBlobFromCache(cacheUrl) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function uploadFromUrl(url) {
|
async function uploadFromUrl(url) {
|
||||||
|
history.replaceState({}, '', '/signature');
|
||||||
var response = await fetch(url);
|
var response = await fetch(url);
|
||||||
if(response.status != 200) {
|
if(response.status != 200) {
|
||||||
return;
|
return;
|
||||||
@ -909,8 +910,6 @@ async function uploadFromUrl(url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var pageUpload = async function() {
|
var pageUpload = async function() {
|
||||||
history.replaceState({}, "Signature de PDF", "/signature");
|
|
||||||
|
|
||||||
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');
|
||||||
document.getElementById('page-signature').classList.add('d-none');
|
document.getElementById('page-signature').classList.add('d-none');
|
||||||
@ -927,13 +926,14 @@ var pageUpload = async function() {
|
|||||||
let response = new Response(document.getElementById('input_pdf_upload').files[0], { "status" : 200, "statusText" : "OK" });
|
let response = new Response(document.getElementById('input_pdf_upload').files[0], { "status" : 200, "statusText" : "OK" });
|
||||||
let urlPdf = '/pdf/'+filename;
|
let urlPdf = '/pdf/'+filename;
|
||||||
await cache.put(urlPdf, response);
|
await cache.put(urlPdf, response);
|
||||||
|
history.pushState({}, '', '/signature#'+filename);
|
||||||
history.replaceState({}, "Signature de PDF", '/signature#'+filename);
|
|
||||||
pageSignature(urlPdf)
|
pageSignature(urlPdf)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var pageSignature = async function(url) {
|
var pageSignature = async function(url) {
|
||||||
|
let filename = url.replace('/pdf/', '');
|
||||||
|
document.title = filename + ' - ' + document.title;
|
||||||
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 = /[]/;
|
||||||
@ -951,7 +951,6 @@ var pageSignature = async function(url) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let pdfBlob = await getPDFBlobFromCache(url);
|
let pdfBlob = await getPDFBlobFromCache(url);
|
||||||
let filename = url.replace('/pdf/', '');
|
|
||||||
if(!pdfBlob) {
|
if(!pdfBlob) {
|
||||||
document.location = '/signature';
|
document.location = '/signature';
|
||||||
return;
|
return;
|
||||||
@ -976,8 +975,6 @@ var pageSignature = async function(url) {
|
|||||||
pageUpload();
|
pageUpload();
|
||||||
}
|
}
|
||||||
window.addEventListener('hashchange', function() {
|
window.addEventListener('hashchange', function() {
|
||||||
//window.location.href = window.location.href;
|
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
})
|
})
|
||||||
//pageSignature(url);
|
|
||||||
})();
|
})();
|
Loading…
x
Reference in New Issue
Block a user