Files
mybb-april-fools/dist/main.js
T
2023-03-27 19:22:43 +04:00

1 line
7.2 KiB
JavaScript

(()=>{"use strict";var t,n={n:t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return n.d(o,{a:o}),o},d:(t,o)=>{for(var r in o)n.o(o,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(t,n)=>Object.prototype.hasOwnProperty.call(t,n)},o=function(){return o=Object.assign||function(t){for(var n,o=1,r=arguments.length;o<r;o++)for(var e in n=arguments[o])Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e]);return t},o.apply(this,arguments)},r=function(){function t(){this.jokes={}}return t.check=function(t){return Math.random()<.01*t},t.prototype.add=function(t){this.jokes[t.id]=t},t.prototype.setSettings=function(t){for(var n=0,r=Object.entries(t);n<r.length;n++){var e=r[n],s=e[0],i=e[1];this.jokes[s].settings=o(o({},this.jokes[s].settings),i)}},t.prototype.start=function(n,o){if(void 0===o&&(o=!1),n in this.jokes){var r=this.jokes[n];(o||t.check(r.settings.chance))&&r.start()}},t.prototype.startAll=function(){for(var t=0,n=Object.keys(this.jokes);t<n.length;t++){var o=n[t];this.start(o)}},t}(),e=(t=function(n,o){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])},t(n,o)},function(n,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function r(){this.constructor=n}t(n,o),n.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}),s=function(){},i=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n}(s);const c=jQuery;var a,u,p=n.n(c),f=function(){var t=function(n,o){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])},t(n,o)};return function(n,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function r(){this.constructor=n}t(n,o),n.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),l=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.data_name="april-fools-shake",n}return f(n,t),n.prototype.rand=function(t){return t+this.settings.force*(2*Math.random()-1)},n.prototype.start=function(){var t=this;this.items=p()(this.settings.selector),this.items.each((function(n,o){var r={};t.settings.directions.forEach((function(t){r[t]=parseInt(p()(o).css("margin-"+t))})),p()(o).data(t.data_name,r)})),this.interval_id=setInterval((function(){t.items.each((function(n,o){for(var r=p()(o).data(t.data_name),e=0,s=Object.entries(r);e<s.length;e++){var i=s[e];p()(o).css("margin-"+i[0],t.rand(i[1]))}}))}),this.settings.interval)},n.prototype.stop=function(){var t=this;clearInterval(this.interval_id),this.items.each((function(n,o){var r={};t.settings.directions.forEach((function(t){p()(o).css("margin-"+t,r[t])})),p()(o).data(t.data_name,r)}))},n}(i),h=function(){var t=function(n,o){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])},t(n,o)};return function(n,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function r(){this.constructor=n}t(n,o),n.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),y=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return h(n,t),n.prototype.start=function(){p()(this.settings.selector).each((function(){p()(this).html(p()(this).html().replace(/(ть?ся)/g,(function(t){return t.indexOf("ь")>0?"тся":"ться"})))}))},n}(s),_=function(){var t=function(n,o){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])},t(n,o)};return function(n,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function r(){this.constructor=n}t(n,o),n.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),v=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return _(n,t),n.prototype.start=function(){p()(".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"'),p()(".post-links, .post-links ul, .post h3 span").css("margin-left","0"),p()(".post h3 span").css("margin-right","25em")},n}(s),O=function(){var t=function(n,o){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])},t(n,o)};return function(n,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function r(){this.constructor=n}t(n,o),n.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),g=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return O(n,t),n.prototype.start=function(){var t=this;p()(this.settings.selector).each((function(n,o){for(var e=[],s=0,i=Object.entries(t.settings.variants);s<i.length;s++){var c=i[s];r.check(t.settings.variant_chance)&&e.push(c[0].replace("{0}",Math.round(Math.random()*c[1]).toString()))}e.length>0&&p()(o).css("filter",e.join(" "))}))},n}(s),d=function(){var t=function(n,o){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])},t(n,o)};return function(n,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function r(){this.constructor=n}t(n,o),n.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),j=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return d(n,t),n.prototype.start=function(){var t=this;p()(this.settings.selector).each((function(n,o){for(var r=p()(t).text(),e="",s=0;s<r.length;s++)e+=r[s][s%2?"toLowerCase":"toUpperCase"]();p()(t).text(e)}))},n}(s),w=function(){var t=function(n,o){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])},t(n,o)};return function(n,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function r(){this.constructor=n}t(n,o),n.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),b=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return w(n,t),n.prototype.transform=function(t){for(var n="",o=0;o<t.length;o++){var r=t[o],e=t[o+1];(this.settings.symbols.includes(r)||" "===e||this.settings.symbols.includes(e))&&(n+=r)}return n},n.prototype.process=function(t){},n.prototype.start=function(){p()(this.settings.selector).find("*").contents().filter((function(t,n){return n.nodeType===Node.TEXT_NODE})).each((function(t,n){console.log(n)}))},n}(s);window.AprilJokes=(a=[l,y,v,g,j,b],u=new r,a.forEach((function(t){u.add(new t)})),u)})();