Skip to content
Snippets Groups Projects
Commit e85f40ac authored by Chris Hallberg's avatar Chris Hallberg Committed by Robert Lange
Browse files

Lightbox now ignores links that open in new window (target=new).

Used jQuery to simplify attr logic.
parent 4c0796f7
Branches
Tags
No related merge requests found
...@@ -232,10 +232,16 @@ VuFind.register('lightbox', function Lightbox() { ...@@ -232,10 +232,16 @@ VuFind.register('lightbox', function Lightbox() {
* data-lightbox-title = Lightbox title (overrides any title the page provides) * data-lightbox-title = Lightbox title (overrides any title the page provides)
*/ */
_constrainLink = function constrainLink(event) { _constrainLink = function constrainLink(event) {
if (typeof $(this).data('lightboxIgnore') != 'undefined' var $link = $(this);
|| typeof this.attributes.href === 'undefined' if (typeof $link.data("lightboxIgnore") != "undefined"
|| this.attributes.href.value.charAt(0) === '#' || typeof $link.attr("href") === "undefined"
|| this.href.match(/^[a-zA-Z]+:[^/]/) // ignore resource identifiers (mailto:, tel:, etc.) || $link.attr("href").charAt(0) === "#"
|| $link.attr("href").match(/^[a-zA-Z]+:[^/]/) // ignore resource identifiers (mailto:, tel:, etc.)
|| (typeof $link.attr("target") !== "undefined"
&& (
$link.attr("target").toLowerCase() === "_new"
|| $link.attr("target").toLowerCase() === "new"
))
) { ) {
return true; return true;
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment