From 14cf2cbe5b45858b787cae6c8c09d37dbe55760d Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sat, 30 Apr 2016 08:40:21 -0400 Subject: [PATCH] again --- contrib/js/expand-image.js | 2 +- contrib/js/expand-video.js | 8 ++++++-- contrib/static/nntpchan.js | 8 ++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/contrib/js/expand-image.js b/contrib/js/expand-image.js index 0432434..3af3965 100644 --- a/contrib/js/expand-image.js +++ b/contrib/js/expand-image.js @@ -17,7 +17,7 @@ function setupInlineImage(thumb, url) { var expanded = false; var oldurl = img.src; thumb.href = "#"; - thumb.target = ""; + thumb.target = undefined; img.addEventListener("click", function(ev) { if (expanded) { img.setAttribute("class", "thumbnail"); diff --git a/contrib/js/expand-video.js b/contrib/js/expand-video.js index 07b6a0f..a5d44ff 100644 --- a/contrib/js/expand-video.js +++ b/contrib/js/expand-video.js @@ -3,6 +3,10 @@ var configRoot = ""; +if (typeof _ == 'undefined') { + var _ = function(a) { return a; }; +} + function setupVideo(thumb, url) { if (thumb.videoAlreadySetUp) return; thumb.videoAlreadySetUp = true; @@ -208,8 +212,8 @@ function setupVideosIn(element) { if (/(\.webm)|(\.mp4)$/.test(thumbs[i].pathname)) { setupVideo(thumbs[i], thumbs[i].href); } else { - var url = thumbs[i].href - if (/(\.webm)|(\.mp4)$/.test(url)) setupVideo(thumbs[i], url); + var url = thumbs[i].href; + if (/(\.webm)|(\.mp4)$/.test(url)) setupVideo(thumbs[i], url); } } } diff --git a/contrib/static/nntpchan.js b/contrib/static/nntpchan.js index 73d8fd0..84f5ae3 100644 --- a/contrib/static/nntpchan.js +++ b/contrib/static/nntpchan.js @@ -16,9 +16,10 @@ parent.backlink=true;}};parent.backlink=true;} function inject_hover_for_element(elem){var elems=elem.getElementsByClassName("backlink");var ls=[];var l=elems.length;for(var idx=0;idxwindow.innerHeight){window.scrollBy(0,bottom-window.innerHeight);}} thumb.addEventListener("mouseover",function(e){if(false){getVideo();expanded=false;hovering=true;var docRight=document.documentElement.getBoundingClientRect().right;var thumbRight=thumb.querySelector("img, video").getBoundingClientRect().right;var maxWidth=docRight-thumbRight-20;if(maxWidth<250)maxWidth=250;video.style.position="fixed";video.style.right="0px";video.style.top="0px";var docRight=document.documentElement.getBoundingClientRect().right;var thumbRight=thumb.querySelector("img, video").getBoundingClientRect().right;video.style.maxWidth=maxWidth+"px";video.style.maxHeight="100%";video.style.pointerEvents="none";video.style.display="inline";videoHide.style.display="none";videoContainer.style.display="inline";videoContainer.style.position="fixed";video.controls=false;video.play();}},false);thumb.addEventListener("mouseout",unhover,false);thumb.addEventListener("wheel",function(e){if(true){if(e.deltaY>0)volume-=0.1;if(e.deltaY<0)volume+=0.1;if(volume<0)volume=0;if(volume>1)volume=1;if(video!=null){video.muted=(volume==0);video.volume=volume;} e.preventDefault();}},false);} -function setupVideosIn(element){var thumbs=element.querySelectorAll("a.file");for(var i=0;i5){widget.removeChild(widget.children[0]);} nntpchan_buildpost(widget,j);widget.scrollTop=widget.scrollHeight;}