//For source code and license information please check https://github.com/majestrate/nntpchan /* ./contrib/js/main.js_ */ onready_callbacks=[];function onready(fnc){onready_callbacks.push(fnc);} function ready(){for(var i=0;i>"+linkhash.substr(0,10)));if(!parent){parent=el.parentNode;} parent.removeChild(el);parent.appendChild(elem);elem.onclick=function(ev){if(parent.backlink){nntpchan_apicall(prefix+"api/find?hash="+linkhash,function(j){var wrapper=document.createElement("div");wrapper.setAttribute("class","hover "+linkhash);if(j==null){wrapper.setAttribute("class","hover notfound-hover "+linkhash);wrapper.appendChild(document.createTextNode("not found"));}else{nntpchan_buildpost(wrapper,j);} parent.appendChild(wrapper);parent.backlink=false;},function(msg){var wrapper=document.createElement("div");wrapper.setAttribute("class","hover "+linkhash);wrapper.appendChild(document.createTextNode(msg));parent.appendChild(wrapper);parent.backlink=false;});}else{var elems=document.getElementsByClassName(linkhash);if(!elems)throw"bad state, no backlinks open?";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;} function inject_postform(prefix,parent){} function inject_livechan_widget(prefix,parent){if("WebSocket"in window){var url="ws://"+document.location.host+prefix+"live";if(document.location.protocol=="https:"){url="wss://"+document.location.host+prefix+"live";} var socket=new WebSocket(url);var progress=function(str){parent.innerHTML="
livechan: "+str+"
";};progress("initialize");socket.onopen=function(){progress("streaming (read only)");} socket.onmessage=function(ev){var j=null;try{j=JSON.parse(ev.data);}catch(e){} if(j){livechan_got_post(parent,j);}} socket.onclose=function(ev){progress("connection closed");setTimeout(function(){inject_livechan_widget(prefix,parent);},1000);}}else{parent.innerHTML="
livechan mode requires websocket support
";setTimeout(function(){parent.innerHTML="";},5000);}} function ukko_livechan(prefix){var ukko=document.getElementById("ukko_threads");if(ukko){ukko.innerHTML="";inject_livechan_widget(prefix,ukko);}} /* ./contrib/js/local_storage.js */ function get_storage(){var st=null;if(window.localStorage){st=window.localStorage;}else if(localStorage){st=localStorage;} return st;} /* ./contrib/js/theme.js */ function enable_theme(prefix,name){if(prefix&&name){var theme=document.getElementById("current_theme");if(theme){theme.href=prefix+"static/"+name+".css";var st=get_storage();st.nntpchan_prefix=prefix;st.nntpchan_theme=name;}}} var st=get_storage();enable_theme(st.nntpchan_prefix,st.nntpchan_theme);