7 lines
63 KiB
JavaScript
7 lines
63 KiB
JavaScript
/*!
|
||
* mybb-april-fools 1.1.2 (01.04.2024)
|
||
* https://forumd.ru/viewtopic.php?id=7372
|
||
* Система первоапрельских розыгрышей для форумов MyBB
|
||
* @author kozhilya
|
||
* @license https://forumd.ru/viewtopic.php?id=5751#rule
|
||
*/(()=>{"use strict";var __webpack_modules__={915:(t,e,i)=>{i.d(e,{A:()=>n});const n='<button class="april-fools__button">🎉</button> '},841:(t,e,i)=>{i.d(e,{A:()=>n});const n='<style class="april-fools__styles">.april-fools__button{position:fixed;bottom:.2rem;right:.2rem;padding:0;font-size:3rem;border:0 solid;background:transparent none;opacity:.3;transition:.4s all;cursor:pointer}.april-fools__button:hover{opacity:1}.april-fools__joke-row{border-bottom:1px solid #000}.april-fools__joke-row:first-of-type{border-top:1px solid #000}.april-fools__joke{display:flex;flex-flow:row wrap;padding:10px;opacity:.5;justify-content:space-between;align-items:center;gap:1ch;cursor:pointer}.april-fools__joke:hover{text-shadow:0 0 #000}.april-fools__joke:before{display:block;flex:0 0 2ch;text-align:center;content:"✔";opacity:0}input.april-fools__joke-input:checked+.april-fools__joke{opacity:1}input.april-fools__joke-input:checked+.april-fools__joke:before{opacity:1}.april-fools__joke .april-fools__joke-title{flex:1 auto;font-weight:700}.april-fools__joke .april-fools__joke-description{flex:1 auto;text-align:right}.april-fools__joke .april-fools__joke-chance{flex:0 0 4ch;text-align:right}.april-fools__content .april-fools__reset-button{display:block;margin:10px auto}body:has(.april-fools__joke__fresh-grass),html:has(.april-fools__joke__fresh-grass){position:fixed;width:100%;left:0;top:var(--fresh-grass-body-top)}.april-fools__joke__fresh-grass{position:fixed;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background-color:#008000C0;z-index:1000}.april-fools__joke__fresh-grass__window{height:100%;width:100%;display:flex;flex-flow:column nowrap;align-items:center;justify-content:center;user-select:none}.april-fools__joke__fresh-grass__window h4{position:absolute;top:0;color:#fff;margin:1vh 0;font-size:2vh;line-height:2vh;text-align:center}.april-fools__joke__fresh-grass__window small{position:absolute;bottom:0}.april-fools__joke__fresh-grass__window img{display:block;max-width:10vw;max-height:10vh}</style> '},863:(t,e,i)=>{i.d(e,{A:()=>n});const n='<div class="april-fools__content"> <div class="april-fools__jokes"></div> <button class="april-fools__reset-button"> Вернуться к настройкам форума (страница будет перезагружена!) </button> </div> <template class="april-fools__template" id="april-fools__window-row"> <div class="april-fools__joke-row"> <input type="checkbox" class="april-fools__joke-input" name="april-fools__joke-${joke.id}" id="april-fools__joke-${joke.id}" style="display:none"/> <label class="april-fools__joke" for="april-fools__joke-${joke.id}"> <span class="april-fools__joke-title">${joke.title}</span> <span class="april-fools__joke-description">${joke.description}</span> <span class="april-fools__joke-chance">${joke.settings.chance}%</span> </label> </div> </template> '},248:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{m:()=>JokerUI});var jquery__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(669),jquery__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__),_html_button_html__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(915),_html_styles_html__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(841),_html_window_html__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(863);class JokerUI{constructor(t){this.joker=t,jquery__WEBPACK_IMPORTED_MODULE_0___default()('link[rel="stylesheet"]').eq(0).before(_html_styles_html__WEBPACK_IMPORTED_MODULE_1__.A);t=this.button;t.hide(),t.mybbModal({title:"Настройки первоапрельских шуток",content:()=>this.render(),closer:!0,noscroll:!0,escClose:!0})}get button(){let t=jquery__WEBPACK_IMPORTED_MODULE_0___default()(".april-fools__button");return t=0===t.length?jquery__WEBPACK_IMPORTED_MODULE_0___default()(_html_button_html__WEBPACK_IMPORTED_MODULE_2__.A).appendTo("body"):t}show(){this.button.show()}render(){const result=jquery__WEBPACK_IMPORTED_MODULE_0___default()("<div></div>").html(_html_window_html__WEBPACK_IMPORTED_MODULE_3__.A),rowTemplate=jquery__WEBPACK_IMPORTED_MODULE_0___default()("#april-fools__window-row",result).html(),jokeContainer=jquery__WEBPACK_IMPORTED_MODULE_0___default()(".april-fools__jokes",result);for(const joke of Object.values(this.joker.jokes)){const row=jquery__WEBPACK_IMPORTED_MODULE_0___default()(eval("`"+rowTemplate+"`"));jquery__WEBPACK_IMPORTED_MODULE_0___default()('input[type="checkbox"]',row).prop("checked",joke.settings.enabled).on("click",t=>{t=t.currentTarget;this.joker.toggleJoke(joke.id,t.checked)}),jokeContainer.append(row)}return jquery__WEBPACK_IMPORTED_MODULE_0___default()("button",result).on("click",async()=>{await this.joker.clearUserStates(),window.location.reload()}),jquery__WEBPACK_IMPORTED_MODULE_0___default()(".april-fools__content",result)}}},669:t=>{t.exports=jQuery}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];return void 0!==e||(e=__webpack_module_cache__[t]={exports:{}},__webpack_modules__[t](e,e.exports,__webpack_require__)),e.exports}__webpack_require__.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return __webpack_require__.d(e,{a:e}),e},__webpack_require__.d=(t,e)=>{for(var i in e)__webpack_require__.o(e,i)&&!__webpack_require__.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var __webpack_exports__={};(()=>{class s{constructor(){this.enabled=!0,this.chance=20}}class o{get settings(){return this._settings}set settings(t){for(const n of Object.entries(t)){var e=n[0],i=n[1];switch(e){case"name":case"title":this.title=i;break;case"description":this.description=i;break;default:this._settings[e]=i}}}check(t){return Math.random()<.01*t}enable(){this.settings.enabled=!0}disable(){this.settings.enabled=!1}toggle(t=null){this.settings.enabled=null===t?!this.settings.enabled:t}}class i extends o{}var r,t=__webpack_require__(248),e=__webpack_require__(669),a=__webpack_require__.n(e);function n(t){return a()(t).find("*").contents().filter((t,e)=>e.nodeType===Node.TEXT_NODE)}let h=(e=document.currentScript)instanceof HTMLScriptElement&&!/\.min\.js$/.test(e.src);function l(...t){h&&console.log(...t)}function c(e,...i){let n="";for(let t=0;t<e.length;t++)n+=e[t],t<i.length&&(n+=(s=i[t],Number(s)===s&&s%1!=0?i[t].toFixed(2):i[t]));var s;return n}class d{constructor(){this.ui=new t.m(this),this.core_settings=new u,this.jokes={}}get settings(){var t={};t.core=this.core_settings;for(const n of Object.entries(this.jokes)){var e=n[0],i=n[1];t[e]=i.settings}return t}set settings(t){for(const n of Object.entries(t)){var e=n[0],i=n[1],e="core"===e?this.core_settings:this.jokes[e].settings;Object.assign(e,i)}}check(t){return Math.random()<.01*t}add(t){this.jokes[t.id]=t}addCustom(t,e,i=null){var n=new class extends o{constructor(){super(...arguments),this.id=t,this.title="Пользовательская шутка",this.description="Для шутки не определено описание",this._settings=new s}start(){e.call(this,this.settings)}};return n.settings=i,this.add(n),n}enable(){this.core_settings.enabled=!0}disable(){this.core_settings.enabled=!1}enableAll(){for(const t of Object.keys(this.jokes))this.jokes[t].enable()}disableAll(){for(const t of Object.keys(this.jokes))this.jokes[t].disable()}toggleJoke(t,e){t=this.jokes[t];t.settings.enabled=e,t instanceof i&&!e&&t.stop(),this.saveUserStates()}saveUserStates(){var t={};for(const e of Object.keys(this.jokes))t[e]=this.jokes[e].settings.enabled;fetch("/api.php?"+$.param({method:"storage.set",user_id:window.UserID,key:"april-fools",token:window.ForumAPITicket,value:JSON.stringify(t),timer:1440})).then(t=>{})}async loadUserStates(){var t=await(await fetch("/api.php?"+$.param({method:"storage.get",user_id:window.UserID,key:"april-fools"}))).json();if(!t.error){var e=JSON.parse(t.response.storage.data["april-fools"]);for(const i of Object.keys(this.jokes))this.jokes[i].settings.enabled=e[i]}}async clearUserStates(){await fetch("/api.php?"+$.param({method:"storage.delete",user_id:window.UserID,key:"april-fools",token:window.ForumAPITicket}))}start(t,e=!1){t in this.jokes&&(t=this.jokes[t],e||t.settings.enabled&&this.check(t.settings.chance)?(l(t.title,"- шутка включена"),t.start()):l(t.title,"- шутка не включена"))}startAll(t=!1){for(const e of Object.keys(this.jokes))this.start(e,t)}regularCheck(){var t,e;return!!this.core_settings.enabled&&(0<=this.core_settings.testers.indexOf(window.UserID)||(t=(e=new Date).getMonth()+1,e=e.getDate(),4===t&&1===e&&this.check(this.core_settings.chance)))}async regularStart(){this.regularCheck()&&(await this.loadUserStates(),this.ui.show(),this.startAll())}}class u{constructor(){this.chance=100,this.enabled=!0,this.testers=[]}}i;class p{constructor(){this.enabled=!1,this.chance=1,this.directions=["top","left","bottom","left"],this.force=.5,this.selector="[id^=pun]",this.interval=100}}o;class g{constructor(){this.enabled=!0,this.chance=20,this.selector=".post-content"}}o;class f{constructor(){this.enabled=!1,this.chance=30}}o;class m{constructor(){this.enabled=!0,this.chance=30,this.selector='img[src*="/avatars/"]',this.variant_chance=20,this.variants={"sepia({0}%)":100,"saturate({0}%)":100,"hue-rotate({0}deg)":360,"invert({0}%)":100}}}o;class A{constructor(){this.enabled=!0,this.chance=20,this.selector=".pa-author a"}}o;class w{constructor(){this.enabled=!0,this.chance=20,this.selector=".post-content",this.shuffle_chance=50}}function _(t){let s,o,n,r,a=t&&t.emoji||"🤪",h=t&&t.element,l=h||document.body,c=window.innerWidth,d=window.innerHeight,u={x:c/2,y:c/2},p=[];const g=window.matchMedia("(prefers-reduced-motion: reduce)");function e(){if(g.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init");s=document.createElement("canvas"),o=s.getContext("2d"),s.style.top="0px",s.style.left="0px",s.style.pointerEvents="none",h?(s.style.position="absolute",l.appendChild(s),s.width=l.clientWidth,s.height=l.clientHeight):(s.style.position="fixed",document.body.appendChild(s),s.width=c,s.height=d),o.font="16px serif",o.textBaseline="middle",o.textAlign="center";var t=o.measureText(a),e=document.createElement("canvas"),i=e.getContext("2d");e.width=t.width,e.height=2*t.actualBoundingBoxAscent,i.textAlign="center",i.font="16px serif",i.textBaseline="middle",i.fillText(a,e.width/2,t.actualBoundingBoxAscent),r=e;let n=0;for(n=0;n<7;n++)p[n]=new y(r);l.addEventListener("mousemove",A),l.addEventListener("touchmove",m,{passive:!0}),l.addEventListener("touchstart",m,{passive:!0}),window.addEventListener("resize",f),w()}function f(t){c=window.innerWidth,d=window.innerHeight,h?(s.width=l.clientWidth,s.height=l.clientHeight):(s.width=c,s.height=d)}function m(t){var e;0<t.touches.length&&(h?(e=l.getBoundingClientRect(),u.x=t.touches[0].clientX-e.left,u.y=t.touches[0].clientY-e.top):(u.x=t.touches[0].clientX,u.y=t.touches[0].clientY))}function A(t){var e;h?(e=l.getBoundingClientRect(),u.x=t.clientX-e.left,u.y=t.clientY-e.top):(u.x=t.clientX,u.y=t.clientY)}function w(){s.width=s.width,p[0].position.x=u.x,p[0].position.y=u.y;for(let t=1;t<7;t++){var e=new _(0,0);0<t&&v(t-1,t,e),t<6&&v(t+1,t,e);var i=new _(10*-p[t].velocity.x,10*-p[t].velocity.y),e=new _(+(e.X+i.X),+(e.Y+i.Y)+50);p[t].velocity.x+=.01*e.X,p[t].velocity.y+=.01*e.Y,Math.abs(p[t].velocity.x)<.1&&Math.abs(p[t].velocity.y)<.1&&Math.abs(e.X)<.1&&Math.abs(e.Y)<.1&&(p[t].velocity.x=0,p[t].velocity.y=0),p[t].position.x+=p[t].velocity.x,p[t].position.y+=p[t].velocity.y,i=s.clientHeight,e=s.clientWidth,p[t].position.y>=i-11-1&&(0<p[t].velocity.y&&(p[t].velocity.y=.7*-p[t].velocity.y),p[t].position.y=i-11-1),p[t].position.x>=e-11&&(0<p[t].velocity.x&&(p[t].velocity.x=.7*-p[t].velocity.x),p[t].position.x=e-11-1),p[t].position.x<0&&(p[t].velocity.x<0&&(p[t].velocity.x=.7*-p[t].velocity.x),p[t].position.x=0),p[t].draw(o)}n=requestAnimationFrame(w)}function i(){s.remove(),cancelAnimationFrame(n),l.removeEventListener("mousemove",A),l.removeEventListener("touchmove",m),l.removeEventListener("touchstart",m),window.addEventListener("resize",f)}function _(t,e){this.X=t,this.Y=e}function v(t,e,i){var n=p[t].position.x-p[e].position.x,t=p[t].position.y-p[e].position.y,e=Math.sqrt(n*n+t*t);10<e&&(i.X+=n/e*(n=10*(e-10)),i.Y+=t/e*n)}function y(t){this.position={x:u.x,y:u.y},this.velocity={x:0,y:0},this.canv=t,this.draw=function(t){t.drawImage(this.canv,this.position.x-this.canv.width/2,this.position.y-this.canv.height/2,this.canv.width,this.canv.height)}}return g.onchange=()=>{(g.matches?i:e)()},e(),{destroy:i}}function v(t){let e,o,i,s=t&&t.element,r=s||document.body,a=window.innerWidth,h=window.innerHeight,l={x:a/2,y:a/2},c=[];const d=t?.particles||15,u=t?.rate||.4,n=t?.baseImageSrc||"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAATCAYAAACk9eypAAAAAXNSR0IArs4c6QAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAhGVYSWZNTQAqAAAACAAFARIAAwAAAAEAAQAAARoABQAAAAEAAABKARsABQAAAAEAAABSASgAAwAAAAEAAgAAh2kABAAAAAEAAABaAAAAAAAAAEgAAAABAAAASAAAAAEAA6ABAAMAAAABAAEAAKACAAQAAAABAAAADKADAAQAAAABAAAAEwAAAAAChpcNAAAACXBIWXMAAAsTAAALEwEAmpwYAAABWWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgpMwidZAAABqElEQVQoFY3SPUvDQBgH8BREpRHExYiDgmLFl6WC+AYmWeyLg4i7buJX8DMpOujgyxGvUYeCgzhUQUSKKLUS0+ZyptXh8Z5Ti621ekPyJHl+uftfomhaf9Ei5JyxXKfynyEA6EYcLHpwyflT958GAQ7DTABNHd8EbtDbEH2BD5QEQmi2mM8P/Iq+A0SzszEg+3sPjDnDdVEtQKQbMUidHD3xVzf6A9UDEmEm+8h9KTqTVUjT+vB53aHrCbAPiceYq1dQI1Aqv4EhMll0jzv+Y0yiRgCnLRSYyDQHVoqUXe4uKL9l+L7GXC4vkMhE6eW/AOJs9k583ORDUyXMZ8F5SVHVVnllmPNKSFagAJ5DofaqGXw/gHBYg51dIldkmknY3tguv3jOtHR4+MqAzaraJXbEhqHhcQlwGSOi5pytVQHZLN5s0WNe8HPrLYlFsO20RPHkImxsbmHdLJFI76th7Z4SeuF53hTeFLvhRCJRCTKZKxgdnRDbW+iozFJbBMw14/ElwGYc0egMBMFzT21f5Rog33Z7dX02GBm7WV5ZfT5Nn5bE3zuCDe9UxdTpNvK+5AAAAABJRU5ErkJggg==";let p=!1,g=new Image;g.src=n;const f=window.matchMedia("(prefers-reduced-motion: reduce)");function m(){if(f.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init");e=document.createElement("canvas"),o=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",s?(e.style.position="absolute",r.appendChild(e),e.width=r.clientWidth,e.height=r.clientHeight):(e.style.position="fixed",document.body.appendChild(e),e.width=a,e.height=h),r.addEventListener("mousemove",w),window.addEventListener("resize",A),_()}function A(t){a=window.innerWidth,h=window.innerHeight,s?(e.width=r.clientWidth,e.height=r.clientHeight):(e.width=a,e.height=h)}function w(t){if(s){const e=r.getBoundingClientRect();l.x=t.clientX-e.left,l.y=t.clientY-e.top}else l.x=t.clientX,l.y=t.clientY;if(!1===p){p=!0;for(let t=0;t<d;t++)e=l.x,i=l.y,n=g,c.push(new y(e,i,n))}var e,i,n}function _(){{o.clearRect(0,0,a,h);let n=l.x,s=l.y;c.forEach(function(t,e,i){e=i[e+1]||i[0];t.position.x=n,t.position.y=s,t.move(o),n+=(e.position.x-t.position.x)*u,s+=(e.position.y-t.position.y)*u})}i=requestAnimationFrame(_)}function v(){e.remove(),cancelAnimationFrame(i),r.removeEventListener("mousemove",w),window.addEventListener("resize",A)}function y(t,e,i){this.position={x:t,y:e},this.image=i,this.move=function(t){t.drawImage(this.image,this.position.x,this.position.y)}}return f.onchange=()=>{(f.matches?v:m)()},m(),{destroy:v}}function y(t){let e,r,i,n=t&&t.element,s=n||document.body,a=window.innerWidth,h=window.innerHeight,l={x:a/2,y:a/2},c=[];const o=t?.length||20,d=t?.colors||["#FE0000","#FD8C00","#FFE500","#119F0B","#0644B3","#C22EDC"],u=t?.size||3;let p=!1;const g=window.matchMedia("(prefers-reduced-motion: reduce)");function f(){if(g.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init");e=document.createElement("canvas"),r=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",n?(e.style.position="absolute",s.appendChild(e),e.width=s.clientWidth,e.height=s.clientHeight):(e.style.position="fixed",document.body.appendChild(e),e.width=a,e.height=h),s.addEventListener("mousemove",A),window.addEventListener("resize",m),w()}function m(t){a=window.innerWidth,h=window.innerHeight,n?(e.width=s.clientWidth,e.height=s.clientHeight):(e.width=a,e.height=h)}function A(t){if(n){const e=s.getBoundingClientRect();l.x=t.clientX-e.left,l.y=t.clientY-e.top}else l.x=t.clientX,l.y=t.clientY;if(!1===p){p=!0;for(let t=0;t<o;t++)e=l.x,i=l.y,c.push(new v(e,i))}var e,i}function w(){{r.clearRect(0,0,a,h),r.lineJoin="round";let n=[],s=l.x,o=l.y;c.forEach(function(t,e,i){e=i[e+1]||i[0];t.position.x=s,t.position.y=o,n.push({x:s,y:o}),s+=.4*(e.position.x-t.position.x),o+=.4*(e.position.y-t.position.y)}),d.forEach((t,i)=>{r.beginPath(),r.strokeStyle=t,n.length&&r.moveTo(n[0].x,n[0].y+i*(u-1)),n.forEach((t,e)=>{0!==e&&r.lineTo(t.x,t.y+i*u)}),r.lineWidth=u,r.lineCap="round",r.stroke()})}i=requestAnimationFrame(w)}function _(){e.remove(),cancelAnimationFrame(i),s.removeEventListener("mousemove",A),window.addEventListener("resize",m)}function v(t,e){this.position={x:t,y:e}}return g.onchange=()=>{(g.matches?_:f)()},f(),{destroy:_}}function x(t){let e,o,r,i=t&&t.element,n=i||document.body,a=window.innerWidth,h=window.innerHeight,l={x:a/2,y:a/2};const O=t&&t.dateColor||"blue",W=t&&t.faceColor||"black",P=t&&t.secondsColor||"red",Y=t&&t.minutesColor||"black",F=t&&t.hoursColor||"black",c=.4,H=t&&t.theDays||["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"],U=t&&t.theMonths||["JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"];var t=new Date,X=t.getDate(),z=t.getYear()+1900;const s=(" "+H[t.getDay()]+" "+X+" "+U[t.getMonth()]+" "+z).split(""),d=["3","4","5","6","7","8","9","10","11","12","1","2"],u=d.length,p=["•","•","•"],g=["•","•","•","•"],f=["•","•","•","•","•"],m=360/u,A=360/s.length,w=45/6.5,_=[],v=[],y=[],x=[],b=[],E=[],M=[],k=[],C=[];var j=parseInt(s.length+u+p.length+g.length+f.length)+1;const L=window.matchMedia("(prefers-reduced-motion: reduce)");function B(){if(L.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init");e=document.createElement("canvas"),o=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",i?(e.style.position="absolute",n.appendChild(e),e.width=n.clientWidth,e.height=n.clientHeight):(e.style.position="fixed",document.body.appendChild(e),e.width=a,e.height=h),o.font="10px sans-serif",o.textAlign="center",o.textBaseline="middle";for(let t=0;t<j;t++)_[t]=0,v[t]=0,y[t]=0,x[t]=0;for(let t=0;t<s.length;t++)C[t]={color:O,value:s[t]};for(let t=0;t<d.length;t++)k[t]={color:W,value:d[t]};for(let t=0;t<p.length;t++)M[t]={color:F,value:p[t]};for(let t=0;t<g.length;t++)E[t]={color:Y,value:g[t]};for(let t=0;t<f.length;t++)b[t]={color:P,value:f[t]};n.addEventListener("mousemove",S),n.addEventListener("touchmove",D,{passive:!0}),n.addEventListener("touchstart",D,{passive:!0}),window.addEventListener("resize",R),I()}function R(t){a=window.innerWidth,h=window.innerHeight,i?(e.width=n.clientWidth,e.height=n.clientHeight):(e.width=a,e.height=h)}function D(t){var e;0<t.touches.length&&(i?(e=n.getBoundingClientRect(),l.x=t.touches[0].clientX-e.left,l.y=t.touches[0].clientY-e.top):(l.x=t.touches[0].clientX,l.y=t.touches[0].clientY))}function S(t){var e;i?(e=n.getBoundingClientRect(),l.x=t.clientX-e.left,l.y=t.clientY-e.top):(l.x=t.clientX,l.y=t.clientY)}function I(){y[0]=Math.round(_[0]+=(l.y-_[0])*c),x[0]=Math.round(v[0]+=(l.x-v[0])*c);for(let t=1;t<j;t++)y[t]=Math.round(_[t]+=(y[t-1]-_[t])*c),x[t]=Math.round(v[t]+=(x[t-1]-v[t])*c),_[t-1]>=h-80&&(_[t-1]=h-80),v[t-1]>=a-80&&(v[t-1]=a-80);o.clearRect(0,0,a,h);var t=new Date,e=t.getSeconds(),i=Math.PI*(e-15)/30,e=t.getMinutes(),n=Math.PI*(e-15)/30,e=t.getHours(),s=Math.PI*(e-3)/6+Math.PI*parseInt(t.getMinutes())/360;for(let t=0;t<C.length;t++)C[t].y=_[t]+67.5*Math.sin(-i+t*A*Math.PI/180),C[t].x=v[t]+67.5*Math.cos(-i+t*A*Math.PI/180),o.fillStyle=C[t].color,o.fillText(C[t].value,C[t].x,C[t].y);for(let t=0;t<k.length;t++)k[t].y=_[C.length+t]+45*Math.sin(t*m*Math.PI/180),k[t].x=v[C.length+t]+45*Math.cos(t*m*Math.PI/180),o.fillStyle=k[t].color,o.fillText(k[t].value,k[t].x,k[t].y);for(let t=0;t<M.length;t++)M[t].y=_[C.length+u+t]+0+t*w*Math.sin(s),M[t].x=v[C.length+u+t]+0+t*w*Math.cos(s),o.fillStyle=M[t].color,o.fillText(M[t].value,M[t].x,M[t].y);for(let t=0;t<E.length;t++)E[t].y=_[C.length+u+M.length+t]+0+t*w*Math.sin(n),E[t].x=v[C.length+u+M.length+t]+0+t*w*Math.cos(n),o.fillStyle=E[t].color,o.fillText(E[t].value,E[t].x,E[t].y);for(let t=0;t<b.length;t++)b[t].y=_[C.length+u+M.length+E.length+t]+0+t*w*Math.sin(i),b[t].x=v[C.length+u+M.length+E.length+t]+0+t*w*Math.cos(i),o.fillStyle=b[t].color,o.fillText(b[t].value,b[t].x,b[t].y);r=requestAnimationFrame(I)}function T(){e.remove(),cancelAnimationFrame(r),n.removeEventListener("mousemove",S),n.removeEventListener("touchmove",D),n.removeEventListener("touchstart",D),window.addEventListener("resize",R)}return L.onchange=()=>{(L.matches?T:B)()},B(),{destroy:T}}function b(t){let e,s,o,i=t||{},n=t&&t.element,r=n||document.body,a=i.text?" "+t.text:" Your Text Here",h=t?.color||"#000000",l=i.font||"monospace",c=i.textSize||12,d=c+"px "+l,u=i.gap||c+2,p=0,g=[],f=window.innerWidth,m=window.innerHeight,A={x:f/2,y:f/2};for(let t=0;t<a.length;t++)g[t]={letter:a.charAt(t),x:f/2,y:f/2};t?.size;const w=window.matchMedia("(prefers-reduced-motion: reduce)");function _(){if(w.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init");e=document.createElement("canvas"),s=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",n?(e.style.position="absolute",r.appendChild(e),e.width=r.clientWidth,e.height=r.clientHeight):(e.style.position="fixed",document.body.appendChild(e),e.width=f,e.height=m),r.addEventListener("mousemove",y),window.addEventListener("resize",v),x()}function v(t){f=window.innerWidth,m=window.innerHeight,n?(e.width=r.clientWidth,e.height=r.clientHeight):(e.width=f,e.height=m)}function y(t){var e;n?(e=r.getBoundingClientRect(),A.x=t.clientX-e.left,A.y=t.clientY-e.top):(A.x=t.clientX,A.y=t.clientY)}function x(){s.clearRect(0,0,f,m),p+=.15;var t=2*Math.cos(p),e=5*Math.sin(p);for(let t=g.length-1;0<t;t--)g[t].x=g[t-1].x+u,g[t].y=g[t-1].y,s.fillStyle=h,s.font=d,s.fillText(g[t].letter,g[t].x,g[t].y);var i=g[0].x,n=g[0].y;i+=(A.x-i)/5+t+2,n+=(A.y-n)/5+e,g[0].x=i,g[0].y=n,o=requestAnimationFrame(x)}function b(){e.remove(),cancelAnimationFrame(o),r.removeEventListener("mousemove",y),window.addEventListener("resize",v)}return w.onchange=()=>{(w.matches?b:_)()},_(),{destroy:b}}i;(e=r=r||{}).Rainbow="rainbow",e.FairyDust="fairy_dust",e.SpringyEmoji="springy_emoji",e.Emoji="emoji",e.Ghost="ghost",e.Trailing="trailing",e.TextFlag="text_flag",e.FollowingDot="following_dot",e.Bubbles="bubbles",e.Snowflake="snowflake",e.Clock="clock";class E{constructor(){this.enabled=!0,this.chance=100,this.effects={[r.Rainbow]:new class extends M{constructor(){super(...arguments),this.length=20,this.size=3,this.colors=["#9400D3","#4B0082","#0000FF","#00FF00","#FFFF00","#FF7F00","#FF0000"]}},[r.SpringyEmoji]:new class extends M{constructor(){super(...arguments),this.emoji="🤪"}},[r.Emoji]:new class extends M{constructor(){super(...arguments),this.emoji=["🔥","🐬","🦆"]}},[r.FairyDust]:new class extends M{constructor(){super(...arguments),this.colors=["#ff0000","#00ff00","#0000ff"]}},[r.Ghost]:new M,[r.Trailing]:new class extends M{constructor(){super(...arguments),this.particles=15,this.rate=.4,this.baseImageSrc=null}},[r.TextFlag]:new class extends M{constructor(){super(...arguments),this.text="С днём смеха!",this.color="#000000",this.font="monospace",this.textSize=12,this.gap=14,this.size=3}},[r.FollowingDot]:new class extends M{constructor(){super(...arguments),this.color="#323232a6"}},[r.Bubbles]:new M,[r.Snowflake]:new class extends M{constructor(){super(...arguments),this.weight=0}},[r.Clock]:new class extends M{constructor(){super(...arguments),this.dateColor="blue",this.faceColor="black",this.secondsColor="red",this.minutesColor="black",this.hoursColor="black"}}}}}class M extends class{}{constructor(){super(...arguments),this.enabled=!0,this.weight=50}}o;class k{constructor(){this.enabled=!0,this.chance=100,this.gender_resolver=null,this.rude=!1,this.change_frequency=5,this.schemas={"{adj} {noun}{p}":10,"{noun} {adj}{p}":3,"{adj}, {adj} {noun}{p}":10,"{adj} и очень {adj} {noun}{p}":10,"{adj} {noun} {verb}{p}":10,"{adj} {noun} {adv} {verb}{p}":5,"{adj} {noun} {verb} {place}{p}":5,"{adj} {noun} {adv} {verb} {place}{p}":5},this.variants={adj:{},noun:{},verb:{},place:{},adv:{},p:{"":new C({weight:15}),".":new C({weight:10}),"...":new C({weight:5}),"!":new C({weight:5}),"!!!":new C({weight:2}),"?":new C({weight:2}),"?!":new C({weight:1})}}}}class C{constructor(t){this.weight=10,this.enabled=!0,this.rude=!1,(this.gender=null)==this.weight&&(this.weight=t.weight),null==this.enabled&&(this.enabled=t.enabled),null==this.rude&&(this.rude=t.rude),null==this.gender&&(this.gender=t.gender)}}function j(i,t){const n={};return t.split(",").map(t=>t.trim()).forEach(t=>{var e=t.replace(/[^А-ЯЁа-яёA-Za-z\- ]/g,"");""!==e&&(n[e]=new C({gender:i,rude:0<=t.indexOf("$"),enabled:t.indexOf("!")<0,weight:10*(0<=t.indexOf("$")?.5:1)*(0<=t.indexOf("%")?.5:1)*(0<=t.indexOf("^")?2:1)}))}),n}window.BuildStupidTitleVariant=j;o;class L{constructor(){this.enabled=!0,this.chance=10}}o;class B{constructor(){this.enabled=!0,this.chance=10,this.selector=".post-content",this.ruToEn={"а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ё":"e","ж":"j","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"shch","ъ":"ie","ы":"y","ь":"","э":"e","ю":"u","я":"ya"},this.enToRu={a:"а",b:"б",c:"с",d:"д",e:"е",f:"ф",gh:"ж",g:"г",h:"х",i:"и",j:"й",k:"к",l:"л",m:"м",n:"н",o:"о",p:"п",q:"кью",r:"р",s:"с",t:"т",u:"ю",v:"в",w:"в",x:"кс",y:"ы",z:"з"}}}class R{constructor(t=0,e=0){this.x=t,this.y=e}get angle(){return Math.atan2(this.y,this.x)}set angle(t){var e=this.length;this.x=Math.cos(t)*e,this.y=Math.sin(t)*e}get length(){return Math.distance(this.x,this.y)}set length(t){var e=this.angle;this.x=Math.cos(e)*t,this.y=Math.sin(e)*t}static addVectors(t,e){return new R(t.x+e.x,t.y+e.y)}static dotProduct(t,e){return t.x*e.x+t.y*e.y}static fromLengthAngle(t,e){var i=new R;return i.length=e,i.angle=t,i}reverse(){return new R(-this.x,-this.y)}add(t){return R.addVectors(this,t)}multiply(t){return new R(t*this.x,t*this.y)}toTransform(){return`translate(${this.x}px, ${this.y}px)`}toString(){return c`Vector(x=${this.x}, y=${this.y}, `+c`length=${this.length}, angle=${this.angle})`}}Math.distance=(t,e)=>Math.sqrt(t*t+e*e);o;class D{constructor(t){this.settings=t,this.state={position:new R,velocity:R.fromLengthAngle(2*Math.random()*Math.PI,Math.random()*(this.settings.maxVelocity-this.settings.minVelocity)+this.settings.minVelocity),acceleration:new R},this.mouse=new R,this.dt=1/this.settings.tickPerSecond}get position(){return this.state.position}get velocity(){return this.state.velocity}get acceleration(){return this.state.acceleration}step(t){this.last=this.state,this.debugLines=[],this.forces={},this.processForces(),this.processMovement(),this.processCollisions(t)}processForces(){this.forces.gravity=R.fromLengthAngle(this.last.position.angle+Math.PI,this.settings.gravity),this.last.velocity.length<this.settings.minVelocity?this.forces.correction=R.fromLengthAngle(this.last.velocity.angle,this.settings.correctionForce*Math.pow(this.last.velocity.length-this.settings.minVelocity,2)):this.last.velocity.length>this.settings.maxVelocity&&(this.forces.correction=R.fromLengthAngle(this.last.velocity.angle+Math.PI,this.settings.correctionForce*Math.pow(this.last.velocity.length-this.settings.maxVelocity,2)));var t=this.mouse.add(this.last.position.reverse());t.length<this.settings.keepDistance&&0<t.length&&(this.forces.running=R.fromLengthAngle(t.angle+Math.PI,this.settings.mouseForceMax-Math.pow(Math.abs(t.length/this.settings.keepDistance-1),this.settings.mouseForcePow)))}processMovement(){this.debugLines.push("Forces:");let t=new R;for(var[e,i]of Object.entries(this.forces))t=t.add(i),this.debugLines.push(` [${e}] `+i);t=t.multiply(1/this.settings.mass),this.state={position:this.last.position,velocity:this.last.velocity,acceleration:t},this.state.velocity=this.velocity.add(this.acceleration.multiply(this.dt)),this.state.position=this.position.add(this.velocity.multiply(this.dt)),this.debugLines.push("acceleration: "+this.acceleration),this.debugLines.push("velocity: "+this.velocity),this.debugLines.push("position: "+this.position)}processCollisions(t){var e=(window.innerWidth-t.width)/2,t=(window.innerHeight-t.height)/2;this.position.x<-e&&(this.position.x=-2*e-this.position.x,this.velocity.x=-this.velocity.x*this.settings.collisionElasticity),this.position.x>e&&(this.position.x=2*e-this.position.x,this.velocity.x=-this.velocity.x*this.settings.collisionElasticity),this.position.y<-t&&(this.position.y=-2*t-this.position.y,this.velocity.y=-this.velocity.y*this.settings.collisionElasticity),this.position.y>t&&(this.position.y=2*t-this.position.y,this.velocity.y=-this.velocity.y*this.settings.collisionElasticity)}randomGaussian(t=0,e=1){var i=1-Math.random(),n=Math.random();return Math.sqrt(-2*Math.log(i))*Math.cos(2*Math.PI*n)*e+t}}class S{constructor(){this.enabled=!0,this.chance=100,this.keepDistance=200,this.maxVelocity=500,this.minVelocity=20,this.tickPerSecond=50,this.gravity=20,this.correctionForce=.8,this.mouseForceMax=5e3,this.mouseForcePow=5,this.mass=1,this.collisionElasticity=.9}}window.AprilJokes=(t=>{const e=new d;return t.forEach(t=>{e.add(new t)}),$(()=>e.regularStart()),e})([class extends i{constructor(){super(...arguments),this.id="shake",this.title="Форумо-трясение",this.description="Страница форума начинает трястись",this._settings=new p,this.dataName="april-fools-shake"}rand(t){return t+this.settings.force*(2*Math.random()-1)}start(){this.items=a()(this.settings.selector),this.items.each((t,e)=>{const i={};this.settings.directions.forEach(t=>{i[t]=parseInt(a()(e).css("margin-"+t))}),a()(e).data(this.dataName,i)}),this.intervalId=setInterval(()=>{this.items.each((t,e)=>{var i=a()(e).data(this.dataName);for(const n of Object.entries(i))a()(e).css("margin-"+n[0],this.rand(n[1]))})},this.settings.interval)}stop(){clearInterval(this.intervalId),this.items.each((t,e)=>{const i={};this.settings.directions.forEach(t=>{a()(e).css("margin-"+t,i[t])}),a()(e).data(this.dataName,i)})}},class extends o{constructor(){super(...arguments),this.id="humanitarian_hell",this.title="Ад гуманитария",this.description='Все "тся" заменяются на "ться", а все "ться" на "тся"',this._settings=new g}processText(t){return t.replace(/(ть?ся)/g,function(t){return 0<t.indexOf("ь")?"тся":"ться"})}start(){n(this.settings.selector).each((t,e)=>{e.textContent=this.processText(e.textContent)})}},class extends o{constructor(){super(...arguments),this.id="mirror",this.title="Зеркало",this.description="Элементы форума отражаются (по крайней мере, пытаются)",this._settings=new f}start(){a()(".post, .post h3, .post-links, .post-author, .post-content").css("transform","scaleX(-1)").css("-moz-transform","scaleX(-1)").css("-moz-transform","scaleX(-1)").css("filter","FlipH").css("-ms-filter",'"FlipH"'),a()(".post-links, .post-links ul, .post h3 span").css("margin-left","0"),a()(".post h3 span").css("margin-right","25em")}},class extends o{constructor(){super(...arguments),this.id="carnival",this.title="Карнавал",this.description="Аватарки приобретают интересные цвета",this._settings=new m}start(){a()(this.settings.selector).each((t,e)=>{var i=[];for(const n of Object.entries(this.settings.variants))this.check(this.settings.variant_chance)&&i.push(n[0].replace("{0}",Math.round(Math.random()*n[1]).toString()));0<i.length&&a()(e).css({filter:i.join(" ")})})}},class extends o{constructor(){super(...arguments),this.id="crazy_letters",this.title="Мама, Я сОшЛа С уМа!",this.description="иМеНа ЗаБоРчИкОм",this._settings=new A}start(){a()(this.settings.selector).each((t,e)=>{var i=a()(e).text();let n="";for(let t=0;t<i.length;t++)n+=i[t][t%2?"toLowerCase":"toUpperCase"]();a()(this).text(n)})}},class extends o{constructor(){super(...arguments),this.id="letter_chaos",this.title="Буквенный хаос",this.description="Все буквы в словах, кроме первой и последней, перемешены",this._settings=new w,this.punctuationSymbols=null}shuffleLetters(t){if(t.length<3||!this.check(this.settings.shuffle_chance))return t;var t=t.split(""),e=t.slice(1,-1);for(let t=e.length-1;0<t;t--){var i=Math.floor(Math.random()*(t+1));[e[t],e[i]]=[e[i],e[t]]}return[t[0],...e,t[t.length-1]].join("")}processNode(t){t.textContent=null==(t=t.textContent)?void 0:t.replace(/([А-Яа-яA-Za-z]+)/gm,(t,e)=>this.shuffleLetters(e))}start(){n(this.settings.selector).each((t,e)=>this.processNode(e))}},class extends i{constructor(){super(...arguments),this.id="cursor_effects",this.title="Красивый курсор",this.description="Эффекты, следующие за курсором",this._settings=new E}enableAll(){for(const t of Object.keys(this.settings.effects))this.settings.effects[t].enabled=!0}disableAll(){for(const t of Object.keys(this.settings.effects))this.settings.effects[t].enabled=!1}weight(t){t=this.settings.effects[t];return t.enabled?t.weight:0}getRandomEffect(){var t=Object.values(r).map(t=>t),e=t.reduce((t,e)=>t+this.weight(e),0),i=Math.random()*e;let n=0;for(const s of t)if(i<=(n+=this.weight(s)))return s;throw new Error("Тебя быть тут не должно...")}start(){var t=this.getRandomEffect(),e=this.settings.effects[t];this.active_cursor_effect=function(t,e){switch(t){case r.Rainbow:return y(e);case r.FairyDust:return function(t){let e=t&&t.colors||["#D61C59","#E7D84B","#1B8798"],i=t&&t.element,n=i||document.body,s=window.innerWidth,o=window.innerHeight;const r={x:s/2,y:s/2},a={x:s/2,y:s/2},h=[],l=[];let c,d,u;const p=window.matchMedia("(prefers-reduced-motion: reduce)");function g(){if(p.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init");c=document.createElement("canvas"),d=c.getContext("2d"),c.style.top="0px",c.style.left="0px",c.style.pointerEvents="none",i?(c.style.position="absolute",n.appendChild(c),c.width=n.clientWidth,c.height=n.clientHeight):(c.style.position="fixed",n.appendChild(c),c.width=s,c.height=o),d.font="21px serif",d.textBaseline="middle",d.textAlign="center",e.forEach(t=>{var e=d.measureText("*"),i=document.createElement("canvas"),n=i.getContext("2d");i.width=e.width,i.height=e.actualBoundingBoxAscent+e.actualBoundingBoxDescent,n.fillStyle=t,n.textAlign="center",n.font="21px serif",n.textBaseline="middle",n.fillText("*",i.width/2,e.actualBoundingBoxAscent),l.push(i)}),n.addEventListener("mousemove",A),n.addEventListener("touchmove",m,{passive:!0}),n.addEventListener("touchstart",m,{passive:!0}),window.addEventListener("resize",f),_()}function f(t){s=window.innerWidth,o=window.innerHeight,i?(c.width=n.clientWidth,c.height=n.clientHeight):(c.width=s,c.height=o)}function m(e){if(0<e.touches.length)for(let t=0;t<e.touches.length;t++)w(e.touches[t].clientX,e.touches[t].clientY,l[Math.floor(Math.random()*l.length)])}function A(t){window.requestAnimationFrame(()=>{if(i){const e=n.getBoundingClientRect();r.x=t.clientX-e.left,r.y=t.clientY-e.top}else r.x=t.clientX,r.y=t.clientY;1.5<Math.hypot(r.x-a.x,r.y-a.y)&&(w(r.x,r.y,l[Math.floor(Math.random()*e.length)]),a.x=r.x,a.y=r.y)})}function w(t,e,i){h.push(new y(t,e,i))}function _(){if(0!=h.length){d.clearRect(0,0,s,o);for(let t=0;t<h.length;t++)h[t].update(d);for(let t=h.length-1;0<=t;t--)h[t].lifeSpan<0&&h.splice(t,1);0==h.length&&d.clearRect(0,0,s,o)}u=requestAnimationFrame(_)}function v(){c.remove(),cancelAnimationFrame(u),n.removeEventListener("mousemove",A),n.removeEventListener("touchmove",m),n.removeEventListener("touchstart",m),window.addEventListener("resize",f)}function y(t,e,i){var n=Math.floor(30*Math.random()+60);this.initialLifeSpan=n,this.lifeSpan=n,this.velocity={x:(Math.random()<.5?-1:1)*(Math.random()/2),y:.7*Math.random()+.9},this.position={x:t,y:e},this.canv=i,this.update=function(t){this.position.x+=this.velocity.x,this.position.y+=this.velocity.y,this.lifeSpan--,this.velocity.y+=.02;var e=Math.max(this.lifeSpan/this.initialLifeSpan,0);t.drawImage(this.canv,this.position.x-this.canv.width/2*e,this.position.y-this.canv.height/2,this.canv.width*e,this.canv.height*e)}}return p.onchange=()=>{(p.matches?v:g)()},g(),{destroy:v}}(e);case r.SpringyEmoji:return _(e);case r.Emoji:return function(t){const e=t&&t.emoji||["😀","😂","😆","😊"];let i=t&&t.element,n=i||document.body,s=window.innerWidth,o=window.innerHeight;const r={x:s/2,y:s/2},a={x:s/2,y:s/2};let h=0;const l=[],c=[];let d,u,p;const g=window.matchMedia("(prefers-reduced-motion: reduce)");function f(){if(g.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init");d=document.createElement("canvas"),u=d.getContext("2d"),d.style.top="0px",d.style.left="0px",d.style.pointerEvents="none",i?(d.style.position="absolute",n.appendChild(d),d.width=n.clientWidth,d.height=n.clientHeight):(d.style.position="fixed",document.body.appendChild(d),d.width=s,d.height=o),u.font="21px serif",u.textBaseline="middle",u.textAlign="center",e.forEach(t=>{var e=u.measureText(t),i=document.createElement("canvas"),n=i.getContext("2d");i.width=e.width,i.height=2*e.actualBoundingBoxAscent,n.textAlign="center",n.font="21px serif",n.textBaseline="middle",n.fillText(t,i.width/2,e.actualBoundingBoxAscent),c.push(i)}),n.addEventListener("mousemove",w,{passive:!0}),n.addEventListener("touchmove",A,{passive:!0}),n.addEventListener("touchstart",A,{passive:!0}),window.addEventListener("resize",m),v()}function m(t){s=window.innerWidth,o=window.innerHeight,i?(d.width=n.clientWidth,d.height=n.clientHeight):(d.width=s,d.height=o)}function A(e){if(0<e.touches.length)for(let t=0;t<e.touches.length;t++)_(e.touches[t].clientX,e.touches[t].clientY,c[Math.floor(Math.random()*c.length)])}function w(t){t.timeStamp-h<16||window.requestAnimationFrame(()=>{if(i){const e=n.getBoundingClientRect();r.x=t.clientX-e.left,r.y=t.clientY-e.top}else r.x=t.clientX,r.y=t.clientY;1<Math.hypot(r.x-a.x,r.y-a.y)&&(_(r.x,r.y,c[Math.floor(Math.random()*e.length)]),a.x=r.x,a.y=r.y,h=t.timeStamp)})}function _(t,e,i){l.push(new x(t,e,i))}function v(){if(0!=l.length){u.clearRect(0,0,s,o);for(let t=0;t<l.length;t++)l[t].update(u);for(let t=l.length-1;0<=t;t--)l[t].lifeSpan<0&&l.splice(t,1);0==l.length&&u.clearRect(0,0,s,o)}p=requestAnimationFrame(v)}function y(){d.remove(),cancelAnimationFrame(p),n.removeEventListener("mousemove",w),n.removeEventListener("touchmove",A),n.removeEventListener("touchstart",A),window.addEventListener("resize",m)}function x(t,e,i){var n=Math.floor(60*Math.random()+80);this.initialLifeSpan=n,this.lifeSpan=n,this.velocity={x:(Math.random()<.5?-1:1)*(Math.random()/2),y:.4*Math.random()+.8},this.position={x:t,y:e},this.canv=i,this.update=function(t){this.position.x+=this.velocity.x,this.position.y+=this.velocity.y,this.lifeSpan--,this.velocity.y+=.05;var e=Math.max(this.lifeSpan/this.initialLifeSpan,0);t.drawImage(this.canv,this.position.x-this.canv.width/2*e,this.position.y-this.canv.height/2,this.canv.width*e,this.canv.height*e)}}return g.onchange=()=>{(g.matches?y:f)()},f(),{destroy:y}}(e);case r.Ghost:return function(t){let e,i,n,s=t&&t.element,o=s||document.body,r=t&&t.randomDelay,a=t&&t.minDelay||5,h=t&&t.maxDelay||50,l=window.innerWidth,c=window.innerHeight,d={x:l/2,y:l/2},u=[],p=new Image;t&&t.image?p.src=t.image:p.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAATCAYAAACk9eypAAAAAXNSR0IArs4c6QAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAhGVYSWZNTQAqAAAACAAFARIAAwAAAAEAAQAAARoABQAAAAEAAABKARsABQAAAAEAAABSASgAAwAAAAEAAgAAh2kABAAAAAEAAABaAAAAAAAAAEgAAAABAAAASAAAAAEAA6ABAAMAAAABAAEAAKACAAQAAAABAAAADKADAAQAAAABAAAAEwAAAAAChpcNAAAACXBIWXMAAAsTAAALEwEAmpwYAAABWWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgpMwidZAAABqElEQVQoFY3SPUvDQBgH8BREpRHExYiDgmLFl6WC+AYmWeyLg4i7buJX8DMpOujgyxGvUYeCgzhUQUSKKLUS0+ZyptXh8Z5Ti621ekPyJHl+uftfomhaf9Ei5JyxXKfynyEA6EYcLHpwyflT958GAQ7DTABNHd8EbtDbEH2BD5QEQmi2mM8P/Iq+A0SzszEg+3sPjDnDdVEtQKQbMUidHD3xVzf6A9UDEmEm+8h9KTqTVUjT+vB53aHrCbAPiceYq1dQI1Aqv4EhMll0jzv+Y0yiRgCnLRSYyDQHVoqUXe4uKL9l+L7GXC4vkMhE6eW/AOJs9k583ORDUyXMZ8F5SVHVVnllmPNKSFagAJ5DofaqGXw/gHBYg51dIldkmknY3tguv3jOtHR4+MqAzaraJXbEhqHhcQlwGSOi5pytVQHZLN5s0WNe8HPrLYlFsO20RPHkImxsbmHdLJFI76th7Z4SeuF53hTeFLvhRCJRCTKZKxgdnRDbW+iozFJbBMw14/ElwGYc0egMBMFzT21f5Rog33Z7dX02GBm7WV5ZfT5Nn5bE3zuCDe9UxdTpNvK+5AAAAABJRU5ErkJggg==";const g=window.matchMedia("(prefers-reduced-motion: reduce)");function f(){if(g.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init");e=document.createElement("canvas"),i=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",s?(e.style.position="absolute",o.appendChild(e),e.width=o.clientWidth,e.height=o.clientHeight):(e.style.position="fixed",document.body.appendChild(e),e.width=l,e.height=c),o.addEventListener("mousemove",y),o.addEventListener("touchmove",A,{passive:!0}),o.addEventListener("touchstart",A,{passive:!0}),window.addEventListener("resize",m),b()}function m(t){l=window.innerWidth,c=window.innerHeight,s?(e.width=o.clientWidth,e.height=o.clientHeight):(e.width=l,e.height=c)}function A(e){if(0<e.touches.length)for(let t=0;t<e.touches.length;t++)x(e.touches[t].clientX,e.touches[t].clientY,p)}g.onchange=()=>{(g.matches?E:f)()};let w=()=>Math.floor(Math.random()*(h-a+1))+a,_=Date.now(),v=w();function y(t){if(r){if(_+v>Date.now())return;_=Date.now(),v=w()}var e;s?(e=o.getBoundingClientRect(),d.x=t.clientX-e.left,d.y=t.clientY-e.top):(d.x=t.clientX,d.y=t.clientY),x(d.x,d.y,p)}function x(t,e,i){u.push(new M(t,e,i))}function b(){if(0!=u.length){i.clearRect(0,0,l,c);for(let t=0;t<u.length;t++)u[t].update(i);for(let t=u.length-1;0<=t;t--)u[t].lifeSpan<0&&u.splice(t,1);0==u.length&&i.clearRect(0,0,l,c)}n=requestAnimationFrame(b)}function E(){e.remove(),cancelAnimationFrame(n),o.removeEventListener("mousemove",y),o.removeEventListener("touchmove",A),o.removeEventListener("touchstart",A),window.addEventListener("resize",m)}function M(t,e,i){this.initialLifeSpan=40,this.lifeSpan=40,this.position={x:t,y:e},this.image=i,this.update=function(t){this.lifeSpan--;var e=Math.max(this.lifeSpan/this.initialLifeSpan,0);t.globalAlpha=e,t.drawImage(this.image,this.position.x,this.position.y)}}return f(),{destroy:E}}(e);case r.Trailing:return v(e);case r.TextFlag:return b(e);case r.FollowingDot:return function(t){let e,i,n=t&&t.element,s=n||document.body,o=window.innerWidth,r=window.innerHeight,a={x:o/2,y:o/2},h=new function(t,e,i,n){this.position={x:t,y:e},this.width=10,this.lag=10,this.moveTowards=function(t,e,i){this.position.x+=(t-this.position.x)/this.lag,this.position.y+=(e-this.position.y)/this.lag,i.fillStyle=l,i.beginPath(),i.arc(this.position.x,this.position.y,this.width,0,2*Math.PI),i.fill(),i.closePath()}}(o/2,r/2),l=t?.color||"#323232a6";const c=window.matchMedia("(prefers-reduced-motion: reduce)");function d(){if(c.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init");e=document.createElement("canvas"),i=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",n?(e.style.position="absolute",s.appendChild(e),e.width=s.clientWidth,e.height=s.clientHeight):(e.style.position="fixed",document.body.appendChild(e),e.width=o,e.height=r),s.addEventListener("mousemove",p),window.addEventListener("resize",u),g()}function u(t){o=window.innerWidth,r=window.innerHeight,n?(e.width=s.clientWidth,e.height=s.clientHeight):(e.width=o,e.height=r)}function p(t){var e;n?(e=s.getBoundingClientRect(),a.x=t.clientX-e.left,a.y=t.clientY-e.top):(a.x=t.clientX,a.y=t.clientY)}function g(){i.clearRect(0,0,o,r),h.moveTowards(a.x,a.y,i),requestAnimationFrame(g)}function f(){e.remove(),cancelAnimationFrame(g),s.removeEventListener("mousemove",p),window.addEventListener("resize",u)}return c.onchange=()=>{(c.matches?f:d)()},d(),{destroy:f}}(e);case r.Bubbles:return function(t){let e,i,n,s=t&&t.element,o=s||document.body,r=window.innerWidth,a=window.innerHeight,h={x:r/2,y:r/2},l=[],c=[];const d=window.matchMedia("(prefers-reduced-motion: reduce)");function u(){if(d.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init");e=document.createElement("canvas"),i=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",s?(e.style.position="absolute",o.appendChild(e),e.width=o.clientWidth,e.height=o.clientHeight):(e.style.position="fixed",document.body.appendChild(e),e.width=r,e.height=a),o.addEventListener("mousemove",f),o.addEventListener("touchmove",g,{passive:!0}),o.addEventListener("touchstart",g,{passive:!0}),window.addEventListener("resize",p),A()}function p(t){r=window.innerWidth,a=window.innerHeight,s?(e.width=o.clientWidth,e.height=o.clientHeight):(e.width=r,e.height=a)}function g(e){if(0<e.touches.length)for(let t=0;t<e.touches.length;t++)m(e.touches[t].clientX,e.touches[t].clientY,c[Math.floor(Math.random()*c.length)])}function f(t){var e;s?(e=o.getBoundingClientRect(),h.x=t.clientX-e.left,h.y=t.clientY-e.top):(h.x=t.clientX,h.y=t.clientY),m(h.x,h.y)}function m(t,e,i){l.push(new _(t,e,i))}function A(){if(0!=l.length){i.clearRect(0,0,r,a);for(let t=0;t<l.length;t++)l[t].update(i);for(let t=l.length-1;0<=t;t--)l[t].lifeSpan<0&&l.splice(t,1);0==l.length&&i.clearRect(0,0,r,a)}n=requestAnimationFrame(A)}function w(){e.remove(),cancelAnimationFrame(n),o.removeEventListener("mousemove",f),o.removeEventListener("touchmove",g),o.removeEventListener("touchstart",g),window.addEventListener("resize",p)}function _(t,e,i){var n=Math.floor(60*Math.random()+60);this.initialLifeSpan=n,this.lifeSpan=n,this.velocity={x:(Math.random()<.5?-1:1)*(Math.random()/10),y:-1*Math.random()-.4},this.position={x:t,y:e},this.canv=i,this.baseDimension=4,this.update=function(t){this.position.x+=this.velocity.x,this.position.y+=this.velocity.y,this.velocity.x+=2*(Math.random()<.5?-1:1)/75,this.velocity.y-=Math.random()/600,this.lifeSpan--;var e=.2+(this.initialLifeSpan-this.lifeSpan)/this.initialLifeSpan;t.fillStyle="#e6f1f7",t.strokeStyle="#3a92c5",t.beginPath(),t.arc(this.position.x-this.baseDimension/2*e,this.position.y-this.baseDimension/2,this.baseDimension*e,0,2*Math.PI),t.stroke(),t.fill(),t.closePath()}}return d.onchange=()=>{(d.matches?w:u)()},u(),{destroy:w}}(e);case r.Snowflake:return function(t){let e,s,i,n=t&&t.element,o=n||document.body,r=["❄️"],a=window.innerWidth,h=window.innerHeight,l={x:a/2,y:a/2},c=[],d=[];const u=window.matchMedia("(prefers-reduced-motion: reduce)");function p(){if(u.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init");e=document.createElement("canvas"),s=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",n?(e.style.position="absolute",o.appendChild(e),e.width=o.clientWidth,e.height=o.clientHeight):(e.style.position="fixed",document.body.appendChild(e),e.width=a,e.height=h),s.font="12px serif",s.textBaseline="middle",s.textAlign="center",r.forEach(t=>{var e=s.measureText(t),i=document.createElement("canvas"),n=i.getContext("2d");i.width=e.width,i.height=2*e.actualBoundingBoxAscent,n.textAlign="center",n.font="12px serif",n.textBaseline="middle",n.fillText(t,i.width/2,e.actualBoundingBoxAscent),d.push(i)}),o.addEventListener("mousemove",m),o.addEventListener("touchmove",f,{passive:!0}),o.addEventListener("touchstart",f,{passive:!0}),window.addEventListener("resize",g),w()}function g(t){a=window.innerWidth,h=window.innerHeight,n?(e.width=o.clientWidth,e.height=o.clientHeight):(e.width=a,e.height=h)}function f(e){if(0<e.touches.length)for(let t=0;t<e.touches.length;t++)A(e.touches[t].clientX,e.touches[t].clientY,d[Math.floor(Math.random()*d.length)])}function m(t){var e;n?(e=o.getBoundingClientRect(),l.x=t.clientX-e.left,l.y=t.clientY-e.top):(l.x=t.clientX,l.y=t.clientY),A(l.x,l.y,d[Math.floor(Math.random()*r.length)])}function A(t,e,i){c.push(new v(t,e,i))}function w(){if(0!=c.length){s.clearRect(0,0,a,h);for(let t=0;t<c.length;t++)c[t].update(s);for(let t=c.length-1;0<=t;t--)c[t].lifeSpan<0&&c.splice(t,1);0==c.length&&s.clearRect(0,0,a,h)}i=requestAnimationFrame(w)}function _(){e.remove(),cancelAnimationFrame(i),o.removeEventListener("mousemove",m),o.removeEventListener("touchmove",f),o.removeEventListener("touchstart",f),window.addEventListener("resize",g)}function v(t,e,i){var n=Math.floor(60*Math.random()+80);this.initialLifeSpan=n,this.lifeSpan=n,this.velocity={x:(Math.random()<.5?-1:1)*(Math.random()/2),y:1+Math.random()},this.position={x:t,y:e},this.canv=i,this.update=function(t){this.position.x+=this.velocity.x,this.position.y+=this.velocity.y,this.lifeSpan--,this.velocity.x+=2*(Math.random()<.5?-1:1)/75,this.velocity.y-=Math.random()/300;var e=Math.max(this.lifeSpan/this.initialLifeSpan,0),i=2*this.lifeSpan*.0174533;t.translate(this.position.x,this.position.y),t.rotate(i),t.drawImage(this.canv,-this.canv.width/2*e,-this.canv.height/2,this.canv.width*e,this.canv.height*e),t.rotate(-i),t.translate(-this.position.x,-this.position.y)}}return u.onchange=()=>{(u.matches?_:p)()},p(),{destroy:_}}(e);case r.Clock:return x(e)}}(t,e)}stop(){this.active_cursor_effect.destroy()}},class extends o{constructor(){super(...arguments),this.id="stupid_title",this.title="Глупые статусы",this.description="Каждому пользователю даётся новый глупый статус",this._settings=new k,this.loadedGenders=null,this.variantsGenerated=!1,this.seed=0}async loadGenders(){var t=a()(".pa-author a").map((t,e)=>e.innerText).toArray().reduce((t,e)=>(t.indexOf(e)<0&&t.push(e),t),[]),t="/api.php?"+a().param({method:"users.get",fields:"username,sex",username:t}),t=await(await fetch(t)).json();this.loadedGenders={},t.error||null!=(t=t.response)&&t.users.forEach(t=>{"0"!==t.sex&&(this.loadedGenders[t.username]="1"===t.sex)})}resolveGender(t){return null!==this.settings.gender_resolver?!!this.settings.gender_resolver.call(this,t):t in this.loadedGenders?!!this.loadedGenders[t]:(this.resetSeed(),"m"===this.selectRandom(t,{m:1,f:1}))}async start(){var t;this.variantsGenerated||((t=this.settings.variants).adj=Object.assign(Object.assign(Object.assign({},j(!0,"адекватный,$адский,активный,алчный,%ангельский,банальный,безнадёжный,$бесполезный,былой,верный,виртуальный,вкусный,воспитанный,выгодный,выходной,гигантский,$глупый,гордый,грамотный,громадный,грубый,далекий,двуличный,деятельный,доброжелательный,$жалкий,жёсткий,жестокий,$жирный,заинтересованный,запасной,застенчивый,знакомый,иностранный,истинный,конструктивный,креативный,ласковый,любимый,мелочный,^мирный,мстительный,небесный,невозможный,независимый,низкий,нужный,объективный,обыкновенный,опрятный,^оригинальный,особенный,острый,откровенный,открытый,пестрый,повседневный,подземный,пожилой,показательный,последний,посторонний,провинциальный,пышный,робкий,родной,самовлюблённый,северный,седой,семейный,серьёзный,сногсшибательный,^солнечный,спокойный,суровый,терпеливый,уверенный в себе,ударный,^удачливый,формальный,хладнокровный,целый,чистый,чрезвычайный,чужой,южный")),j(!1,"адекватная,$адская,активная,алчная,%ангельская,банальная,безнадёжная,$бесполезная,былая,верная,виртуальная,вкусная,воспитанная,выгодная,выходная,гигантская,$глупая,гордая,грамотная,громадная,грубая,далекая,двуличная,деятельная,доброжелательная,$жалкая,жёсткая,жестокая,$жирная,заинтересованная,запасная,застенчивая,знакомая,иностранная,истинная,конструктивная,креативная,ласковая,любимая,мелочная,^мирная,мстительная,небесная,невозможная,независимая,низкая,нужная,объективная,обыкновенная,опрятная,^оригинальная,особенная,острая,откровенная,открытая,пестрая,повседневная,подземная,пожилая,показательная,последняя,посторонняя,провинциальная,пышная,робкая,родная,самовлюблённая,северная,седая,семейная,серьезная,сногсшибательная,^солнечная,спокаяная,суровая,терпеливая,уверенная в себе,ударная,^удачливая,формальная,хладнокровная,целая,чистая,чрезвычайная,чужая,южная")),t.adj),t.noun=Object.assign(Object.assign(Object.assign({},j(!0,"актёр,$балбес,бард,басурманин,борец,бродяга,бруталище,волк,дворф,%дед,%дедушка,джентльмен,диван,динозавр,дракон,ёж,%ёжик,жук,зайц,$злоумышленник,зомби,карасик,кентавр,кит,кот,кролик,кулак,лев,ледник,лесоруб,%мальчег,мальчик,манекен,массажист,мачо,монах,монстр,наследник,ниндзя,носорог,одиночка,организм,орёл,отец,принц,проказник,пузырь,$раб,рыцарь,спортсмен,сурикат,сын,%сынок,тигр,товарищ,хоббит,эльф")),j(!1,"актриса,акула,$бабка,бабочка,%бабушка,бактерия,белочка,бусинка,валькирия,$ведьма,волторна,волчица,горгулья,дворфиха,девочка,деревяшка,детка,%деффачка,%дочка,дочь,заноза,$злоумышленница,знаменитость,каруселька,килька,конфетка,косточка,кошка,красотка,крышка,леди,$личинка,львица,мать,машина,милашка,монашка,мышь,наследница,орлица,панда,пиранья,принцесса,простуда,$рабыня,русалочка,рыбка,рыбка,скамеечка,спортсменка,тигрица,травка,черепашка,чертовка,эльфийка")),t.noun),t.verb=Object.assign(Object.assign(Object.assign(Object.assign({},j(null,"бежит,берёт и делает,болеет,встаёт,говорит,думает,забывает,замирает,заходит,идёт,%имеет план и придерживается его,ловит,меняется,молчит,нарушает,оглядывается,орёт,освобождает,отвечает,отказаться куда-то идти,отказывается,отказывается вставать,отказывается что-то делать,оформляет,плывёт,поглядывает,поздравляет,поздравляет,получает,прибывает,приказывает,просыпается,прощает,работает,радуется,скрывается,снимает,снимает,снимается в сериале,снимается в фильме,собирается,соединяет,спрашивает,тянет,указывает,учит,читает,что-то скрывает,чувствует опасность,шепчет")),j(!0,"взял и сделал,додумался,женился,женится,заработался,не спал,не успел,обиделся,познал дзен,присел,проснулся,скрылся,смог,успел")),j(!1,"взяла и сделала,выходит замуж,вышла замуж,додумалась,заработалась,не спала,не успела,обиделась,познала дзен,присела,проснулась,скрылась,смогла,успела")),t.verb),t.place=Object.assign(Object.assign({},j(null,"в джунглях,в квартире,в космосе,в лесу,в очереди,в пустыне,в театре,%в тёплой и уютной квартире,в филармонии,где-то,на заснеженной вершине,на конференции,на пляже,на форуме,под водой,под дождём,%под проливным дождём")),t.place),t.adv=Object.assign(Object.assign({},j(null,"безрассудно,быстро,внезапно,вновь,$грубо,грустно,медленно,%молниеносно,немедленно,опять,осмысленно,позже,предсказуемо,расчётливо,регулярно,счастливо,уже,уныло")),t.adv),this.variantsGenerated=!0),await this.loadGenders();const n={};a()(".post-author").each((t,e)=>{var i=a()(".pa-author a",e).text();i&&(i in n||(this.resetSeed(),n[i]=this.generatePhrase(i)),a()(".pa-title",e).text(n[i]))})}generatePhrase(i){const n=this.resolveGender(i);var t=this.selectRandom(i,this.settings.schemas);return this.capitalizeFirst(t.replace(/\{(.+?)}/g,(t,e)=>{e=this.buildVariants(e,n);return this.selectRandom(i,e)}))}prng(i,t,e){let n=3735928559^t,s=1103547991^t;for(let t=0,e;t<i.length;t++)e=i.charCodeAt(t),n=Math.imul(n^e,2654435761),s=Math.imul(s^e,1597334677);n=Math.imul(n^n>>>16,2246822507)^Math.imul(s^s>>>13,3266489909);t=4294967296*(2097151&(s=Math.imul(s^s>>>16,2246822507)^Math.imul(n^n>>>13,3266489909)))+(n>>>0);return Math.floor(Math.pow(Math.sin(t),2)*e)%e}resetSeed(){var t=new Date,e=60*t.getUTCHours()+t.getUTCMinutes();0===this.settings.change_frequency?this.seed=60*e+t.getUTCSeconds():this.seed=Math.floor(e/this.settings.change_frequency)}selectRandom(t,i){var e=Object.keys(i),n=e.reduce((t,e)=>t+i[e],0),s=this.prng(t,this.seed++,n);let o=0;for(const r of e)if(s<=(o+=i[r]))return r;throw new Error("Тебя быть тут не должно...")}buildVariants(t,e){var i={},t=this.settings.variants[t];for(const o of Object.entries(t)){var n=o[0],s=o[1];!s.enabled||s.gender===!e||!this.settings.rude&&s.rude||(i[n]=s.weight)}return i}capitalizeFirst(t){return t.charAt(0).toUpperCase()+t.slice(1)}},class extends o{constructor(){super(...arguments),this.id="inverted_scroll",this.title="Обратная гравитация",this.description="Скролл в обратную сторону",this._settings=new L}start(){document.addEventListener("wheel",t=>{t.preventDefault(),scrollBy(0,-t.deltaY)},{passive:!1})}},class extends o{constructor(){super(...arguments),this.id="latinization",this.title="Латинизация",this.description="Все символы на странице или только в постах или еще где-то местами - латиницей вместо кириллицы и наоборот",this._settings=new B}start(){n(this.settings.selector).each((t,e)=>this.processNode(e))}latinize(t){if(/[а-яА-ЯёЁ0-9_-]+/.test(t))for(var[e,i]of Object.entries(this.settings.ruToEn))t=t.replace(new RegExp(e,"g"),i).replace(new RegExp(e.toUpperCase(),"gi"),i.toUpperCase());else if(/[a-zA-Z0-9_-]+/.test(t))for(var[n,s]of Object.entries(this.settings.enToRu))t=t.replace(new RegExp(n,"g"),s).replace(new RegExp(n.toUpperCase(),"gi"),s.toUpperCase());return t}processNode(t){t.textContent=null==(t=t.textContent)?void 0:t.replace(/([А-Яа-яA-Za-z]+)/gm,(t,e)=>this.latinize(e))}},class extends o{constructor(){super(...arguments),this.id="fresh_grass",this.title="Свежая трава",this.description="Предложение потрогать траву",this._settings=new S}start(){a()(()=>this.init())}init(){var t=a()(document.body);document.body.style.setProperty("--fresh-grass-body-top",`-${window.scrollY}px`),this.container=a()('<div class="april-fools__joke__fresh-grass"> <div class="april-fools__joke__fresh-grass__window"> <h4>А ты трогал сегодня траву?</h4> <img class="april-fools__joke__fresh-grass__image" src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/13/Green_Grass.JPG/1280px-Green_Grass.JPG" alt="Здесь должная быть трава, но что-то сломалось... Притворись, что она здесь есть, хорошо?"> <small> Изображение травы взято с <a href="https://commons.wikimedia.org/wiki/File:Green_Grass.JPG">WikiMedia</a> под лицензией <a href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0 DEED</a>. </small> </div> </div>'),this.container.hide(0),t.append(this.container),this.container.fadeIn(500),this.fleeingGrass()}debug(t){h&&a()("small",this.container).html(`<pre>${t}</pre>`)}fleeingGrass(){this.movement=new D(this.settings);const e=a()("img.april-fools__joke__fresh-grass__image",this.container);e.on("mousedown",()=>{this.close()}),a()(window).on("mousemove",t=>{this.movement.mouse=new R(t.clientX-window.innerWidth/2,t.clientY-window.innerHeight/2)}),this.intervalIndex=setInterval(()=>{var t=e[0].getBoundingClientRect();this.movement.step(t),e.css("transform",this.movement.state.position.toTransform())},Math.floor(1e3*this.movement.dt))}close(){clearInterval(this.intervalIndex),this.container.fadeOut({duration:500,complete:()=>{this.container.remove(),scrollTo(0,-parseInt(document.body.style.getPropertyValue("--fresh-grass-body-top")))}})}}])})()})(); |