1 line
4.0 KiB
JavaScript
1 line
4.0 KiB
JavaScript
!function n(r,i,s){function a(e,t){if(!i[e]){if(!r[e]){var o="function"==typeof require&&require;if(!t&&o)return o(e,!0);if(c)return c(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}o=i[e]={exports:{}},r[e][0].call(o.exports,function(t){return a(r[e][1][t]||t)},o,o.exports,n,r,i,s)}return i[e].exports}for(var c="function"==typeof require&&require,t=0;t<s.length;t++)a(s[t]);return a}({1:[function(t,e,o){"use strict";var i=function(){return(i=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var r in e=arguments[o])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};define(["require","exports"],function(t,e){function o(){this.jokes={}}Object.defineProperty(e,"__esModule",{value:!0}),e.AprilFoolsJokeClass=void 0,o.prototype.add=function(t){this.jokes[t.id]=t},o.prototype.setSettings=function(t){for(var e=0,o=Object.entries(t);e<o.length;e++){var n=o[e],r=n[0],n=n[1];this.jokes[r].settings=i(i({},this.jokes[r].settings),n)}},o.prototype.check=function(t){return Math.random()<.01*t},o.prototype.start=function(t,e){void 0===e&&(e=!1),t in this.jokes&&(t=this.jokes[t],e||this.check(t.settings.chance))&&t.start()},o.prototype.startAll=function(){for(var t=0,e=Object.keys(this.jokes);t<e.length;t++){var o=e[t];this.start(o)}},e.AprilFoolsJokeClass=o})},{}],2:[function(t,e,o){"use strict";n=function(t,e){return(n=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}))(t,e)};var n,s=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)};define(["require","exports"],function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.StopableJoke=e.Joke=void 0;function o(){}e.Joke=o,s(i,n=o);var n,r=i;function i(){return null!==n&&n.apply(this,arguments)||this}e.StopableJoke=r})},{}],3:[function(t,e,o){"use strict";n=function(t,e){return(n=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}))(t,e)};var n,i=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)};define(["require","exports","../joke"],function(t,e,o){Object.defineProperty(e,"__esModule",{value:!0}),e.ShakeJokeSettings=e.ShakeJoke=void 0;n=o.StopableJoke,i(r,n),r.prototype.rand=function(t){return t+this.settings.force*(2*Math.random()-1)},r.prototype.start=function(){var s=this;this.items=$(this.settings.selector),this.items.each(function(t,e){var o={};s.settings.directions.forEach(function(t){o[t]=parseInt($(e).css("margin-"+t))}),$(e).data(s.data_name,o)}),this.interval_id=setInterval(function(){s.items.each(function(t,e){for(var o=$(e).data(s.data_name),n=0,r=Object.entries(o);n<r.length;n++){var i=r[n];$(e).css("margin-"+i[0],s.rand(i[1]))}})},this.settings.interval)},r.prototype.stop=function(){var n=this;clearInterval(this.interval_id),this.items.each(function(t,e){var o={};n.settings.directions.forEach(function(t){$(e).css("margin-"+t,o[t])}),$(e).data(n.data_name,o)})};var n,o=r;function r(){var t=null!==n&&n.apply(this,arguments)||this;return t.data_name="april-fools-shake",t}e.ShakeJoke=o,e.ShakeJokeSettings=function(){this.chance=1,this.directions=["top","left","bottom","left"],this.selector="[id^=pun]",this.interval=100,this.force=.5}})},{}],4:[function(t,e,o){"use strict";define(["require","exports","./handler","./jokes/shake"],function(t,e,o,n){var r;Object.defineProperty(e,"__esModule",{value:!0}),window.AprilJokes=(e=[n.ShakeJoke],r=new o.AprilFoolsJokeClass,e.forEach(function(t){r.add(new t)}),r)})},{}]},{},[1,2,3,4]); |