instant-0chan/lib/javascript/kusaba.new.js

2 lines
118 KiB
JavaScript

"use strict";var style_cookie,style_cookie_txt,style_cookie_site,ispage,_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},kumod_set=!1,is_entering=!1,_messages={en:{noLocalStorage:"Your browser does not support LocalStorage",oops:"Something went wrong...",blankResponse:"blank response",expandingThread:"Expanding thread...",newThread:"new thread",NewThread:"New thread",replyTo:"reply to",cancel:"Cancel",update:"Update",updatingCounts:"Updating...",couldntFetch:"Could not fetch this post",noNewPosts:"No new posts",replies:"Replies",settings_fxEnabled:"Animation effects",settings_showReplies:"Show replies inside posts",settings_sfwMode:"NSFW mode",settings_expandImgFull:"Expand images to full size",settings_constrainWidth:"Constrain content width",enterCaptcha:"Please enter captcha.",selectText:"Select some text",dcls:"Double click to show source",watchOn:"Watch on",captcharot:"Captcha has rotted",threadUpdationAutomatically:"Tread is being updated automatically.",stopFuckingDolls:"<b>\u041E\u0442\u043A\u043B\u044E\u0447\u0438\u0442\u0435 AJAX-\u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0443 \u043F\u043E\u0441\u0442\u043E\u0432 \u0438 AJAX-\u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u0442\u0440\u0435\u0434\u0430.</b><br />(\u041A\u043B\u0438\u043A\u043D\u0438\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u0437\u0430\u043A\u0440\u044B\u0442\u044C)",del:"Delete",delandban:"Delete and ban",ban:"Ban",stickthread:"Stick thread",unstickthread:"Unstick thread",lockthread:"Lock thread",unlockthread:"Unlock thread",returnDesktop:"Switch to desktop interface",returnTouch:"Switch to touch interface",forceDesktop:"Force Desktop interface",okay:"Okay",captchalang:"Captcha language",reply:"Reply",imageDownscaledBy:"Image was downscaled by",videoDownscaledBy:"Video was downscaled by",toFit:"to feet screen",newReplies:"New replies",newThreadsAvailable:"New threads available.",loading:"Loading",anonymous:"Anonymous",sortBy:"Sort by",bumpOrder:"Bump order",lastReply:"Last reply",creationDate:"Creation date",replyCount:"Reply count",doStick:"Respect stickied",showHidden:"Show hidden",doNotStick:"Ignore stickied",hideHidden:"Hide hidden",search:"Search",threadOnPage:"Thread is on page",goToThread:"Go to thread",smallPics:"Small pictures",largePics:"Large pictures",legacyMode:"Legacy mode",threads:"Threads",comments:"Replies",active_since:"Active since",last_active:"Last seen",active_on:"Active on",tryAgain:"Try again",xhrError:"XHR error",details:"details",thread:"Thread",post:"Post",posts:"Posts",deleted:"has been deleted",deletedMulti:"have been deleted",report:"Report",reported:"has been reported",reportedMulti:"have been reported",fileRemoved:"File<br>removed.",file:"File",files:"Files",collapse:"Collapse",asMod:"as Mod",historyEmpty:"History is empty",noDataLoaded:"No data was loaded",unable_load_20:"Unable to load 2.0 boards list",captchaLangChanged:"Captcha laguage changed",found:"Found",links:"Links",selectMultiple:"Select multiple",selected:"Selected",directLink:"Direct link",quoteLink:"Quote link"},ru:{noLocalStorage:"localStorage \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043E\u043C",oops:"\u0427\u0442\u043E-\u0442\u043E \u043F\u043E\u0448\u043B\u043E \u043D\u0435 \u0442\u0430\u043A...",blankResponse:"\u043F\u0443\u0441\u0442\u043E\u0439 \u043E\u0442\u0432\u0435\u0442",expandingThread:"\u0420\u0430\u0437\u0432\u043E\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043C \u0442\u0440\u0435\u0434...",newThread:"\u043D\u043E\u0432\u044B\u0439 \u0442\u0440\u0435\u0434",NewThread:"\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u0442\u0440\u0435\u0434",replyTo:"\u043E\u0442\u0432\u0435\u0442 \u043D\u0430",cancel:"\u041E\u0442\u043C\u0435\u043D\u0430",update:"\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C",updatingCounts:"\u0418\u0449\u0435\u043C \u043D\u043E\u0432\u044B\u0435 \u043F\u043E\u0441\u0442\u044B...",couldntFetch:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u044D\u0442\u043E\u0442 \u043F\u043E\u0441\u0442",noNewPosts:"\u041D\u0435\u0442 \u043D\u043E\u0432\u044B\u0445 \u043F\u043E\u0441\u0442\u043E\u0432",replies:"\u041E\u0442\u0432\u0435\u0442\u044B",settings_fxEnabled:"\u0410\u043D\u0438\u043C\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u044D\u0444\u0444\u0435\u043A\u0442\u044B",settings_showReplies:"\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u043E\u0442\u0432\u0435\u0442\u044B \u0432\u043D\u0443\u0442\u0440\u0438 \u043F\u043E\u0441\u0442\u0430",settings_sfwMode:"\u041C\u0430\u043C\u043A\u0430 \u0432 \u043A\u043E\u043C\u043D\u0430\u0442\u0435",settings_expandImgFull:"\u0420\u0430\u0437\u0432\u043E\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044C \u043A\u0430\u0440\u0442\u0438\u043D\u043A\u0438 \u0434\u043E \u0438\u0441\u0445\u043E\u0434\u043D\u043E\u0433\u043E \u0440\u0430\u0437\u043C\u0435\u0440\u0430",settings_constrainWidth:"\u041E\u0433\u0440\u0430\u043D\u0438\u0447\u0438\u0432\u0430\u0442\u044C \u0448\u0438\u0440\u0438\u043D\u0443 \u043A\u043E\u043D\u0442\u0435\u043D\u0442\u0430",enterCaptcha:"\u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u0430\u043F\u0447\u0443.",selectText:"\u0422\u0435\u043A\u0441\u0442 \u043D\u0435 \u0432\u044B\u0434\u0435\u043B\u0435\u043D",dcls:"Double click to show source",watchOn:"\u0421\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u043D\u0430",odc:"javascript:LatexIT.replaceWithSrc(this);",captcharot:"\u041A\u0430\u043F\u0447\u0430 \u043F\u0440\u043E\u0442\u0443\u0445\u043B\u0430",threadUpdationAutomatically:"\u0422\u0440\u0435\u0434 \u043E\u0431\u043D\u043E\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438",stopFuckingDolls:"<b>\u041E\u0442\u043A\u043B\u044E\u0447\u0438\u0442\u0435 AJAX-\u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0443 \u043F\u043E\u0441\u0442\u043E\u0432 \u0438 AJAX-\u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u0442\u0440\u0435\u0434\u0430.</b><br />(\u041A\u043B\u0438\u043A\u043D\u0438\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u0437\u0430\u043A\u0440\u044B\u0442\u044C)",del:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C",delandban:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0438 \u0437\u0430\u0431\u0430\u043D\u0438\u0442\u044C",ban:"\u0417\u0430\u0431\u0430\u043D\u0438\u0442\u044C",stickthread:"\u041F\u0440\u0438\u043A\u0440\u0435\u043F\u0438\u0442\u044C \u0442\u0440\u0435\u0434",unstickthread:"\u041E\u0442\u043B\u0435\u043F\u0438\u0442\u044C \u0442\u0440\u0435\u0434",lockthread:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u0442\u0440\u0435\u0434",unlockthread:"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0442\u0440\u0435\u0434",returnDesktop:"\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C\u0441\u044F \u043D\u0430 \u0434\u0435\u0441\u043A\u0442\u043E\u043F\u043D\u044B\u0439 \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441",returnTouch:"\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C\u0441\u044F \u043D\u0430 \u0442\u0430\u0447-\u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441",forceDesktop:"Force Desktop interface",okay:"\u042F\u0441\u043D\u043E",captchalang:"\u042F\u0437\u044B\u043A \u043A\u0430\u043F\u0447\u0438",reply:"\u041E\u0442\u0432\u0435\u0442\u0438\u0442\u044C",imageDownscaledBy:"\u041A\u0430\u0440\u0442\u0438\u043D\u043A\u0430 \u0443\u0436\u0430\u0442\u0430 \u043D\u0430",videoDownscaledBy:"\u0412\u0438\u0434\u0435\u043E \u0443\u0436\u0430\u0442\u043E \u043D\u0430",toFit:"\u043F\u043E \u0440\u0430\u0437\u043C\u0435\u0440\u0443 \u043E\u043A\u043D\u0430",newReplies:"\u041D\u043E\u0432\u044B\u0445 \u043E\u0442\u0432\u0435\u0442\u043E\u0432",newThreadsAvailable:"\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u044B \u043D\u043E\u0432\u044B\u0435 \u0442\u0440\u0435\u0434\u044B.",loading:"\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043C",anonymous:"\u0410\u043D\u043E\u043D\u0438\u043C",sortBy:"\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u043E",bumpOrder:"\u0431\u0430\u043C\u043F\u0430\u043C",lastReply:"\u0434\u0430\u0442\u0435 \u043E\u0442\u0432\u0435\u0442\u043E\u0432",creationDate:"\u0434\u0430\u0442\u0435 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F",replyCount:"\u0447\u0438\u0441\u043B\u0443 \u043E\u0442\u0432\u0435\u0442\u043E\u0432",doStick:"\u041F\u0440\u0438\u043A\u0440\u0435\u043F\u043B\u044F\u0442\u044C",showHidden:"\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u0441\u043A\u0440\u044B\u0442\u044B\u0435",doNotStick:"\u041D\u0435 \u043F\u0440\u0438\u043A\u0440\u0435\u043F\u043B\u044F\u0442\u044C",hideHidden:"\u0421\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u0441\u043A\u0440\u044B\u0442\u044B\u0435",search:"\u041F\u043E\u0438\u0441\u043A",threadOnPage:"\u0422\u0440\u0435\u0434 \u0440\u0430\u0441\u043F\u043E\u043B\u0430\u0433\u0430\u0435\u0442\u0441\u044F \u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435",goToThread:"\u041F\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u0442\u0440\u0435\u0434",smallPics:"\u041C\u0435\u043B\u043A\u0438\u0435 \u043A\u0430\u0440\u0442\u0438\u043D\u043A\u0438",largePics:"\u0411\u043E\u043B\u044C\u0448\u0438\u0435 \u043A\u0430\u0440\u0442\u0438\u043D\u043A\u0438",legacyMode:"\u041E\u043B\u0434\u0444\u0430\u0436\u043D\u044B\u0439 \u0440\u0435\u0436\u0438\u043C",threads:"\u0422\u0440\u0435\u0434\u043E\u0432",comments:"\u041E\u0442\u0432\u0435\u0442\u043E\u0432",active_since:"\u041F\u0440\u0438\u0441\u043E\u0435\u0434\u0438\u043D\u0438\u043B\u0441\u044F",last_active:"\u0411\u044B\u043B \u0430\u043A\u0442\u0438\u0432\u0435\u043D",active_on:"\u0410\u043A\u0442\u0438\u0432\u0435\u043D \u043D\u0430",tryAgain:"\u041F\u043E\u043F\u0440\u043E\u0431\u043E\u0432\u0430\u0442\u044C \u0441\u043D\u043E\u0432\u0430",xhrError:"\u041E\u0448\u0438\u0431\u043A\u0430 XHR",details:"\u043F\u043E\u0434\u0440\u043E\u0431\u043D\u043E\u0441\u0442\u0438",thread:"\u0422\u0440\u0435\u0434",post:"\u041F\u043E\u0441\u0442",posts:"\u041F\u043E\u0441\u0442\u044B",deleted:"\u0443\u0434\u0430\u043B\u0435\u043D",deletedMulti:"\u0443\u0434\u0430\u043B\u0435\u043D\u044B",report:"\u041F\u043E\u0436\u0430\u043B\u043E\u0432\u0430\u0442\u044C\u0441\u044F",reported:": \u0436\u0430\u043B\u043E\u0431\u0430 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0430",reportedMulti:": \u0436\u0430\u043B\u043E\u0431\u044B \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u044B",fileRemoved:"\u0424\u0430\u0439\u043B<br>\u0443\u0434\u0430\u043B\u0435\u043D.",file:"\u0424\u0430\u0439\u043B",files:"\u0424\u0430\u0439\u043B\u044B",collapse:"\u0421\u0432\u0435\u0440\u043D\u0443\u0442\u044C",asMod:"\u043E\u0442 \u043B\u0438\u0446\u0430 \u043C\u043E\u0434\u0435\u0440\u0430\u0442\u043E\u0440\u0430",historyEmpty:"\u0418\u0441\u0442\u043E\u0440\u0438\u044F \u043F\u0443\u0441\u0442\u0430",noDataLoaded:"\u0414\u0430\u043D\u043D\u044B\u0435 \u043D\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u044B",unable_load_20:"Unable to load 2.0 boards list",captchaLangChanged:"\u042F\u0437\u044B\u043A \u043A\u0430\u043F\u0447\u0438 \u0438\u0437\u043C\u0435\u043D\u0435\u043D",found:"\u041D\u0430\u0439\u0434\u0435\u043D\u043E",links:"\u0421\u0441\u044B\u043B\u043A\u0438",selectMultiple:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E",selected:"\u0412\u044B\u0431\u0440\u0430\u043D\u043E",directLink:"\u041F\u0440\u044F\u043C\u0430\u044F \u0441\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u043F\u043E\u0441\u0442",quoteLink:"\u0421\u0441\u044B\u043B\u043A\u0430 \u0434\u043B\u044F \u0446\u0438\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F"}},_l="undefined"!=typeof locale&&_messages.hasOwnProperty(locale)?_messages[locale]:_messages.ru;Array.prototype.indexOf||(Array.prototype.indexOf=function(elt){var len=this.length,from=+arguments[1]||0;for(from=0>from?Math.ceil(from):Math.floor(from),0>from&&(from+=len);from<len;from++)if(from in this&&this[from]===elt)return from;return-1});var Utf8={encode:function encode(string){var _StringfromCharCode=String.fromCharCode;string=string.replace(/\r\n/g,"\n");for(var c,utftext="",n=0;n<string.length;n++)c=string.charCodeAt(n),128>c?utftext+=_StringfromCharCode(c):127<c&&2048>c?(utftext+=_StringfromCharCode(192|c>>6),utftext+=_StringfromCharCode(128|63&c)):(utftext+=_StringfromCharCode(224|c>>12),utftext+=_StringfromCharCode(128|63&c>>6),utftext+=_StringfromCharCode(128|63&c));return utftext},decode:function decode(utftext){for(var _StringfromCharCode2=String.fromCharCode,string="",i=0,c=0,c2=0,c3=0;i<utftext.length;)c=utftext.charCodeAt(i),128>c?(string+=_StringfromCharCode2(c),i++):191<c&&224>c?(c2=utftext.charCodeAt(i+1),string+=_StringfromCharCode2((31&c)<<6|63&c2),i+=2):(c2=utftext.charCodeAt(i+1),c3=utftext.charCodeAt(i+2),string+=_StringfromCharCode2((15&c)<<12|(63&c2)<<6|63&c3),i+=3);return string}};function Cookie(name){if(1==arguments.length){var regexp=new RegExp("(^|;\\s+)"+name+"=(.*?)(;|$)"),hit=regexp.exec(document.cookie);return hit&&2<hit.length?Utf8.decode(unescape(replaceAll(hit[2],"+","%20"))):""}var value=arguments[1],days=arguments[2],expires="";if(days){var date=new Date;date.setTime(date.getTime()+1e3*(60*(60*(24*days)))),expires="; expires="+date.toGMTString()}document.cookie=name+"="+value+expires+"; path=/"}function replaceAll(str,from,to){for(var idx=str.indexOf(from);-1<idx;)str=str.replace(from,to),idx=str.indexOf(from);return str}function insert(text){var textarea=($("#postclone").length&&"none"!==$("#postclone").css("display")?$("#postclone"):$("#postform")).find("textarea")[0];if(textarea){if(textarea.createTextRange&&textarea.caretPos){var caretPos=textarea.caretPos;caretPos.text=" "==caretPos.text.charAt(caretPos.text.length-1)?text+" ":text}else if(textarea.setSelectionRange){var start=textarea.selectionStart,end=textarea.selectionEnd;textarea.value=textarea.value.substr(0,start)+text+textarea.value.substr(end),textarea.setSelectionRange(start+text.length,start+text.length)}else textarea.value+=text+" ";textarea.focus()}return"none"===$("#postclone").css("display")&&void 0}function markup($target,start,end,istart,iend){var element=$target.find("textarea").get(0);if(element.selectionStart||"0"==element.selectionStart){element.focus();var startPos=element.selectionStart,endPos=element.selectionEnd,selected=element.value.substring(startPos,endPos);-1===selected.indexOf("\n")&&"undefined"!=typeof istart&&"undefined"!=typeof iend&&(start=istart,end=iend),element.value=element.value.substring(0,startPos)+start+element.value.substring(startPos,endPos)+end+element.value.substring(endPos,element.value.length)}else element.value+=start+end}function bullets($target,bullet,istart,iend){var $area=$target.find("textarea"),element=$area.get(0),startPos=element.selectionStart,endPos=element.selectionEnd,selected=$area.val().substring(startPos,endPos);if(-1===selected.indexOf("\n")&&"undefined"!=typeof istart&&"undefined"!=typeof iend)element.value=element.value.substring(0,startPos)+istart+element.value.substring(startPos,endPos)+iend+element.value.substring(endPos,element.value.length);else{selected=$area.val().substring(startPos,endPos).split("\n");for(var newtxt="",i=0;i<selected.length;i++)newtxt+=bullet+selected[i],i<selected.length-1&&(newtxt+="\n");$area.val($area.val().substring(0,startPos)+newtxt+$area.val().substring(endPos))}}function quote(b,a){var v=eval("document."+a+".message");v.value+=">>"+b+"\n",v.focus()}function checkhighlight(){var match;(match=/#i([0-9]+)/.exec(document.location.toString()))&&!$("#postform textarea").val()&&insert(">>"+match[1]),(match=/#([0-9]+)/.exec(document.location.toString()))&&highlight(match[1])}function highlight(id){var offTimeout=1<arguments.length&&arguments[1]!==void 0?arguments[1]:5e3;$(".highlight").removeClass("highlight");var $post=$("#delform a[name=\""+id+"\"]").parents(".reply, .op"),post=$post[0];if(!post)return!1;$post.addClass("highlight"),offTimeout&&setTimeout(function(){return $post.removeClass("highlight")},offTimeout);var bcr=post.getBoundingClientRect(),docHeight=document.documentElement.clientHeight;if(bcr.bottom>docHeight||0>bcr.top){var postX=bcr.top+document.documentElement.scrollTop,spaceAround=docHeight-bcr.height;window.scrollTo(0,postX-(spaceAround?Math.ceil(spaceAround/2):0))}return!0}function get_password(name){var pass=getCookie(name);return pass?pass:(pass=randomString(8),Cookie(name,pass,365),pass)}function togglePassword(){var passwordbox_html=$("#passwordbox").html().toLowerCase(),newhtml="<td></td><td></td>";return passwordbox_html==newhtml&&(newhtml="<td class=\"postblock\">Mod</td><td><input type=\"text\" name=\"modpassword\" size=\"28\" maxlength=\"75\">&nbsp;<acronym title=\"Display staff status (Mod/Admin)\">D</acronym>:&nbsp;<input type=\"checkbox\" name=\"displaystaffstatus\" checked>&nbsp;<acronym title=\"Lock\">L</acronym>:&nbsp;<input type=\"checkbox\" name=\"lockonpost\">&nbsp;&nbsp;<acronym title=\"Sticky\">S</acronym>:&nbsp;<input type=\"checkbox\" name=\"stickyonpost\">&nbsp;&nbsp;<acronym title=\"Raw HTML\">RH</acronym>:&nbsp;<input type=\"checkbox\" name=\"rawhtml\">&nbsp;&nbsp;<acronym title=\"Name\">N</acronym>:&nbsp;<input type=\"checkbox\" name=\"usestaffname\"></td>"),$("#passwordbox").html(newhtml).show(),!1}function getCookie(name){return Cookie(name)}function set_cookie(name,value,days){return Cookie(name,value,days)}var Styles={all:[],titles:[],init:function init(){_.each(document.getElementsByTagName("link"),function(link){-1!=link.getAttribute("rel").indexOf("style")&&link.getAttribute("title")&&(this.all.push(link),this.titles.push(link.getAttribute("title")),-1===link.getAttribute("rel").indexOf("alternate")&&(this._default=link.getAttribute("title")),link.hasAttribute("data-custom")&&(this.custom=link.getAttribute("title")))},this),this.current=this._default;var customBypass=getCookie("bypasscustom");this.customBypass=!!(customBypass.length&&"undefined"!=typeof this_board_dir&&in_array(this_board_dir,customBypass.split("|"))),this.initiated=!0},decide:function decide(){this.init();var testingCSS=LSfetchJSON("testing-css");if(testingCSS){var title=this.addStyle(testingCSS.url,testingCSS.title);this.setStyle(title);var $clink=$("<a href=\"#\">\u041E\u0442\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0442\u0435\u0441\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 "+title+".css</a>");return $clink.click(function(ev){ev.preventDefault(),Styles.quitTest(),$(this).parent().slideUp()}),void(this.$cancelLink=$("<div style=\"font-weight: bold\"></div>").append($clink))}if(this.hasOwnProperty("custom")&&!this.customBypass)return this.setCustom();var sc=getCookie(style_cookie);sc&&in_array(sc,this.titles)?this.setStyle(sc):(this.setDefault(),set_cookie("kustyle_site",this._default,365),set_cookie("kustyle",this._default,365))},change:function change(stylename){in_array(stylename,this.titles)&&this.current!==stylename&&(this.setStyle(stylename),this.hasOwnProperty("custom")&&this.custom===stylename?this.removeBypass():(this.hasOwnProperty("custom")&&this.addBypass(),set_cookie("kustyle_site",stylename,365),set_cookie("kustyle",stylename,365)))},removeBypass:function removeBypass(){if(this.customBypass&&"undefined"!=typeof this_board_dir){this.customBypass=!1;var oldcookie=getCookie("bypasscustom").split("|"),newcookie=[];_.each(oldcookie,function(brd){brd!==this_board_dir&&newcookie.push(brd)}),newcookie=newcookie.length?newcookie.join("|"):"",set_cookie("bypasscustom",newcookie,365)}},addBypass:function addBypass(){if(!(this.customBypass||"undefined"==typeof this_board_dir)){this.customBypass=!0;var cookie=getCookie("bypasscustom").split("|");in_array(this_board_dir,cookie)||(cookie.push(this_board_dir),set_cookie("bypasscustom",cookie.join("|"),365))}},setDefault:function setDefault(){this.hasOwnProperty("_default")&&this.current!==this._default&&this.setStyle(this._default)},setCustom:function setCustom(){this.hasOwnProperty("custom")&&this.setStyle(this.custom)},setStyle:function setStyle(stylename){in_array(stylename,this.titles)&&(scrollAnchor&&scrollAnchor.save&&scrollAnchor.save("setstyle",".postnode",window,"v"),_.each(this.all,function(sheet){sheet.disabled=!0,sheet.getAttribute("title")===stylename&&(sheet.disabled=!1)}),scrollAnchor&&scrollAnchor.restore&&scrollAnchor.restore("setstyle"),this.current=stylename)},onTest:null,addStyle:function addStyle(url){var title=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"";if(!title){var m=/(?:.+\/)?(.+)\.css/i.exec(url);if(!m)return;title=m[1]}if(title=_.capitalize(_.escape(title)),!in_array(title,this.titles)){var $link=$("<link rel=\"stylesheet\" type=\"text/css\" href=\""+url+"\" title=\""+title+"\" disabled>");$("head").append($link),this.titles.push(title),this.all.push($link[0])}return title},testStyle:function testStyle(url,title){title=this.addStyle(url,title),this.setStyle(title),this.onTest={url:url,title:title},pups.succ("\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D \u0441\u0442\u0438\u043B\u044C "+title+".\n <div class=\"styletest-form\">\n <button onclick=\"Styles.confirmLongTermTest()\">OK</button>\n <button onclick=\"Styles.quitTest()\">"+_l.cancel+"</button>\n </div>",{time:0,save:!0})},confirmLongTermTest:function confirmLongTermTest(){this.onTest&&localStorage.setItem("testing-css",JSON.stringify(this.onTest))},quitTest:function quitTest(){localStorage.removeItem("testing-css"),this.decide()}};style_cookie&&Styles.decide();var HiddenThreads={list:function(){if(null==localStorage)return pups.err(_l.noLocalStorage),[];var list=localStorage.getItem("hiddenThreads."+this_board_dir);return null==list?[]:list.split(",")},isHidden:function isHidden(threadid){return-1!=HiddenThreads.list().indexOf(threadid)},hide:function hide(threadid){if(null==localStorage)pups.err(_l.noLocalStorage);else{var newlist=HiddenThreads.list();newlist.push(threadid.toString()),localStorage.setItem("hiddenThreads."+this_board_dir,newlist.join(","))}},unhide:function unhide(threadid){if(null==localStorage)pups.err(_l.noLocalStorage);else{var list=HiddenThreads.list(),i=list.indexOf(threadid.toString());if(-1==i)return;var newlist=list.slice(0,i);newlist=newlist.concat(list.slice(i+1)),localStorage.setItem("hiddenThreads."+this_board_dir,newlist.join(","))}}};function togglethread(threadid){return HiddenThreads.isHidden(threadid)?($("#unhidethread"+threadid+this_board_dir).slideUp(),$("#thread"+threadid+this_board_dir).slideDown(),HiddenThreads.unhide(threadid)):($("#unhidethread"+threadid+this_board_dir).slideDown(),$("#thread"+threadid+this_board_dir).slideUp(),HiddenThreads.hide(threadid)),!1}function toggleblotter(){$(".blotter-entries").each(function(){$(this).slideToggle(function(){$(this).is(":hidden")?Cookie("ku_showblotter","0",365):Cookie("ku_showblotter","1",365)})})}function hideblotter(){$(".blotter-entries").each(function(){$(this).hide()})}function expandthread(threadid,board,ev){ev.preventDefault();var $thread=$("#thread"+threadid+board);if($thread.length){var expandFrom=+$thread.find(".postnode.op").find("input[type=checkbox]").val(),expandTo=+$thread.find(".postnode:not(.op):first").find("input[type=checkbox]").val(),$omitted=$thread.find(".omittedposts");$omitted.find("a").hide();var $msg=$omitted.find("span");$msg.length||($msg=$("<div class=\"spinner\"></div><span>"+_l.loading+"...</span>").prependTo($omitted)),HTMLoader.getThread(board,+threadid,[expandFrom,expandTo],function(err,posts){posts?($thread.find(".omittedposts").replaceWith(posts),replyMap.showReplies()):($msg.text(_l.oops+(!1===err?"":" ("+err+")")),$omitted.find("a").text(_l.tryAgain).show())})}return!1}var newposts={busy:!1,get:function get(){var options=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};if(options=_.defaults(options,{threadid:null,expectedPost:null,silent:!1,onError:function onError(err){return pups.err("Error geting new posts ("+err+")")},onSuccess:null,timestamp:null}),!options.threadid){if(ispage)return options.onError();options.threadid=+$("input[name=replythread]").val()}return this.pushTask(options),!1},execute:function execute(task){var _this2=this;this.busy=!0;var threadid=+task.threadid,expectedPost=task.expectedPost,onError=function(err){_this2.next(),task.onError(err)},replies_container=void 0,$newposts_get=void 0;if(!ispage)$newposts_get=$("#newposts_get"),$newposts_get.removeClass("upd-counting").addClass("upd-updating"),replies_container=document.querySelector(".replies");else if(replies_container=document.querySelector("#thread"+threadid+this_board_dir+" .replies"),!replies_container)return onError("No replies container!");if(expectedPost&&highlight(expectedPost))return $newposts_get.removeClass("upd-updating"),void this.next();var $lastQrl=$(".qrl[data-parent=\""+threadid+"\"]").last(),lastpost=+($lastQrl.data("postnum")||$lastQrl.data("parent"));return lastpost?void HTMLoader.getThread(this_board_dir,threadid,[lastpost,1/0],function(err,posts){return ispage||$newposts_get.removeClass("upd-updating"),posts?(replies_container.insertAdjacentHTML("beforeend",posts),replyMap.showReplies(),unreadCounter.refreshTimestamp(task.timestamp||null),task.onSuccess&&task.onSuccess()):!task.silent&&pups.info(""===posts?_l.noNewPosts:_l.oops+(!1===err?"":" ("+err+")"),{time:1}),expectedPost&&!highlight(expectedPost)?onError("No target reply!"):void _this2.next()},!1,!0):onError()},pushTask:function pushTask(task){this.busy?this.stack.push(task):this.execute(task)},next:function(){var next=this.stack.shift();next?this.execute(next):this.busy=!1},stack:[]};function quickreply(){var _Mathround=Math.round,externalBoard=$(this).data("boardname");externalBoard===this_board_dir&&(externalBoard=!1);var parent=$(this).data("parent"),current=$(this).data("postnum")||parent,preferUnpinned=!!+localStorage.pinForm,appearsNew="none"===$("#postclone").css("display");return $("#postclone").show(),isTouch||(preferUnpinned?$("#postclone").css({top:$(this).offset().top+$(this).height(),left:_Mathround($(window).width()/2-$("#postclone").width()/2),position:"absolute"}):appearsNew&&$("#postclone").css({top:$(this).offset().top+$(this).height()-$(document).scrollTop(),left:_Mathround($(window).width()/2-$("#postclone").width()/2),position:"fixed"})),$("#postclone input[name=\"replythread\"]").val(parent),externalBoard?($("#postclone input[name=\"board\"]").val(externalBoard),$("#postclone .posttypeindicator").html("<a href=\""+ku_boardspath+"/"+externalBoard+"/res/"+parent+".html?i#"+current+"\"> &gt;&gt;/"+externalBoard+"/"+parent+"</a>")):$("#postclone .posttypeindicator").html("<a class=\"xlink\" href=\"#"+current+"\"> &gt;&gt;"+parent+"</a>"),insert(">>"+current+"\n"),!1}function popupMessage(content){var delay=1<arguments.length&&arguments[1]!==void 0?arguments[1]:1e3;pups.info(content,{time:delay/1e3}),console.warn("popupMessage() is deprecated. Please use YOBA alerts instead.")}var Captcha={init:function init(){var _this3=this;$(".captchawrap").click(function(ev){return _this3.refresh(ev.ctrlKey||ev.altKey)}),injector.inject("captcha-rotting",".cw-running .rotting-indicator {\n -webkit-animation-duration: "+captchaTimeout+"s;\n -o-animation-duration: "+captchaTimeout+"s;\n animation-duration: "+captchaTimeout+"s;\n }\n .cw-running .captchaimage,\n .cw-running .rotten-msg {\n -webkit-animation-delay: "+captchaTimeout+"s;\n -o-animation-delay: "+captchaTimeout+"s;\n animation-delay: "+captchaTimeout+"s;}"),$(".captchaimage").on("animationend webkitAnimationEnd msAnimationEnd",function(){_this3.shownOnce=!1,$("input[name=captcha]").val("")})},refresh:function refresh(){var switch_lang=!!(0<arguments.length&&arguments[0]!==void 0)&&arguments[0];if($(".captchawrap").length){this.shownOnce=!0;var cColor=$(".captchawrap").css("color").match(/([0-9]+(?:\.[0-9]+)?)/g);cColor=3<=cColor.length?"&color="+cColor.slice(0,3).join(","):"",$(".captchaimage").attr("src",ku_boardspath+"/captcha.php?"+Math.random()+cColor+(switch_lang?"&switch":"")),$(".captchawrap").removeClass("cw-initial cw-running").each(function(){void this.offsetWidth}).addClass("cw-running"),Array.prototype.forEach.call(document.querySelectorAll("input[name=\"captcha\"]"),function(input){return input.value=null})}},refreshOnce:function refreshOnce(){return this.shownOnce||this.refresh(),!1},shownOnce:!1},Ajax={submitPost:function submitPost(form){var _this4=this,alertsToRemove=_.clone(this.shownErrors);setTimeout(function(){alertsToRemove.forEach(function(a){pups.closeByID(a)})},300),this.shownErrors=[];var showError=function(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};return _this4.shownErrors.push(pups.err(a,b))},captchafield=form.querySelector("input[name=captcha]");if(captchafield&&!captchafield.value.length)return showError(_l.enterCaptcha);if(0<+$(".rotten-msg").css("opacity"))return showError(_l.captcharot);"postclone"===form.id&&ffdata.save(),form.classList.add("form-sending");var fd=new FormData(form),xr=new XMLHttpRequest;fd.append("AJAX",1),this.postToken=randomString(),fd.append("token",this.postToken),xr.open("POST",form.action),xr.onload=function(){if(form.classList.remove("form-sending"),200!==xr.status)return void showError(_l.xhrError);[].forEach.call(form.querySelectorAll(".error-in-attachment"),function(el){return el.classList.remove("error-in-attachment")}),Captcha.refresh();var res=null;try{res=JSON.parse(xr.response)}catch(e){return showError(_l.xhrError),void console.error("Malformed response (JSON expected):",xr.response)}if(res.error){if(res.error_verbose&&(res.error=res.error+"<br>"+res.error_verbose),!res.error_type)showError(res.error,{time:0});else if("ban"==res.error_type&&showError(res.error+" (<a href=\""+ku_cgipath+"/banned.php\" target=\"_blank\">"+_l.details+"</a>)",{time:0,save:!0}),"duplicate_file"==res.error_type&&(showError(res.error,{time:0}),form.querySelector("input[name=\"imagefile\"]").value=null),"upload_error"==res.error_type){showError(res.error,{time:0});var badatt=form.querySelector(".multiembedwrap[data-pos=\""+res.error_data.attachmenttype+"-"+(res.error_data.position+1)+"\"]");badatt&&badatt.classList.add("error-in-attachment")}return}resetForm(form),"postclone"==form.id&&$(form).hide();var noko=form.querySelector("input[name=\"redirecttothread\"]").checked;0==res.thread_replyto?noko?document.location.href=ku_boardspath+"/"+res.board+"/res/"+res.post_id+".html":document.location.href=ku_boardspath+"/"+res.board:newposts.get({threadid:ispage?res.thread_replyto:null,expectedPost:+res.post_id,onError:function onError(err){console.error(err),document.location.href=ku_boardspath+"/"+res.board+"/res/"+res.thread_replyto+".html#"+res.post_id,ispage||document.location.reload()},onSuccess:function onSuccess(){return $("#delform div[id^=thread"+res.thread_replyto+"] .fresh-replies").remove()}})},xr.send(fd)},shownErrors:[],reportPost:function reportPost(fd){var callback=1<arguments.length&&arguments[1]!==void 0?arguments[1]:null,xr=new XMLHttpRequest;fd.append("AJAX",1),fd.append("reportpost",1),xr.open("POST",document.forms.delform.action),xr.onload=function(){if(200!==xr.status)return pups.err(_l.xhrError),callback(!1);var res=null;try{res=JSON.parse(xr.response)}catch(e){return pups.err(_l.xhrError),console.error("Malformed response (JSON expected):",xr.response),callback(!1)}if(callback&&callback(res.data),res.error)return res.error_verbose&&(res.error=res.error+"<br>"+res.error_verbose),void pups.err(res.error,{time:0});$("body").removeClass("select-multiple"),$(".userdelete").removeClass("ud-active");var postsReported=[],postErrors=[];res.data.forEach(function(item){return item.success?void(postsReported.push(item.id),!$("input[name=\"post[]\"]:checked").length&&$(".userdelete").removeClass("ud-active")):void postErrors.push(item)});var msg="";postsReported.length&&(postsReported=postsReported.map(function(post){return"#"+post}),msg+=1<postsReported.length?_l.posts+" "+postsReported.join(", ")+" "+_l.reportedMulti+".":_l.post+" "+postsReported[0]+" "+_l.reported+".",pups.succ(msg,{time:2+postsReported.length})),postErrors.forEach(function(err){pups.err(_l.post+" #"+err.id+": "+err.message)})},xr.send(fd)},modThread:function modThread(a,action){var $a=$(a),fd=new FormData,xr=new XMLHttpRequest,$li=$a.find("li");$li.addClass("spin-around"),fd.append("AJAX",1),xr.open("POST",a.getAttribute("href")),xr.onload=function(){if($li.removeClass("spin-around"),200!==xr.status)return void pups.err(_l.xhrError);var res=null;try{res=JSON.parse(xr.response)}catch(e){return pups.err(_l.xhrError),void console.error("Malformed response (JSON expected):",xr.response)}if(res.error)return res.error_verbose&&(res.error=res.error+"<br>"+res.error_verbose),void pups.err(res.error,{time:0});var $posthead=$a.parents(".posthead"),$extrabtns=$posthead.find(".extrabtns");"stickypost"==action&&($extrabtns.prepend(makeIcon("pin","i-icon i-pin")),$posthead.addClass("thread-stickied")),"unstickypost"==action&&($extrabtns.find("svg.i-icon.i-pin").remove(),$posthead.removeClass("thread-stickied")),"lockpost"==action&&($extrabtns.prepend(makeIcon("lock","i-icon i-lock")),$posthead.addClass("thread-locked")),"unlockpost"==action&&($extrabtns.find("svg.i-icon.i-lock").remove(),$posthead.removeClass("thread-locked")),pups.succ(res.message)},xr.send(fd)},deleteItems:function deleteItems(fd){var callback=1<arguments.length&&arguments[1]!==void 0?arguments[1]:null,kind="Items";if(!fd.has)fd.append("deletepost",1);else if(fd.has("post[]"))fd.has("delete-file[]")||(kind="Posts"),fd.append("deletepost",1);else if(fd.has("delete-file[]"))kind="Files";else return;var xr=new XMLHttpRequest;fd.append("AJAX",1),this.delToken=randomString(),fd.append("token",this.delToken),xr.open("POST",document.forms.delform.action),xr.onload=function(){if(200!==xr.status)return pups.err(_l.xhrError),callback(null);var res=null;try{res=JSON.parse(xr.response)}catch(e){return pups.err(_l.xhrError),console.error("Malformed response (JSON expected):",xr.response),callback(null)}return callback&&callback(res.data),res.error?(res.error_verbose&&(res.error=res.error+"<br>"+res.error_verbose),void pups.err(res.error,{time:0})):void _deleteItems(res.data)},xr.send(fd)}};function inspectFormData(formData){var _iteratorNormalCompletion=!0,_didIteratorError=!1,_iteratorError=void 0;try{for(var _step,pair,_iterator=formData.entries()[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=!0)pair=_step.value,console.log(pair[0]+", "+pair[1])}catch(err){_didIteratorError=!0,_iteratorError=err}finally{try{!_iteratorNormalCompletion&&_iterator.return&&_iterator.return()}finally{if(_didIteratorError)throw _iteratorError}}}function makeIcon(i){var classes=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"",bare=!!(2<arguments.length&&arguments[2]!==void 0)&&arguments[2];return(bare?"":"<svg class=\"icon "+classes+"\">")+"\n <use xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#i-"+i+"\"></use>\n "+(bare?"":"</svg>")}function expandimg(postnum,imgurl,thumburl,imgw,imgh,thumbw,thumbh){var element=document.getElementById("thumb"+postnum);if(null==element)return!1;var fc_width,$element=$(element),$postbody=$element.parents(".postbody"),$fc_filename=$element.parents("figure").find(".fc-filename");if("undefined"!=typeof event&&2===event.which)return!0;if("full"!=element.getElementsByTagName("img")[0].getAttribute("alt").substring(0,4)){if($element.html("<img src=\""+imgurl+"\" alt=\"full"+postnum+"\" class=\"thumb\" height=\""+imgh+"\" width=\""+imgw+"\">"),!Settings.expandImgFull()){for(var img=element.getElementsByTagName("img")[0],max_w=document.documentElement?document.documentElement.clientWidth:document.body.clientWidth,offset=50,offset_el=img;null!=offset_el;)offset+=offset_el.offsetLeft,offset_el=offset_el.offsetParent;var new_w=max_w-offset;if(img.width>new_w){var ratio=img.width/img.height,zoom=1-new_w/img.width,notice=document.createElement("div");notice.setAttribute("class","filesize"),notice.style.textDecoration="underline";var textNode=document.createTextNode(_l.imageDownscaledBy+" "+Math.round(100*zoom)+"% "+_l.toFit);notice.appendChild(textNode),element.insertBefore(notice,img),$(img).width(new_w),$(img).height(new_w/ratio)}fc_width=new_w}else fc_width=imgw;$postbody&&$postbody.addClass("postbody-expanded")}else element.innerHTML="<img src=\""+thumburl+"\" alt=\""+postnum+"\" class=\"thumb\" height=\""+thumbh+"\" width=\""+thumbw+"\">",fc_width=thumbw,$postbody&&$postbody.removeClass("postbody-expanded");return $fc_filename[0].style.maxWidth=fc_width-50+"px",!1}var PostPreviews={zindex:3,cached:{},parent:{},_parseURL:function _parseURL(url){var matches=url.match(/\/(.+)\/res\/([0-9]+)\.html#([0-9]+)|postbynumber\.php\?b=(.+)&p=([0-9]+)/i);return matches?{board:matches[1]||matches[4],parent:matches[2]||"?",post:matches[3]||matches[5]}:null},_mouseover:function _mouseover(e){var _this5=this;e.stopPropagation();var href=this.getAttribute("href"),isCatalog=$(this).hasClass("catalog-entry"),parsedURL=PostPreviews._parseURL(href);if(!parsedURL)return!1;var board=parsedURL.board,parentid=parsedURL.parent,postid=parsedURL.post,previewid="preview_"+board+"_"+postid,preview=$("#"+previewid);0==preview.length&&($("body").children().first().before("<div id=\""+previewid+"\"></div>"),preview=$("#"+previewid),preview.addClass("reflinkpreview content-background pre-hidden actual-reflinkpreview"),preview.mouseleave(PostPreviews._mouseout),preview.mouseover(PostPreviews.onMouseOver));var parent=$(this).parents("div[id^=preview]");if(0<parent.length){if(previewid==parent.attr("id"))return;for(var id in PostPreviews.parent)if(id==previewid||PostPreviews.parent[id]==previewid)return;PostPreviews.parent[previewid]=parent.attr("id")}else PostPreviews.parent=[];var transformOrigin;e.clientY<$(window).height()/1.5?(preview.css({top:e.pageY+5}),transformOrigin="top "):(preview.css({bottom:$(window).height()-e.pageY+5}),transformOrigin="bottom "),e.clientX<$(window).width()/1.5?(preview.css({left:e.pageX+15}),transformOrigin+="left"):(preview.css({right:$(window).width()-e.pageX+15}),transformOrigin+="right"),preview.css({zIndex:PostPreviews.zindex++,"transform-origin":transformOrigin}),this.style.cursor="progress",HTMLoader.getPost(board,parentid,postid,function(err,post){window.setTimeout(function(){preview[0].getBoundingClientRect(),preview.html(post?post:_l.oops+(!1===err?"":" ("+err+")")).removeClass("pre-hidden"),_this5.style.cursor="pointer"},0)}),e.preventDefault()},onMouseOver:function onMouseOver(){var preview=$(this);if($(this).is("a")){var parsedURL=PostPreviews._parseURL(this.getAttribute("href"));if(!parsedURL)return;var board=parsedURL.board,postid=parsedURL.post;preview=$("#preview_"+board+"_"+postid).first()}for(;0<preview.length;)clearTimeout(preview[0].fadeout),preview=$("#"+PostPreviews.parent[preview.attr("id")])},_mouseout:function _mouseout(){var preview=$(this);if($(this).is("a")){this.predelay&&clearTimeout(this.predelay);var parsedURL=PostPreviews._parseURL(this.getAttribute("href"));if(!parsedURL)return;var board=parsedURL.board,postid=parsedURL.post;preview=$("#preview_"+board+"_"+postid).first()}for(var _loop=function(){clearTimeout(preview[0].fadeout);var pre=preview;preview[0].fadeout=setTimeout(function(){pre.addClass("pre-hidden"),setTimeout(function(){delete PostPreviews.parent[pre.attr("id")],pre.remove()},PostPreviews._timings.transition)},PostPreviews._timings.fade),preview=$("#"+PostPreviews.parent[preview.attr("id")])};0<preview.length;)_loop()},_timings:{predelay:50,transition:200,fade:400}};function set_inputs(id){var form=document.getElementById(id);if(form){var name=form.querySelector("input[name=name]");name&&!name.value&&(name.value=getCookie("name")),form.em.value||(form.em.value=getCookie("email")),form.postpassword.value||(form.postpassword.value=get_password("postpassword"))}}function set_delpass(id){var form=document.getElementById(id);if(form){var postpassword=form.postpassword;postpassword&&!postpassword.value&&(postpassword.value=get_password("postpassword"))}}(function($){$.event.special.load={add:function add(callback){1===this.nodeType&&"img"===this.tagName.toLowerCase()&&""!==this.src&&(this.complete||4===this.readyState?callback.handler.apply(this):"uninitialized"===this.readyState&&0===this.src.indexOf("data:")?$(this).trigger("error"):$(this).bind("load",callback.handler))}}})(jQuery);var Settings={_checkbox:function _checkbox(clicked,settingName,defaultValue){return null==localStorage?void pups.err(_l.noLocalStorage):(null==localStorage[settingName]&&(localStorage[settingName]=defaultValue),!0==clicked?localStorage[settingName]=$("#settings_"+settingName).is(":checked"):"true"==localStorage[settingName]?$("#settings_"+settingName).attr("checked","checked"):$("#settings_"+settingName).removeAttr("checked"),"true"==localStorage[settingName]||!0==localStorage[settingName])},fxEnabled:function fxEnabled(changed){var enabled=Settings._checkbox(changed,"fxEnabled",!0);return null!=changed&&($.fx.off=!enabled),enabled},showReplies:function showReplies(changed){var enabled=Settings._checkbox(changed,"showReplies",!0);return null!=changed&&(scrollAnchor.save("replymap",".postnode",window,"v"),enabled?(replyMap.showReplies(),injector.remove("hide-replies")):injector.inject("hide-replies",".replieslist {display: none}"),scrollAnchor.restore("replymap")),enabled},sfwMode:function sfwMode(changed){var enabled=Settings._checkbox(changed,"sfwMode",!1);return enabled?injector.inject("sfwMode",".thumb { opacity: 0.05;} .thumb:hover { opacity: 1;}"):injector.remove("sfwMode"),enabled},expandImgFull:function expandImgFull(changed){return Settings._checkbox(changed,"expandImgFull",!1)},constrainWidth:function constrainWidth(changed){var enabled=Settings._checkbox(changed,"constrainWidth",!1);enabled?injector.inject("constrainWidth","body {\n max-width: 960px;\n margin: 0px auto;\n }"):injector.remove("constrainWidth")}},rswap={i:!0,swap:function swap(){this.i?$("#delform").before($("#rswapper")).after($(".postarea")):$("#delform").before($(".postarea")).after($("#rswapper")),this.i=!this.i}},captchalang=getCookie("captchalang")||"ru";function setCaptchaLang(lang){in_array(lang,["ru","en","num"])&&(captchalang=lang,set_cookie("captchalang",lang,365),pups.succ(_l.captchaLangChanged))}var offClick=[];function readyset(){if($(".make-me-readonly").each(function(){$(this).attr("readonly",!0).on("focus",function(){$(this).removeAttr("readonly")})}),ispage||$(".mgoback").show(),isTouch?$("#js_settings").prepend("<a href=\"javascript: localStorage.setItem('interfaceType', 'desktop'); location.reload();\">"+_l.returnDesktop+"</a><br>"):$("#js_settings").prepend("<a href=\"javascript: localStorage.setItem('interfaceType', 'touch'); location.reload();\">"+_l.returnTouch+"</a><br>"),$("#js_settings").prepend(_l.captchalang+": <a href=\"javascript:setCaptchaLang('ru');\">Cyrillic</a> | <a href=\"javascript:setCaptchaLang('en');\">Latin</a> | <a href=\"javascript:setCaptchaLang('num');\">Numeral</a><br />"),Styles.$cancelLink&&$("#js_settings").prepend(Styles.$cancelLink),pups.init(),chpok.init(!0),LatexIT.init(),checkhighlight(),checkgotothread(),checknamesave(),bnrs.init(),getCookie("ku_menutype")){var c=Cookie("ku_menutype");"default"!=c&&""!=c&&(document.getElementById("overlay_menu").style.position=c)}if(processNodeInsertion(),isTouch?(add_mob_menu(),$("body").addClass("touch-mode"),$(".sect-exr:not([data-toexpand=\"_options\"])").parent().hide(),$(".sect-exr").click(function(){return $("#js_settings").is(":visible")?menu_show("_off_"):menu_show("ms-_options"),!1}),offClick.push(function(){menu_show("_off_"),$("[id^=preview]").addClass("pre-hidden"),setTimeout(function(){$("[id^=preview]").remove()},PostPreviews._timings.transition)}),$("body").on("click","a[class^='ref']",PostPreviews._mouseover)):(cloud20.init(),$(".sect-exr").mouseenter(function(){menu_show("ms-"+$(this).data("toexpand"))}),$("#overlay_menu").mouseleave(function(){menu_show("_off_")}),$("body").on("mouseenter","a[class^='ref']",function(ev){var _this6=this;this.predelay=setTimeout(function(){return PostPreviews._mouseover.bind(_this6)(ev)},PostPreviews._timings.predelay)}).on("mouseleave","a[class^='ref']",PostPreviews._mouseout).on("click","a[class^='ref']",function(e){e.preventDefault();var href=this.getAttribute("href");highlight(href.split("#")[1],0)||(document.location.href=href)})),$(".opt-exp").click(function(ev){ev.preventDefault(),$(this).find(".expandee").toggleClass("expanded")}).mouseleave(function(){var _this7=this;this.hideTimeout=setTimeout(function(){return $(_this7).find(".expandee").removeClass("expanded")},250)}).mouseenter(function(){clearTimeout(this.hideTimeout)}),$(".code_markup_select").change(function(){markup($(this).parents("form"),"[code="+$(this).val()+"]","[/code]")}),$("html").click(function(ev){return offClick.forEach(function(fn){return fn(ev)})}),$("body").on("click",".uib-mup",function(){return markup($(this).parents("form"),$(this).data("mups"),$(this).data("mupe"),$(this).data("imups"),$(this).data("imupe")),!1}).on("click",".uib-bul",function(){return bullets($(this).parents("form"),$(this).data("bul"),$(this).data("imups"),$(this).data("imupe")),!1}).on("click",".uib-tx",function(){var target=$(this).data("target");return head.js("http://latex.codecogs.com/editor3.js",function(){OpenLatexEditor(target,"phpBB","en-us",!1,"","full")}),!1}).on("click",".movie",function(event){expandwebm($(this),event)}).on("click",".qrl",quickreply).on("click",".hashpic",function(){$(".highlight").removeClass("highlight");var found=$(".hashpic[alt="+$(this).attr("alt")+"]").each(function(){$(this).parents(".posthead").parent().addClass("highlight")}).length;pups.info(_l.found+": "+found,{time:1.5})}).on("click",".posttypeindicator a",function(){var xl=$(this),offset=$("[name=\""+xl.attr("href").substr(1)+"\"]").offset()||$("[name=\""+xl.text().split(">>")[1]+"\"]").offset()||!1;return offset&&$("html, body").animate({scrollTop:offset.top-($("#overlay_menu").height()+10)},250),!1}).on("click",".dice",function(){"undefined"==typeof $(this).data("html")&&$(this).data("html",$(this).html());var htm=stripHTML($(this).html());$(this).html($(this).attr("title")),$(this).attr("title",htm)}).on("submit","#postform, #postclone",function(e){e.preventDefault(),Ajax.submitPost(this)}).on("click",".shl",function(){return!1}).on("click",".embed-play-button",function(ev){ev.preventDefault(),unwrapEmbed($(this).parents("figure"))}).on("click",".collapse-video",function(ev){ev.preventDefault(),wrapEmbed($(this).parents("figure"))}).on("mouseenter","._country_",function(){"undefined"==typeof $(this).attr("title")&&$(this).attr("title",countries[$(this).attr("src").split("flags/")[1].split(".png")[0].toUpperCase()])}).on("click",".audiowrap",function(ev){ev.preventDefault();var $this=$(this),src=$this.attr("href"),$fig=$this.parents("figure");$fig.hasClass("unwrapped")||$fig.addClass("unwrapped unwrapped-audio");var $fsz=$fig.find(".filesize");$fsz.find(".collapse-btn").length||$fsz.append("\n <button title=\""+_l.collapse+"\" class=\"emb-button collapse-video\">\n "+makeIcon("shrink","b-icon")+"\n </button>"),$this.find("audio").length||$this.append("<audio src=\""+src+"\" controls autoplay=\"true\"></audio>"),$fsz.find(".collapse-video").click(function(){$fig.removeClass("unwrapped unwrapped-audio").find("audio")[0].pause()})}).on("change",".multidel",function(){var itemCount=$(".multidel:checked").length;$(".item-count").length||($(".userdelete tbody").prepend("<tr><td>\n "+_l.selected+": <span class=\"item-count\"></span>\n <button class=\"close-multisel icon-wraping-button\" title=\""+_l.cancel+"\">"+makeIcon("x","b-icon ",!1)+"</button>\n </td></tr>"),$(".close-multisel").click(function(ev){ev.preventDefault(),$(".multidel").prop("checked",!1),$("body").removeClass("select-multiple"),$(".userdelete").removeClass("ud-active")})),0<itemCount?$(".item-count").text(itemCount):($(".userdelete").removeClass("ud-active"),$("body").removeClass("select-multiple"))}).on("click","label.postinfo",function(ev){if(!$(this).find(".multidel").is(":visible")){ev.stopPropagation(),ev.preventDefault();var $this=$(this),$menu=$this.parent().find(".post-menu"),on=!$menu.is(":visible");if($(".post-menu").hide(),!$menu.length){var $postnode=$(this).parents(".postnode"),board=$postnode.data("board"),id=$postnode.data("id"),isOP=$postnode.hasClass("op");this.insertAdjacentHTML("afterend","<div class=\"content-background post-menu\" style=\"display: none\"> \n <ul>\n <li class=\"menu-delete\">"+makeIcon("x")+"<span>"+_l.del+"</span></li>\n <li class=\"menu-report\">"+makeIcon("warning")+"<span>"+_l.report+"</span></li>\n <li class=\"menu-link-share\">"+makeIcon("link")+"<span>"+_l.links+"</span></li>\n <li class=\"menu-select-multiple\">"+makeIcon("select-multiple")+"<span>"+_l.selectMultiple+"</span></li>\n "+(kumod_set?"\n <li class=\"menu-delete menu-delete-mod\">"+makeIcon("x")+"<span>"+_l.del+" "+_l.asMod+"</span></li>\n <a href=\""+ku_cgipath+"/manage_page.php?action=bans&amp;banboard="+board+"&amp;banpost="+id+"\">\n <li class=\"menu-ban\">"+makeIcon("ban")+"<span>"+_l.ban+"...<span></li>\n </a>\n "+(isOP?"\n <a class=\"stickypost-btn\" onclick=\"Ajax.modThread(this, 'stickypost'); return false\"\n href=\""+ku_cgipath+"/manage_page.php?action=stickypost&amp;board="+board+"&amp;postid="+id+"\">\n <li>"+makeIcon("pin")+"<span>"+_l.stickthread+"<span></li>\n </a>\n <a class=\"unstickypost-btn\" onclick=\"Ajax.modThread(this, 'unstickypost'); return false\"\n href=\""+ku_cgipath+"/manage_page.php?action=unstickypost&amp;board="+board+"&amp;postid="+id+"\">\n <li>"+makeIcon("unpin")+"<span>"+_l.unstickthread+"<span></li>\n </a>\n <a class=\"lockpost-btn\" onclick=\"Ajax.modThread(this, 'lockpost'); return false\"\n href=\""+ku_cgipath+"/manage_page.php?action=lockpost&amp;board="+board+"&amp;postid="+id+"\">\n <li>"+makeIcon("lock")+"<span>"+_l.lockthread+"<span></li>\n </a>\n <a class=\"unlockpost-btn\" onclick=\"Ajax.modThread(this, 'unlockpost'); return false\"\n href=\""+ku_cgipath+"/manage_page.php?action=unlockpost&amp;board="+board+"&amp;postid="+id+"\">\n <li>"+makeIcon("unlock")+"<span>"+_l.unlockthread+"<span></li>\n </a>":""):"")+"\n </ul>\n </div>"),$menu=$this.parent().find(".post-menu")}$menu.toggle(on)}}).on("click",".file-menu-toggle",function(ev){ev.stopPropagation(),ev.preventDefault();var $menu=$(".file-menu"),$this=$(this),$fsz=$this.parent(),visible=$menu.is(":visible");if($(".post-menu").hide(),!(visible&&$menu[0].$boundTo[0]==$fsz[0])){var ofs=$fsz.offset(),offsetTop=$fsz.hasClass("embed-wrap")?22:$fsz.outerHeight();$menu.css({left:ofs.left+"px",top:ofs.top+offsetTop+"px","min-width":$fsz.outerWidth()+"px"}).show(),$menu[0].__menuProps={fileid:$fsz.parents("figure").data("fileid"),board:$fsz.parents(".postnode").data("board")},$menu[0].$boundTo=$fsz}}).on("click",".post-menu li",function(ev){return ev.stopPropagation()}).on("click",".menu-select-multiple",function(){$(".post-menu").hide();var $menu=$(this).parents(".post-menu"),isFile=$menu.hasClass("file-menu"),$md=(isFile?$menu[0].$boundTo:$(this).parents(".posthead")).find(".multidel");$md.length&&($md.prop("checked",!0).trigger("change"),$(".userdelete").addClass("ud-active"),$("body").addClass("select-multiple"))}).on("click",".menu-link-share",function(){var $this=$(this),isShown=$this.find("input").length;if(!isShown){var $postnode=$this.parents(".postnode"),board=$postnode.data("board"),id=$postnode.data("id"),directLink=ku_boardspath+$postnode.find(".shl").attr("href");$this.find("span").html("<input class=\"pm-direct-link pm-link\" type=\"text\" value=\""+directLink+"\" title=\""+_l.directLink+"\">&nbsp;\n <input class=\"pm-quote-link pm-link\" type=\"text\" value=\"&gt;&gt;/"+board+"/"+id+"\" title=\""+_l.quoteLink+"\">").css({"font-size":0}).find(".pm-direct-link").click()}else $this.toggleClass("direct-or-quote")}).on("click",".pm-link",function(ev){ev.stopPropagation();var $this=$(this);$(".pm-link").removeClass("selected"),$this.focus().select().addClass("selected")}).on("click",".menu-delete",function(){var $this=$(this),$menu=$this.parents(".post-menu"),menu=$menu[0],isFile=$menu.hasClass("file-menu"),$item=isFile?$menu[0].$boundTo:$this.parents(".posthead");$this.addClass("spin-around");var fd=new FormData;isFile?fd.append("delete-file[]",menu.__menuProps.fileid):fd.append("post[]",$item.parents(".postnode").data("id")),fd.append("moddelete",$this.hasClass("menu-delete-mod")),fd.append("board",isFile?menu.__menuProps.board:$item.parents(".postnode").data("board")),fd.append("postpassword",$("#delform input[name=\"postpassword\"]").val()),Ajax.deleteItems(fd,function(data){if($this.removeClass("spin-around"),!!data){var result=data[0];!result.success&&$item.is(":visible")?($item.find(".multidel").prop("checked",!0).trigger("change"),$(".userdelete").addClass("ud-active"),$("body").addClass("select-multiple")):isFile&&$(".file-menu").hide()}})}).on("click",".menu-report",function(){var $this=$(this),$item=$this.parents(".posthead");$this.addClass("spin-around");var fd=new FormData;fd.append("post[]",$item.find(".reflink a:last").text()),fd.append("board",$item.parents(".postnode").data("board")),Ajax.reportPost(fd,function(){$this.removeClass("spin-around")})}).on("click",".csswrap",function(ev){ev.preventDefault();var cssLink=$(this).attr("href"),styleName=$(this).parent().find(".fc-filename").text();Styles.testStyle(cssLink,styleName)}).on("click",".remove-file",function(ev){ev.preventDefault(),$(this).parent().find("input[type=file]").val(null)}),offClick.push(function(){$(".post-menu").hide()}),$(window).resize(function(){var $fileMenu=$(".file-menu");if($fileMenu.is(":visible")){var $fsz=$fileMenu[0].$boundTo,ofs=$fsz.offset(),offsetTop=$fsz.hasClass("embed-wrap")?22:$fsz.outerHeight();$fileMenu.css({left:ofs.left+"px",top:ofs.top+offsetTop+"px","min-width":$fsz.outerWidth()+"px"})}}),$("#postclone label").each(function(){var id=$(this).attr("for"),newid=id+"_clone";$(this).parents("form").find("#"+id).attr("id",newid),$(this).attr("for",newid)}),$("#postform textarea").attr("id","top-textarea"),$("#postform .uib-tx").data("target","top-textarea"),$("#postclone textarea").attr("id","pop-textarea"),$("#postclone .uib-tx").data("target","pop-textarea"),!isTouch){$("#postclone").drags().find("input, textarea, select, label").mousedown(function(e){e.stopPropagation()});var pinnerState=+localStorage.pinForm?"pinned":"unpinned",pinner="<a href=\"#\" class=\"pinner "+pinnerState+"\" onclick=\"javascript:$('#postclone').pin();return false;\" title=\"\u041F\u0440\u0438\u043A\u0440\u0435\u043F\u0438\u0442\u044C / \u041E\u0442\u043A\u0440\u0435\u043F\u0438\u0442\u044C\"><svg class=\"icon b-icon\"><use class=\"use-pin\" xlink:href=\"#i-pin\"></use><use class=\"use-unpin\" xlink:href=\"#i-unpin\"></use></svg></a>"}else var pinner="";if(ffdata.load(),$("<span class=\"extrabtns postboxcontrol\">"+pinner+"&nbsp;<a href=\"#\" onclick=\"javascript:$('#postclone').hide();return false;\" title=\"\u0417\u0430\u043A\u0440\u044B\u0442\u044C\"><svg class=\"icon b-icon\"><use xlink:href=\"#i-x\"></use></svg></a></span>").appendTo("#postclone"),$("#delform").on("submit",function(e){e.preventDefault(),Ajax.deleteItems(new FormData(this))}),$("input[name=reportpost]").click(function(e){e.preventDefault(),Ajax.reportPost(new FormData($(this).parents("form")[0]))}),$("#delform").after("<div id=\"rswapper\">[<a onclick=\"javascript:rswap.swap();return false;\" href=\"#\">"+(ispage?_l.NewThread:_l.reply)+"</a>]<hr /></div>"),Settings.sfwMode(!1),localStorage)for(var s in Settings)"_"!=s.substring(0,1)&&($("#js_settings").append("<label><input type=\"checkbox\" onchange=\"javascript:Settings."+s+"(true)\" name=\"settings_"+s+"\" id=\"settings_"+s+"\" value=\"true\"> "+_l["settings_"+s]+"</label><br />"),Settings[s](!1));else $("#js_settings").append("<span style=\"color:#F00\">"+_l.noLocalStorage+"</span><br />\u0422\u0432\u043E\u0439 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u2014 \u0433\u043E\u0432\u043D\u043E. \u0421\u043A\u0430\u0447\u0430\u0439 <a href=\"/web/20110329072959/http://google.com/chrome\" target=\"_blank\">Chome</a>, \u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440.");var textbox=document.getElementById("message");textbox&&(textbox.onfocus=function(){is_entering=!0},textbox.onblur=function(){is_entering=!1}),$("body").append("\n <div class=\"content-background post-menu file-menu\" style=\"display: none\"> \n <ul>\n <li class=\"menu-delete\">"+makeIcon("x")+"<span>"+_l.del+"</span></li>\n <li class=\"menu-select-multiple\">"+makeIcon("select-multiple")+"<span>"+_l.selectMultiple+"</span></li>\n "+(kumod_set?"<li class=\"menu-delete menu-delete-mod\">"+makeIcon("x")+"<span>"+_l.del+" "+_l.asMod+"</span></li>":"")+"\n </ul>\n </div>\n "),$(document).on("animationstart webkitAnimationStart MSAnimationStart oanimationstart",function(event){var $target=$(event.target);"nodeInserted"!=event.originalEvent.animationName||$target.hasClass("_inserted_")||processNodeInsertion($target)}),$("input[name^=embed]").on("input",function(){var $this=$(this);$this.parent().find(".site-indicator").remove();var match=embedLinks.process($(this).val());match&&$this.after("<img src=\""+ku_boardspath+"/images/site-logos/"+match.site+".png\" class=\"site-indicator\">")}),$("input[name^=imagefile]").on("change",function(){var $this=$(this);if($this.val()){var nextCheckbox=$this.parent().next();nextCheckbox.length&&nextCheckbox.prop("checked",!0)}}),"undefined"!=typeof is_catalog&&is_catalog&&catalog.init(),$(".userdelete").addClass("content-background reflinkpreview"),$("<div id=\"tripinfo\"></div>").addClass("content-background reflinkpreview qreplyform").hide().appendTo("body"),$("#delform").on("click",".postertrip",function(ev){ev.preventDefault(),ev.stopPropagation();var trip=$(this).text().split("!")[1],offset=$(this).offset(),height=$(this).height();$.getJSON("/tripinfo.php",{trip:trip}).done(function(data){var active_on=[];_.each(data.active_on,function(board){active_on.push("<a target=\"_blank\" href=\""+ku_boardspath+"/"+board+"/\">/"+board+"/</a>")}),$("#tripinfo").html("<div><b class=\"postertrip\">!"+trip+"</b> [<a href=\"https://www.google.com/search?q=!"+trip+"\" target=\"_blank\">G</a>]</div><a style=\"float:left;\" href=\"#\" onclick=\"javascript:$('#tripinfo').hide();return false;\"><svg style=\"position: absolute; top: 3px; right: 3px;\" class=\"icon b-icon\"><use xlink:href=\"#i-x\"></use></svg></a><div class=\"trip-info-line\">"+_l.threads+": "+data.threads+", "+_l.comments+": "+data.comments+"</div><div class=\"trip-info-line\">"+_l.active_since+": "+catalog.formatDate(data.active_since,!0)+"</div><div class=\"trip-info-line\">"+_l.last_active+": "+catalog.formatDate(data.last_active,!0)+"</div>"+(active_on.length?"<div class=\"trip-info-line\">"+_l.active_on+": "+active_on.join(", ")+"</div>":"")).css({top:offset.top+height,left:offset.left}).fadeIn("fast")}).fail(function(error){console.error(error)})}),$("input[name=disable_name]").on("change",function(){var off=$(this).is(":checked");$(this).parents("form").find("input[name=name]").attr("disabled",off),localStorage.setItem("post_anonymously",+off)}).prop("checked",!!+localStorage.post_anonymously).trigger("change"),unreadCounter.update(),Captcha.init(),liveupd_ena&&"undefined"!=typeof io&&updater.init(),$("input[name=\"ttl-enable\"]").on("change",function(){var on=$(this).is(":checked"),$i=$(this).parents("form").find("input[name=\"ttl\"]");$i.attr("disabled",!on),on&&0==$i.val()&&$i.val(1),$i.attr("min",on?1:0)}).trigger("change")}var NTP={calc:function calc(t0,t1,t2,t3){return(t1-t0+(t2-t3))/2},sync:function sync(){this.pending=!0;var _this=this,t0=new Date().valueOf();$.ajax({url:"/ntp.php",success:function success(servertime){var t3=new Date().valueOf();_this.offset=_this.calc(t0,servertime,servertime,t3)},error:function error(){pups.err("Failed to synchronize time with the server")},complete:function complete(){for(_this.synced=!0;_this.stack.length;)_this.stack.shift().resolve(_this.timeWithOffset)}})},offset:0,stack:[],get timeWithOffset(){return new Date(new Date().getTime()+this.offset).getTime()},getServerTime:function getServerTime(){if(this.synced)return Promise.resolve(this.timeWithOffset);var promise=externallyResolvingPromise();return this.pending||this.sync(),this.stack.push(promise),promise.promise}};function externallyResolvingPromise(){var promiseResolve,promiseReject,promise=new Promise(function(resolve,reject){promiseResolve=resolve,promiseReject=reject});return{promise:promise,resolve:promiseResolve,reject:promiseReject}}function processNodeInsertion($node){"undefined"==typeof $node?$node=$("body"):($node.addClass("_inserted_"),$node=$node.parents(":eq(1)")),$node.find(".prettyprint").length&&prettyPrint.apply(window),LatexIT.render($node),$node.find(".post-ttl:not(._inserted_)").each(function(){var $this=$(this);$this.addClass("_inserted_");var iv,updateTTL=function(){$this.length?NTP.getServerTime().then(function(srvTime){var ms_left=1e3*$this.data("deleted-timestamp")-srvTime;if(0<=ms_left){var min_left=Math.round(ms_left/6e4),h_left=Math.floor(min_left/60);min_left-=60*h_left,$this.text(_.padLeft(h_left,2,"0")+":"+_.padLeft(min_left,2,"0"))}else $.get(document.forms.delform.action),_deleteItems([{action:"delete_post",id:$this.parents(".posthead").find(".reflink > a:not(.shl)").text()}],!1,updater.markOnly),clearInterval(iv)}):clearInterval(iv)};iv=setInterval(updateTTL,30000),updateTTL()})}var chpok={init:function init(){!!(0<arguments.length&&arguments[0]!==void 0)&&arguments[0];document.body.insertAdjacentHTML("beforeend","<audio id=\"chpok-audio\" style=\"display:none\">\n <source src=\""+ku_boardspath+"/images/chpok.mp3\">\n <source src=\""+ku_boardspath+"/images/chpok.ogg\">\n </audio>"),this.initiated=!0,this.audio=document.querySelector("#chpok-audio")},play:function play(){this.initiated||this.init(),this.audio.play().catch(function(){return _.noop})}},updater={newThreads:[],init:function init(){this.socket=io.connect(liveupd_api);var subscribeTo;ispage?(subscribeTo=[liveupd_sitename+this_board_dir+":threads"],$(".op .reflink").children(":last-child").each(function(){subscribeTo.push(liveupd_sitename+this_board_dir+":"+$(this).text())})):(subscribeTo=[liveupd_sitename+$("input[name=board]").val()+":"+$("input[name=replythread]").val()],_l.noNewPosts+="<br>"+_l.threadUpdationAutomatically),this.socket.on("update",this.dispatch.bind(this)).emit("subscribe",subscribeTo),Object.defineProperty(this,"markOnly",{value:!0,writable:!1,configurable:!1})},dispatch:function dispatch(data){if(!data.action)return pups.warn("Event with unspecified action, see console"),void console.warn(data);if("new_thread"==data.action){if(data.token&&Ajax.postToken&&data.token==Ajax.postToken)return;this.notifyAboutNewThreads(data)}if("new_reply"==data.action){if(data.token&&Ajax.postToken&&data.token==Ajax.postToken)return;ispage?this.notifyAboutNewRepliesOnBoardPage(data):this.showNewReplies(data)}if("delete"==data.action){if(data.token&&Ajax.delToken&&data.token==Ajax.delToken)return;_deleteItems(data.items,!1,this.markOnly)}},showNewReplies:function showNewReplies(data){newposts.get({silent:!0,timestamp:data.timestamp,onSuccess:function onSuccess(){document.hasFocus()||chpok.play()}})},notifyAboutNewThreads:function notifyAboutNewThreads(data){this.newThreads.push(data.new_thread_id),document.hasFocus()?!$("#wild_thread_appeared").length&&$(".postarea").after("<a class=\"xlink\" onclick=\"updater.showNewThreads();return false\" id=\"wild_thread_appeared\"><span class=\"salient\">"+_l.newThreadsAvailable+"</span><hr /></a>"):(scrollAnchor.save("autoload",".postnode",window,"v"),this.showNewThreads(function(){return scrollAnchor.restore("autoload")}),chpok.play())},notifyAboutNewRepliesOnBoardPage:function notifyAboutNewRepliesOnBoardPage(data){this.repliesOnBoardPage[data.room]?this.repliesOnBoardPage[data.room].push(data.reply_id):this.repliesOnBoardPage[data.room]=[data.reply_id],this.refreshNewRepliesCount(data.room,data.timestamp)},refreshNewRepliesCount:function refreshNewRepliesCount(thread){var _this8=this,timestamp=1<arguments.length&&arguments[1]!==void 0?arguments[1]:null,count=(this.repliesOnBoardPage[thread]||[]).length,$target=$("[id^=replies"+thread+"]"),$counter=$target.find(".fresh-replies"),clearCounter=function(){return _this8.repliesOnBoardPage[thread]=[]};if(count){if(!$counter.length){var loadNewReplies=function(callback){newposts.get({threadid:thread,onSuccess:function onSuccess(){clearCounter(),callback&&callback()},onError:function onError(e){console.error(e),pups.err(_l.oops)},silent:!0,timestamp:timestamp})};if(!document.hasFocus())scrollAnchor.save("autoload",".postnode",window,"v"),loadNewReplies(function(){return scrollAnchor.restore("autoload")}),chpok.play();else{var $freshReplies=$target.append("<a href=\"/"+this_board_dir+"/res/"+thread+".html\" class=\"salient fresh-replies\">"+_l.newReplies+": <span class=\"fresh-replies-number\"></span></a>").find(".fresh-replies"),freshReplies=$freshReplies[0];$freshReplies.click(function(e){e.preventDefault();$freshReplies.__alreadyLoading||(freshReplies.__alreadyLoading=!0,freshReplies.insertAdjacentHTML("afterBegin","<div class=\"spinner\"></div>"),loadNewReplies(function(){return $(freshReplies).remove()}))})}}$target.find(".fresh-replies-number").text(count)}else $counter.length&&($counter.remove(),clearCounter())},repliesOnBoardPage:{},showNewThreads:function showNewThreads(callback){var _this9=this,$wta=$("#wild_thread_appeared");$wta.length&&$wta.find("span")[0].insertAdjacentHTML("afterBegin","<div class=\"spinner\"></div>"),this.newThreads.forEach(function(thr){HTMLoader.getThread(this_board_dir,thr,null,function(err,posts){return err?pups.err(_l.noDataLoaded):void($wta.remove(),document.querySelector("#delform").insertAdjacentHTML("afterBegin","\n <div id=\"thread"+thr+this_board_dir+"\">\n "+posts+"\n <div id=\"replies"+thr+this_board_dir+"\" class=\"replies\"></div>\n </div>\n <br clear=\"left\" />\n <hr />"),_this9.socket.emit("subscribe",liveupd_sitename+this_board_dir+":"+thr),callback&&callback())})}),this.newThreads=[]}};function _deleteItems(items){var bySelf=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],markOnly=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2],postsDeleted=[],postErrors=[],insideDeletedThread=void 0,filesDeleted=[],fileErrors=[];if(items.forEach(function(item){if("delete_post"==item.action||"post"==item.itemtype){if(bySelf&&!item.success)return void postErrors.push(item);insideDeletedThread=!1;var $thread=$("#delform [id^=thread"+item.id+"]"),$reply=$("#delform [id^=reply"+item.id+"]");if($thread.length)markOnly||!ispage?($thread.addClass("deleted").find(".reply, figure").addClass("deleted"),!ispage&&(insideDeletedThread=!0,$("form[name=postform], .qrl, #rswapper").remove(),pups.warn(_l.thread+" "+_l.deleted+"!",{time:0}))):($thread.prev().remove(),$thread.next().remove(),$thread.next().remove(),$thread.remove());else if(!$reply.length)updater.repliesOnBoardPage[item.thread_id]&&(updater.repliesOnBoardPage[item.thread_id]=updater.repliesOnBoardPage[item.thread_id].filter(function(i){return i!=item.id})),updater.refreshNewRepliesCount(item.thread_id);else if(markOnly)$reply.addClass("deleted");else{var _$reply=$("#delform [id^=reply"+item.id+"]");_$reply.length&&_$reply.parents(".postnode").remove()}insideDeletedThread||postsDeleted.push("#"+item.id)}if("delete_file"==item.action||"file"==item.itemtype){if(bySelf&&!item.success)return void fileErrors.push(item);var $fig=$("figure[data-fileid="+item.id+"]");markOnly?$fig.addClass("deleted"):$fig.replaceWith("<div class=\"nothumb\">"+_l.fileRemoved+"</div>"),filesDeleted.push("#"+item.id)}"delete_thread"==item.action&&(updater.newThreads=updater.newThreads.filter(function(i){return i!=item.id}),!updater.newThreads.length&&$("#wild_thread_appeared").remove(),pups.info(_l.thread+" "+item.id+" "+_l.deleted+"."))}),$(".multidel").is(":checked")||$(".multidel.delete-file").is(":checked")||($(".userdelete").removeClass("ud-active"),$("body").removeClass("select-multiple")),postsDeleted.length){var msg=1<postsDeleted.length?_l.posts+" "+postsDeleted.join(", ")+" "+_l.deletedMulti+".":_l.post+" "+postsDeleted[0]+" "+_l.deleted+".";pups[bySelf?"succ":"info"](msg,{time:2+postsDeleted.length})}if(filesDeleted.length){var _msg=1<filesDeleted.length?_l.files+" "+filesDeleted.join(", ")+" "+_l.deletedMulti+".":_l.file+" "+filesDeleted[0]+" "+_l.deleted+".";pups[bySelf?"succ":"info"](_msg,{time:2+filesDeleted.length})}postErrors.length&&pups.err(postErrors.map(function(err){return _l.post+" #"+err.id+": "+err.message}).join("<br>"),{time:2+postErrors.length}),fileErrors.length&&pups.err(fileErrors.map(function(err){return _l.file+" #"+err.id+": "+err.message}).join("<br>"),{time:2+fileErrors.length})}if(+localStorage.localmod)kumod_set=!0;else{var kumod=getCookie("kumod");""!==kumod&&("allboards"===kumod?kumod_set=!0:kumod_set=in_array(this_board_dir,kumod.split("|")))}function expandwebm($mov,ev){$mov.parents(".reply");if("1"!==$mov.data("expanded")){ev.preventDefault();var movieurl=$mov.attr("href"),imgh=$mov.data("height"),imgw=$mov.data("width"),dt=$mov.data("thumb"),postnum=$mov.data("id"),uid="_vframe_"+randomString(5)+new Date().getTime();$mov.replaceWith(function(){return"<span id=\""+uid+"\" data-thumb=\""+dt+"\" data-width=\""+imgw+"\"\" data-height=\""+imgh+"\" data-href=\""+movieurl+"\">"+this.innerHTML+"</span>"}),$mov=$("#"+uid),$mov.find("img").hide();var video=$mov.find("video").show(),notice="";if(video.length?video.get(0).play():$mov.find(".playable-thumb").append("<video class=\"thumb\" src=\""+movieurl+"\" controls loop autoplay height=\""+imgh+"\" width=\""+imgw+"\"></video>").promise().done(function(){video=$mov.find("video")}),!Settings.expandImgFull()){for(var offset=50,offset_el=video[0],max_w=document.documentElement?document.documentElement.clientWidth:document.body.clientWidth;null!=offset_el;)offset+=offset_el.offsetLeft,offset_el=offset_el.offsetParent;var new_w=max_w-offset;if(imgw>new_w){video.width(new_w),video.height(new_w/(imgw/imgh)),notice=_l.videoDownscaledBy+" "+Math.round(100*(1-new_w/imgw))+"% "+_l.toFit}}var $fig=$mov.parents("figure");$fig.hasClass("unwrapped")||$fig.addClass("unwrapped");var $fsz=$mov.parent().find(".filesize");$fsz.find(".collapse-btn").length||($fsz.append("\n <button title=\""+_l.collapse+"\" class=\"emb-button collapse-video\">\n "+makeIcon("shrink","b-icon")+"\n </button>"),$mov.parent().find(".collapse-video").click(function(){$fig.removeClass("unwrapped");var uid="_vframe_"+randomString(5)+new Date().getTime();return $mov.replaceWith(function(){return"<a class=\"movie\" id=\""+uid+"\" data-thumb=\""+dt+"\" data-width=\""+imgw+"\"\" data-height=\""+imgh+"\" href=\""+movieurl+"\">"+this.innerHTML+"</a>"}).data("expanded","0"),$mov=$("#"+uid),$mov.find("video").hide()[0].pause(),$mov.find("img").show(),$(this).remove(),$mov.parents(".reply").removeClass("reply-expanded"),!1})),$mov.parents(".reply").addClass("reply-expanded")}}function checknamesave(){var checkd=""!=getCookie("name");var doc=document.getElementById("save");null!=doc&&(doc.checked=checkd)}function checkgotothread(){var checkd;checkd=!("on"!=getCookie("tothread")),$("#gotothread").attr("checked",checkd)}function navigatepages(event){if(document.getElementById&&!is_entering&&(window.event&&(event=window.event),event.ctrlKey)){var link=null,href=null,docloc=document.location.toString();if(-1!=docloc.indexOf("/res/"))13==(event.keyCode?event.keyCode:event.which?event.which:null)&&$("textarea[name=\"message\"]:focus").parents("form").submit();else{if(-1==docloc.indexOf(".html")||-1!=docloc.indexOf("board.html"))var page=0,docloc_trimmed=docloc.substr(0,docloc.lastIndexOf("/")+1);else{var page=docloc.substr(docloc.lastIndexOf("/")+1);page=+page.substr(0,page.indexOf(".html"));var docloc_trimmed=docloc.substr(0,docloc.lastIndexOf("/")+1)}if(0==page)var docloc_valid=docloc_trimmed;else var docloc_valid=docloc_trimmed+page+".html";var match;if(match=/#s([0-9]+)/.exec(docloc))var relativepost=+match[1];else var relativepost=-1;for(var maxthreads=0;0<document.getElementsByName("s"+ ++maxthreads).length;);switch(event.keyCode?event.keyCode:event.which?event.which:null){case 13:$("textarea[name=\"message\"]:focus").parents("form").submit();break;case 37:link=document.getElementById("prevPage");break;case 39:link=document.getElementById("nextPage");break;case 40:if(relativepost==maxthreads-1)break;else var newrelativepost=relativepost+1;href=docloc_valid+"#s"+newrelativepost;break;case 38:if(-1==relativepost||0==relativepost)break;else var newrelativepost=relativepost-1;href=docloc_valid+"#s"+newrelativepost;break;case 36:document.location=docloc_trimmed;}link&&link.action&&(document.location=link.action),href&&(document.location.href=href)}}}window.document.addEventListener?window.document.addEventListener("keydown",navigatepages,!1):window.document.attachEvent("onkeydown",navigatepages),NodeList.prototype.forEach=Array.prototype.forEach,Element.prototype._findParent=function(selector){for(var node=this;node&&!node.matches(selector);)if(node=node.parentNode,!node.matches)return null;return node};var replyMap={showReplies:function showReplies(){var _this10=this,root=0<arguments.length&&arguments[0]!==void 0?arguments[0]:document;root.querySelectorAll(".postnode").forEach(function(post){var n=post.querySelector(".reflink a:last-child").innerHTML,msg=post.querySelector(".postmessage"),repliesContainer=post.querySelector(".replieslist");_this10.posts[n]?_this10.posts[n].container=repliesContainer:_this10.posts[n]={container:repliesContainer,replies:[]};var links=msg.querySelectorAll("a[class^=ref\\|"+this_board_dir+"]");links.length&&links.forEach(function(link){var linkData=link.className.split(" ")[0].split("|"),linkN=linkData[3],threadID=link._findParent("div[id^=thread]").dataset.threadid,href="/"+linkData[1]+"/res/"+threadID+".html#"+n,htm="<a class=\"ref-reply\" href=\""+href+"\">&gt;&gt;"+n+"</a>";threadID||console.warn("what?"),_this10.posts[linkN]?!_.includes(_this10.posts[linkN].replies,htm)&&_this10.posts[linkN].replies.push(htm):_this10.posts[linkN]={replies:[htm]},_this10.posts[linkN].skip=!1})}),_.each(this.posts,function(post){!post.skip&&post.replies.length&&post.container&&(post.container.innerHTML=_l.replies+": "+post.replies.join(", "),post.skip=!0)})},posts:{}},scrollAnchor={save:function save(id,elements,parent,dimensions){parent=parent||window,dimensions=dimensions||"vh";var mid=[window.innerWidth/2,window.innerHeight/2],elMap=[],parentBCR=parent==window?{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}:parent.getBoundingClientRect();parent!=window&&(0>=parentBCR.left&&0>=parentBCR.right||0>=parentBCR.top&&0>=parentBCR.bottom||parentBCR.left>=window.innerWidth||parentBCR.top>=window.innerHeight)&&(mid=[parentBCR.left+parentBCR.width/2,parentBCR.top+parentBCR.height/2]);var elems=(parent==window?document:parent).querySelectorAll(elements);if(elems.length){elems.forEach(function(el){var _Mathabs=Math.abs,_Mathpos=Math.pos,bcr=el.getBoundingClientRect(),relativeVisibleWidth=_Mathpos(bcr.width-(_Mathpos(parentBCR.left-bcr.left)+_Mathpos(bcr.right-parentBCR.right)))/bcr.width,relativeVisibleHeight=_Mathpos(bcr.height-(_Mathpos(parentBCR.top-bcr.top)+_Mathpos(bcr.bottom-parentBCR.bottom)))/bcr.height,dx=_Mathabs(mid[0]-(bcr.left+bcr.width/2)),dy=_Mathabs(mid[1]-(bcr.top+bcr.height/2));elMap.push({el:el,primaryVisibility:"h"==dimensions[0]?relativeVisibleWidth:relativeVisibleHeight,secondaryVisibility:"v"==dimensions[0]?relativeVisibleWidth:relativeVisibleHeight,primaryOffset:"h"==dimensions[0]?dx:dy,secondaryOffset:"v"==dimensions[0]?dx:dy})}),elMap.sort(function(a,b){return b.primaryVisibility===a.primaryVisibility?1<dimensions.length&&b.secondaryVisibility!==a.secondaryVisibility?b.secondaryVisibility-a.secondaryVisibility:a.primaryOffset===b.primaryOffset?1<dimensions.length?a.secondaryOffset-b.secondaryOffset:void 0:a.primaryOffset-b.primaryOffset:b.primaryVisibility-a.primaryVisibility});var anchor=elMap[0].el,bcrBefore=anchor.getBoundingClientRect();this.saved[id]={anchor:anchor,left:bcrBefore.left,top:bcrBefore.top,parent:parent,dimensions:dimensions}}},restore:function restore(id){var loaded=this.saved[id];loaded&&window.requestAnimationFrame(function(){var bcrAfter=loaded.anchor.getBoundingClientRect();loaded.parent.scrollBy(-1===loaded.dimensions.indexOf("h")?0:bcrAfter.left-loaded.left,-1===loaded.dimensions.indexOf("v")?0:bcrAfter.top-loaded.top)})},saved:{}};Math.pos=function(x){return 0<=x?x:0},function(){for(var lastTime=0,vendors=["ms","moz","webkit","o"],x=0;x<vendors.length&&!window.requestAnimationFrame;++x)window.requestAnimationFrame=window[vendors[x]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[vendors[x]+"CancelAnimationFrame"]||window[vendors[x]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(callback){var currTime=new Date().getTime(),timeToCall=Math.max(0,16-(currTime-lastTime)),id=window.setTimeout(function(){callback(currTime+timeToCall)},timeToCall);return lastTime=currTime+timeToCall,id}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(id){clearTimeout(id)})}();var menu_current="",menu_last="";function menu_show(id){if(""!=menu_current){var dl="_off_"==id?125:0;$("#"+menu_current).delay(dl).slideUp(100),menu_last=menu_current}""!=id&&(menu_last==id&&"undefined"!=typeof $("#"+id).queue()&&0<$("#"+id).queue().length?$("#"+id).clearQueue():$("#"+id).slideDown(150)),menu_current=id}function menu_pin(){"absolute"==document.getElementById("overlay_menu").style.position?(document.getElementById("overlay_menu").style.position="fixed",Cookie("ku_menutype","fixed",365)):(document.getElementById("overlay_menu").style.position="absolute",Cookie("ku_menutype","absolute",365))}function toggle_oldmenu(){var on=0<arguments.length&&arguments[0]!==void 0?arguments[0]:null;null===on&&(on="yes"!=getCookie("ku_oldmenu")),injector.inject("oldmenu","#"+(on?"overlay_menu":"head_oldmenu")+" { display: none }"),on&&!document.getElementById("head_oldmenu")&&document.getElementById("boardlist_header").insertAdjacentHTML("afterBegin","<div id=\"head_oldmenu\" class=\"boardlist\">\n "+document.getElementById("ns_oldmenu").innerText+"\n <a href=\"#\" onclick=\"javascript:toggle_oldmenu();\" class=\"bl-sect\" style=\"order:1\">[overlay]</a>\n </div>"),Cookie("ku_oldmenu",on?"yes":"no",90)}var LatexIT={mode:"gif",init:function init(){document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")&&(this.mode="svg")},odc:"javascript:LatexIT.replaceWithSrc(this);",dcls:"Double click to show source",pre:function pre(eqn){var txt=eqn.innerHTML;if(!txt.match(/<img.*?>/i)&&!txt.match(/<object.*?>/i)){txt=txt.replace(/<br>/gi,"").replace(/<br \/>/gi,"").replace(/&amp;/mg,"&");var atxt="[tex]"+txt+"[/tex]";txt=escape(txt.replace(/\\/mg,"\\"));var c=eval("LatexIT.normalize"+$(eqn).parent().css("color")),extxt="{\\color[rgb]{"+c.r+","+c.g+","+c.b+"}"+txt+"}";txt=" <img src=\"http://latex.codecogs.com/"+this.mode+".latex?"+extxt+"\" title=\""+this.dcls+"\" alt=\""+atxt+"\" ondblclick=\""+this.odc+"\" border=\"0\" class=\"latex\" /> "}return txt},replaceWithSrc:function replaceWithSrc(eqn){var txt=$(eqn).attr("alt");$(eqn).parent().html(txt)},render:function render($scope){for(var scope="undefined"==typeof $scope?window.document:$scope[0],eqn=scope.getElementsByTagName("*"),i=0;i<eqn.length;i++)("latex"==eqn[i].getAttribute("lang")||"latex"==eqn[i].getAttribute("xml:lang"))&&(eqn[i].innerHTML=this.pre(eqn[i]))},normalizergb:function normalizergb(r,g,b){return{r:(r/255).toFixed(3),g:(g/255).toFixed(2),b:(b/255).toFixed(2)}},normalizergba:function normalizergba(r,g,b){return this.normalizergb(r,g,b)}};function in_array(needle,haystack){return"object"===("undefined"==typeof haystack?"undefined":_typeof(haystack))?_.includes(haystack,needle):needle===haystack}(function($){$.fn.drags=function(opt){if(opt=$.extend({handle:"",cursor:"move"},opt),""===opt.handle)var $el=this;else var $el=this.find(opt.handle);return $el.css("cursor",opt.cursor).on("mousedown",function(e){if(""===opt.handle)var $drag=$(this).addClass("draggable");else var $drag=$(this).addClass("active-handle").parent().addClass("draggable");var z_idx=$drag.css("z-index"),drg_h=$drag.outerHeight(),drg_w=$drag.outerWidth(),pos_y=$drag.offset().top+drg_h-e.pageY,pos_x=$drag.offset().left+drg_w-e.pageX;$drag.css("z-index",1e3).parents().on("mousemove",function(e){$(".draggable").offset({top:e.pageY+pos_y-drg_h,left:e.pageX+pos_x-drg_w}).on("mouseup",function(){$(this).removeClass("draggable").css("z-index",z_idx)})}),e.preventDefault()}).on("mouseup",function(){""===opt.handle?$(this).removeClass("draggable"):$(this).removeClass("active-handle").parent().removeClass("draggable")})},$.fn.dragsOff=function(opt){if(opt=$.extend({handle:"",cursor:"default"},opt),""===opt.handle){var $el=this;$(this).removeClass("draggable")}else{var $el=this.find(opt.handle);$(this).removeClass("active-handle").parent().removeClass("draggable")}return $el.css("cursor","default").off("mousedown").off("mouseup").off("mousemove")},$.fn.pin=function(){if("fixed"!==this.css("position")){var abs={top:this.position().top-$(document).scrollTop(),left:this.position().left-$(document).scrollLeft()};this.css({position:"fixed",left:abs.left,top:abs.top}),this.find(".pinner").removeClass("pinned").addClass("unpinned"),localStorage.pinForm=0}else{var abs={top:this.position().top+$(document).scrollTop(),left:this.position().left+$(document).scrollLeft()};this.css({position:"absolute",left:abs.left,top:abs.top}),this.find(".pinner").removeClass("unpinned").addClass("pinned"),localStorage.pinForm=1}}})(jQuery);function unwrapEmbed($fig){$fig.addClass("unwrapped");var $iw=$fig.find(".emb-iframe-wrapper");$iw.data("h")>$iw.data("w")&&$iw.addClass("vertical-video"),$iw.css({paddingBottom:100*($iw.data("h")/$iw.data("w"))+"%"});var code=$iw.data("code");if("Youtube"==$iw.data("site")){var start=$iw.data("startraw");$iw.append("<iframe src=\"https://www.youtube-nocookie.com/embed/"+code+"?autoplay=1"+(start?"&start="+start:"")+"\" "+"frameborder=\"0\" scrolling=\"no\" webkitallowfullscreen=\"\" mozallowfullscreen=\"\" allowfullscreen=\"\""+"></iframe>")}if("Vimeo"==$iw.data("site")){var _start=$iw.data("start");$iw.append("<iframe src=\"//player.vimeo.com/video/"+code+"?badge=0&autoplay=1"+(_start?"#t="+_start:"")+"\" frameborder=\"0\" scrolling=\"no\" webkitallowfullscreen=\"\" mozallowfullscreen=\"\" allowfullscreen=\"\"></iframe>")}"Coub"==$iw.data("site")&&$iw.append("<iframe src=\"http://coub.com/embed/"+code+"?muted=false&autostart=true&originalSize=false&hideTopBar=false&noSiteButtons=false&startWithHD=false\" "+"frameborder=\"0\" scrolling=\"no\" webkitallowfullscreen=\"\" mozallowfullscreen=\"\" allowfullscreen=\"\""+"></iframe>");var $ew=$fig.find(".embed-wrap");$ew.find(".collapse-video").length||$fig.find(".embed-wrap").append("\n <button title=\""+_l.collapse+"\" class=\"emb-button collapse-video\">\n "+makeIcon("shrink")+"\n </button>")}function wrapEmbed($fig){$fig.removeClass("unwrapped"),$fig.find(".emb-iframe-wrapper").empty()}function resetForm(form){var fields=form.querySelectorAll("input[type=text]:not([name=name]), input[type=file], textarea");Array.prototype.forEach.call(fields,function(field){return field.value=null}),Array.prototype.forEach.call(form.querySelectorAll(".site-indicator"),function(i){return i.remove()})}var injector={inject:function inject(alias,css){var id="injector:"+alias,existing=document.getElementById(id);if(existing)return void(existing.innerHTML=css);var head=document.head||document.getElementsByTagName("head")[0],style=document.createElement("style");style.type="text/css",style.id=id,style.styleSheet?style.styleSheet.cssText=css:style.appendChild(document.createTextNode(css)),head.appendChild(style)},remove:function remove(alias){var id="injector:"+alias,style=document.getElementById(id);if(style){var head=document.head||document.getElementsByTagName("head")[0];head&&head.removeChild(document.getElementById(id))}}};function randomString(){for(var length=0<arguments.length&&arguments[0]!==void 0?arguments[0]:10,chars=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",result="",i=length;0<i;--i)result+=chars[Math.round(Math.random()*(chars.length-1))];return result}function add_mob_menu(){$("#overlay_menu").hide(),document.body.insertAdjacentHTML("afterbegin","<div id=\"mobile-menu\"><div id=\"mobile-menu-contents\"></div></div>");var mm=document.querySelector("#mobile-menu-contents"),$mmw=$("#mobile-menu"),htm="";$("<div id=\"mmb-_options\" style=\"display: none\"></div>").append($("#ms-_options")).appendTo($(mm)),$mmw.append("<div id=\"mm-toggle\">\n <div class=\"mm-bars\"></div>\n <div id=\"mm-circle\"></div>\n </div>");var cats=boards10.list;cloud20.getBoards().then(function(b20){cats.sort(function(a,b){return+a.order>+b.order}).push({id:"20",name:"2.0",boards:b20}),cats.forEach(function(cat,ix){cat.boards&&(htm+="<a href=\"#\" class=\"mm-item mm-cat\" data-mmbx=\""+ix+"\">"+cat.name+"</a>\n <span class=\"mm-boards\" id=\"mmb-"+ix+"\">",cat.boards.forEach(function(b){b.dir=b.dir||b.name,htm+="<a class=\"mm-item mm-brd\" href=\"/"+b.dir+"\">/"+b.dir+"/ \u2014 "+b.desc+"</a>"}),htm+="</span>")}),htm+="<a href=\"#\" class=\"mm-item mm-toggle-options\" onclick=\"\n $('.mm-boards').toggle(false); \n $('#mmb-_options').slideToggle('fast');\n $('.mmc-expanded').removeClass('mmc-expanded')\n return false\n \">Options</a>",mm.insertAdjacentHTML("afterBegin",""+htm),$("#mm-toggle").click(function(){if(!$mmw.hasClass("mm-expanded")){$mmw.addClass("mm-expanded");var bcr=$mmw[0].getBoundingClientRect(),x=bcr.width-20-10,y=bcr.height-20-10,R=Math.sqrt(x*x+y*y),scale=Math.ceil(R/20);$("#mm-circle").css({transform:"scale("+scale+")"}),$(mm).css({visibility:"visible",opacity:1}),$mmw.addClass("bars-away"),setTimeout(function(){$mmw.addClass("mm-expanded-full")},300)}}),offClick.push(function(){$mmw.hasClass("mm-expanded-full")&&($mmw.removeClass("mm-expanded-full bars-away"),setTimeout(function(){$(mm).css({visibility:"hidden"}),$mmw.removeClass("mm-expanded")},300),$(mm).css({visibility:"visible",opacity:0}),$("#mm-circle").css({transform:"scale(1)"}))})}),$mmw.click(function(ev){ev.stopPropagation()}).on("click",".mm-cat[data-mmbx]",function(){var $target=$("#mmb-"+$(this).data("mmbx"));return $target.is(":visible")?($target.toggle(!1),$(this).removeClass("mmc-expanded")):($(".mm-boards").toggle(!1),$("#mmb-_options").slideUp("fast"),$target.toggle(!0),$(".mmc-expanded").removeClass("mmc-expanded"),$(this).addClass("mmc-expanded")),!1})}var boards10={get list(){var _this11=this;return this.allboards||(this.allboards=[],document.querySelectorAll(".olm-link").forEach(function(o){if(o=o.querySelector("a"),!!o){var s=o.dataset.toexpand,sd=o.innerText,sect=document.querySelector("#ms-"+s);if(s&&"20"!=s&&"_options"!=s){var section={id:s,name:sd,boards:[]};sect.querySelectorAll("a").forEach(function(a){var m=a.innerText.match(/\/(.+?)\/ - (.+)/);m&&section.boards.push({dir:m[1],desc:m[2]})}),_this11.allboards.push(section)}}})),this.allboards}},cloud20={init:function init(){var _this12=this;this.getBoards().then(function(){return _this12.filter("")}).catch(_.noop),$("#boardselect").on("input",function(){cloud20.filter($(this).val())})},getBoards:function getBoards(){var _this13=this;return new Promise(function(rs,rj){_this13.allboards?rs(_this13.allboards):$.getJSON(ku_cgipath+"/boards20.json",function(data){_this13.allboards=data,rs(data)}).fail(function(e){pups.err(_l.unable_load_20),rj(e)})})},filter:function filter(query){var res=[];"undefined"==typeof this.allboards||(""==query?res=this.allboards:(query=query.toLowerCase(),_.each(this.allboards,function(board){(-1!==board.name.toLowerCase().search(query)||-1!==board.desc.toLowerCase().search(query))&&res.push(board)})),this.display(res))},display:function display(list){var newhtml="",opts="";_.each(list,function(item){newhtml+="<a class=\"menu-item\" title=\""+item.desc+"\" href=\""+ku_boardsfolder+item.name+"/\">/"+item.name+"/ - "+item.desc+"</a>",opts+="<option value=\""+item.name+"\">/"+item.name+"/ - "+item.desc+"</option>"}),$("#boards20").html(newhtml),$(".boardsel20").append(opts)}},countries={A1:"Anonymous Proxy",A2:"Satellite Provider",O1:"Other Country",AD:"Andorra",AE:"United Arab Emirates",AF:"Afghanistan",AG:"Antigua and Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AP:"Asia/Pacific Region",AQ:"Antarctica",AR:"Argentina",AS:"American Samoa",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Aland Islands",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Bartelemey",BM:"Bermuda",BN:"Brunei Darussalam",BO:"Bolivia",BQ:"Bonaire, Saint Eustatius and Saba",BR:"Brazil",BS:"Bahamas",BT:"Bhutan",BV:"Bouvet Island",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CC:"Cocos (Keeling) Islands",CD:"Congo, The Democratic Republic of the",CF:"Central African Republic",CG:"Congo",CH:"Switzerland",CI:"Cote d'Ivoire",CK:"Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cape Verde",CW:"Curacao",CX:"Christmas Island",CY:"Cyprus",CZ:"Czech Republic",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",EU:"Europe",FI:"Finland",FJ:"Fiji",FK:"Falkland Islands (Malvinas)",FM:"Micronesia, Federated States of",FO:"Faroe Islands",FR:"France",GA:"Gabon",GB:"United Kingdom",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GS:"South Georgia and the South Sandwich Islands",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HM:"Heard Island and McDonald Islands",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IL:"Israel",IM:"Isle of Man",IN:"India",IO:"British Indian Ocean Territory",IQ:"Iraq",IR:"Iran, Islamic Republic of",IS:"Iceland",IT:"Italy",JE:"Jersey",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KM:"Comoros",KN:"Saint Kitts and Nevis",KP:"Korea, Democratic People's Republic of",KR:"Korea, Republic of",KW:"Kuwait",KY:"Cayman Islands",KZ:"Kazakhstan",LA:"Lao People's Democratic Republic",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libyan Arab Jamahiriya",MA:"Morocco",MC:"Monaco",MD:"Moldova, Republic of",ME:"Montenegro",MF:"Saint Martin",MG:"Madagascar",MH:"Marshall Islands",MK:"Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MP:"Northern Mariana Islands",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"Philippines",PK:"Pakistan",PL:"Poland",PM:"Saint Pierre and Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PS:"Palestinian Territory",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Reunion",RO:"Romania",RS:"Serbia",RU:"Russian Federation",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"Saint Helena",SI:"Slovenia",SJ:"Svalbard and Jan Mayen",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome and Principe",SV:"El Salvador",SX:"Sint Maarten",SY:"Syrian Arab Republic",SZ:"Swaziland",TC:"Turks and Caicos Islands",TD:"Chad",TF:"French Southern Territories",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Turkey",TT:"Trinidad and Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania, United Republic of",UA:"Ukraine",UG:"Uganda",UM:"United States Minor Outlying Islands",US:"United States",UY:"Uruguay",UZ:"Uzbekistan",VA:"Holy See (Vatican City State)",VC:"Saint Vincent and the Grenadines",VE:"Venezuela",VG:"Virgin Islands, British",VI:"Virgin Islands, U.S.",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis and Futuna",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe",XX:"OMCK",T1:"Tor"},bnrs={initiated:!1,init:function init(){$.getJSON(ku_boardspath+"/bnrs.json",function(data){var reduced=[];1<data.length?_.each(data,function(bnr){bnr.link!==this_board_dir&&reduced.push(bnr)}):reduced=data,bnrs.data=reduced,bnrs.initiated=!0,bnrs.display()})},display:function display(){if(this.initiated&&this.data.length){var reduced=[];"undefined"==typeof this.current?reduced=this.data:_.each(this.data,function(item){item.path!==bnrs.current&&reduced.push(item)});var toDisplay=randomItem(reduced);this.current=toDisplay.path;var link=-1===toDisplay.link.indexOf("http")?ku_boardspath+"/"+toDisplay.link:toDisplay.link,newhtml="<a class=\"bnrsupdate\" href=\"#\" onclick=\"javascript:bnrs.display();return false;\"></a><a href=\""+link+"\"><img src=\""+ku_boardspath+"/images/bnrs/"+toDisplay.path+"\" /></a>";$(".bnr").length?$(".bnr").html(newhtml):$(".logo").before("<div class=\"bnr-wrap\"><div class=\"bnr\">"+newhtml+"</div></div>")}}};function getRandomInt(min,max){return Math.floor(Math.random()*(max-min+1))+min}function randomItem(array){return array[getRandomInt(0,array.length-1)]}var ffdata={pos:["top","left"],save:function save(){var data={};_.each(ffdata.pos,function(pos){data[pos]=$("#postclone").css(pos)});var savedOn=new Date().getTime();return data.savedon=savedOn,ffdata.savedOn=savedOn,$("#postform [name=ffdata_savedon]").val(savedOn),localStorage.setItem("ffdata_"+this_board_dir+"_"+(ispage?"page":$("#postform [name=replythread]").val()),JSON.stringify(data)),!0},savedOn:!1,unload:function unload(){$("#postform [name=ffdata_savedon]").val(ffdata.savedOn||new Date().getTime())},load:function load(){var key="ffdata_"+this_board_dir+"_"+(ispage?"page":$("#postform [name=replythread]").val());if(localStorage[key])try{var data=JSON.parse(localStorage[key]);data.savedon&&data.savedon==$("#postform [name=ffdata_savedon]").val()?(_.each(ffdata.pos,function(pos){data.hasOwnProperty(pos)&&$("#postclone").css(pos,data[pos])}),$("#postclone").show()):localStorage.removeItem(key)}catch(e){localStorage.removeItem(key),console.log("unable to load form data",e)}}},embedLinks={sites:[{id:"youtube",rx:/(?:youtu(?:\.be|be\.com)\/(?:.*v(?:\/|=)|(?:.*\/)?)([\w'-]+))/i},{id:"vimeo",rx:/[\w\W]*vimeo\.com\/(?:.*?)([0-9]+)(?:.*)?/},{id:"coub",rx:/[\w\W]*coub\.com\/view\/([\w\W]*)[\w\W]*/}],process:function process(val){var result=null;return _.find(this.sites,function(site){var fruit=site.rx.exec(val);null!=fruit&&(result={site:site.id,code:fruit[1]})}),result}};window.onbeforeunload=ffdata.unload;var catalog={conf:{sortBy:"bumped",layout:"text",respectStickied:!0,showHidden:!0,expandOnHover:!0},saveConfig:function saveConfig(){localStorage.catalogSettings=JSON.stringify(this.conf)},init:function init(){if(localStorage.catalogSettings)try{var myConf=JSON.parse(localStorage.catalogSettings);_.each(myConf,function(val,key){this.conf[key]=val},this)}catch(e){console.error("Invalid catalog config"),localStorage.removeItem("catalogSettings")}_.each([["bumped","bumpOrder"],["replied","lastReply"],["timestamp","creationDate"],["reply_count","replyCount"]],function(val_desc){"<option value=\""+val_desc[0]+"\""+(val_desc[0]==this.conf.sortBy?" selected":"")+">"+_l[val_desc[1]]+"</option>"}.bind(this));var sortBtns="<div class=\"button-group\" data-select=\"sortBy\">";_.each([["bumped","bumpOrder","bump","i-20"],["timestamp","creationDate","creation","i-20"],["replied","lastReply","reply","i-16in20"],["reply_count","replyCount","replies","i-20"]],function(v_d_i){sortBtns+="<div class=\"bg-button"+(v_d_i[0]==this.conf.sortBy?" bgb-selected":"")+"\" data-val=\""+v_d_i[0]+"\" title=\""+_l.sortBy+" "+_l[v_d_i[1]]+"\"> <svg class=\"icon "+v_d_i[3]+"\"><use xlink:href=\"#i-"+v_d_i[2]+"\"></use></svg></div>"}.bind(this)),sortBtns+="</div>";var pinBtns="<div class=\"button-group"+("bumped"===this.conf.sortBy?"":" disabled")+"\" data-select=\"respectStickied\" id=\"pinControl\">";_.each([[1,"doStick","pin","i-16in20"],[0,"doNotStick","unpin","i-16in20"]],function(v_d_i){pinBtns+="<div class=\"bg-button"+(v_d_i[0]==this.conf.respectStickied?" bgb-selected":"")+"\" data-val=\""+v_d_i[0]+"\" title=\""+_l[v_d_i[1]]+"\"> <svg class=\"icon "+v_d_i[3]+"\"><use xlink:href=\"#i-"+v_d_i[2]+"\"></use></svg></div>"}.bind(this)),pinBtns+="</div>";var hideBtns="<div class=\"button-group\" data-select=\"showHidden\">";_.each([[0,"hideHidden","hide","i-16in20"],[1,"showHidden","unhide","i-16in20"]],function(v_d_i){hideBtns+="<div class=\"bg-button"+(v_d_i[0]==this.conf.showHidden?" bgb-selected":"")+"\" data-val=\""+v_d_i[0]+"\" title=\""+_l[v_d_i[1]]+"\"> <svg class=\"icon "+v_d_i[3]+"\"><use xlink:href=\"#i-"+v_d_i[2]+"\"></use></svg></div>"}.bind(this)),hideBtns+="</div>";var layoutBtns="<div class=\"button-group\" data-select=\"layout\">";_.each([["text","smallPics","grid-small","i-20"],["gallery","largePics","gallery-grid","i-20"]],function(v_d_i){layoutBtns+="<div class=\"bg-button"+(v_d_i[0]==this.conf.layout?" bgb-selected":"")+"\" data-val=\""+v_d_i[0]+"\" title=\""+_l[v_d_i[1]]+"\"> <svg class=\"icon "+v_d_i[3]+"\"><use xlink:href=\"#i-"+v_d_i[2]+"\"></use></svg></div>"}.bind(this)),layoutBtns+="</div>";var searchInput="<input name=\"subject\" autocomplete=\"false\" class=\"button-group\" type=\"text\" id=\"cat-search\" placeholder=\""+_l.search+"...\" /><input type=\"text\" name=\"FUCKYOUCHROMEFUCKYOU\" style=\"display:none;\"/>";$("#catalog-controls").html(sortBtns+pinBtns+searchInput+hideBtns+layoutBtns),this.load(),this.conf.expandOnHover&&$("#catalog-contents").addClass("expand-on-hover-enabled"),$("#catalog-contents").on("click",".namedate-overlay",function(){$(this).toggleClass("date-on name-on")}).on("click",".ce-text .bigThumb",function(ev){ev.stopPropagation(),ev.preventDefault();var $card=$(this).parents(".cat-entry");$card.toggleClass("thumbExpanded")}).on("click",".bigThumb audio, .bigThumb video",function(ev){ev.stopPropagation()}).on("animationstart webkitAnimationStart MSAnimationStart oanimationstart",function(event){var $target=$(event.target);"embed-image-insert"!=event.originalEvent.animationName||$target.hasClass("_inserted_")||this.getEmbedThumb($target)}.bind(this)).on("mousedown",".cat-prv",function(ev){ev.preventDefault(),PostPreviews._mouseover.bind(this)(ev)}).on("click",".cat-prv",function(ev){ev.stopPropagation(),ev.preventDefault()}).on("mouseleave",".cat-prv",function(ev){PostPreviews._mouseout.bind(this)(ev)}).on("click",".i-hide",function(ev){var $target=$(ev.currentTarget),$card=$target.parents(".cat-entry"),threadID=$card.data("id"),threadIX=_.findIndex(this.model,{id:threadID}),thread=this.model[threadIX];thread.hidden=!thread.hidden,thread.hidden?($target[0].classList.add("hidden-on"),$target.html(makeIcon("unhide","",!0)),HiddenThreads.hide(threadID),$card.addClass("thread-hidden")):($target[0].classList.remove("hidden-on"),$target.html(makeIcon("hide","",!0)),HiddenThreads.unhide(threadID),$card.removeClass("thread-hidden")),this.model[threadIX]=thread,delete this.rendered[this.conf.layout][threadID]}.bind(this)),$(".bg-button").click(function(ev){var $target=$(ev.currentTarget);if(!$target.hasClass("bgb-selected")){var $group=$target.parent(),val=$target.data("val"),key=$group.data("select");$group.find(".bg-button").removeClass("bgb-selected"),$target.addClass("bgb-selected"),"sortBy"!==key&&"layout"!==key?val=!!val:"bumped"==val?$("#pinControl").removeClass("disabled"):$("#pinControl").addClass("disabled"),this.conf[key]=val,this.saveConfig(),"showHidden"===key?val?$("#catalog-contents").removeClass("hideHidden"):$("#catalog-contents").addClass("hideHidden"):this.build()}}.bind(this)),$("#refresh_catalog").click(function(ev){ev.preventDefault(),this.load()}.bind(this)),$("#cat-search").on("input",function(){var query=$(this).val().toLowerCase().replace(/\"/,"\\\"");try{injector.remove("cat-search")}catch(e){}query.length?injector.inject("cat-search","#catalog-contents .cat-entry:not([data-search *= \""+query+"\"]) { display:none; }"):injector.remove("cat-search")}).trigger("input")},load:function load(){this.rendered={text:{},gallery:{}},this.model=null,$.getJSON("catalog.json?v="+new Date().getTime()).done(this.build.bind(this)).fail(function(err){throw err})},fileTypes:{image:["jpg","gif","png"],jpgThumb:["webm","cob","vim","you"],iconsAvailable:["swf","mp3","ogg","css","flv"],audio:["mp3","ogg"],embed:["cob","vim","you"]},authorities:["","Admin","Mod","?","God"],formatDate:function formatDate(timestamp,short){"undefined"==typeof short&&(short=!1);var date=new Date(1e3*timestamp),Dow=this.dateLocal.dows.hasOwnProperty(locale)?this.dateLocal.dows[locale][date.getDay()]:this.dateLocal.dows.en[date.getDay()],yy=_.padLeft(date.getFullYear()%100,2,0),mo=_.padLeft(date.getMonth()+1,2,0),Mon="ru"===locale?this.dateLocal.mons.ru[date.getMonth()]:date.getMonth()+1,dd=_.padLeft(date.getDate(),2,0),hh=_.padLeft(date.getHours(),2,0),mm=_.padLeft(date.getMinutes(),2,0),ss=_.padLeft(date.getSeconds(),2,0);return(short?"ru"===locale?dd+"."+mo+"."+yy+" \u0432 ":mo+"/"+dd+"/"+yy+" @ ":"ru"===locale?Dow+" "+dd+" "+Mon+"\u2019"+yy+" \u0432 ":mo+"/"+dd+"/"+yy+" ("+Dow+") @ ")+hh+":"+mm+":"+ss},dateLocal:{dows:{ru:["\u041F\u043D\u0434","\u0412\u0442\u0440","\u0421\u0440\u0434","\u0427\u0442\u0432","\u041F\u0442\u043D","\u0421\u0431\u0442","\u0412\u0441\u043A"],en:["Sun","Mon","Tue","Wen","Thu","Fri","Sat"]},mons:{ru:["\u042F\u043D\u0432","\u0424\u0435\u0432","\u041C\u0430\u0440","\u0410\u043F\u0440","\u041C\u0430\u0439","\u0418\u044E\u043D","\u0418\u044E\u043B","\u0410\u0432\u0433","\u0421\u0435\u043D","\u041E\u043A\u0442","\u041D\u043E\u044F","\u0414\u0435\u043A"]}},build:function build(data){if("undefined"==typeof data&&(data=this.model),!!data){if(_.each(data,function(entry,i){_.each(["id","reply_count","bumped","replied","reply_count","timestamp","page","locked","stickied","deleted_timestamp"],function(prop){entry[prop]=~~entry[prop]}),data[i]=entry}),"bumped"===this.conf.sortBy&&this.conf.respectStickied)this.model=_.sortByOrder(data,["stickied","bumped"],["desc","desc"]);else{var sby=[this.conf.sortBy];"bumped"!==this.conf.sortBy&&sby.push("bumped"),this.model=_.sortByOrder(data,sby,_.repeat("desc",sby.length))}var html="";_.each(this.model,function(thread){html+=this.buildEntry(thread)},this),$("#catalog-contents").html(html)}},getEmbedThumb:function getEmbedThumb($el){var site=$el.data("site"),id=$el.data("id"),$thread=$el.parents(".cat-entry"),threadID=$thread.data("id");"cob"==site&&$.get(ku_boardspath+"/corpsy.php?code="+id,function(res){$el.replaceWith("<img src=\""+res.thumbnail_url+"\">"),this.rendered[this.conf.layout][threadID]=$thread[0].outerHTML}.bind(this)),"vim"==site&&$.get("http://vimeo.com/api/v2/video/"+id+".json",function(res){$el.replaceWith("<img src=\""+res[0].thumbnail_medium+"\">"),this.rendered[this.conf.layout][threadID]=$thread[0].outerHTML}.bind(this))},buildEntry:function buildEntry(thread){if(this.rendered[this.conf.layout].hasOwnProperty(thread.id))return this.rendered[this.conf.layout][thread.id];if(!thread.processed){thread.url="/"+this_board_dir+"/res/"+thread.id+".html";var embed=thread.embeds?thread.embeds.find(function(e){return"removed"!=e.file})||"removed":null;if(!embed||"removed"===embed)thread.smallThumb="<a href=\""+thread.url+"\" class=\"smallThumb\"> <div class=\"nofile-removed ctx\">"+("removed"===embed?"\u0423\u0434\u0430\u043B\u0451\u043D":"No File")+"</div></a>";else{if(_.includes(this.fileTypes.image,embed.file_type)||_.includes(this.fileTypes.jpgThumb,embed.file_type)||_.includes(this.fileTypes.audio,embed.file_type)&&0<+embed.thumb_w&&0<+embed.thumb_h){var ftype=_.includes(this.fileTypes.image,embed.file_type)?embed.file_type:"jpg",thumbURL=_.includes(this.fileTypes.embed,embed.file_type)?embed.file_type+"-"+embed.file+"-":embed.file,vartype="mp3"==embed.file_type?" onerror=\"switchFileType(this)\" extset=\"jpg,png,gif\"":"";thread.smallThumb="<a href=\""+thread.url+"\" class=\"smallThumb\"> <img src=\"thumb/"+thumbURL+"c."+ftype+"\""+vartype+"></a>",thread.bigThumb="<img src=\"thumb/"+thumbURL+"s."+ftype+"\""+vartype+">"}else{var smallSrc=_.includes(this.fileTypes.iconsAvailable,embed.file_type)?"/inc/filetypes/"+embed.file_type+".png":"/inc/filetypes/generic"+(_.includes(this.fileTypes.embed,embed.file_type)?"-embed":"")+".png",expandable=_.includes(this.fileTypes.embed,embed.file_type)||_.includes(this.fileTypes.audio,embed.file_type);thread.smallThumb="<a href=\""+thread.url+"\" class=\"smallThumb\"> <img src=\""+smallSrc+"\"></a>",_.includes(this.fileTypes.audio,embed.file_type)&&(thread.bigThumb="<audio src=\"src/"+embed.file+"."+embed.file_type+"\" controls></audio>")}thread.bigThumb="<a target=\"_blank\" href=\""+thread.url+"\" class=\"bigThumb\">"+thread.bigThumb+"</a>"}thread.op="<a target=\"_blank\" title=\""+_l.goToThread+"\" target=\"_blank\" href=\""+thread.url+"\" class=\"op-number ctx\">#"+thread.id+"</a>",thread.preview="<a href=\""+thread.url+"#"+thread.id+"\" class=\"actor cat-prv\"> <svg class=\"icon\"><use xlink:href=\"#i-eye\"></use></svg> </a>";var repliesLabel="<svg class=\"icon\"><use xlink:href=\"#i-reply\"></use></svg> <span class=\"ctx reply-count\">"+thread.reply_count+"</span>";thread.last_reply&&(repliesLabel="<a href=\""+thread.url+"#"+thread.last_reply+"\" class=\"actor cat-prv\">"+repliesLabel+"</a>");var replies="<div class=\"infolabel\">"+repliesLabel+"</div>",images="<div class=\"infolabel\"> <svg class=\"icon\"><use xlink:href=\"#i-picture\"></use></svg> <span class=\"ctx image-count\">"+thread.images+"</span> </div>",page="<div class=\"infolabel il-page\"> <a title=\""+_l.threadOnPage+" "+thread.page+"\" target=\"_blank\" href=\"/"+this_board_dir+"/"+(0<thread.page?thread.page+".html":"")+"#"+thread.id+"\" class=\"actor\"> <svg class=\"icon\"><use xlink:href=\"#i-page\"></use></svg> <span class=\"ctx page-number\">"+thread.page+"</span> </a> </div>";thread.countersCombined=replies+images+page,thread.posterauthority=+thread.posterauthority,thread.nameDatePriority="date",("name"==localStorage.cat_nameDatePriority||"date"!=localStorage.cat_nameDatePriority&&(thread.name||thread.tripcode||thread.posterauthority))&&(thread.nameDatePriority="name");var poster=(thread.name?"<span class=\"ctx postername\">"+thread.name+"</span>":"")+(thread.tripcode?"<span class=\"ctx postertrip\">!"+thread.tripcode+"</span>":"")+(thread.posterauthority?"<span class=\"ctx admin\">&nbsp;##"+this.authorities[thread.posterauthority]+"##</span>":"");thread.poster="<div class=\"cat-poster\"><span class=\"ctx\">by&nbsp;</span>"+(poster||"<span class=\"ctx c-postername\">"+(this_board_defaultName||_l.anonymous)+"</span>")+"</div>";thread.date="<div class=\"ctx cat-date cat-date-long\">"+this.formatDate(thread.timestamp)+"</div>",thread.dateCompact="<div class=\"ctx cat-date cat-date-short\">"+this.formatDate(thread.timestamp,1)+"</div>",thread.searchData=_.escape(stripHTML(thread.subject+" "+thread.message).toLowerCase()),thread.message=thread.message.replace(/\\"/mg,"\""),thread.processed=!0,this.model[_.findIndex(this.model,{id:thread.id})]=thread}thread=this.buildIndicators(thread);var html=this.layouts[this.conf.layout].bind(this)(thread);return this.rendered[this.conf.layout][thread.id]=html,html},buildIndicators:function buildIndicators(thread){thread.hidden=_.includes((localStorage["hiddenThreads."+this_board_dir]||"").split(","),""+thread.id);var pin=thread.stickied?"<svg class=\"foradmin-act icon i-layer-1 i-pin\"><use xlink:href=\"#i-pin\"></use></svg>":"",lock=thread.locked?"<svg class=\"foradmin-act icon i-layer-1 i-lock\"><use xlink:href=\"#i-lock\"></use></svg>":"",deathmark=thread.deleted_timestamp?"<svg class=\"foradmin-act icon i-layer-1 i-deathmark\"><use xlink:href=\"#i-skull\"></use></svg>":"",hide="<svg class=\"actor icon i-layer-1 i-hide"+(thread.hidden?" hidden-on":"")+"\"><use xlink:href=\"#i-"+(thread.hidden?"unhide":"hide")+"\"></use></svg>";return thread.indicatorsCombined="<div class=\"indicators\"><svg class=\"actor icon i-burger foradmin-show\"><use xlink:href=\"#i-burger\"></use></svg><span class=\"i-layer-1\">"+deathmark+pin+lock+hide+"</span><span class=\"i-layer-2\"><svg class=\"actor icon i-layer-2 i-delete foradmin-show\"><use xlink:href=\"#i-x\"></use></svg><svg class=\"actor icon i-layer-2 i-dnb foradmin-show\"><use xlink:href=\"#i-and\"></use></svg><svg class=\"actor icon i-layer-2 i-ban foradmin-show\"><use xlink:href=\"#i-ban\"></use></svg></span></div>",thread},layouts:{text:function text(thread){return"<div data-id=\""+thread.id+"\" class=\"cat-entry ce-text"+(thread.hidden?" thread-hidden":"")+"\" data-search=\""+thread.searchData+"\"> <div class=\"cat-card\"> <div class=\"ce-heda\">"+thread.smallThumb+"<div class=\"cat-infoline ci-op-link\">"+thread.op+thread.indicatorsCombined+"</div> <div class=\"cat-infoline namedate-overlay "+thread.nameDatePriority+"-on\">"+thread.poster+thread.date+"</div> <div class=\"cat-infoline\">"+thread.preview+thread.countersCombined+"</div> </div> <div class=\"ce-opcontent ctx\"> <h5>"+thread.subject+"</h5>"+thread.message+"</div> </div>"+thread.bigThumb+"</div>"},gallery:function gallery(thread){return"<div data-id=\""+thread.id+"\" class=\"cat-entry ce-gallery"+(thread.hidden?" thread-hidden":"")+"\" data-search=\""+thread.searchData+"\"> <div class=\"cat-card\">"+thread.bigThumb+"<div class=\"cat-infoline\"> <div class=\"ci-op-link\">"+thread.op+"</div> <div class=\"counters\">"+thread.countersCombined+"</div> </div> <div class=\"cat-infoline\">"+thread.preview+"<div class=\"namedate-overlay "+thread.nameDatePriority+"-on\">"+thread.poster+thread.dateCompact+"</div>"+thread.indicatorsCombined+"</div> <div class=\"ce-opcontent ctx\"> <h5>"+thread.subject+"</h5>"+thread.message+"</div> </div> </div>"}}};function stripHTML(html){var tmp=document.implementation.createHTMLDocument("New").body;return tmp.innerHTML=html,tmp.textContent||tmp.innerText||""}var unreadCounter={init:function init(built){built||(built=+document.querySelector("meta[property=\"i0:buildtime\"]").content),this.lastvisits=localStorage.lastvisits?JSON.parse(localStorage.lastvisits)||{}:{};var last_ts=this.lastvisits.hasOwnProperty(boardid)?parseInt(this.lastvisits[boardid]):0;last_ts<built&&(this.lastvisits[boardid]=built,localStorage.setItem("lastvisits",JSON.stringify(this.lastvisits)))},refreshTimestamp:function refreshTimestamp(){var timestamp=0<arguments.length&&arguments[0]!==void 0?arguments[0]:Math.round(new Date().getTime()/1e3);this.lastvisits||this.init(),this.lastvisits[boardid]=timestamp,localStorage.setItem("lastvisits",JSON.stringify(this.lastvisits))},update:function update(){this.lastvisits||this.init(),$.ajax({url:"/newpostscount.php",data:this.lastvisits,dataType:"json",success:function success(data){$(".newposts-counter").remove(),$(".got-updates").removeClass("got-updates"),_.each(data,function(val,brd){if(0<+val){var valstr="<span class=\"newposts-counter\">\xA0("+val+")</span>",$brd=$(".menu-item[href=\"/"+brd+"/\"]");$brd.length&&($brd.append(valstr),$(".sect-exr[data-toexpand=\""+$brd.parents(".menu-sect").attr("id").split("ms-")[1]+"\"]").parent().addClass("got-updates")),$(".mobile-nav option[value=\""+brd+"\"]").append(valstr)}})}})}},HTMLoader={loadThread:function loadThread(boardID,threadID,done,postID){var _this14=this;$.get("?"===threadID?ku_boardspath+"/postbynumber.php?b="+boardID+"&p="+postID:ku_boardspath+"/"+boardID+"/res/"+threadID+".html?"+(force_html_nocache?Math.random():"")).then(function(data){var posts=data.match(/<div\s*?class\s*?=\s*?"[^"]*?i0svcel[^"]*?"\s*?>!i0-pd:[0-9]+\s*?<\/div\s*?>[\s\S]+?<div\s*?class\s*?=\s*?"[^"]*?i0svcel[^"]*?"\s*?>!i0-pd-end\s*?<\/div\s*?>/gi).map(function(match){var res=match.match(/<div\s*?class\s*?=\s*?"[^"]*?i0svcel[^"]*?"\s*?>!i0-pd:([0-9]+)\s*?<\/div\s*?>([\s\S]+?)<div\s*?class\s*?=\s*?"[^"]*?i0svcel[^"]*?"\s*?>!i0-pd-end\s*?<\/div\s*?>/i);return{id:+res[1],body:res[2]}});if("?"===threadID){var thrno=data.match(/<!--i0:thrno=([0-9]+)-->/);thrno&&(threadID=thrno[1])}if(posts.length){var postMap=posts.map(function(post){return _this14.cached[boardID+"_"+post.id]=post.body,post.id});"?"!==threadID&&(_this14.threadMaps[boardID+"_"+threadID]=postMap)}done()}).fail(function(err){done(err.status||"null")})},getPost:function getPost(boardID,threadID,postID,callback,secondTry){var _this15=this,cachedPost=this.cached[boardID+"_"+postID];if(cachedPost)return void callback(!1,cachedPost);if(!secondTry){var found=!1;if(boardID===this_board_dir){var $post=$("a[name="+postID+"]");if($post.length){var post=$post.parents(".postnode")[0].outerHTML;this.cached[boardID+"_"+postID]=post,found=!0,callback(!1,post)}}found||this.loadThread(boardID,threadID,function(err){err?callback(err):_this15.getPost(boardID,threadID,postID,callback,!0)},postID)}else callback(null)},getThread:function getThread(boardID,threadID,range,callback,secondTry,force){var _this16=this,threadMap=!force&&this.threadMaps[boardID+"_"+threadID];threadMap?(range&&(threadMap=threadMap.filter(function(n){return n>range[0]&&n<range[1]})),callback(!1,threadMap.reduce(function(htm,postID){return htm+_this16.cached[boardID+"_"+postID]},""))):secondTry?callback(null):this.loadThread(boardID,threadID,function(err){err?callback(err):_this16.getThread(boardID,threadID,range,callback,!0)})},cached:{},threadMaps:{}};function switchFileType(el){var exp=/\.([a-z0-9]+)(?=$|\?)/i,match=el.src.match(exp);if(match){var exts=el.getAttribute("extset").toLowerCase().split(",");if(exts.length){var i=exts.indexOf(match[1].toLowerCase());-1==i||i>=exts.length-1||(el.src=el.src.replace(exp,"."+exts[i+1]))}}}function LSfetchJSON(key){var val=null,data=localStorage[key];if("undefined"!=typeof data)try{val=JSON.parse(data)}catch(e){console.error(e),localStorage.removeItem(key)}return val}var pups={push:function push(a){var _this17=this;return a.id=(+_.uniqueId(_.now())).toString(16),this.container.insertAdjacentHTML("afterBegin",this.buildAlert(a)),a.el=document.getElementById("pup_"+a.id),a.el.style.marginTop=-a.el.getBoundingClientRect().height+"px",a.el.getBoundingClientRect(),a.el.onclick=function(){delete a.timeout,a.onHold=!1,a.old=!0,a.el.classList.add("pup-away"),a.el.style.marginTop=-a.el.getBoundingClientRect().height+"px"},a.el.onmouseenter=function(){_this17.stack.slice(0).reverse().find(function(ar){return ar.onHold=!0,ar.id==a.id})},a.el.onmouseleave=function(){_this17.stack.forEach(function(ae){ae.onHold=!1}),_this17.holdOffTimeout=setTimeout(function(){_this17.stack.forEach(function(ae){!ae.onHold&&ae.old&&ae.el&&(ae.el.classList.add("pup-away"),ae.el.style.marginTop=-a.el.getBoundingClientRect().height+"px")})},200)},this.queue.add(function(){_this17.scheduleClose(a),a.el.classList.remove("pup-pre"),a.el.style.marginTop=null,a.el.classList.remove("pup-noshadow")}),this.stack.push(a),this.save(),a.id},closeByID:function closeByID(aid){var a=this.byID(aid);a&&a.el.onclick()},queue:{stack:[],busy:!1,add:function add(fn){var _this18=this;return new Promise(function(resolve){_this18.busy?_this18.stack.push(function(){return resolve(fn())}):(_this18.timeout=setTimeout(_this18.next.bind(_this18),1e3*_this18.cooldown),_this18.busy=!0,resolve(fn()))})},next:function(){var next=this.stack.shift();next?(next(),this.timeout=setTimeout(this.next.bind(this),1e3*this.cooldown)):this.busy=!1},cooldown:.3},byID:function byID(aid){return this.stack.find(function(a){return a.id==aid})},update:function update(aid,upd){var a=this.byID(aid);"object"!==("undefined"==typeof upd?"undefined":_typeof(upd))&&(a={msg:upd}),_.extend(a,upd),this.scheduleClose(a),a.el.setAttribute("pupclass",a.cls),a.el.querySelector(".pup-wrapped").innerHTML=this.buildAlert(a,1),this.save()},buildAlert:function buildAlert(a){var contentsOnly=!!(1<arguments.length&&arguments[1]!==void 0)&&arguments[1],contents="\n <div class=\"alert-icon\">\n <svg class=\"icon\"><use xlink:href=\"#i-"+this.iconMap[a.cls]+"\"></use></svg>\n </div>\n <div class=\"alert-msg\">"+a.msg+"</div>";return contentsOnly?contents:"<div class=\"pup "+(a.old?"pup-away pup-away-full":"pup-pre pup-noshadow")+"\" pupclass=\""+a.cls+"\" id=\"pup_"+a.id+"\">\n <div class=\"pup-wrapped\">\n "+contents+"\n </div>\n </div>"},iconMap:{succ:"success",err:"error",info:"info",warn:"warning"},historyToggle:function historyToggle(){var _this19=this;if(!this.stack.length)return void this.push({cls:"info",msg:_l.historyEmpty,destroy:!0});var on=this.container.classList.toggle("history-mode");setTimeout(function(){return _this19.container.style.overflow=on?"auto":null},on?300:0)},scheduleClose:function scheduleClose(a){a.timeout&&clearTimeout(a.timeout),a.onHold&&(a.onHold=!1);var time=a.time||0===a.time?a.time:this.defaultTimeout;time&&(a.timeout=setTimeout(function(){a.old=!0,a.onHold||(a.el.classList.add("pup-away"),a.el.style.marginTop=-a.el.getBoundingClientRect().height+"px")},1e3*time))},defaultTimeout:3.5,init:function init(){var _this20=this,container_id=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"pups-container";if(document.body.insertAdjacentHTML("beforeEnd","<div id=\""+container_id+"\"><div class=\"pup-history-shadow\"></div></div>"),this.container=document.getElementById(container_id),!this.container)return void console.error("No popup container found");this.container.onclick=function(){if(_this20.container.classList.contains("history-mode"))return _this20.historyToggle()},["err","warn","info","succ","wait"].forEach(function(pupclass){_this20[pupclass]=function(a){var options=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return"object"!==("undefined"==typeof a?"undefined":_typeof(a))&&(a={msg:a}),a.cls=pupclass,_.extend(a,options),this.push(a)}});var log=LSfetchJSON("I0_event_log")||[];log.forEach(function(a){a.old=!0,_this20.container.insertAdjacentHTML("afterBegin",_this20.buildAlert(a)),_this20.stack.push(a)})},historySize:10,save:function save(){var ss=[];for(_.cloneDeep(this.stack).forEach(function(a){a.save&&(["old","onHold","timeout","el","save"].forEach(function(junkProperty){return delete a[junkProperty]}),ss.push(a))});ss.length>this.historySize;)ss.shift();localStorage.I0_event_log=JSON.stringify(ss)},stack:[]};
//# sourceMappingURL=kusaba.new.js.map