From: clyates Date: Tue, 18 Mar 2014 23:18:28 +0000 (+0000) Subject: Update foundation.interchange.js X-Git-Tag: v5.2.2~92^2~1 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=refs%2Fpull%2F4724%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Update foundation.interchange.js Use regex literal to remove need for regex var New regex tests for an image extension at the end of path --- diff --git a/js/foundation/foundation.interchange.js b/js/foundation/foundation.interchange.js index 0fa88c2cf..623904515 100644 --- a/js/foundation/foundation.interchange.js +++ b/js/foundation/foundation.interchange.js @@ -58,13 +58,10 @@ if (last_path == path) return; - var regex = "/(\.jpg|\.jpeg|\.png|\.gif|\.tiff|\.bmp)$/"; - - if (new RegExp(regex,'i').test(path)){ - - $(el).css('background-image', 'url('+path+')'); - el.data('interchange-last-path', path); - return trigger(path); + if (/\.(jpg|jpeg|png|gif|tiff|bmp)$/i.test(path)) { + $(el).css('background-image', 'url('+path+')'); + el.data('interchange-last-path', path); + return trigger(path); } return $.get(path, function (response) {