From 96e7f24faff9b828f7f065a55ec90cdd6fdae1d8 Mon Sep 17 00:00:00 2001 From: Marko Date: Tue, 5 Jul 2011 09:09:15 -0700 Subject: [PATCH 1/2] updated fileExtension variable to correct the regex to only return the extension when file is in format "foobar.png" (with dot as extension separator) --- source/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/core.js b/source/core.js index fbf56e3..ce33cc2 100644 --- a/source/core.js +++ b/source/core.js @@ -28,7 +28,7 @@ Array.prototype.contains = Array.prototype.contains || function (obj) { var galleryName = /^(light|shadow)box\[(.*?)\]/i, inlineParam = /\s*([a-z_]*?)\s*=\s*(.+)\s*/, - fileExtension = /[0-9a-z]+$/i, + fileExtension = /\.[0-9a-z]+$/i, scriptPath = /(.+\/)shadowbox\.js/i, root = document.documentElement, From 24a2aee1f9a57cd1b7e94dd0691f54e1840115a0 Mon Sep 17 00:00:00 2001 From: Marko Date: Tue, 5 Jul 2011 12:17:57 -0700 Subject: [PATCH 2/2] updated again to correctly fix the regex problem --- source/core.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/core.js b/source/core.js index ce33cc2..1092552 100644 --- a/source/core.js +++ b/source/core.js @@ -28,7 +28,7 @@ Array.prototype.contains = Array.prototype.contains || function (obj) { var galleryName = /^(light|shadow)box\[(.*?)\]/i, inlineParam = /\s*([a-z_]*?)\s*=\s*(.+)\s*/, - fileExtension = /\.[0-9a-z]+$/i, + fileExtension = /\.([0-9a-z]+)(?:[\?#]|$)/i, scriptPath = /(.+\/)shadowbox\.js/i, root = document.documentElement, @@ -826,7 +826,7 @@ S.getPlayer = function(content) { // get file extension var ext, m = content.match(fileExtension); if (m) { - ext = m[0].toLowerCase(); + ext = m[1].toLowerCase(); } if (ext) {