aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web
diff options
context:
space:
mode:
authorfschneider <florian.schneider@student.tugraz.at>2015-08-13 16:17:19 +0200
committerfschneider <florian.schneider@student.tugraz.at>2015-08-13 16:17:19 +0200
commit399096e21435170201ab85e58a20bfcfa9d4912f (patch)
tree90bafbe98708ce80b3f4c472c6c8c86dc36b8abe /pdf-as-web
parentb5413b1ba040b558cc2cc5fdaa810d409e0620af (diff)
downloadpdf-as-4-399096e21435170201ab85e58a20bfcfa9d4912f.tar.gz
pdf-as-4-399096e21435170201ab85e58a20bfcfa9d4912f.tar.bz2
pdf-as-4-399096e21435170201ab85e58a20bfcfa9d4912f.zip
Improvements
Diffstat (limited to 'pdf-as-web')
-rw-r--r--pdf-as-web/src/main/webapp/assets/css/style.css44
-rw-r--r--pdf-as-web/src/main/webapp/assets/img/signature.pngbin1015 -> 2517 bytes
-rw-r--r--pdf-as-web/src/main/webapp/assets/js/dragNdrop.js36
-rw-r--r--pdf-as-web/src/main/webapp/assets/js/pdf.js/web/app.js50
-rw-r--r--pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.css1
-rw-r--r--pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.html4
-rw-r--r--pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.js88
-rw-r--r--pdf-as-web/src/main/webapp/index.jsp9
8 files changed, 195 insertions, 37 deletions
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
--- a/pdf-as-web/src/main/webapp/assets/img/signature.png
+++ b/pdf-as-web/src/main/webapp/assets/img/signature.png
Binary files 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 = "<img src='" + global_status.applicationContext + "/visblock?r=" + sig_size.toString() + "' alt='Signature' id='img_signature' class='cl_signature' draggable='true' style='position: absolute; z-index:4; cursor:move'>";
+ //var image_source = global_status.applicationContext + "/visblock?r=" + sig_size.toString();
+ var image_source = '../../../img/signature.png';
+ var defaultSignature = "<img src='" + image_source + "' alt='Signature' id='img_signature' class='cl_signature' draggable='true' style='position: absolute; z-index:4; " +
+ "cursor:move; left:" + left_pos + "; top:" + top_pos + "; width:" + image_width + "; height:" + image_height + ";'>";
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/
</div>
<span id="scaleSelectContainer" class="dropdownToolbarButton">
<select id="scaleSelect" title="Zoom" tabindex="23" data-l10n-id="zoom">
- <option id="pageAutoOption" title="" value="auto" selected="selected" data-l10n-id="page_scale_auto">Automatic Zoom</option>
+ <option id="pageAutoOption" title="" value="auto" data-l10n-id="page_scale_auto">Automatic Zoom</option>
<option id="pageActualOption" title="" value="page-actual" data-l10n-id="page_scale_actual">Actual Size</option>
- <option id="pageFitOption" title="" value="page-fit" data-l10n-id="page_scale_fit">Fit Page</option>
+ <option id="pageFitOption" title="" value="page-fit" selected="selected" data-l10n-id="page_scale_fit">Fit Page</option>
<option id="pageWidthOption" title="" value="page-width" data-l10n-id="page_scale_width">Full Width</option>
<option id="customScaleOption" title="" value="custom"></option>
<option title="" value="0.5" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 50 }'>50%</option>
diff --git a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.js b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.js
index f31d5dc5..e5563ba5 100644
--- a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.js
+++ b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.js
@@ -52,6 +52,47 @@ var MAX_AUTO_SCALE = 1.25;
var SCROLLBAR_PADDING = 40;
var VERTICAL_PADDING = 5;
+
+// preventing from using arrow keys or page keys to scroll
+$(document).on('keypress', function(e) {
+ switch(e.which)
+ {
+ case 48: // 0
+ case 49:
+ case 50:
+ case 51:
+ case 52:
+ case 53:
+ case 54:
+ case 55:
+ case 56:
+ case 57: // 9
+ case 220: // backslash
+ case 27: // escape
+ case 13: // enter
+ break;
+
+ default:
+ e.preventDefault();
+ break;
+ }
+});
+
+// handles the replacement of the signature (used when page changes)
+function replaceSignature()
+{
+ var previous_left = $("#img_signature").prop("left");
+ var previous_top = $("#img_signature").prop("top");
+
+ // place it new
+ $("#placeSignature").click();
+
+ // reapply the props
+
+ $("#img_signature").prop("left", previous_left);
+ $("#img_signature").prop("top", previous_top);
+}
+
// optimised CSS custom property getter/setter
var CustomStyle = (function CustomStyleClosure() {
@@ -189,7 +230,6 @@ function watchScroll(viewAreaElement, callback) {
rAF = null;
var currentY = viewAreaElement.scrollTop;
- console.log("currentY: " + currentY);
var lastY = state.lastY;
if (currentY !== lastY) {
state.down = currentY > lastY;
@@ -198,7 +238,9 @@ function watchScroll(viewAreaElement, callback) {
state.lastY = currentY;
// place the signature again on current page
+
$("#placeSignature").click();
+
callback(state);
});
@@ -399,7 +441,7 @@ var ProgressBar = (function ProgressBarClosure() {
setWidth: function ProgressBar_setWidth(viewer) {
if (viewer) {
var container = viewer.parentNode;
- var scrollbarWidth = 0; //container.offsetWidth - viewer.offsetWidth;
+ var scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
if (scrollbarWidth > 0) {
this.bar.setAttribute('style', 'width: calc(100% - ' +
scrollbarWidth + 'px);');
@@ -728,7 +770,7 @@ Preferences._readFromStorage = function (prefObj) {
window.addEventListener('beforeprint', stopPropagationIfNeeded, false);
window.addEventListener('afterprint', stopPropagationIfNeeded, false);
}
-})();
+})();
@@ -2229,7 +2271,7 @@ var GrabToPan = (function GrabToPanClosure() {
// a grab operation, to ensure that the cursor has the desired appearance.
var overlay = this.overlay = document.createElement('div');
overlay.className = 'grab-to-pan-grabbing';
- }
+ }
GrabToPan.prototype = {
/**
* Class name of element which can be grabbed
@@ -2566,11 +2608,11 @@ var OverlayManager = {
* @private
*/
_keyDown: function overlayManager_keyDown(evt) {
- var self = OverlayManager;
+ /* var self = OverlayManager;
if (self.active && evt.keyCode === 27) { // Esc key.
self._closeThroughCaller();
evt.preventDefault();
- }
+ } */
},
/**
@@ -4601,7 +4643,6 @@ var PDFViewer = (function pdfViewer() {
},
_updateLocation: function (firstPage) {
- console.log("update location");
var currentScale = this._currentScale;
var currentScaleValue = this._currentScaleValue;
var normalizedScaleValue =
@@ -4620,8 +4661,6 @@ var PDFViewer = (function pdfViewer() {
var intTop = Math.round(topLeft[1]);
pdfOpenParams += ',' + intLeft + ',' + intTop;
- console.log("stats: " + topLeft +" "+ intLeft +" "+ intTop);
-
this.location = {
pageNumber: pageNumber,
scale: normalizedScaleValue,
@@ -7330,18 +7369,19 @@ window.addEventListener('keydown', function keydown(evt) {
PDFViewerApplication.currentScaleValue !== 'page-fit') {
break;
}
- /* in presentation mode */
- /* falls through */
+
+ // in presentation mode
+ // falls through
case 37: // left arrow
// horizontal scrolling using arrow keys
if (PDFViewerApplication.pdfViewer.isHorizontalScrollbarEnabled) {
break;
- }
- /* falls through */
+ }
+ // falls through
case 75: // 'k'
case 80: // 'p'
PDFViewerApplication.page--;
- handled = true;
+ handled = true;
break;
case 27: // esc key
if (SecondaryToolbar.opened) {
@@ -7352,8 +7392,8 @@ window.addEventListener('keydown', function keydown(evt) {
PDFViewerApplication.findBar.opened) {
PDFViewerApplication.findBar.close();
handled = true;
- }
- break;
+ }
+
case 40: // down arrow
case 34: // pg down
case 32: // spacebar
@@ -7361,24 +7401,26 @@ window.addEventListener('keydown', function keydown(evt) {
PDFViewerApplication.currentScaleValue !== 'page-fit') {
break;
}
- /* falls through */
+
+ // falls through
case 39: // right arrow
// horizontal scrolling using arrow keys
if (PDFViewerApplication.pdfViewer.isHorizontalScrollbarEnabled) {
break;
- }
- /* falls through */
+ }
+
+ // falls through
case 74: // 'j'
case 78: // 'n'
- PDFViewerApplication.page++;
- handled = true;
+ PDFViewerApplication.page++;
+ handled = true;
break;
case 36: // home
if (PresentationMode.active || PDFViewerApplication.page > 1) {
PDFViewerApplication.page = 1;
handled = true;
- }
+ }
break;
case 35: // end
if (PresentationMode.active || (PDFViewerApplication.pdfDocument &&
@@ -7455,7 +7497,7 @@ window.addEventListener('keydown', function keydown(evt) {
evt.preventDefault();
PDFViewerApplication.clearMouseScrollState();
}
-});
+});
window.addEventListener('beforeprint', function beforePrint(evt) {
PDFViewerApplication.beforePrint();
diff --git a/pdf-as-web/src/main/webapp/index.jsp b/pdf-as-web/src/main/webapp/index.jsp
index 492e9d28..7c8d9569 100644
--- a/pdf-as-web/src/main/webapp/index.jsp
+++ b/pdf-as-web/src/main/webapp/index.jsp
@@ -119,6 +119,11 @@
</ul>
</div>
</div>
+ <div class="center" id="OuterBackBox">
+ <div id="InnerBackBox">
+ <p id="BackBox">Back</p>
+ </div>
+ </div>
<!-- Main Switch Frame -->
@@ -171,9 +176,11 @@
</div>
</div>
</div>
- <div id="content" class="center">
+ <div id="outerCenter" class="center">
+ <div id="content" class="">
Loading your PDF, please wait...
</div>
+ </div>
</div>
<div id="SignContainer" style="display: none;">