From 14c0e1d6d7ee464673ff1be0592c1acf372184ad Mon Sep 17 00:00:00 2001 From: Victor Häggqvist Date: Sat, 16 Jan 2016 22:17:44 +0100 Subject: ignore img extenssion by default --- src/LightBox.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/LightBox.js') diff --git a/src/LightBox.js b/src/LightBox.js index e9ab137..2b23d36 100644 --- a/src/LightBox.js +++ b/src/LightBox.js @@ -19,6 +19,7 @@ export default class LightBox { log.debug('HAS_TOUCH '+LightBox.HAS_TOUCH); const defaultOptions = { allowedTypes: 'png|jpg|jpeg|gif', + restrictTypes: false, selectorId: 'imagelightbox', animationSpeed: 350, preloadNext: true, @@ -135,6 +136,8 @@ export default class LightBox { } isTargetValid(element) { + if (this.options.restrictTypes === false) return true; + let validTypes = new RegExp("(\.("+this.options.allowedTypes+")$)"); return element.tagName.toLowerCase() === 'a' && validTypes.test(element.href); -- cgit v1.2.3