[Pkg-javascript-commits] [pdf.js] 11/72: Add option to open external links in new window

David Prévot taffit at moszumanska.debian.org
Wed Mar 18 20:15:55 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit d271811740d4ac51186b207ca0017ae7f5de9260
Author: Mike Lyons <mike at dropbox.com>
Date:   Thu Feb 26 13:26:41 2015 -0500

    Add option to open external links in new window
---
 src/display/annotation_helper.js | 3 +++
 src/display/api.js               | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/src/display/annotation_helper.js b/src/display/annotation_helper.js
index 3236176..a64ee35 100644
--- a/src/display/annotation_helper.js
+++ b/src/display/annotation_helper.js
@@ -217,6 +217,9 @@ var AnnotationUtils = (function AnnotationUtilsClosure() {
 
     var link = document.createElement('a');
     link.href = link.title = item.url || '';
+    if (item.url && PDFJS.openExternalLinksInNewWindow) {
+      link.target = '_blank';
+    }
 
     container.appendChild(link);
 
diff --git a/src/display/api.js b/src/display/api.js
index 547fe6d..7cd8c57 100644
--- a/src/display/api.js
+++ b/src/display/api.js
@@ -161,6 +161,15 @@ PDFJS.maxCanvasPixels = (PDFJS.maxCanvasPixels === undefined ?
                          16777216 : PDFJS.maxCanvasPixels);
 
 /**
+ * Opens external links in a new window if enabled. The default behavior opens
+ * external links in the PDF.js window.
+ * @var {boolean}
+ */
+PDFJS.openExternalLinksInNewWindow = (
+  PDFJS.openExternalLinksInNewWindow === undefined ?
+    false : PDFJS.openExternalLinksInNewWindow);
+
+/**
  * Document initialization / loading parameters object.
  *
  * @typedef {Object} DocumentInitParameters

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list