diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 8e075ec0..a88b96c2 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -1532,7 +1532,9 @@ var thegrid = (function () { return true; var oth = ebi(this.getAttribute('ref')), + href = this.getAttribute('href'), aplay = ebi('a' + oth.getAttribute('id')), + is_img = /\.(gif|jpe?g|png|webp)(\?|$)/i.test(href), td = oth.closest('td').nextSibling, tr = td.parentNode; @@ -1543,11 +1545,11 @@ var thegrid = (function () { else if (widget.is_open && aplay) aplay.click(); - else if (QS('#files tr.sel')) - window.open(this.getAttribute('href'), '_blank'); + else if (!is_img && QS('#files tr.sel')) + window.open(href, '_blank'); else return true; - return ev(e); + ev(e); } r.loadsel = function () { diff --git a/copyparty/web/util.js b/copyparty/web/util.js index fafa01d5..92eb14a5 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -67,6 +67,9 @@ function ev(e) { if (e.stopPropagation) e.stopPropagation(); + if (e.stopImmediatePropagation) + e.stopImmediatePropagation(); + e.returnValue = false; return e; } @@ -360,11 +363,11 @@ function get_vpath() { function get_pwd() { - var pwd = ('; ' + document.cookie).split('; cppwd='); - if (pwd.length < 2) - return null; + var pwd = ('; ' + document.cookie).split('; cppwd='); + if (pwd.length < 2) + return null; - return pwd[1].split(';')[0]; + return pwd[1].split(';')[0]; }