From 399096e21435170201ab85e58a20bfcfa9d4912f Mon Sep 17 00:00:00 2001 From: fschneider Date: Thu, 13 Aug 2015 16:17:19 +0200 Subject: Improvements --- pdf-as-web/src/main/webapp/assets/css/style.css | 44 +++++++++-- .../src/main/webapp/assets/img/signature.png | Bin 1015 -> 2517 bytes pdf-as-web/src/main/webapp/assets/js/dragNdrop.js | 36 +++++++++ .../src/main/webapp/assets/js/pdf.js/web/app.js | 50 ++++++++++-- .../main/webapp/assets/js/pdf.js/web/viewer.css | 1 + .../main/webapp/assets/js/pdf.js/web/viewer.html | 4 +- .../src/main/webapp/assets/js/pdf.js/web/viewer.js | 88 +++++++++++++++------ pdf-as-web/src/main/webapp/index.jsp | 9 ++- 8 files changed, 195 insertions(+), 37 deletions(-) (limited to 'pdf-as-web') diff --git a/pdf-as-web/src/main/webapp/assets/css/style.css b/pdf-as-web/src/main/webapp/assets/css/style.css index f5b31212..fa4ea6d4 100644 --- a/pdf-as-web/src/main/webapp/assets/css/style.css +++ b/pdf-as-web/src/main/webapp/assets/css/style.css @@ -10,10 +10,27 @@ footer { clear: both; } -iframe { - border: none; - min-width:10em; -} + + +@media all and (min-width: 320px) { + + iframe { + border: none; + min-width:5em; + height: 80%; + width:100%; + } + } + + @media all and (max-width: 320px) { + + iframe { + border: none; + min-width:5em; + width: 100%; + height: 40%; + } + } .methodChooseContainer { width: 80px; @@ -41,10 +58,26 @@ iframe { #navBar { margin: 2em; min-width: 25em; + margin-bottom: 0.3em; +} + +#InnerBackBox { + width: 25em; + min-width: 25em; +} + +#BackBox { + margin-left: 1.7em; + width: 2.4em; +} + +#BackBox:hover { + cursor:pointer; + cursor:hand; } #ViewerExternToolbar { - margin-bottom: 1em !important; + margin-bottom: 1em; min-width: 25em; } @@ -107,6 +140,7 @@ iframe { height: 40em; font-size: 150%; margin-bottom: 5em; + width: 100%; } #noSignatureWarning { diff --git a/pdf-as-web/src/main/webapp/assets/img/signature.png b/pdf-as-web/src/main/webapp/assets/img/signature.png index a6a854cc..061aace6 100644 Binary files a/pdf-as-web/src/main/webapp/assets/img/signature.png and b/pdf-as-web/src/main/webapp/assets/img/signature.png differ diff --git a/pdf-as-web/src/main/webapp/assets/js/dragNdrop.js b/pdf-as-web/src/main/webapp/assets/js/dragNdrop.js index dc420ecf..f7310fe8 100644 --- a/pdf-as-web/src/main/webapp/assets/js/dragNdrop.js +++ b/pdf-as-web/src/main/webapp/assets/js/dragNdrop.js @@ -92,6 +92,26 @@ function registerEventListeners() { $("#SignStepButton").click(); }); + $(document).bind("keypress", function(evt) { + + if(evt.which == 13) + { + if($("#UploadStepButton").hasClass("active") && !$("#uploadContinue").prop("disabled")) + { + $("#PlaceStepButton").click(); + } + else if($("#PlaceStepButton").hasClass("active")) + { + $("#SignStepButton").click(); + } + } + else if(evt.which == 8) + { + $("#BackBox").click(); + } + + }); + $("#placeSignatureExtern").bind("click", function(evt) { $("#iFrame").contents().find("#placeSignature").click(); @@ -102,6 +122,22 @@ function registerEventListeners() { $("#iFrame").contents().find("#delSignature").click(); }) + $("#BackBox").bind("click", function(evt) { + + if($("#PlaceStepButton").hasClass("active")) + { + $("#UploadStepButton").click(); + } + else if($("#SignStepButton").hasClass("active")) + { + $("#PlaceStepButton").click(); + } + else if($("#FinishStepButton").hasClass("active")) + { + $("#SignStepButton").click(); + } + }); + function toggleView(input) { console.log("toggleView : " + input); diff --git a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/app.js b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/app.js index af161a14..d44dab43 100644 --- a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/app.js +++ b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/app.js @@ -122,11 +122,6 @@ function displayPdf() { console.log("now finished"); } -/*$("#placeSignatureExtern").bind("click", function(evt) { - console.log("PLACE SIGNATURE EXTERN"); - $("#placeSignature").click(); - -}); */ // //Attaches event handlers to the signature placement icons @@ -194,10 +189,44 @@ function isSignaturePlaced() { //Places signature given by parameter s on the page provided by the page_to_place parameter or on the current page if no such //parameter is provided. If the parameter s is omitted a default signature is placed. // + +var last_left; +var last_top; + function placeSignature(evt, page_to_place, s) { + + //check if properties are already assigned + + // get properties (if assigned) from last placement + + var left_pos; + var top_pos; + + //console.log("last left: " + last_left + " last top: " + last_top); + + if(typeof last_left != 'undefined') + { + //console.log("not undefined"); + left_pos = last_left; + top_pos = last_top; + } + else // otherwise set default position + { + //console.log("first time set left and top"); + left_pos = "30%"; + top_pos = "20%"; + } + + var image_width = "30%"; + var image_height = "9%"; + + var current_scale = PDFViewerApplication.pdfViewer.currentScale; var sig_size = Math.floor(96 * current_scale); - var defaultSignature = "Signature"; + //var image_source = global_status.applicationContext + "/visblock?r=" + sig_size.toString(); + var image_source = '../../../img/signature.png'; + var defaultSignature = "Signature"; if (typeof page_to_place === 'undefined') { page_to_place = PDFView.page;} if (typeof s === 'undefined') { s = defaultSignature} @@ -214,6 +243,10 @@ function placeSignature(evt, page_to_place, s) { }); updateSignaturePosition(global_status.getSignature()); makeSignatureDraggable(global_status.getSignature()); + +//console.log("left: " + $("#img_signature").css("left") + " top: " + $("#img_signature").css("top")); + + } // @@ -243,6 +276,11 @@ function updateSignaturePosition(signature) { var y = thisPos.top; signature.posx = (Math.floor(x / current_scale / (4.0/3.0))).toString(); signature.posy = Math.floor((parseInt(canvas_height) - (thisPos.top)) / current_scale / (4.0/3.0)).toString(); + + //console.log("last x: last y: " + $("#img_signature").css("left") + " " + $("#img_signature").css("top")); + + last_left = $("#img_signature").css("left"); + last_top = $("#img_signature").css("top"); } // diff --git a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.css b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.css index 2eff3912..8cf1a6a4 100644 --- a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.css +++ b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.css @@ -1872,6 +1872,7 @@ html[dir='rtl'] #documentPropertiesOverlay .row > * { overflow: visible; } + #mainContainer, #viewerContainer, .page, .page canvas { position: static; padding: 0; diff --git a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.html b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.html index 6db3039e..ec9fce96 100644 --- a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.html +++ b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.html @@ -233,9 +233,9 @@ http://sourceforge.net/adobe/cmap/wiki/License/