From a389c8b82d051c59b393787927e8d589bf21bb3a Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sun, 1 May 2016 17:56:47 -0400 Subject: [PATCH] make image expansion case insensitive --- contrib/js/expand-image.js | 2 +- contrib/static/nntpchan.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/js/expand-image.js b/contrib/js/expand-image.js index dad5c54..ce3e97b 100644 --- a/contrib/js/expand-image.js +++ b/contrib/js/expand-image.js @@ -6,7 +6,7 @@ // is the filename matching an image? function filenameIsImage(fname) { - return /\.(gif|jpeg|jpg|png|webp)/.test(fname); + return /\.(gif|jpeg|jpg|png|webp)/.test(fname.toLowerCase()); } // setup image inlining for 1 element diff --git a/contrib/static/nntpchan.js b/contrib/static/nntpchan.js index d5118ed..992e110 100644 --- a/contrib/static/nntpchan.js +++ b/contrib/static/nntpchan.js @@ -52,7 +52,7 @@ e.onclick=postit;var f=document.querySelector("form");f.onsubmit=function(){post /* ./contrib/js/banner.js */ var banner_count=3;function nntpchan_inject_banners(elem,prefix){var n=Math.floor(Math.random()*banner_count);var banner=prefix+"static/banner_"+n+".jpg";var e=document.createElement("img");e.src=banner;e.id="nntpchan_banner";elem.appendChild(e);} /* ./contrib/js/expand-image.js */ -function filenameIsImage(fname){return/\.(gif|jpeg|jpg|png|webp)/.test(fname);} +function filenameIsImage(fname){return/\.(gif|jpeg|jpg|png|webp)/.test(fname.toLowerCase());} function setupInlineImage(thumb,url){if(thumb.inlineIsSetUp)return;thumb.inlineIsSetUp=true;var img=thumb.querySelector("img.thumbnail");var expanded=false;var oldurl=img.src;thumb.onclick=function(){if(expanded){img.setAttribute("class","thumbnail");img.src=oldurl;expanded=false;}else{img.setAttribute("class","expanded-thumbnail");img.src=url;expanded=true;} return false;}} function setupInlineImageIn(element){var thumbs=element.querySelectorAll("a.file");for(var i=0;i