From 8b7d6216a454e24be3ca33400fefbcd798782ade Mon Sep 17 00:00:00 2001 From: Teswa Date: Wed, 29 Mar 2023 21:13:40 +0400 Subject: [PATCH] =?UTF-8?q?=D0=93=D0=BB=D1=83=D0=BF=D1=8B=D0=B5=20=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D1=82=D1=83=D1=81=D1=8B,=20=D0=BE=D0=BA=D0=BD?= =?UTF-8?q?=D0=BE=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B5=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 + dist/april-fools.js | 78 +++++++-- dist/april-fools.min.js | 2 +- package-lock.json | 176 +++++++++++++++++++ package.json | 1 + settings.compact.js | 32 +++- settings.example.js | 72 +++++++- src/html.d.ts | 4 + src/html/button.html | 1 + src/html/styles.html | 66 +++++++ src/html/window.html | 15 ++ src/joke.ts | 10 ++ src/joker.ts | 108 +++++++++++- src/jokes/carnival.ts | 6 +- src/jokes/crazy_letters.ts | 4 + src/jokes/crazy_punctuation.ts | 72 -------- src/jokes/cursor.ts | 6 +- src/jokes/humanitarian_hell.ts | 4 + src/jokes/letter_chaos.ts | 4 + src/jokes/mirror.ts | 4 + src/jokes/shake.ts | 6 +- src/jokes/stupid_title.ts | 312 +++++++++++++++++++++++++++++++++ src/main.ts | 8 +- src/ui.ts | 62 +++++++ webpack.config.js | 7 + 25 files changed, 956 insertions(+), 106 deletions(-) create mode 100644 src/html.d.ts create mode 100644 src/html/button.html create mode 100644 src/html/styles.html create mode 100644 src/html/window.html delete mode 100644 src/jokes/crazy_punctuation.ts create mode 100644 src/jokes/stupid_title.ts create mode 100644 src/ui.ts diff --git a/README.md b/README.md index 90e9949..7ac2ee3 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,8 @@ window.AprilJokes.settings = { Обратите внимание, что метод `disableAll()` должен быть вызван *до* установки настроек `settings`, иначе заданные значения `enabled` будут сброшены. +Так же есть метод `window.AprilJokes.enableAll()`, который включает все шутки, в том числе отключённые по умолчанию. + --- ### Настройка `shake` (Форумо-трясение) diff --git a/dist/april-fools.js b/dist/april-fools.js index 28051bd..d806ee1 100644 --- a/dist/april-fools.js +++ b/dist/april-fools.js @@ -10,6 +10,36 @@ /******/ "use strict"; /******/ var __webpack_modules__ = ({ +/***/ "./src/html/button.html": +/*!******************************!*\ + !*** ./src/html/button.html ***! + \******************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://mybb-april-fools/./src/html/button.html?"); + +/***/ }), + +/***/ "./src/html/styles.html": +/*!******************************!*\ + !*** ./src/html/styles.html ***! + \******************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://mybb-april-fools/./src/html/styles.html?"); + +/***/ }), + +/***/ "./src/html/window.html": +/*!******************************!*\ + !*** ./src/html/window.html ***! + \******************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"
\\n
\\n\\n \\n
\\n\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://mybb-april-fools/./src/html/window.html?"); + +/***/ }), + /***/ "./src/joke.ts": /*!*********************!*\ !*** ./src/joke.ts ***! @@ -26,7 +56,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \**********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"JokerClass\": () => (/* binding */ JokerClass)\n/* harmony export */ });\n/* harmony import */ var _joke__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./joke */ \"./src/joke.ts\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n/**\n * Блок обработки перво-апрельских шуток\n *\n * @author Kozhilya\n */\nvar JokerClass = /** @class */ (function () {\n function JokerClass() {\n /**\n * Общие настройки системы\n */\n this.core_settings = new CoreSettings;\n /**\n * Перечисление всех шуток\n */\n this.jokes = {};\n }\n /**\n * Проверка вероятности\n *\n * @param {number} chance Вероятность срабатывания\n * @returns {boolean} Флаг срабатывания (true - сработало)\n */\n JokerClass.prototype.check = function (chance) {\n return Math.random() < 0.01 * chance;\n };\n /**\n * Добавление шутки\n *\n * @param joke Объект шутки\n */\n JokerClass.prototype.add = function (joke) {\n this.jokes[joke.id] = joke;\n };\n /**\n * Регистрация новой шутки\n *\n * @param id Идентификатор шутки\n * @param handler Метод, выполняющий шутку\n * @param settings Объект настроек шутки\n */\n JokerClass.prototype.addCustom = function (id, handler, settings) {\n if (settings === void 0) { settings = null; }\n var joke = new /** @class */ (function (_super) {\n __extends(class_1, _super);\n function class_1() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.id = id;\n _this.settings = { chance: 10, enabled: true };\n return _this;\n }\n class_1.prototype.start = function () {\n handler.call(this, this.settings);\n };\n return class_1;\n }(_joke__WEBPACK_IMPORTED_MODULE_0__.Joke));\n Object.assign(joke.settings, settings !== null && settings !== void 0 ? settings : {});\n this.add(joke);\n };\n Object.defineProperty(JokerClass.prototype, \"settings\", {\n /**\n * Получение полного списка настроек\n */\n get: function () {\n var result = {};\n result['core'] = this.core_settings;\n for (var _i = 0, _a = Object.entries(this.jokes); _i < _a.length; _i++) {\n var entries = _a[_i];\n var id = entries[0];\n var joke = entries[1];\n result[id] = joke.settings;\n }\n return result;\n },\n /**\n * Запись новых настроек\n *\n * @param settings\n */\n set: function (settings) {\n for (var _i = 0, _a = Object.entries(settings); _i < _a.length; _i++) {\n var entry = _a[_i];\n var id = entry[0];\n var jokeSettings = entry[1];\n var targetSettings = (id === 'core') ? this.core_settings : this.jokes[id].settings;\n Object.assign(targetSettings, jokeSettings);\n }\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Разблокировать систему\n */\n JokerClass.prototype.enable = function () {\n this.core_settings.enabled = true;\n };\n /**\n * Заблокировать систему\n */\n JokerClass.prototype.disable = function () {\n this.core_settings.enabled = false;\n };\n /**\n * Разблокировать все шутки\n */\n JokerClass.prototype.enableAll = function () {\n for (var _i = 0, _a = Object.keys(this.jokes); _i < _a.length; _i++) {\n var key = _a[_i];\n this.jokes[key].enable();\n }\n };\n /**\n * Заблокировать все шутки\n */\n JokerClass.prototype.disableAll = function () {\n for (var _i = 0, _a = Object.keys(this.jokes); _i < _a.length; _i++) {\n var key = _a[_i];\n this.jokes[key].disable();\n }\n };\n /**\n * Запуск шутки\n *\n * @param id\n * @param {boolean} forced\n */\n JokerClass.prototype.start = function (id, forced) {\n if (forced === void 0) { forced = false; }\n if (!(id in this.jokes))\n return;\n var joke = this.jokes[id];\n if (!forced && (!joke.settings.enabled || !this.check(joke.settings.chance))) {\n return;\n }\n joke.start();\n };\n /**\n * Запуск всех шуток\n */\n JokerClass.prototype.startAll = function (forced) {\n if (forced === void 0) { forced = false; }\n for (var _i = 0, _a = Object.keys(this.jokes); _i < _a.length; _i++) {\n var key = _a[_i];\n this.start(key, forced);\n }\n };\n JokerClass.prototype.regularStart = function () {\n var today = new Date();\n var month = today.getMonth() + 1; // Note that getMonth() returns 0-indexed month, so we need to add 1\n var day = today.getDate();\n if (month !== 4 || day !== 1 || !this.core_settings.enabled || !this.check(this.core_settings.chance)) {\n return;\n }\n this.startAll();\n };\n return JokerClass;\n}());\n\nvar CoreSettings = /** @class */ (function () {\n function CoreSettings() {\n this.chance = 100;\n this.enabled = true;\n }\n return CoreSettings;\n}());\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/joker.ts?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"JokerClass\": () => (/* binding */ JokerClass)\n/* harmony export */ });\n/* harmony import */ var _joke__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./joke */ \"./src/joke.ts\");\n/* harmony import */ var _ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ui */ \"./src/ui.ts\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\n\n\n/**\n * Блок обработки перво-апрельских шуток\n *\n * @author Kozhilya\n */\nvar JokerClass = /** @class */ (function () {\n function JokerClass() {\n this.ui = new _ui__WEBPACK_IMPORTED_MODULE_1__.JokerUI(this);\n /**\n * Общие настройки системы\n */\n this.core_settings = new CoreSettings;\n /**\n * Перечисление всех шуток\n */\n this.jokes = {};\n }\n /**\n * Проверка вероятности\n *\n * @param {number} chance Вероятность срабатывания\n * @returns {boolean} Флаг срабатывания (true - сработало)\n */\n JokerClass.prototype.check = function (chance) {\n return Math.random() < 0.01 * chance;\n };\n /**\n * Добавление шутки\n *\n * @param joke Объект шутки\n */\n JokerClass.prototype.add = function (joke) {\n this.jokes[joke.id] = joke;\n };\n /**\n * Регистрация новой шутки\n *\n * @param id Идентификатор шутки\n * @param handler Метод, выполняющий шутку\n * @param settings Объект настроек шутки\n */\n JokerClass.prototype.addCustom = function (id, handler, settings) {\n if (settings === void 0) { settings = null; }\n var joke = new /** @class */ (function (_super) {\n __extends(class_1, _super);\n function class_1() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.id = id;\n _this.title = 'Пользовательская шутка';\n _this.description = 'Для шутки не определено описание';\n _this.settings = { chance: 10, enabled: true };\n return _this;\n }\n class_1.prototype.start = function () {\n handler.call(this, this.settings);\n };\n return class_1;\n }(_joke__WEBPACK_IMPORTED_MODULE_0__.Joke));\n Object.assign(joke.settings, settings !== null && settings !== void 0 ? settings : {});\n this.add(joke);\n return joke;\n };\n Object.defineProperty(JokerClass.prototype, \"settings\", {\n /**\n * Получение полного списка настроек\n */\n get: function () {\n var result = {};\n result['core'] = this.core_settings;\n for (var _i = 0, _a = Object.entries(this.jokes); _i < _a.length; _i++) {\n var entries = _a[_i];\n var id = entries[0];\n var joke = entries[1];\n result[id] = joke.settings;\n }\n return result;\n },\n /**\n * Запись новых настроек\n *\n * @param settings\n */\n set: function (settings) {\n for (var _i = 0, _a = Object.entries(settings); _i < _a.length; _i++) {\n var entry = _a[_i];\n var id = entry[0];\n var jokeSettings = entry[1];\n var targetSettings = (id === 'core') ? this.core_settings : this.jokes[id].settings;\n Object.assign(targetSettings, jokeSettings);\n }\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Разблокировать систему\n */\n JokerClass.prototype.enable = function () {\n this.core_settings.enabled = true;\n };\n /**\n * Заблокировать систему\n */\n JokerClass.prototype.disable = function () {\n this.core_settings.enabled = false;\n };\n /**\n * Разблокировать все шутки\n */\n JokerClass.prototype.enableAll = function () {\n for (var _i = 0, _a = Object.keys(this.jokes); _i < _a.length; _i++) {\n var key = _a[_i];\n this.jokes[key].enable();\n }\n };\n /**\n * Заблокировать все шутки\n */\n JokerClass.prototype.disableAll = function () {\n for (var _i = 0, _a = Object.keys(this.jokes); _i < _a.length; _i++) {\n var key = _a[_i];\n this.jokes[key].disable();\n }\n };\n /**\n * Переключение шутки\n */\n JokerClass.prototype.toggleJoke = function (joke_id, state) {\n var joke = this.jokes[joke_id];\n joke.settings.enabled = state;\n if (joke instanceof _joke__WEBPACK_IMPORTED_MODULE_0__.StopableJoke && !state) {\n joke.stop();\n }\n this.saveUserStates();\n };\n /**\n * Сохранение пользовательских настроек\n */\n JokerClass.prototype.saveUserStates = function () {\n var states = {};\n for (var _i = 0, _a = Object.keys(this.jokes); _i < _a.length; _i++) {\n var key = _a[_i];\n states[key] = this.jokes[key].settings.enabled;\n }\n fetch('/api.php?' + $.param({\n method: 'storage.set',\n user_id: window.UserID,\n key: 'april-fools',\n token: window.ForumAPITicket,\n value: JSON.stringify(states),\n timer: 24 * 60\n }));\n };\n /**\n * Загрузка пользовательских настроек\n */\n JokerClass.prototype.loadUserStates = function () {\n return __awaiter(this, void 0, void 0, function () {\n var response, json, data, _i, _a, key;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, fetch('/api.php?' + $.param({\n method: 'storage.get',\n user_id: window.UserID,\n key: 'april-fools',\n }))];\n case 1:\n response = _b.sent();\n return [4 /*yield*/, response.json()];\n case 2:\n json = _b.sent();\n if (json.error) {\n return [2 /*return*/];\n }\n data = JSON.parse(json.response.storage.data['april-fools']);\n for (_i = 0, _a = Object.keys(this.jokes); _i < _a.length; _i++) {\n key = _a[_i];\n this.jokes[key].settings.enabled = data[key];\n }\n return [2 /*return*/];\n }\n });\n });\n };\n JokerClass.prototype.clearUserStates = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, fetch('/api.php?' + $.param({\n method: 'storage.delete',\n user_id: window.UserID,\n key: 'april-fools',\n token: window.ForumAPITicket,\n }))];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n };\n /**\n * Запуск шутки\n *\n * @param id\n * @param {boolean} forced\n */\n JokerClass.prototype.start = function (id, forced) {\n if (forced === void 0) { forced = false; }\n if (!(id in this.jokes))\n return;\n var joke = this.jokes[id];\n if (!forced && (!joke.settings.enabled || !this.check(joke.settings.chance))) {\n return;\n }\n joke.start();\n };\n /**\n * Запуск всех шуток\n */\n JokerClass.prototype.startAll = function (forced) {\n if (forced === void 0) { forced = false; }\n for (var _i = 0, _a = Object.keys(this.jokes); _i < _a.length; _i++) {\n var key = _a[_i];\n this.start(key, forced);\n }\n };\n JokerClass.prototype.regularCheck = function () {\n if (!this.core_settings.enabled) {\n return false;\n }\n if (this.core_settings.testers.indexOf(window.UserID) >= 0) {\n return true;\n }\n var today = new Date();\n var month = today.getMonth() + 1;\n var day = today.getDate();\n if (month !== 4 || day !== 1) {\n return false;\n }\n return this.check(this.core_settings.chance);\n };\n JokerClass.prototype.regularStart = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this.regularCheck()) {\n return [2 /*return*/];\n }\n return [4 /*yield*/, this.loadUserStates()];\n case 1:\n _a.sent();\n this.ui.show();\n this.startAll();\n return [2 /*return*/];\n }\n });\n });\n };\n return JokerClass;\n}());\n\nvar CoreSettings = /** @class */ (function () {\n function CoreSettings() {\n this.chance = 100;\n this.enabled = true;\n this.testers = [];\n }\n return CoreSettings;\n}());\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/joker.ts?"); /***/ }), @@ -36,7 +66,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \*******************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CarnivalJoke\": () => (/* binding */ CarnivalJoke),\n/* harmony export */ \"CarnivalJokeSettings\": () => (/* binding */ CarnivalJokeSettings)\n/* harmony export */ });\n/* harmony import */ var _joke__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../joke */ \"./src/joke.ts\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ \"jquery\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n/**\n * **Карнавал**\n *\n * Аватарки приобретают интересные цвета\n *\n * @author Kozhilya\n */\nvar CarnivalJoke = /** @class */ (function (_super) {\n __extends(CarnivalJoke, _super);\n function CarnivalJoke() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.id = 'carnival';\n _this.settings = new CarnivalJokeSettings;\n return _this;\n }\n CarnivalJoke.prototype.start = function () {\n var _this = this;\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(this.settings.selector).each(function (_, elem) {\n var filters = [];\n for (var _i = 0, _a = Object.entries(_this.settings.variants); _i < _a.length; _i++) {\n var entry = _a[_i];\n if (!_this.check(_this.settings.variant_chance)) {\n continue;\n }\n filters.push(entry[0].replace('{0}', Math.round(Math.random() * entry[1]).toString()));\n }\n if (filters.length > 0) {\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(elem).css({ 'filter': filters.join(' ') });\n }\n });\n };\n return CarnivalJoke;\n}(_joke__WEBPACK_IMPORTED_MODULE_0__.Joke));\n\nvar CarnivalJokeSettings = /** @class */ (function () {\n function CarnivalJokeSettings() {\n this.enabled = true;\n this.chance = 30;\n /**\n * Селектор всех элементов, которые будут перекрашены\n */\n this.selector = 'img[src*=\"/avatars/\"]';\n /**\n * Вероятность применения некоторого фильтра\n */\n this.variant_chance = 20;\n /**\n * Список фильтров и диапозона случайных параметров\n */\n this.variants = {\n 'sepia({0}%)': 100,\n 'saturate({0}%)': 100,\n 'hue-rotate({0}deg)': 360,\n 'invert({0}%)': 100,\n };\n }\n return CarnivalJokeSettings;\n}());\n\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/jokes/carnival.ts?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CarnivalJoke\": () => (/* binding */ CarnivalJoke),\n/* harmony export */ \"CarnivalJokeSettings\": () => (/* binding */ CarnivalJokeSettings)\n/* harmony export */ });\n/* harmony import */ var _joke__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../joke */ \"./src/joke.ts\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ \"jquery\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n/**\n * **Карнавал**\n *\n * Аватарки приобретают интересные цвета\n *\n * @author Kozhilya\n */\nvar CarnivalJoke = /** @class */ (function (_super) {\n __extends(CarnivalJoke, _super);\n function CarnivalJoke() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.id = 'carnival';\n _this.title = 'Карнавал';\n _this.description = 'Аватарки приобретают интересные цвета';\n _this.settings = new CarnivalJokeSettings;\n return _this;\n }\n CarnivalJoke.prototype.start = function () {\n var _this = this;\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(this.settings.selector).each(function (_, elem) {\n var filters = [];\n for (var _i = 0, _a = Object.entries(_this.settings.variants); _i < _a.length; _i++) {\n var entry = _a[_i];\n if (!_this.check(_this.settings.variant_chance)) {\n continue;\n }\n filters.push(entry[0].replace('{0}', Math.round(Math.random() * entry[1]).toString()));\n }\n if (filters.length > 0) {\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(elem).css({ 'filter': filters.join(' ') });\n }\n });\n };\n return CarnivalJoke;\n}(_joke__WEBPACK_IMPORTED_MODULE_0__.Joke));\n\nvar CarnivalJokeSettings = /** @class */ (function () {\n function CarnivalJokeSettings() {\n this.enabled = true;\n this.chance = 30;\n /**\n * Селектор всех элементов, которые будут перекрашены\n */\n this.selector = 'img[src*=\"/avatars/\"]';\n /**\n * Вероятность применения некоторого фильтра\n */\n this.variant_chance = 20;\n /**\n * Список фильтров и диапозона случайных параметров\n */\n this.variants = {\n 'sepia({0}%)': 100,\n 'saturate({0}%)': 100,\n 'hue-rotate({0}deg)': 360,\n 'invert({0}%)': 100,\n };\n }\n return CarnivalJokeSettings;\n}());\n\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/jokes/carnival.ts?"); /***/ }), @@ -46,17 +76,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CrazyLettersJoke\": () => (/* binding */ CrazyLettersJoke),\n/* harmony export */ \"CrazyLettersJokeSettings\": () => (/* binding */ CrazyLettersJokeSettings)\n/* harmony export */ });\n/* harmony import */ var _joke__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../joke */ \"./src/joke.ts\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ \"jquery\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n/**\n * **Мама, Я сОшЛа С уМа!**\n *\n * иМеНа ЗаБоРчИкОм\n *\n * @author Kozhilya\n */\nvar CrazyLettersJoke = /** @class */ (function (_super) {\n __extends(CrazyLettersJoke, _super);\n function CrazyLettersJoke() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.id = 'crazy_letters';\n _this.settings = new CrazyLettersJokeSettings;\n return _this;\n }\n CrazyLettersJoke.prototype.start = function () {\n var _this = this;\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(this.settings.selector).each(function (_, elem) {\n var text = jquery__WEBPACK_IMPORTED_MODULE_1___default()(_this).text();\n var result = '';\n for (var i = 0; i < text.length; i++) {\n result += text[i][(i % 2) ? 'toLowerCase' : 'toUpperCase']();\n }\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(_this).text(result);\n });\n };\n return CrazyLettersJoke;\n}(_joke__WEBPACK_IMPORTED_MODULE_0__.Joke));\n\nvar CrazyLettersJokeSettings = /** @class */ (function () {\n function CrazyLettersJokeSettings() {\n this.enabled = true;\n this.chance = 20;\n /**\n * Селектор всех элементов, которые будут затронуты\n */\n this.selector = '.pa-author a';\n }\n return CrazyLettersJokeSettings;\n}());\n\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/jokes/crazy_letters.ts?"); - -/***/ }), - -/***/ "./src/jokes/crazy_punctuation.ts": -/*!****************************************!*\ - !*** ./src/jokes/crazy_punctuation.ts ***! - \****************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CrazyPunctuationJoke\": () => (/* binding */ CrazyPunctuationJoke),\n/* harmony export */ \"CrazyPunctuationJokeSettings\": () => (/* binding */ CrazyPunctuationJokeSettings)\n/* harmony export */ });\n/* harmony import */ var _joke__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../joke */ \"./src/joke.ts\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ \"jquery\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n/**\n * **Бешеные запятые**\n *\n * Запятые после слов\n *\n * @author Kozhilya\n */\nvar CrazyPunctuationJoke = /** @class */ (function (_super) {\n __extends(CrazyPunctuationJoke, _super);\n function CrazyPunctuationJoke() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.id = 'crazy_punctuation';\n _this.settings = new CrazyPunctuationJokeSettings;\n _this.punctuationSymbols = null;\n return _this;\n }\n CrazyPunctuationJoke.prototype.shufflePunctuation = function (text) {\n var _this = this;\n if (this.punctuationSymbols === null) {\n this.punctuationSymbols = this.settings.symbols.split('');\n }\n var words = text.split(\" \");\n var shuffledWords = words.map(function (word) {\n var characters = word.split(\"\");\n // Filter out any non-punctuation characters\n var punctuation = characters.filter(function (char) { return _this.punctuationSymbols.includes(char); });\n // Shuffle the punctuation array\n var shuffledPunctuation = punctuation.sort(function () { return Math.random() - 0.5; });\n // Loop through each character in the word and replace punctuation with shuffled punctuation\n var index = 0;\n return characters.map(function (char) {\n if (_this.punctuationSymbols.includes(char)) {\n return shuffledPunctuation[index++];\n }\n return char;\n }).join(\"\");\n });\n // Join the shuffled words array into a single string with spaces\n return shuffledWords.join(\" \");\n };\n CrazyPunctuationJoke.prototype.start = function () {\n var _this = this;\n var items = jquery__WEBPACK_IMPORTED_MODULE_1___default()(this.settings.selector).find('*').contents().filter(function (_, node) { return node.nodeType === Node.TEXT_NODE; });\n items.each(function (_, node) {\n node.textContent = _this.shufflePunctuation(node.textContent);\n });\n };\n return CrazyPunctuationJoke;\n}(_joke__WEBPACK_IMPORTED_MODULE_0__.Joke));\n\nvar CrazyPunctuationJokeSettings = /** @class */ (function () {\n function CrazyPunctuationJokeSettings() {\n this.enabled = true;\n this.chance = 20;\n /**\n * Селектор всех элементов, которые будут затронуты\n */\n this.selector = '.post-content p';\n /**\n * Мигрирующие знаки\n */\n this.symbols = ',.;:?!-()[]{}\\'\"';\n }\n return CrazyPunctuationJokeSettings;\n}());\n\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/jokes/crazy_punctuation.ts?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CrazyLettersJoke\": () => (/* binding */ CrazyLettersJoke),\n/* harmony export */ \"CrazyLettersJokeSettings\": () => (/* binding */ CrazyLettersJokeSettings)\n/* harmony export */ });\n/* harmony import */ var _joke__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../joke */ \"./src/joke.ts\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ \"jquery\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n/**\n * **Мама, Я сОшЛа С уМа!**\n *\n * иМеНа ЗаБоРчИкОм\n *\n * @author Kozhilya\n */\nvar CrazyLettersJoke = /** @class */ (function (_super) {\n __extends(CrazyLettersJoke, _super);\n function CrazyLettersJoke() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.id = 'crazy_letters';\n _this.title = 'Мама, Я сОшЛа С уМа!';\n _this.description = 'иМеНа ЗаБоРчИкОм';\n _this.settings = new CrazyLettersJokeSettings;\n return _this;\n }\n CrazyLettersJoke.prototype.start = function () {\n var _this = this;\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(this.settings.selector).each(function (_, elem) {\n var text = jquery__WEBPACK_IMPORTED_MODULE_1___default()(_this).text();\n var result = '';\n for (var i = 0; i < text.length; i++) {\n result += text[i][(i % 2) ? 'toLowerCase' : 'toUpperCase']();\n }\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(_this).text(result);\n });\n };\n return CrazyLettersJoke;\n}(_joke__WEBPACK_IMPORTED_MODULE_0__.Joke));\n\nvar CrazyLettersJokeSettings = /** @class */ (function () {\n function CrazyLettersJokeSettings() {\n this.enabled = true;\n this.chance = 20;\n /**\n * Селектор всех элементов, которые будут затронуты\n */\n this.selector = '.pa-author a';\n }\n return CrazyLettersJokeSettings;\n}());\n\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/jokes/crazy_letters.ts?"); /***/ }), @@ -66,7 +86,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \*****************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CursorEffectsJoke\": () => (/* binding */ CursorEffectsJoke),\n/* harmony export */ \"CursorEffectsJokeSettings\": () => (/* binding */ CursorEffectsJokeSettings)\n/* harmony export */ });\n/* harmony import */ var _joke__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../joke */ \"./src/joke.ts\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n// import * as cursor_effects from \"cursor-effects\";\nvar cursor_effects = __webpack_require__(/*! cursor-effects */ \"./node_modules/cursor-effects/dist/cjs.cjs\");\n/**\n * **Красивый курсор**\n *\n * Эффекты, следующие за курсором\n *\n * @author Tim Holman\n * @link https://tholman.com/cursor-effects/\n */\nvar CursorEffectsJoke = /** @class */ (function (_super) {\n __extends(CursorEffectsJoke, _super);\n function CursorEffectsJoke() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.id = 'cursor_effects';\n _this.settings = new CursorEffectsJokeSettings;\n return _this;\n }\n /**\n * Разблокировать все варианты курсоров\n */\n CursorEffectsJoke.prototype.enableAll = function () {\n for (var _i = 0, _a = Object.keys(this.settings.effects); _i < _a.length; _i++) {\n var key = _a[_i];\n this.settings.effects[key].enabled = true;\n }\n };\n /**\n * Заблокировать все варианты курсоров\n */\n CursorEffectsJoke.prototype.disableAll = function () {\n for (var _i = 0, _a = Object.keys(this.settings.effects); _i < _a.length; _i++) {\n var key = _a[_i];\n this.settings.effects[key].enabled = false;\n }\n };\n CursorEffectsJoke.prototype.weight = function (effect) {\n var s = this.settings.effects[effect];\n return s.enabled ? s.weight : 0;\n };\n CursorEffectsJoke.prototype.getRandomEffect = function () {\n var _this = this;\n var elements = Object.keys(CursorEffectsEnum).map(function (e) { return e; });\n var totalWeight = elements.reduce(function (sum, element) { return sum + _this.weight(element); }, 0);\n var randomWeight = Math.random() * totalWeight;\n var currentWeight = 0;\n for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {\n var element = elements_1[_i];\n currentWeight += this.weight(element);\n if (randomWeight <= currentWeight) {\n return element;\n }\n }\n throw new Error(\"Тебя быть тут не должно...\");\n };\n CursorEffectsJoke.prototype.start = function () {\n var effect = this.getRandomEffect();\n var settings = this.settings.effects[effect];\n this.active_cursor_effect = resolveCursorEffectsEnum(effect, settings);\n };\n CursorEffectsJoke.prototype.stop = function () {\n this.active_cursor_effect.destroy();\n };\n return CursorEffectsJoke;\n}(_joke__WEBPACK_IMPORTED_MODULE_0__.StopableJoke));\n\nvar CursorEffectsEnum;\n(function (CursorEffectsEnum) {\n CursorEffectsEnum[\"Rainbow\"] = \"rainbow\";\n CursorEffectsEnum[\"SpringyEmoji\"] = \"springy_emoji\";\n CursorEffectsEnum[\"FairyDust\"] = \"fairy_dust\";\n CursorEffectsEnum[\"Emoji\"] = \"emoji\";\n CursorEffectsEnum[\"Ghost\"] = \"ghost\";\n CursorEffectsEnum[\"Trailing\"] = \"trailing\";\n CursorEffectsEnum[\"TextFlag\"] = \"text_flag\";\n CursorEffectsEnum[\"FollowingDot\"] = \"following_dot\";\n CursorEffectsEnum[\"Bubbles\"] = \"bubbles\";\n CursorEffectsEnum[\"Snowflake\"] = \"snowflake\";\n CursorEffectsEnum[\"Clock\"] = \"clock\";\n})(CursorEffectsEnum || (CursorEffectsEnum = {}));\nfunction resolveCursorEffectsEnum(effect, options) {\n switch (effect) {\n case CursorEffectsEnum.Rainbow:\n return cursor_effects.rainbowCursor(options);\n case CursorEffectsEnum.FairyDust:\n return cursor_effects.fairyDustCursor(options);\n case CursorEffectsEnum.SpringyEmoji:\n return cursor_effects.springyEmojiCursor(options);\n case CursorEffectsEnum.Emoji:\n return cursor_effects.emojiCursor(options);\n case CursorEffectsEnum.Ghost:\n return cursor_effects.ghostCursor(options);\n case CursorEffectsEnum.Trailing:\n return cursor_effects.trailingCursor(options);\n case CursorEffectsEnum.TextFlag:\n return cursor_effects.textFlag(options);\n case CursorEffectsEnum.FollowingDot:\n return cursor_effects.followingDotCursor(options);\n case CursorEffectsEnum.Bubbles:\n return cursor_effects.bubbleCursor(options);\n case CursorEffectsEnum.Snowflake:\n return cursor_effects.snowflakeCursor(options);\n case CursorEffectsEnum.Clock:\n return cursor_effects.clockCursor(options);\n }\n}\nvar CursorEffectsJokeSettings = /** @class */ (function () {\n function CursorEffectsJokeSettings() {\n var _a;\n this.enabled = true;\n this.chance = 100;\n this.effects = (_a = {},\n _a[CursorEffectsEnum.Rainbow] = new /** @class */ (function (_super) {\n __extends(class_1, _super);\n function class_1() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n /**\n * Длина полосы\n */\n _this.length = 20;\n /**\n * Ширина полосы\n */\n _this.size = 3;\n /**\n * Заданые цвета\n */\n _this.colors = [\n \"#9400D3\",\n \"#4B0082\",\n \"#0000FF\",\n \"#00FF00\",\n \"#FFFF00\",\n \"#FF7F00\",\n \"#FF0000\"\n ];\n return _this;\n }\n return class_1;\n }(DefaultCursorEffectsSetting)),\n _a[CursorEffectsEnum.FairyDust] = new /** @class */ (function (_super) {\n __extends(class_2, _super);\n function class_2() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n /**\n * Цвет звёздочек\n */\n _this.colors = [\"#ff0000\", \"#00ff00\", \"#0000ff\"];\n return _this;\n }\n return class_2;\n }(DefaultCursorEffectsSetting)),\n _a[CursorEffectsEnum.SpringyEmoji] = new /** @class */ (function (_super) {\n __extends(class_3, _super);\n function class_3() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n /**\n * Эмодзи \"на резинке\"\n */\n _this.emoji = \"🤪\";\n return _this;\n }\n return class_3;\n }(DefaultCursorEffectsSetting)),\n _a[CursorEffectsEnum.Emoji] = new /** @class */ (function (_super) {\n __extends(class_4, _super);\n function class_4() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n /**\n * Падающие эмодзи\n */\n _this.emoji = [\"🔥\", \"🐬\", \"🦆\"];\n return _this;\n }\n return class_4;\n }(DefaultCursorEffectsSetting)),\n _a[CursorEffectsEnum.Trailing] = new /** @class */ (function (_super) {\n __extends(class_5, _super);\n function class_5() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n /**\n * Количество элементов\n */\n _this.particles = 15;\n /**\n * Скорость частиц\n */\n _this.rate = 0.4;\n /**\n * Ссылка на картинку с курсором\n */\n _this.baseImageSrc = null;\n return _this;\n }\n return class_5;\n }(DefaultCursorEffectsSetting)),\n _a[CursorEffectsEnum.TextFlag] = new /** @class */ (function (_super) {\n __extends(class_6, _super);\n function class_6() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n /**\n * Отображаемый текст\n */\n _this.text = \"С днём смеха!\";\n /**\n * Цвет текста\n */\n _this.color = \"#000000\";\n /**\n * Шрифт текста\n */\n _this.font = \"monospace\";\n /**\n * Размер текста\n */\n _this.textSize = 12;\n /**\n * Растояние между бквами\n */\n _this.gap = 14;\n /**\n * Размер... чего-то.\n */\n _this.size = 3;\n return _this;\n }\n return class_6;\n }(DefaultCursorEffectsSetting)),\n _a[CursorEffectsEnum.FollowingDot] = new /** @class */ (function (_super) {\n __extends(class_7, _super);\n function class_7() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return class_7;\n }(DefaultCursorEffectsSetting)),\n _a[CursorEffectsEnum.Snowflake] = new /** @class */ (function (_super) {\n __extends(class_8, _super);\n function class_8() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.weight = 0;\n return _this;\n }\n return class_8;\n }(DefaultCursorEffectsSetting)),\n _a[CursorEffectsEnum.Clock] = new /** @class */ (function (_super) {\n __extends(class_9, _super);\n function class_9() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n /**\n * Цвет даты\n */\n _this.dateColor = \"blue\";\n /**\n * Цвет циферблата\n */\n _this.faceColor = \"black\";\n /**\n * Цвет секундной стрелки\n */\n _this.secondsColor = \"red\";\n /**\n * Цвет минутной стрелки\n */\n _this.minutesColor = \"black\";\n /**\n * Цвет часовой стрелки\n */\n _this.hoursColor = \"black\";\n return _this;\n }\n return class_9;\n }(DefaultCursorEffectsSetting)),\n _a[CursorEffectsEnum.Ghost] = new DefaultCursorEffectsSetting,\n _a[CursorEffectsEnum.Bubbles] = new DefaultCursorEffectsSetting,\n _a);\n }\n return CursorEffectsJokeSettings;\n}());\n\nvar DefaultCursorEffectsSetting = /** @class */ (function () {\n function DefaultCursorEffectsSetting() {\n /**\n * Флаг возможности срабатывания\n */\n this.enabled = false;\n /**\n * Весовой коэффициент вероятности курсора\n */\n this.weight = 50;\n }\n return DefaultCursorEffectsSetting;\n}());\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/jokes/cursor.ts?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CursorEffectsJoke\": () => (/* binding */ CursorEffectsJoke),\n/* harmony export */ \"CursorEffectsJokeSettings\": () => (/* binding */ CursorEffectsJokeSettings)\n/* harmony export */ });\n/* harmony import */ var _joke__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../joke */ \"./src/joke.ts\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n// import * as cursor_effects from \"cursor-effects\";\nvar cursor_effects = __webpack_require__(/*! cursor-effects */ \"./node_modules/cursor-effects/dist/cjs.cjs\");\n/**\n * **Красивый курсор**\n *\n * Эффекты, следующие за курсором\n *\n * @author Tim Holman\n * @link https://tholman.com/cursor-effects/\n */\nvar CursorEffectsJoke = /** @class */ (function (_super) {\n __extends(CursorEffectsJoke, _super);\n function CursorEffectsJoke() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.id = 'cursor_effects';\n _this.title = 'Красивый курсор';\n _this.description = 'Эффекты, следующие за курсором';\n _this.settings = new CursorEffectsJokeSettings;\n return _this;\n }\n /**\n * Разблокировать все варианты курсоров\n */\n CursorEffectsJoke.prototype.enableAll = function () {\n for (var _i = 0, _a = Object.keys(this.settings.effects); _i < _a.length; _i++) {\n var key = _a[_i];\n this.settings.effects[key].enabled = true;\n }\n };\n /**\n * Заблокировать все варианты курсоров\n */\n CursorEffectsJoke.prototype.disableAll = function () {\n for (var _i = 0, _a = Object.keys(this.settings.effects); _i < _a.length; _i++) {\n var key = _a[_i];\n this.settings.effects[key].enabled = false;\n }\n };\n CursorEffectsJoke.prototype.weight = function (effect) {\n var s = this.settings.effects[effect];\n return s.enabled ? s.weight : 0;\n };\n CursorEffectsJoke.prototype.getRandomEffect = function () {\n var _this = this;\n var elements = Object.values(CursorEffectsEnum).map(function (e) { return e; });\n var totalWeight = elements.reduce(function (sum, element) { return sum + _this.weight(element); }, 0);\n var randomWeight = Math.random() * totalWeight;\n var currentWeight = 0;\n for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {\n var element = elements_1[_i];\n currentWeight += this.weight(element);\n if (randomWeight <= currentWeight) {\n return element;\n }\n }\n throw new Error(\"Тебя быть тут не должно...\");\n };\n CursorEffectsJoke.prototype.start = function () {\n var effect = this.getRandomEffect();\n var settings = this.settings.effects[effect];\n this.active_cursor_effect = resolveCursorEffectsEnum(effect, settings);\n };\n CursorEffectsJoke.prototype.stop = function () {\n this.active_cursor_effect.destroy();\n };\n return CursorEffectsJoke;\n}(_joke__WEBPACK_IMPORTED_MODULE_0__.StopableJoke));\n\nvar CursorEffectsEnum;\n(function (CursorEffectsEnum) {\n CursorEffectsEnum[\"Rainbow\"] = \"rainbow\";\n CursorEffectsEnum[\"FairyDust\"] = \"fairy_dust\";\n CursorEffectsEnum[\"SpringyEmoji\"] = \"springy_emoji\";\n CursorEffectsEnum[\"Emoji\"] = \"emoji\";\n CursorEffectsEnum[\"Ghost\"] = \"ghost\";\n CursorEffectsEnum[\"Trailing\"] = \"trailing\";\n CursorEffectsEnum[\"TextFlag\"] = \"text_flag\";\n CursorEffectsEnum[\"FollowingDot\"] = \"following_dot\";\n CursorEffectsEnum[\"Bubbles\"] = \"bubbles\";\n CursorEffectsEnum[\"Snowflake\"] = \"snowflake\";\n CursorEffectsEnum[\"Clock\"] = \"clock\";\n})(CursorEffectsEnum || (CursorEffectsEnum = {}));\nfunction resolveCursorEffectsEnum(effect, options) {\n switch (effect) {\n case CursorEffectsEnum.Rainbow:\n return cursor_effects.rainbowCursor(options);\n case CursorEffectsEnum.FairyDust:\n return cursor_effects.fairyDustCursor(options);\n case CursorEffectsEnum.SpringyEmoji:\n return cursor_effects.springyEmojiCursor(options);\n case CursorEffectsEnum.Emoji:\n return cursor_effects.emojiCursor(options);\n case CursorEffectsEnum.Ghost:\n return cursor_effects.ghostCursor(options);\n case CursorEffectsEnum.Trailing:\n return cursor_effects.trailingCursor(options);\n case CursorEffectsEnum.TextFlag:\n return cursor_effects.textFlag(options);\n case CursorEffectsEnum.FollowingDot:\n return cursor_effects.followingDotCursor(options);\n case CursorEffectsEnum.Bubbles:\n return cursor_effects.bubbleCursor(options);\n case CursorEffectsEnum.Snowflake:\n return cursor_effects.snowflakeCursor(options);\n case CursorEffectsEnum.Clock:\n return cursor_effects.clockCursor(options);\n }\n}\nvar CursorEffectsJokeSettings = /** @class */ (function () {\n function CursorEffectsJokeSettings() {\n var _a;\n this.enabled = true;\n this.chance = 100;\n this.effects = (_a = {},\n /**\n * Радужный след за курсором\n */\n _a[CursorEffectsEnum.Rainbow] = new /** @class */ (function (_super) {\n __extends(class_1, _super);\n function class_1() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n /**\n * Длина полосы\n */\n _this.length = 20;\n /**\n * Ширина полосы\n */\n _this.size = 3;\n /**\n * Цвета полос (сверху вниз)\n */\n _this.colors = [\n \"#9400D3\",\n \"#4B0082\",\n \"#0000FF\",\n \"#00FF00\",\n \"#FFFF00\",\n \"#FF7F00\",\n \"#FF0000\"\n ];\n return _this;\n }\n return class_1;\n }(DefaultCursorEffectsSetting)),\n /**\n * Цепочка из эмодзи \"на резинке\" под курсором\n */\n _a[CursorEffectsEnum.SpringyEmoji] = new /** @class */ (function (_super) {\n __extends(class_2, _super);\n function class_2() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n /**\n * Висящий эмодзи\n */\n _this.emoji = \"🤪\";\n return _this;\n }\n return class_2;\n }(DefaultCursorEffectsSetting)),\n /**\n * Падающие от курсора эмодзи\n */\n _a[CursorEffectsEnum.Emoji] = new /** @class */ (function (_super) {\n __extends(class_3, _super);\n function class_3() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n /**\n * Падающие эмодзи\n */\n _this.emoji = [\"🔥\", \"🐬\", \"🦆\"];\n return _this;\n }\n return class_3;\n }(DefaultCursorEffectsSetting)),\n /**\n * Падающие от курсора пылинки\n */\n _a[CursorEffectsEnum.FairyDust] = new /** @class */ (function (_super) {\n __extends(class_4, _super);\n function class_4() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n /**\n * Цвет пылинок\n */\n _this.colors = [\"#ff0000\", \"#00ff00\", \"#0000ff\"];\n return _this;\n }\n return class_4;\n }(DefaultCursorEffectsSetting)),\n /**\n * След \"зависших\" курсоров\n */\n _a[CursorEffectsEnum.Ghost] = new DefaultCursorEffectsSetting,\n /**\n * След курсоров \"на резинке\"\n */\n _a[CursorEffectsEnum.Trailing] = new /** @class */ (function (_super) {\n __extends(class_5, _super);\n function class_5() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n /**\n * Количество элементов\n */\n _this.particles = 15;\n /**\n * Скорость частиц\n */\n _this.rate = 0.4;\n /**\n * Ссылка на картинку с курсором\n * Используйте `null`, что бы использовать картинку курсора по умолчанию\n */\n _this.baseImageSrc = null;\n return _this;\n }\n return class_5;\n }(DefaultCursorEffectsSetting)),\n /**\n * Текст, развивающийся флагом от курсора\n */\n _a[CursorEffectsEnum.TextFlag] = new /** @class */ (function (_super) {\n __extends(class_6, _super);\n function class_6() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n /**\n * Отображаемый текст\n */\n _this.text = \"С днём смеха!\";\n /**\n * Цвет текста\n */\n _this.color = \"#000000\";\n /**\n * Шрифт текста\n */\n _this.font = \"monospace\";\n /**\n * Размер текста\n */\n _this.textSize = 12;\n /**\n * Растояние между бквами\n */\n _this.gap = 14;\n /**\n * Размер... чего-то.\n */\n _this.size = 3;\n return _this;\n }\n return class_6;\n }(DefaultCursorEffectsSetting)),\n /**\n * Точка, преследующая курсор\n */\n _a[CursorEffectsEnum.FollowingDot] = new /** @class */ (function (_super) {\n __extends(class_7, _super);\n function class_7() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n /**\n * Цвет догоняющей точки\n */\n _this.color = \"#323232a6\";\n return _this;\n }\n return class_7;\n }(DefaultCursorEffectsSetting)),\n /**\n * Пузырьки от курсора\n */\n _a[CursorEffectsEnum.Bubbles] = new DefaultCursorEffectsSetting,\n /**\n * Снежинки, летящие от курсора\n *\n * Отключено, потому что сейчас не зима :D\n */\n _a[CursorEffectsEnum.Snowflake] = new /** @class */ (function (_super) {\n __extends(class_8, _super);\n function class_8() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.weight = 0;\n return _this;\n }\n return class_8;\n }(DefaultCursorEffectsSetting)),\n /**\n * Циферблат вокруг курсора\n */\n _a[CursorEffectsEnum.Clock] = new /** @class */ (function (_super) {\n __extends(class_9, _super);\n function class_9() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n /**\n * Цвет даты\n */\n _this.dateColor = \"blue\";\n /**\n * Цвет циферблата\n */\n _this.faceColor = \"black\";\n /**\n * Цвет секундной стрелки\n */\n _this.secondsColor = \"red\";\n /**\n * Цвет минутной стрелки\n */\n _this.minutesColor = \"black\";\n /**\n * Цвет часовой стрелки\n */\n _this.hoursColor = \"black\";\n return _this;\n }\n return class_9;\n }(DefaultCursorEffectsSetting)),\n _a);\n }\n return CursorEffectsJokeSettings;\n}());\n\nvar DefaultCursorEffectsSetting = /** @class */ (function () {\n function DefaultCursorEffectsSetting() {\n /**\n * Флаг возможности срабатывания\n */\n this.enabled = true;\n /**\n * Весовой коэффициент вероятности курсора\n */\n this.weight = 50;\n }\n return DefaultCursorEffectsSetting;\n}());\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/jokes/cursor.ts?"); /***/ }), @@ -76,7 +96,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \****************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"HumanitarianHellJoke\": () => (/* binding */ HumanitarianHellJoke),\n/* harmony export */ \"HumanitarianHellJokeSettings\": () => (/* binding */ HumanitarianHellJokeSettings)\n/* harmony export */ });\n/* harmony import */ var _joke__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../joke */ \"./src/joke.ts\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ \"jquery\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n/**\n * **Ад гуманитария**\n *\n * Все \"тся\" заменяются на \"ться\", а все \"ться\" на \"тся\"\n *\n * @author Kozhilya\n */\nvar HumanitarianHellJoke = /** @class */ (function (_super) {\n __extends(HumanitarianHellJoke, _super);\n function HumanitarianHellJoke() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.id = 'humanitarian_hell';\n _this.settings = new HumanitarianHellJokeSettings;\n return _this;\n }\n HumanitarianHellJoke.prototype.start = function () {\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(this.settings.selector).each(function () {\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).html(jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).html().replace(/(ть?ся)/g, function (fnd) {\n return (fnd.indexOf('ь') > 0) ? 'тся' : 'ться';\n }));\n });\n };\n return HumanitarianHellJoke;\n}(_joke__WEBPACK_IMPORTED_MODULE_0__.Joke));\n\nvar HumanitarianHellJokeSettings = /** @class */ (function () {\n function HumanitarianHellJokeSettings() {\n this.enabled = true;\n this.chance = 20;\n /**\n * Селектор всех элементов, которые будут затронуты\n */\n this.selector = '.post-content';\n }\n return HumanitarianHellJokeSettings;\n}());\n\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/jokes/humanitarian_hell.ts?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"HumanitarianHellJoke\": () => (/* binding */ HumanitarianHellJoke),\n/* harmony export */ \"HumanitarianHellJokeSettings\": () => (/* binding */ HumanitarianHellJokeSettings)\n/* harmony export */ });\n/* harmony import */ var _joke__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../joke */ \"./src/joke.ts\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ \"jquery\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n/**\n * **Ад гуманитария**\n *\n * Все \"тся\" заменяются на \"ться\", а все \"ться\" на \"тся\"\n *\n * @author Kozhilya\n */\nvar HumanitarianHellJoke = /** @class */ (function (_super) {\n __extends(HumanitarianHellJoke, _super);\n function HumanitarianHellJoke() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.id = 'humanitarian_hell';\n _this.title = 'Ад гуманитария';\n _this.description = 'Все \"тся\" заменяются на \"ться\", а все \"ться\" на \"тся\"';\n _this.settings = new HumanitarianHellJokeSettings;\n return _this;\n }\n HumanitarianHellJoke.prototype.start = function () {\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(this.settings.selector).each(function () {\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).html(jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).html().replace(/(ть?ся)/g, function (fnd) {\n return (fnd.indexOf('ь') > 0) ? 'тся' : 'ться';\n }));\n });\n };\n return HumanitarianHellJoke;\n}(_joke__WEBPACK_IMPORTED_MODULE_0__.Joke));\n\nvar HumanitarianHellJokeSettings = /** @class */ (function () {\n function HumanitarianHellJokeSettings() {\n this.enabled = true;\n this.chance = 20;\n /**\n * Селектор всех элементов, которые будут затронуты\n */\n this.selector = '.post-content';\n }\n return HumanitarianHellJokeSettings;\n}());\n\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/jokes/humanitarian_hell.ts?"); /***/ }), @@ -86,7 +106,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \***********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"LetterChaosJoke\": () => (/* binding */ LetterChaosJoke),\n/* harmony export */ \"LetterChaosJokeSettings\": () => (/* binding */ LetterChaosJokeSettings)\n/* harmony export */ });\n/* harmony import */ var _joke__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../joke */ \"./src/joke.ts\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ \"jquery\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\n\n\n/**\n * **Буквенный хаос**\n *\n * Все буквы в словах, кроме первой и последней, перемешены.\n *\n * @author Kozhilya\n */\nvar LetterChaosJoke = /** @class */ (function (_super) {\n __extends(LetterChaosJoke, _super);\n function LetterChaosJoke() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.id = 'letter_chaos';\n _this.settings = new LetterChaosJokeSettings;\n _this.punctuationSymbols = null;\n return _this;\n }\n LetterChaosJoke.prototype.shuffleLetters = function (word) {\n var _a;\n // Check if the word has two or more letters\n if ((word.length < 3) || !this.check(this.settings.shuffle_chance)) {\n return word;\n }\n // Split the word into an array of characters\n var characters = word.split(\"\");\n // Shuffle the characters between the first and last letters\n var middleCharacters = characters.slice(1, -1);\n for (var i = middleCharacters.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n _a = [middleCharacters[j], middleCharacters[i]], middleCharacters[i] = _a[0], middleCharacters[j] = _a[1];\n }\n // Join the shuffled characters back into a word\n return __spreadArray(__spreadArray([characters[0]], middleCharacters, true), [characters[characters.length - 1]], false).join(\"\");\n };\n LetterChaosJoke.prototype.processNode = function (node) {\n var _a;\n node.textContent = (_a = node.textContent) === null || _a === void 0 ? void 0 : _a.replace(/([А-Яа-яA-Za-z]+)/gm, this.shuffleLetters);\n };\n LetterChaosJoke.prototype.start = function () {\n var _this = this;\n var items = jquery__WEBPACK_IMPORTED_MODULE_1___default()(this.settings.selector).find('*').contents().filter(function (_, node) { return node.nodeType === Node.TEXT_NODE; });\n items.each(function (_, node) { return _this.processNode(node); });\n };\n return LetterChaosJoke;\n}(_joke__WEBPACK_IMPORTED_MODULE_0__.Joke));\n\nvar LetterChaosJokeSettings = /** @class */ (function () {\n function LetterChaosJokeSettings() {\n this.enabled = true;\n this.chance = 20;\n /**\n * Селектор всех элементов, которые будут затронуты\n */\n this.selector = '.post-content';\n /**\n * Вероятность того, что буквы будут перемешаны\n */\n this.shuffle_chance = 50;\n }\n return LetterChaosJokeSettings;\n}());\n\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/jokes/letter_chaos.ts?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"LetterChaosJoke\": () => (/* binding */ LetterChaosJoke),\n/* harmony export */ \"LetterChaosJokeSettings\": () => (/* binding */ LetterChaosJokeSettings)\n/* harmony export */ });\n/* harmony import */ var _joke__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../joke */ \"./src/joke.ts\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ \"jquery\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\n\n\n/**\n * **Буквенный хаос**\n *\n * Все буквы в словах, кроме первой и последней, перемешены.\n *\n * @author Kozhilya\n */\nvar LetterChaosJoke = /** @class */ (function (_super) {\n __extends(LetterChaosJoke, _super);\n function LetterChaosJoke() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.id = 'letter_chaos';\n _this.title = 'Буквенный хаос';\n _this.description = 'Все буквы в словах, кроме первой и последней, перемешены.';\n _this.settings = new LetterChaosJokeSettings;\n _this.punctuationSymbols = null;\n return _this;\n }\n LetterChaosJoke.prototype.shuffleLetters = function (word) {\n var _a;\n // Check if the word has two or more letters\n if ((word.length < 3) || !this.check(this.settings.shuffle_chance)) {\n return word;\n }\n // Split the word into an array of characters\n var characters = word.split(\"\");\n // Shuffle the characters between the first and last letters\n var middleCharacters = characters.slice(1, -1);\n for (var i = middleCharacters.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n _a = [middleCharacters[j], middleCharacters[i]], middleCharacters[i] = _a[0], middleCharacters[j] = _a[1];\n }\n // Join the shuffled characters back into a word\n return __spreadArray(__spreadArray([characters[0]], middleCharacters, true), [characters[characters.length - 1]], false).join(\"\");\n };\n LetterChaosJoke.prototype.processNode = function (node) {\n var _a;\n node.textContent = (_a = node.textContent) === null || _a === void 0 ? void 0 : _a.replace(/([А-Яа-яA-Za-z]+)/gm, this.shuffleLetters);\n };\n LetterChaosJoke.prototype.start = function () {\n var _this = this;\n var items = jquery__WEBPACK_IMPORTED_MODULE_1___default()(this.settings.selector).find('*').contents().filter(function (_, node) { return node.nodeType === Node.TEXT_NODE; });\n items.each(function (_, node) { return _this.processNode(node); });\n };\n return LetterChaosJoke;\n}(_joke__WEBPACK_IMPORTED_MODULE_0__.Joke));\n\nvar LetterChaosJokeSettings = /** @class */ (function () {\n function LetterChaosJokeSettings() {\n this.enabled = true;\n this.chance = 20;\n /**\n * Селектор всех элементов, которые будут затронуты\n */\n this.selector = '.post-content';\n /**\n * Вероятность того, что буквы будут перемешаны\n */\n this.shuffle_chance = 50;\n }\n return LetterChaosJokeSettings;\n}());\n\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/jokes/letter_chaos.ts?"); /***/ }), @@ -96,7 +116,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \*****************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"MirrorJoke\": () => (/* binding */ MirrorJoke),\n/* harmony export */ \"MirrorJokeSettings\": () => (/* binding */ MirrorJokeSettings)\n/* harmony export */ });\n/* harmony import */ var _joke__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../joke */ \"./src/joke.ts\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ \"jquery\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n/**\n * **Зеркало**\n *\n * Элементы форума отражаются (по крайней мере, пытаются)\n *\n * @author Kozhilya\n */\nvar MirrorJoke = /** @class */ (function (_super) {\n __extends(MirrorJoke, _super);\n function MirrorJoke() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.id = 'mirror';\n _this.settings = new MirrorJokeSettings;\n return _this;\n }\n MirrorJoke.prototype.start = function () {\n jquery__WEBPACK_IMPORTED_MODULE_1___default()('.post, .post h3, .post-links, .post-author, .post-content')\n .css('transform', 'scaleX(-1)').css('-moz-transform', 'scaleX(-1)').css('-moz-transform', 'scaleX(-1)').css('filter', 'FlipH').css('-ms-filter', '\"FlipH\"');\n jquery__WEBPACK_IMPORTED_MODULE_1___default()('.post-links, .post-links ul, .post h3 span').css('margin-left', '0');\n jquery__WEBPACK_IMPORTED_MODULE_1___default()('.post h3 span').css('margin-right', '25em');\n };\n return MirrorJoke;\n}(_joke__WEBPACK_IMPORTED_MODULE_0__.Joke));\n\nvar MirrorJokeSettings = /** @class */ (function () {\n function MirrorJokeSettings() {\n this.enabled = true;\n this.chance = 30;\n }\n return MirrorJokeSettings;\n}());\n\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/jokes/mirror.ts?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"MirrorJoke\": () => (/* binding */ MirrorJoke),\n/* harmony export */ \"MirrorJokeSettings\": () => (/* binding */ MirrorJokeSettings)\n/* harmony export */ });\n/* harmony import */ var _joke__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../joke */ \"./src/joke.ts\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ \"jquery\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n/**\n * **Зеркало**\n *\n * Элементы форума отражаются (по крайней мере, пытаются)\n *\n * @author Kozhilya\n */\nvar MirrorJoke = /** @class */ (function (_super) {\n __extends(MirrorJoke, _super);\n function MirrorJoke() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.id = 'mirror';\n _this.title = 'Зеркало';\n _this.description = 'Элементы форума отражаются (по крайней мере, пытаются)';\n _this.settings = new MirrorJokeSettings;\n return _this;\n }\n MirrorJoke.prototype.start = function () {\n jquery__WEBPACK_IMPORTED_MODULE_1___default()('.post, .post h3, .post-links, .post-author, .post-content')\n .css('transform', 'scaleX(-1)').css('-moz-transform', 'scaleX(-1)').css('-moz-transform', 'scaleX(-1)').css('filter', 'FlipH').css('-ms-filter', '\"FlipH\"');\n jquery__WEBPACK_IMPORTED_MODULE_1___default()('.post-links, .post-links ul, .post h3 span').css('margin-left', '0');\n jquery__WEBPACK_IMPORTED_MODULE_1___default()('.post h3 span').css('margin-right', '25em');\n };\n return MirrorJoke;\n}(_joke__WEBPACK_IMPORTED_MODULE_0__.Joke));\n\nvar MirrorJokeSettings = /** @class */ (function () {\n function MirrorJokeSettings() {\n this.enabled = false;\n this.chance = 30;\n }\n return MirrorJokeSettings;\n}());\n\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/jokes/mirror.ts?"); /***/ }), @@ -106,7 +126,17 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \****************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ShakeJoke\": () => (/* binding */ ShakeJoke),\n/* harmony export */ \"ShakeJokeSettings\": () => (/* binding */ ShakeJokeSettings)\n/* harmony export */ });\n/* harmony import */ var _joke__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../joke */ \"./src/joke.ts\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ \"jquery\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n/**\n * **Форумо-трясение**\n *\n * Страница форума начинает трястись\n *\n * @author Kozhilya\n */\nvar ShakeJoke = /** @class */ (function (_super) {\n __extends(ShakeJoke, _super);\n function ShakeJoke() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.id = 'shake';\n _this.settings = new ShakeJokeSettings;\n _this.data_name = 'april-fools-shake';\n return _this;\n }\n ShakeJoke.prototype.rand = function (a) {\n return a + this.settings.force * (Math.random() * 2 - 1);\n };\n ShakeJoke.prototype.start = function () {\n var _this = this;\n this.items = jquery__WEBPACK_IMPORTED_MODULE_1___default()(this.settings.selector);\n this.items.each(function (_, elem) {\n var data = {};\n _this.settings.directions.forEach(function (d) {\n data[d] = parseInt(jquery__WEBPACK_IMPORTED_MODULE_1___default()(elem).css('margin-' + d));\n });\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(elem).data(_this.data_name, data);\n });\n this.interval_id = setInterval(function () {\n _this.items.each(function (_, elem) {\n var data = jquery__WEBPACK_IMPORTED_MODULE_1___default()(elem).data(_this.data_name);\n for (var _i = 0, _a = Object.entries(data); _i < _a.length; _i++) {\n var entry = _a[_i];\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(elem).css('margin-' + entry[0], _this.rand(entry[1]));\n }\n });\n }, this.settings.interval);\n };\n ShakeJoke.prototype.stop = function () {\n var _this = this;\n clearInterval(this.interval_id);\n this.items.each(function (_, elem) {\n var data = {};\n _this.settings.directions.forEach(function (d) {\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(elem).css('margin-' + d, data[d]);\n });\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(elem).data(_this.data_name, data);\n });\n };\n return ShakeJoke;\n}(_joke__WEBPACK_IMPORTED_MODULE_0__.StopableJoke));\n\nvar ShakeJokeSettings = /** @class */ (function () {\n function ShakeJokeSettings() {\n this.enabled = true;\n this.chance = 1;\n /**\n * Направление тряски\n */\n this.directions = ['top', 'left', 'bottom', 'left'];\n /**\n * Селектор всех элементов, которые будут трястись\n */\n this.selector = '[id^=pun]';\n /**\n * Частота тряски\n */\n this.interval = 100;\n /**\n * Сила тряски\n */\n this.force = 0.5;\n }\n return ShakeJokeSettings;\n}());\n\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/jokes/shake.ts?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ShakeJoke\": () => (/* binding */ ShakeJoke),\n/* harmony export */ \"ShakeJokeSettings\": () => (/* binding */ ShakeJokeSettings)\n/* harmony export */ });\n/* harmony import */ var _joke__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../joke */ \"./src/joke.ts\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ \"jquery\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n/**\n * **Форумо-трясение**\n *\n * Страница форума начинает трястись\n *\n * @author Kozhilya\n */\nvar ShakeJoke = /** @class */ (function (_super) {\n __extends(ShakeJoke, _super);\n function ShakeJoke() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.id = 'shake';\n _this.title = 'Форумо-трясение';\n _this.description = 'Страница форума начинает трястись';\n _this.settings = new ShakeJokeSettings;\n _this.data_name = 'april-fools-shake';\n return _this;\n }\n ShakeJoke.prototype.rand = function (a) {\n return a + this.settings.force * (Math.random() * 2 - 1);\n };\n ShakeJoke.prototype.start = function () {\n var _this = this;\n this.items = jquery__WEBPACK_IMPORTED_MODULE_1___default()(this.settings.selector);\n this.items.each(function (_, elem) {\n var data = {};\n _this.settings.directions.forEach(function (d) {\n data[d] = parseInt(jquery__WEBPACK_IMPORTED_MODULE_1___default()(elem).css('margin-' + d));\n });\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(elem).data(_this.data_name, data);\n });\n this.interval_id = setInterval(function () {\n _this.items.each(function (_, elem) {\n var data = jquery__WEBPACK_IMPORTED_MODULE_1___default()(elem).data(_this.data_name);\n for (var _i = 0, _a = Object.entries(data); _i < _a.length; _i++) {\n var entry = _a[_i];\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(elem).css('margin-' + entry[0], _this.rand(entry[1]));\n }\n });\n }, this.settings.interval);\n };\n ShakeJoke.prototype.stop = function () {\n var _this = this;\n clearInterval(this.interval_id);\n this.items.each(function (_, elem) {\n var data = {};\n _this.settings.directions.forEach(function (d) {\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(elem).css('margin-' + d, data[d]);\n });\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(elem).data(_this.data_name, data);\n });\n };\n return ShakeJoke;\n}(_joke__WEBPACK_IMPORTED_MODULE_0__.StopableJoke));\n\nvar ShakeJokeSettings = /** @class */ (function () {\n function ShakeJokeSettings() {\n this.enabled = false;\n this.chance = 1;\n /**\n * Направление тряски (тряска происходит путём изменения перечисленных направлений margin на значение ±force от стандартного значения)\n */\n this.directions = ['top', 'left', 'bottom', 'left'];\n /**\n * Сила тряски - насколько отклоняется элемент от стандартного значения\n */\n this.force = 0.5;\n /**\n * Селектор всех элементов, которые будут трястись\n */\n this.selector = '[id^=pun]';\n /**\n * Частота тряски\n */\n this.interval = 100;\n }\n return ShakeJokeSettings;\n}());\n\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/jokes/shake.ts?"); + +/***/ }), + +/***/ "./src/jokes/stupid_title.ts": +/*!***********************************!*\ + !*** ./src/jokes/stupid_title.ts ***! + \***********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"StupidTitleJoke\": () => (/* binding */ StupidTitleJoke),\n/* harmony export */ \"StupidTitleJokeSettings\": () => (/* binding */ StupidTitleJokeSettings)\n/* harmony export */ });\n/* harmony import */ var _joke__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../joke */ \"./src/joke.ts\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ \"jquery\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (undefined && undefined.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\n\n\n/**\n * **Глупые статусы**\n *\n * Каждому пользователю даётся новый глупый статус.\n *\n * @author Kozhilya\n */\nvar StupidTitleJoke = /** @class */ (function (_super) {\n __extends(StupidTitleJoke, _super);\n function StupidTitleJoke() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.id = 'stupid_title';\n _this.title = 'Глупые статусы';\n _this.description = 'Каждому пользователю даётся новый глупый статус.';\n _this.settings = new StupidTitleJokeSettings;\n _this.loadedGenders = null;\n _this.seed = 0;\n return _this;\n }\n StupidTitleJoke.prototype.loadGenders = function () {\n return __awaiter(this, void 0, void 0, function () {\n var names, url, response, json;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n names = jquery__WEBPACK_IMPORTED_MODULE_1___default()('.pa-author a')\n .map(function (_, elem) { return elem.innerText; }).toArray()\n .reduce(function (arr, name) {\n if (arr.indexOf(name) < 0) {\n arr.push(name);\n }\n return arr;\n }, []);\n url = '/api.php?' + jquery__WEBPACK_IMPORTED_MODULE_1___default().param({ method: 'users.get', fields: 'username,sex', username: names });\n return [4 /*yield*/, fetch(url)];\n case 1:\n response = _a.sent();\n return [4 /*yield*/, response.json()];\n case 2:\n json = _a.sent();\n this.loadedGenders = {};\n if (json.error) {\n return [2 /*return*/];\n }\n json.response.users.forEach(function (element) {\n if (element.sex === '0') {\n return;\n }\n _this.loadedGenders[element.username] = element.sex === '1';\n });\n return [2 /*return*/];\n }\n });\n });\n };\n StupidTitleJoke.prototype.resolveGender = function (name) {\n if (this.settings.gender_resolver !== null) {\n return !!this.settings.gender_resolver.call(this, name);\n }\n if (name in this.loadedGenders) {\n return !!this.loadedGenders[name];\n }\n this.resetSeed();\n return this.selectRandom(name, { 'm': 1, 'f': 1 }) === 'm';\n };\n StupidTitleJoke.prototype.start = function () {\n return __awaiter(this, void 0, void 0, function () {\n var cache;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.loadGenders()];\n case 1:\n _a.sent();\n cache = {};\n jquery__WEBPACK_IMPORTED_MODULE_1___default()('.post-author').each(function (_, root) {\n var name = jquery__WEBPACK_IMPORTED_MODULE_1___default()('.pa-author a', root).text();\n if (!name) {\n return;\n }\n if (!(name in cache)) {\n _this.resetSeed();\n cache[name] = _this.generatePhrase(name);\n }\n jquery__WEBPACK_IMPORTED_MODULE_1___default()('.pa-title', root).text(cache[name]);\n });\n return [2 /*return*/];\n }\n });\n });\n };\n StupidTitleJoke.prototype.prng = function (name, seed, limit) {\n /*\n https://github.com/bryc/code/blob/master/jshash/experimental/cyrb53.js\n\n cyrb53 (c) 2018 bryc (github.com/bryc)\n A fast and simple hash function with decent collision resistance.\n Largely inspired by MurmurHash2/3, but with a focus on speed/simplicity.\n Public domain. Attribution appreciated.\n */\n var h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;\n for (var i = 0, ch = void 0; i < name.length; i++) {\n ch = name.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, 2654435761);\n h2 = Math.imul(h2 ^ ch, 1597334677);\n }\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n var value = 4294967296 * (2097151 & h2) + (h1 >>> 0);\n return Math.floor(Math.pow(Math.sin(value), 2) * limit) % limit;\n };\n StupidTitleJoke.prototype.resetSeed = function () {\n var date = new Date();\n var time = new Date().getUTCHours() * 60 + new Date().getUTCMinutes();\n this.seed = Math.floor(time / this.settings.change_frequency);\n console.log('Seed reset:', time, this.seed);\n };\n StupidTitleJoke.prototype.selectRandom = function (name, variants) {\n var elements = Object.keys(variants);\n var totalWeight = elements.reduce(function (sum, element) { return sum + variants[element]; }, 0);\n var randomWeight = this.prng(name, this.seed++, totalWeight);\n var currentWeight = 0;\n for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {\n var element = elements_1[_i];\n currentWeight += variants[element];\n if (randomWeight <= currentWeight) {\n return element;\n }\n }\n throw new Error(\"Тебя быть тут не должно...\");\n };\n StupidTitleJoke.prototype.buildVariants = function (type, gender) {\n var result = {};\n var variants = this.settings.variants[type];\n for (var _i = 0, _a = Object.entries(variants); _i < _a.length; _i++) {\n var iterator = _a[_i];\n var word = iterator[0];\n var wordSettings = iterator[1];\n if (!wordSettings.enabled || (wordSettings.gender === !gender)) {\n continue;\n }\n if (!this.settings.rude && wordSettings.rude) {\n continue;\n }\n result[word] = wordSettings.weight;\n }\n return result;\n };\n StupidTitleJoke.prototype.capitalizeFirst = function (str) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n };\n StupidTitleJoke.prototype.generatePhrase = function (name) {\n var _this = this;\n var gender = this.resolveGender(name);\n var prhase = this.selectRandom(name, this.settings.schemas);\n return this.capitalizeFirst(prhase.replace(/\\{(.+?)\\}/g, function (_, type) {\n var variants = _this.buildVariants(type, gender);\n return _this.selectRandom(name, variants);\n }));\n };\n return StupidTitleJoke;\n}(_joke__WEBPACK_IMPORTED_MODULE_0__.Joke));\n\nvar StupidTitleJokeSettings = /** @class */ (function () {\n function StupidTitleJokeSettings() {\n this.enabled = true;\n this.chance = 100;\n /**\n * Определение пола по имени.\n * По умолчанию род устанавливается случайным образом\n *\n * Если установлено значение `null`, система попытается загрузить пол, установленный в настройках аккаунта. Если этот пол определить невозможно, то он будет выбран случайно. Эта настройка позволяет изменить это поведение, если ваш форум обладает ролевой системой, в которой пол определяется иным образом.\n *\n * @param name Имя персонажа\n * @returns true, если мужской род; false, если женский род\n */\n this.gender_resolver = null;\n /**\n * Разрешить возможно оскорбительные варианты\n */\n this.rude = false;\n /**\n * Частота смены статусов (в минутах)\n */\n this.change_frequency = 5;\n /**\n * Разрешённые схемы формирования статусов\n *\n * {adj} - прилагательное\n * {noun} - имя существительно\n * {verb} - глагол\n * {adv} - наречие\n * {place} - дополнение места\n * {p} - знак препинания\n */\n this.schemas = {\n '{adj} {noun}{p}': 10,\n '{noun} {adj}{p}': 3,\n '{adj}, {adj} {noun}{p}': 10,\n '{adj} и очень {adj} {noun}{p}': 10,\n '{adj} {noun} {verb}{p}': 10,\n '{adj} {noun} {adv} {verb}{p}': 5,\n '{adj} {noun} {verb} {place}{p}': 5,\n '{adj} {noun} {adv} {verb} {place}{p}': 5,\n };\n /**\n * Вариант слов\n * Смотрите раздел описания скрипта, что бы настроить это поле\n */\n this.variants = {\n adj: __assign(__assign({}, buildVariant(true, 'жесткий,^удачливый,низкий,знакомый,откровенный,^мирный,грамотный,вкусный,виртуальный,пышный,провинциальный,$жирный,заинтересованный,объективный,^оригинальный,пожилой,чистый,особенный,выгодный,громадный,обыкновенный,чужой,ударный,^солнечный,истинный,посторонний,южный,седой,$бесполезный,острый,пестрый,формальный,повседневный,невозможный,$жалкий,целый,$глупый,последний,выходной,серьезный,подземный,небесный,любимый,былой,семейный,далекий,северный,суровый,гигантский,иностранный,родной,конструктивный,показательный,нужный,чрезвычайный,гордый,банальный,открытый,независимый,запасной,мстительный,грубый,алчный,мелочный,хладнокровный,спокойный,терпеливый,креативный,активный,адекватный,застенчивый,опрятный,безнадёжный,уверенный в себе,доброжелательный,ласковый,робкий,воспитанный,самовлюблённый,деятельный,двуличный,верный')), buildVariant(false, 'жесткая,^удачливая,низкая,знакомая,откровенная,^мирная,грамотная,вкусная,виртуальная,пышная,провинциальная,$жирная,заинтересованная,объективная,^оригинальная,пожилая,чистая,особенная,выгодная,громадная,обыкновенная,чужая,ударная,^солнечная,истинная,посторонняя,южная,седая,$бесполезная,острая,пестрая,формальная,повседневная,невозможная,$жалкая,целая,$глупая,последняя,выходная,серьезная,подземная,небесная,любимая,былая,семейная,далекая,северная,суровая,гигантская,иностранная,родная,конструктивная,показательная,нужная,чрезвычайная,гордая,банальная,открытая,независимая,запасная,мстительная,грубая,алчная,мелочная,хладнокровная,спокаяная,терпеливая,креативная,активная,адекватная,застенчивая,опрятная,безнадёжная,уверенная в себе,доброжелательная,ласковая,робкая,воспитанная,самовлюблённая,деятельная,двуличная,верная')),\n noun: __assign(__assign(__assign({}, buildVariant(null, '')), buildVariant(true, 'орёл, ниндзя, манекен, пузырь, бродяга, рыцарь, кентавр, зайц, диван, наследник, сын, джентльмен, басурманин, карасик, $злоумышленник, $раб, хоббит, одиночка, отец, кролик, бруталище, дворф, актёр, %дед, спортсмен, $балбес, %мальчег, лев, ёж, организм, монах, хоббит, борец, тигр, монстр, массажист, мачо, эльф, ледник, жук, кот, зомби, проказник, дракон, носорог, волк, лесоруб, кит, %дедушка, динозавр, бард, кулак, принц, %сынок, мальчик, товарищ, ёжик, сурикат')), buildVariant(false, 'заноза, волторна, $личинка, детка, %бабушка, простуда, черепашка, мышь, волчица, деревяшка, пиранья, каруселька, красотка, леди, %дочка, орлица, принцесса, $ведьма, травка, актриса, наследница, %деффачка, горгулья, белочка, акула, машинка, конфетка, знаменитость, косточка, спортсменка, панда, мать, львица, эльфийка, $злоумышленница, чертовка, дворфиха, кошка, $рабыня, скамеечка, дочь, монашка, бактерия, рыбка, бусинка, $бабка, девочка, валькирия, килька, бабочка, милашка, крышка, тигрица, рыбка, русалочка')),\n verb: __assign(__assign(__assign({}, buildVariant(null, 'встаёт, снимает, приказывает, указывает, собирается, чувствует опасность, орёт, болеет, поздравляет, освобождает, поздравляет, бежит, берёт и делает, молчит, радуется, прощает, читает, снимает, снимается в фильме, что-то скрывает, думает, имеет план и придерживается его, тянет, работает, меняется, ловит, отказаться куда-то идти, заходит, замирает, оформляет, нарушает, отказывается что-то делать, шепчет, снимается в сериале, скрывается, учит, спрашивает, идёт, отказывается вставать, прибывает, отказывается, забывает, получает, плывёт, отвечает, поглядывает, говорит, просыпается, соединяет, оглядывается')), buildVariant(true, 'женится, женился, успел, не успел, смог, скрылся, заработался, познал дзен, присел, обиделся, проснулся, взял и сделал, додумался, не спал')), buildVariant(false, 'выходит замуж, вышла замуж, успела, не успела, смогла, скрылась, заработалась, познала дзен, присела, обиделась, проснулась, взяла и сделала, додумалась, не спала')),\n place: __assign({}, buildVariant(null, 'где-то, в пустыне, на пляже, под дождём, %под проливным дождём, в квартире, %в тёплой и уютной квартире, в космосе, в театре, в филармонии, на заснеженной вершине, на конференции, на форуме, в очереди, в лесу, в джунглях, под водой')),\n adv: __assign({}, buildVariant(null, 'счастливо, уныло, грустно, позже, немедленно, регулярно, вновь, опять, уже, внезапно, предсказуемо, медленно, быстро, %молниеносно, $грубо, безрассудно, осмысленно, расчётливо')),\n p: {\n '': new StupidTitleSetting({ weight: 10 }),\n '.': new StupidTitleSetting({ weight: 10 }),\n '...': new StupidTitleSetting({ weight: 5 }),\n '!': new StupidTitleSetting({ weight: 5 }),\n '!!!': new StupidTitleSetting({ weight: 2 }),\n '?': new StupidTitleSetting({ weight: 2 }),\n '?!': new StupidTitleSetting({ weight: 1 }),\n },\n };\n }\n return StupidTitleJokeSettings;\n}());\n\nvar StupidTitleSetting = /** @class */ (function () {\n function StupidTitleSetting(options) {\n if (options === void 0) { options = new Object; }\n this.weight = 10;\n this.enabled = true;\n this.rude = false;\n this.gender = null;\n for (var _i = 0, _a = Object.entries(options); _i < _a.length; _i++) {\n var iterator = _a[_i];\n if (iterator[0] in this) {\n this[iterator[0]] = iterator[1];\n }\n }\n }\n return StupidTitleSetting;\n}());\nfunction buildVariant(gender, input) {\n var result = {};\n var words = input.split(',').map(function (word) { return word.trim(); });\n words.forEach(function (word) {\n var clean_word = word.replace(/[^А-ЯЁа-яёA-Za-z\\- ]/g, '');\n if (clean_word === '') {\n return;\n }\n result[clean_word] = new StupidTitleSetting({\n gender: gender,\n rude: word.indexOf('$') >= 0,\n enabled: word.indexOf('!') < 0,\n weight: 10 * ((word.indexOf('$') >= 0) ? 0.5 : 1) * ((word.indexOf('%') >= 0) ? 0.5 : 1) * ((word.indexOf('^') >= 0) ? 2 : 1)\n });\n });\n return result;\n}\nwindow.BuildStupdiTitleVariant = buildVariant;\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/jokes/stupid_title.ts?"); /***/ }), @@ -116,7 +146,17 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \*********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _joker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./joker */ \"./src/joker.ts\");\n/* harmony import */ var _jokes_shake__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jokes/shake */ \"./src/jokes/shake.ts\");\n/* harmony import */ var _jokes_humanitarian_hell__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./jokes/humanitarian_hell */ \"./src/jokes/humanitarian_hell.ts\");\n/* harmony import */ var _jokes_mirror__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./jokes/mirror */ \"./src/jokes/mirror.ts\");\n/* harmony import */ var _jokes_carnival__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./jokes/carnival */ \"./src/jokes/carnival.ts\");\n/* harmony import */ var _jokes_crazy_letters__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./jokes/crazy_letters */ \"./src/jokes/crazy_letters.ts\");\n/* harmony import */ var _jokes_crazy_punctuation__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./jokes/crazy_punctuation */ \"./src/jokes/crazy_punctuation.ts\");\n/* harmony import */ var _jokes_letter_chaos__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./jokes/letter_chaos */ \"./src/jokes/letter_chaos.ts\");\n/* harmony import */ var _jokes_cursor__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./jokes/cursor */ \"./src/jokes/cursor.ts\");\n\n\n\n\n\n\n\n\n\nwindow.AprilJokes = (function (jokes) {\n var cl = new _joker__WEBPACK_IMPORTED_MODULE_0__.JokerClass();\n jokes.forEach(function (joke) {\n cl.add(new joke());\n });\n cl.regularStart();\n return cl;\n})([\n _jokes_shake__WEBPACK_IMPORTED_MODULE_1__.ShakeJoke,\n _jokes_humanitarian_hell__WEBPACK_IMPORTED_MODULE_2__.HumanitarianHellJoke,\n _jokes_mirror__WEBPACK_IMPORTED_MODULE_3__.MirrorJoke,\n _jokes_carnival__WEBPACK_IMPORTED_MODULE_4__.CarnivalJoke,\n _jokes_crazy_letters__WEBPACK_IMPORTED_MODULE_5__.CrazyLettersJoke,\n _jokes_crazy_punctuation__WEBPACK_IMPORTED_MODULE_6__.CrazyPunctuationJoke,\n _jokes_letter_chaos__WEBPACK_IMPORTED_MODULE_7__.LetterChaosJoke,\n _jokes_cursor__WEBPACK_IMPORTED_MODULE_8__.CursorEffectsJoke,\n]);\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/main.ts?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _joker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./joker */ \"./src/joker.ts\");\n/* harmony import */ var _jokes_shake__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jokes/shake */ \"./src/jokes/shake.ts\");\n/* harmony import */ var _jokes_humanitarian_hell__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./jokes/humanitarian_hell */ \"./src/jokes/humanitarian_hell.ts\");\n/* harmony import */ var _jokes_mirror__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./jokes/mirror */ \"./src/jokes/mirror.ts\");\n/* harmony import */ var _jokes_carnival__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./jokes/carnival */ \"./src/jokes/carnival.ts\");\n/* harmony import */ var _jokes_crazy_letters__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./jokes/crazy_letters */ \"./src/jokes/crazy_letters.ts\");\n/* harmony import */ var _jokes_letter_chaos__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./jokes/letter_chaos */ \"./src/jokes/letter_chaos.ts\");\n/* harmony import */ var _jokes_cursor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./jokes/cursor */ \"./src/jokes/cursor.ts\");\n/* harmony import */ var _jokes_stupid_title__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./jokes/stupid_title */ \"./src/jokes/stupid_title.ts\");\n\n\n\n\n\n\n\n\n\nwindow.AprilJokes = (function (jokes) {\n var cl = new _joker__WEBPACK_IMPORTED_MODULE_0__.JokerClass();\n jokes.forEach(function (joke) {\n cl.add(new joke());\n });\n $(function () { return cl.regularStart(); });\n return cl;\n})([\n _jokes_shake__WEBPACK_IMPORTED_MODULE_1__.ShakeJoke,\n _jokes_humanitarian_hell__WEBPACK_IMPORTED_MODULE_2__.HumanitarianHellJoke,\n _jokes_mirror__WEBPACK_IMPORTED_MODULE_3__.MirrorJoke,\n _jokes_carnival__WEBPACK_IMPORTED_MODULE_4__.CarnivalJoke,\n _jokes_crazy_letters__WEBPACK_IMPORTED_MODULE_5__.CrazyLettersJoke,\n _jokes_letter_chaos__WEBPACK_IMPORTED_MODULE_6__.LetterChaosJoke,\n _jokes_cursor__WEBPACK_IMPORTED_MODULE_7__.CursorEffectsJoke,\n _jokes_stupid_title__WEBPACK_IMPORTED_MODULE_8__.StupidTitleJoke,\n]);\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/main.ts?"); + +/***/ }), + +/***/ "./src/ui.ts": +/*!*******************!*\ + !*** ./src/ui.ts ***! + \*******************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"JokerUI\": () => (/* binding */ JokerUI)\n/* harmony export */ });\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ \"jquery\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _html_button_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./html/button.html */ \"./src/html/button.html\");\n/* harmony import */ var _html_styles_html__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./html/styles.html */ \"./src/html/styles.html\");\n/* harmony import */ var _html_window_html__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./html/window.html */ \"./src/html/window.html\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\n\n\n\n\nvar JokerUI = /** @class */ (function () {\n function JokerUI(joker) {\n var _this = this;\n this.joker = joker;\n jquery__WEBPACK_IMPORTED_MODULE_0___default()('link[rel=\"stylesheet\"]').eq(0).before(_html_styles_html__WEBPACK_IMPORTED_MODULE_2__[\"default\"]);\n var button = this.button;\n button.hide();\n button.mybbModal({\n title: \"Настройки первоапрельских шуток\",\n content: function () { return _this.render(); },\n closer: true,\n noscroll: true,\n escClose: true,\n });\n }\n Object.defineProperty(JokerUI.prototype, \"button\", {\n get: function () {\n var button = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.april-fools__button');\n if (button.length === 0) {\n button = jquery__WEBPACK_IMPORTED_MODULE_0___default()(_html_button_html__WEBPACK_IMPORTED_MODULE_1__[\"default\"]).appendTo('body');\n }\n return button;\n },\n enumerable: false,\n configurable: true\n });\n JokerUI.prototype.show = function () {\n this.button.show();\n };\n JokerUI.prototype.render = function () {\n var _this = this;\n var result = jquery__WEBPACK_IMPORTED_MODULE_0___default()('
').html(_html_window_html__WEBPACK_IMPORTED_MODULE_3__[\"default\"]);\n var row_template = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#april-fools__window-row', result).html();\n var joke_container = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.april-fools__jokes', result);\n var _loop_1 = function (joke) {\n var row = jquery__WEBPACK_IMPORTED_MODULE_0___default()(eval('`' + row_template + '`'));\n jquery__WEBPACK_IMPORTED_MODULE_0___default()('input[type=\"checkbox\"]', row).prop('checked', joke.settings.enabled)\n .on('click', function (e) { return _this.joker.toggleJoke(joke.id, e.currentTarget.checked); });\n joke_container.append(row);\n };\n for (var _i = 0, _a = Object.values(this.joker.jokes); _i < _a.length; _i++) {\n var joke = _a[_i];\n _loop_1(joke);\n }\n jquery__WEBPACK_IMPORTED_MODULE_0___default()('button', result).on('click', function () { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.joker.clearUserStates()];\n case 1:\n _a.sent();\n window.location.reload();\n return [2 /*return*/];\n }\n });\n }); });\n return jquery__WEBPACK_IMPORTED_MODULE_0___default()('.april-fools__content', result);\n };\n return JokerUI;\n}());\n\n\n\n//# sourceURL=webpack://mybb-april-fools/./src/ui.ts?"); /***/ }), diff --git a/dist/april-fools.min.js b/dist/april-fools.min.js index 905a914..b56a28e 100644 --- a/dist/april-fools.min.js +++ b/dist/april-fools.min.js @@ -1 +1 @@ -(()=>{"use strict";var t={442:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.bubbleCursor=function(t){let e,n,i,o=t&&t.element,r=o||document.body,s=window.innerWidth,c=window.innerHeight,l={x:s/2,y:s/2},a=[],h=[];const u=window.matchMedia("(prefers-reduced-motion: reduce)");function d(){if(u.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;e=document.createElement("canvas"),n=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",o?(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=s,e.height=c),r.addEventListener("mousemove",A),r.addEventListener("touchmove",p,{passive:!0}),r.addEventListener("touchstart",p,{passive:!0}),window.addEventListener("resize",f),y()}function f(t){s=window.innerWidth,c=window.innerHeight,o?(e.width=r.clientWidth,e.height=r.clientHeight):(e.width=s,e.height=c)}function p(t){if(t.touches.length>0)for(let e=0;e=0;t--)a[t].lifeSpan<0&&a.splice(t,1);0==a.length&&n.clearRect(0,0,s,c)}}(),i=requestAnimationFrame(y)}function m(){e.remove(),cancelAnimationFrame(i),r.removeEventListener("mousemove",A),r.removeEventListener("touchmove",p),r.removeEventListener("touchstart",p),window.addEventListener("resize",f)}function v(t,e,n){const i=Math.floor(60*Math.random()+60);this.initialLifeSpan=i,this.lifeSpan=i,this.velocity={x:(Math.random()<.5?-1:1)*(Math.random()/10),y:-1*Math.random()-.4},this.position={x:t,y:e},this.canv=n,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--;const 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 u.onchange=()=>{u.matches?m():d()},d(),{destroy:m}},e.clockCursor=function(t){let e,n,i,o=t&&t.element,r=o||document.body,s=window.innerWidth,c=window.innerHeight,l={x:s/2,y:s/2};const a=t&&t.dateColor||"blue",h=t&&t.faceColor||"black",u=t&&t.secondsColor||"red",d=t&&t.minutesColor||"black",f=t&&t.hoursColor||"black",p=.4;let A=new Date,g=A.getDate(),y=A.getYear()+1900;const m=(" "+["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"][A.getDay()]+" "+g+" "+["JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"][A.getMonth()]+" "+y).split(""),v=["3","4","5","6","7","8","9","10","11","12","1","2"],w=v.length,x=["•","•","•"],E=["•","•","•","•"],b=["•","•","•","•","•"],C=360/w,M=360/m.length,L=45/6.5,S=[],B=[],_=[],R=[],Y=[],j=[],O=[],T=[],H=[];var W=parseInt(m.length+w+x.length+E.length+b.length)+1;const F=window.matchMedia("(prefers-reduced-motion: reduce)");function I(){if(F.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;e=document.createElement("canvas"),n=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",o?(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=s,e.height=c),n.font="10px sans-serif",n.textAlign="center",n.textBaseline="middle";for(let t=0;t0)if(o){const e=r.getBoundingClientRect();l.x=t.touches[0].clientX-e.left,l.y=t.touches[0].clientY-e.top}else l.x=t.touches[0].clientX,l.y=t.touches[0].clientY}function X(t){if(o){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}function P(){!function(){_[0]=Math.round(S[0]+=(l.y-S[0])*p),R[0]=Math.round(B[0]+=(l.x-B[0])*p);for(let t=1;t=c-80&&(S[t-1]=c-80),B[t-1]>=s-80&&(B[t-1]=s-80)}(),function(){n.clearRect(0,0,s,c);const t=new Date,e=t.getSeconds(),i=Math.PI*(e-15)/30,o=t.getMinutes(),r=Math.PI*(o-15)/30,l=t.getHours(),a=Math.PI*(l-3)/6+Math.PI*parseInt(t.getMinutes())/360;for(let t=0;t{F.matches?z():I()},I(),{destroy:z}},e.emojiCursor=function(t){const e=t&&t.emoji||["😀","😂","😆","😊"];let n=t&&t.element,i=n||document.body,o=window.innerWidth,r=window.innerHeight;const s={x:o/2,y:o/2},c={x:o/2,y:o/2};let l=0;const a=[],h=[];let u,d,f;const p=window.matchMedia("(prefers-reduced-motion: reduce)");function A(){if(p.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;u=document.createElement("canvas"),d=u.getContext("2d"),u.style.top="0px",u.style.left="0px",u.style.pointerEvents="none",n?(u.style.position="absolute",i.appendChild(u),u.width=i.clientWidth,u.height=i.clientHeight):(u.style.position="fixed",document.body.appendChild(u),u.width=o,u.height=r),d.font="21px serif",d.textBaseline="middle",d.textAlign="center",e.forEach((t=>{let e=d.measureText(t),n=document.createElement("canvas"),i=n.getContext("2d");n.width=e.width,n.height=2*e.actualBoundingBoxAscent,i.textAlign="center",i.font="21px serif",i.textBaseline="middle",i.fillText(t,n.width/2,e.actualBoundingBoxAscent),h.push(n)})),i.addEventListener("mousemove",m,{passive:!0}),i.addEventListener("touchmove",y,{passive:!0}),i.addEventListener("touchstart",y,{passive:!0}),window.addEventListener("resize",g),w()}function g(t){o=window.innerWidth,r=window.innerHeight,n?(u.width=i.clientWidth,u.height=i.clientHeight):(u.width=o,u.height=r)}function y(t){if(t.touches.length>0)for(let e=0;e{if(n){const e=i.getBoundingClientRect();s.x=t.clientX-e.left,s.y=t.clientY-e.top}else s.x=t.clientX,s.y=t.clientY;Math.hypot(s.x-c.x,s.y-c.y)>1&&(v(s.x,s.y,h[Math.floor(Math.random()*e.length)]),c.x=s.x,c.y=s.y,l=t.timeStamp)}))}function v(t,e,n){a.push(new E(t,e,n))}function w(){!function(){if(0!=a.length){d.clearRect(0,0,o,r);for(let t=0;t=0;t--)a[t].lifeSpan<0&&a.splice(t,1);0==a.length&&d.clearRect(0,0,o,r)}}(),f=requestAnimationFrame(w)}function x(){u.remove(),cancelAnimationFrame(f),i.removeEventListener("mousemove",m),i.removeEventListener("touchmove",y),i.removeEventListener("touchstart",y),window.addEventListener("resize",g)}function E(t,e,n){const i=Math.floor(60*Math.random()+80);this.initialLifeSpan=i,this.lifeSpan=i,this.velocity={x:(Math.random()<.5?-1:1)*(Math.random()/2),y:.4*Math.random()+.8},this.position={x:t,y:e},this.canv=n,this.update=function(t){this.position.x+=this.velocity.x,this.position.y+=this.velocity.y,this.lifeSpan--,this.velocity.y+=.05;const 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?x():A()},A(),{destroy:x}},e.fairyDustCursor=function(t){let e=t&&t.colors||["#D61C59","#E7D84B","#1B8798"],n=t&&t.element,i=n||document.body,o=window.innerWidth,r=window.innerHeight;const s={x:o/2,y:o/2},c={x:o/2,y:o/2},l=[],a=[];let h,u,d;const f=window.matchMedia("(prefers-reduced-motion: reduce)");function p(){if(f.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;h=document.createElement("canvas"),u=h.getContext("2d"),h.style.top="0px",h.style.left="0px",h.style.pointerEvents="none",n?(h.style.position="absolute",i.appendChild(h),h.width=i.clientWidth,h.height=i.clientHeight):(h.style.position="fixed",i.appendChild(h),h.width=o,h.height=r),u.font="21px serif",u.textBaseline="middle",u.textAlign="center",e.forEach((t=>{let e=u.measureText("*"),n=document.createElement("canvas"),i=n.getContext("2d");n.width=e.width,n.height=e.actualBoundingBoxAscent+e.actualBoundingBoxDescent,i.fillStyle=t,i.textAlign="center",i.font="21px serif",i.textBaseline="middle",i.fillText("*",n.width/2,e.actualBoundingBoxAscent),a.push(n)})),i.addEventListener("mousemove",y),i.addEventListener("touchmove",g,{passive:!0}),i.addEventListener("touchstart",g,{passive:!0}),window.addEventListener("resize",A),v()}function A(t){o=window.innerWidth,r=window.innerHeight,n?(h.width=i.clientWidth,h.height=i.clientHeight):(h.width=o,h.height=r)}function g(t){if(t.touches.length>0)for(let e=0;e{if(n){const e=i.getBoundingClientRect();s.x=t.clientX-e.left,s.y=t.clientY-e.top}else s.x=t.clientX,s.y=t.clientY;Math.hypot(s.x-c.x,s.y-c.y)>1.5&&(m(s.x,s.y,a[Math.floor(Math.random()*e.length)]),c.x=s.x,c.y=s.y)}))}function m(t,e,n){l.push(new x(t,e,n))}function v(){!function(){if(0!=l.length){u.clearRect(0,0,o,r);for(let t=0;t=0;t--)l[t].lifeSpan<0&&l.splice(t,1);0==l.length&&u.clearRect(0,0,o,r)}}(),d=requestAnimationFrame(v)}function w(){h.remove(),cancelAnimationFrame(d),i.removeEventListener("mousemove",y),i.removeEventListener("touchmove",g),i.removeEventListener("touchstart",g),window.addEventListener("resize",A)}function x(t,e,n){const i=Math.floor(30*Math.random()+60);this.initialLifeSpan=i,this.lifeSpan=i,this.velocity={x:(Math.random()<.5?-1:1)*(Math.random()/2),y:.7*Math.random()+.9},this.position={x:t,y:e},this.canv=n,this.update=function(t){this.position.x+=this.velocity.x,this.position.y+=this.velocity.y,this.lifeSpan--,this.velocity.y+=.02;const 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 f.onchange=()=>{f.matches?w():p()},p(),{destroy:w}},e.followingDotCursor=function(t){let e,n,i=t&&t.element,o=i||document.body,r=window.innerWidth,s=window.innerHeight,c={x:r/2,y:r/2},l=new function(t,e,n,i){this.position={x:t,y:e},this.width=10,this.lag=10,this.moveTowards=function(t,e,n){this.position.x+=(t-this.position.x)/this.lag,this.position.y+=(e-this.position.y)/this.lag,n.fillStyle=a,n.beginPath(),n.arc(this.position.x,this.position.y,this.width,0,2*Math.PI),n.fill(),n.closePath()}}(r/2,s/2,10,10),a=t?.color||"#323232a6";const h=window.matchMedia("(prefers-reduced-motion: reduce)");function u(){if(h.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;e=document.createElement("canvas"),n=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",i?(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=s),o.addEventListener("mousemove",f),window.addEventListener("resize",d),p()}function d(t){r=window.innerWidth,s=window.innerHeight,i?(e.width=o.clientWidth,e.height=o.clientHeight):(e.width=r,e.height=s)}function f(t){if(i){const e=o.getBoundingClientRect();c.x=t.clientX-e.left,c.y=t.clientY-e.top}else c.x=t.clientX,c.y=t.clientY}function p(){n.clearRect(0,0,r,s),l.moveTowards(c.x,c.y,n),requestAnimationFrame(p)}function A(){e.remove(),cancelAnimationFrame(p),o.removeEventListener("mousemove",f),window.addEventListener("resize",d)}return h.onchange=()=>{h.matches?A():u()},u(),{destroy:A}},e.ghostCursor=function(t){let e,n,i,o=t&&t.element,r=o||document.body,s=window.innerWidth,c=window.innerHeight,l={x:s/2,y:s/2},a=[],h=new Image;h.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 u=window.matchMedia("(prefers-reduced-motion: reduce)");function d(){if(u.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;e=document.createElement("canvas"),n=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",o?(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=s,e.height=c),r.addEventListener("mousemove",A),r.addEventListener("touchmove",p,{passive:!0}),r.addEventListener("touchstart",p,{passive:!0}),window.addEventListener("resize",f),y()}function f(t){s=window.innerWidth,c=window.innerHeight,o?(e.width=r.clientWidth,e.height=r.clientHeight):(e.width=s,e.height=c)}function p(t){if(t.touches.length>0)for(let e=0;e=0;t--)a[t].lifeSpan<0&&a.splice(t,1);0==a.length&&n.clearRect(0,0,s,c)}}(),i=requestAnimationFrame(y)}function m(){e.remove(),cancelAnimationFrame(i),r.removeEventListener("mousemove",A),r.removeEventListener("touchmove",p),r.removeEventListener("touchstart",p),window.addEventListener("resize",f)}function v(t,e,n){this.initialLifeSpan=40,this.lifeSpan=40,this.position={x:t,y:e},this.image=n,this.update=function(t){this.lifeSpan--;const e=Math.max(this.lifeSpan/this.initialLifeSpan,0);t.globalAlpha=e,t.drawImage(this.image,this.position.x,this.position.y)}}return u.onchange=()=>{u.matches?m():d()},d(),{destroy:m}},e.rainbowCursor=function(t){let e,n,i,o=t&&t.element,r=o||document.body,s=window.innerWidth,c=window.innerHeight,l={x:s/2,y:s/2},a=[];const h=t?.length||20,u=t?.colors||["#FE0000","#FD8C00","#FFE500","#119F0B","#0644B3","#C22EDC"],d=t?.size||3;let f=!1;const p=window.matchMedia("(prefers-reduced-motion: reduce)");function A(){if(p.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;e=document.createElement("canvas"),n=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",o?(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=s,e.height=c),r.addEventListener("mousemove",y),window.addEventListener("resize",g),m()}function g(t){s=window.innerWidth,c=window.innerHeight,o?(e.width=r.clientWidth,e.height=r.clientHeight):(e.width=s,e.height=c)}function y(t){if(o){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===f){f=!0;for(let t=0;t{n.beginPath(),n.strokeStyle=e,t.length&&n.moveTo(t[0].x,t[0].y+i*(d-1)),t.forEach(((t,e)=>{0!==e&&n.lineTo(t.x,t.y+i*d)})),n.lineWidth=d,n.lineCap="round",n.stroke()}))}(),i=requestAnimationFrame(m)}function v(){e.remove(),cancelAnimationFrame(i),r.removeEventListener("mousemove",y),window.addEventListener("resize",g)}function w(t,e){this.position={x:t,y:e}}return p.onchange=()=>{p.matches?v():A()},A(),{destroy:v}},e.snowflakeCursor=function(t){let e,n,i,o=t&&t.element,r=o||document.body,s=["❄️"],c=window.innerWidth,l=window.innerHeight,a={x:c/2,y:c/2},h=[],u=[];const d=window.matchMedia("(prefers-reduced-motion: reduce)");function f(){if(d.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;e=document.createElement("canvas"),n=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",o?(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=c,e.height=l),n.font="12px serif",n.textBaseline="middle",n.textAlign="center",s.forEach((t=>{let e=n.measureText(t),i=document.createElement("canvas"),o=i.getContext("2d");i.width=e.width,i.height=2*e.actualBoundingBoxAscent,o.textAlign="center",o.font="12px serif",o.textBaseline="middle",o.fillText(t,i.width/2,e.actualBoundingBoxAscent),u.push(i)})),r.addEventListener("mousemove",g),r.addEventListener("touchmove",A,{passive:!0}),r.addEventListener("touchstart",A,{passive:!0}),window.addEventListener("resize",p),m()}function p(t){c=window.innerWidth,l=window.innerHeight,o?(e.width=r.clientWidth,e.height=r.clientHeight):(e.width=c,e.height=l)}function A(t){if(t.touches.length>0)for(let e=0;e=0;t--)h[t].lifeSpan<0&&h.splice(t,1);0==h.length&&n.clearRect(0,0,c,l)}}(),i=requestAnimationFrame(m)}function v(){e.remove(),cancelAnimationFrame(i),r.removeEventListener("mousemove",g),r.removeEventListener("touchmove",A),r.removeEventListener("touchstart",A),window.addEventListener("resize",p)}function w(t,e,n){const i=Math.floor(60*Math.random()+80);this.initialLifeSpan=i,this.lifeSpan=i,this.velocity={x:(Math.random()<.5?-1:1)*(Math.random()/2),y:1+Math.random()},this.position={x:t,y:e},this.canv=n,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;const e=Math.max(this.lifeSpan/this.initialLifeSpan,0),n=2*this.lifeSpan*.0174533;t.translate(this.position.x,this.position.y),t.rotate(n),t.drawImage(this.canv,-this.canv.width/2*e,-this.canv.height/2,this.canv.width*e,this.canv.height*e),t.rotate(-n),t.translate(-this.position.x,-this.position.y)}}return d.onchange=()=>{d.matches?v():f()},f(),{destroy:v}},e.springyEmojiCursor=function(t){let e,n,i,o,r=t&&t.emoji||"🤪",s=t&&t.element,c=s||document.body,l=window.innerWidth,a=window.innerHeight,h={x:l/2,y:l/2},u=[];const d=window.matchMedia("(prefers-reduced-motion: reduce)");function f(){if(d.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;e=document.createElement("canvas"),n=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",s?(e.style.position="absolute",c.appendChild(e),e.width=c.clientWidth,e.height=c.clientHeight):(e.style.position="fixed",document.body.appendChild(e),e.width=l,e.height=a),n.font="16px serif",n.textBaseline="middle",n.textAlign="center";let t=n.measureText(r),i=document.createElement("canvas"),h=i.getContext("2d");i.width=t.width,i.height=2*t.actualBoundingBoxAscent,h.textAlign="center",h.font="16px serif",h.textBaseline="middle",h.fillText(r,i.width/2,t.actualBoundingBoxAscent),o=i;let f=0;for(f=0;f<7;f++)u[f]=new x(o);c.addEventListener("mousemove",g),c.addEventListener("touchmove",A,{passive:!0}),c.addEventListener("touchstart",A,{passive:!0}),window.addEventListener("resize",p),y()}function p(t){l=window.innerWidth,a=window.innerHeight,s?(e.width=c.clientWidth,e.height=c.clientHeight):(e.width=l,e.height=a)}function A(t){if(t.touches.length>0)if(s){const e=c.getBoundingClientRect();h.x=t.touches[0].clientX-e.left,h.y=t.touches[0].clientY-e.top}else h.x=t.touches[0].clientX,h.y=t.touches[0].clientY}function g(t){if(s){const e=c.getBoundingClientRect();h.x=t.clientX-e.left,h.y=t.clientY-e.top}else h.x=t.clientX,h.y=t.clientY}function y(){!function(){e.width=e.width,u[0].position.x=h.x,u[0].position.y=h.y;for(let t=1;t<7;t++){let i=new v(0,0);t>0&&w(t-1,t,i),t<6&&w(t+1,t,i);let o,r,s=new v(10*-u[t].velocity.x,10*-u[t].velocity.y),c=new v((i.X+s.X)/1,(i.Y+s.Y)/1+50);u[t].velocity.x+=.01*c.X,u[t].velocity.y+=.01*c.Y,Math.abs(u[t].velocity.x)<.1&&Math.abs(u[t].velocity.y)<.1&&Math.abs(c.X)<.1&&Math.abs(c.Y)<.1&&(u[t].velocity.x=0,u[t].velocity.y=0),u[t].position.x+=u[t].velocity.x,u[t].position.y+=u[t].velocity.y,o=e.clientHeight,r=e.clientWidth,u[t].position.y>=o-11-1&&(u[t].velocity.y>0&&(u[t].velocity.y=.7*-u[t].velocity.y),u[t].position.y=o-11-1),u[t].position.x>=r-11&&(u[t].velocity.x>0&&(u[t].velocity.x=.7*-u[t].velocity.x),u[t].position.x=r-11-1),u[t].position.x<0&&(u[t].velocity.x<0&&(u[t].velocity.x=.7*-u[t].velocity.x),u[t].position.x=0),u[t].draw(n)}}(),i=requestAnimationFrame(y)}function m(){e.remove(),cancelAnimationFrame(i),c.removeEventListener("mousemove",g),c.removeEventListener("touchmove",A),c.removeEventListener("touchstart",A),window.addEventListener("resize",p)}function v(t,e){this.X=t,this.Y=e}function w(t,e,n){let i=u[t].position.x-u[e].position.x,o=u[t].position.y-u[e].position.y,r=Math.sqrt(i*i+o*o);if(r>10){let t=10*(r-10);n.X+=i/r*t,n.Y+=o/r*t}}function x(t){this.position={x:h.x,y:h.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 d.onchange=()=>{d.matches?m():f()},f(),{destroy:m}},e.textFlag=function(t){let e,n,i,o=t||{},r=t&&t.element,s=r||document.body,c=o.text?" "+t.text:" Your Text Here",l=o.font||"monospace",a=o.textSize||12,h=a+"px "+l,u=o.gap||a+2,d=0,f=[],p=window.innerWidth,A=window.innerHeight,g={x:p/2,y:p/2};for(let t=0;t0;t--)f[t].x=f[t-1].x+u,f[t].y=f[t-1].y,n.font=h,n.fillText(f[t].letter,f[t].x,f[t].y);let i=f[0].x,o=f[0].y;i+=(g.x-i)/5+t+2,o+=(g.y-o)/5+e,f[0].x=i,f[0].y=o}(),i=requestAnimationFrame(x)}function E(){e.remove(),cancelAnimationFrame(i),s.removeEventListener("mousemove",w),window.addEventListener("resize",v)}return y.onchange=()=>{y.matches?E():m()},m(),{destroy:E}},e.trailingCursor=function(t){let e,n,i,o=t&&t.element,r=o||document.body,s=window.innerWidth,c=window.innerHeight,l={x:s/2,y:s/2},a=[];const h=t?.particles||15,u=t?.rate||.4,d=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 f=!1,p=new Image;p.src=d;const A=window.matchMedia("(prefers-reduced-motion: reduce)");function g(){if(A.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;e=document.createElement("canvas"),n=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",o?(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=s,e.height=c),r.addEventListener("mousemove",m),window.addEventListener("resize",y),v()}function y(t){s=window.innerWidth,c=window.innerHeight,o?(e.width=r.clientWidth,e.height=r.clientHeight):(e.width=s,e.height=c)}function m(t){if(o){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===f){f=!0;for(let t=0;t{A.matches?w():g()},g(),{destroy:w}}}},e={};function n(i){var o=e[i];if(void 0!==o)return o.exports;var r=e[i]={exports:{}};return t[i](r,r.exports,n),r.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t,e=(t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)},function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}),i=function(){function t(){}return t.prototype.check=function(t){return Math.random()<.01*t},t.prototype.enable=function(){this.settings.enabled=!0},t.prototype.disable=function(){this.settings.enabled=!1},t.prototype.toggle=function(t){void 0===t&&(t=null),this.settings.enabled=null===t?!this.settings.enabled:t},t}(),o=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n}(i),r=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),s=function(){function t(){this.core_settings=new c,this.jokes={}}return t.prototype.check=function(t){return Math.random()<.01*t},t.prototype.add=function(t){this.jokes[t.id]=t},t.prototype.addCustom=function(t,e,n){void 0===n&&(n=null);var o=new(function(n){function i(){var e=null!==n&&n.apply(this,arguments)||this;return e.id=t,e.settings={chance:10,enabled:!0},e}return r(i,n),i.prototype.start=function(){e.call(this,this.settings)},i}(i));Object.assign(o.settings,null!=n?n:{}),this.add(o)},Object.defineProperty(t.prototype,"settings",{get:function(){var t={};t.core=this.core_settings;for(var e=0,n=Object.entries(this.jokes);e0?"тся":"ться"})))}))},e}(i),g=function(){this.enabled=!0,this.chance=20,this.selector=".post-content"},y=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),m=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.id="mirror",e.settings=new v,e}return y(e,t),e.prototype.start=function(){h()(".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"'),h()(".post-links, .post-links ul, .post h3 span").css("margin-left","0"),h()(".post h3 span").css("margin-right","25em")},e}(i),v=function(){this.enabled=!1,this.chance=30},w=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),x=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.id="carnival",e.settings=new E,e}return w(e,t),e.prototype.start=function(){var t=this;h()(this.settings.selector).each((function(e,n){for(var i=[],o=0,r=Object.entries(t.settings.variants);o0&&h()(n).css({filter:i.join(" ")})}))},e}(i),E=function(){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}},b=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),C=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.id="crazy_letters",e.settings=new M,e}return b(e,t),e.prototype.start=function(){var t=this;h()(this.settings.selector).each((function(e,n){for(var i=h()(t).text(),o="",r=0;r0;o--){var r=Math.floor(Math.random()*(o+1));e=[i[r],i[o]],i[o]=e[0],i[r]=e[1]}return R(R([n[0]],i,!0),[n[n.length-1]],!1).join("")},e.prototype.processNode=function(t){var e;t.textContent=null===(e=t.textContent)||void 0===e?void 0:e.replace(/([А-Яа-яA-Za-z]+)/gm,this.shuffleLetters)},e.prototype.start=function(){var t=this;h()(this.settings.selector).find("*").contents().filter((function(t,e){return e.nodeType===Node.TEXT_NODE})).each((function(e,n){return t.processNode(n)}))},e}(i),j=function(){this.enabled=!0,this.chance=20,this.selector=".post-content",this.shuffle_chance=50},O=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),T=n(442),H=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.id="cursor_effects",e.settings=new I,e}return O(e,t),e.prototype.enableAll=function(){for(var t=0,e=Object.keys(this.settings.effects);t{"use strict";var __webpack_modules__={525:(t,e,n)=>{n.d(e,{Z:()=>i});const i=''},554:(t,e,n)=>{n.d(e,{Z:()=>i});const i=''},95:(t,e,n)=>{n.d(e,{Z:()=>i});const i='
'},562:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{d:()=>JokerUI});var jquery__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(311),jquery__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__),_html_button_html__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(525),_html_styles_html__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(554),_html_window_html__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(95),JokerUI=function(){function JokerUI(t){var e=this;this.joker=t,jquery__WEBPACK_IMPORTED_MODULE_0___default()('link[rel="stylesheet"]').eq(0).before(_html_styles_html__WEBPACK_IMPORTED_MODULE_1__.Z);var n=this.button;n.hide(),n.mybbModal({title:"Настройки первоапрельских шуток",content:function(){return e.render()},closer:!0,noscroll:!0,escClose:!0})}return Object.defineProperty(JokerUI.prototype,"button",{get:function(){var t=jquery__WEBPACK_IMPORTED_MODULE_0___default()(".april-fools__button");return 0===t.length&&(t=jquery__WEBPACK_IMPORTED_MODULE_0___default()(_html_button_html__WEBPACK_IMPORTED_MODULE_2__.Z).appendTo("body")),t},enumerable:!1,configurable:!0}),JokerUI.prototype.show=function(){this.button.show()},JokerUI.prototype.render=function(){for(var result=jquery__WEBPACK_IMPORTED_MODULE_0___default()("
").html(_html_window_html__WEBPACK_IMPORTED_MODULE_3__.Z),row_template=jquery__WEBPACK_IMPORTED_MODULE_0___default()("#april-fools__window-row",result).html(),joke_container=jquery__WEBPACK_IMPORTED_MODULE_0___default()(".april-fools__jokes",result),_i=0,_a=Object.values(this.joker.jokes);_i<_a.length;_i++){var joke=_a[_i],row=jquery__WEBPACK_IMPORTED_MODULE_0___default()(eval("`"+row_template+"`"));jquery__WEBPACK_IMPORTED_MODULE_0___default()('input[type="checkbox"]',row).prop("checked",joke.settings.enabled),joke_container.append(row)}return jquery__WEBPACK_IMPORTED_MODULE_0___default()(".april-fools__content",result)},JokerUI}()},311:t=>{t.exports=jQuery},442:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.bubbleCursor=function(t){let e,n,i,o=t&&t.element,r=o||document.body,s=window.innerWidth,c=window.innerHeight,a={x:s/2,y:s/2},l=[],h=[];const u=window.matchMedia("(prefers-reduced-motion: reduce)");function d(){if(u.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;e=document.createElement("canvas"),n=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",o?(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=s,e.height=c),r.addEventListener("mousemove",g),r.addEventListener("touchmove",f,{passive:!0}),r.addEventListener("touchstart",f,{passive:!0}),window.addEventListener("resize",p),A()}function p(t){s=window.innerWidth,c=window.innerHeight,o?(e.width=r.clientWidth,e.height=r.clientHeight):(e.width=s,e.height=c)}function f(t){if(t.touches.length>0)for(let e=0;e=0;t--)l[t].lifeSpan<0&&l.splice(t,1);0==l.length&&n.clearRect(0,0,s,c)}}(),i=requestAnimationFrame(A)}function m(){e.remove(),cancelAnimationFrame(i),r.removeEventListener("mousemove",g),r.removeEventListener("touchmove",f),r.removeEventListener("touchstart",f),window.addEventListener("resize",p)}function w(t,e,n){const i=Math.floor(60*Math.random()+60);this.initialLifeSpan=i,this.lifeSpan=i,this.velocity={x:(Math.random()<.5?-1:1)*(Math.random()/10),y:-1*Math.random()-.4},this.position={x:t,y:e},this.canv=n,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--;const 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 u.onchange=()=>{u.matches?m():d()},d(),{destroy:m}},e.clockCursor=function(t){let e,n,i,o=t&&t.element,r=o||document.body,s=window.innerWidth,c=window.innerHeight,a={x:s/2,y:s/2};const l=t&&t.dateColor||"blue",h=t&&t.faceColor||"black",u=t&&t.secondsColor||"red",d=t&&t.minutesColor||"black",p=t&&t.hoursColor||"black",f=.4;let g=new Date,y=g.getDate(),A=g.getYear()+1900;const m=(" "+["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"][g.getDay()]+" "+y+" "+["JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"][g.getMonth()]+" "+A).split(""),w=["3","4","5","6","7","8","9","10","11","12","1","2"],v=w.length,_=["•","•","•"],x=["•","•","•","•"],b=["•","•","•","•","•"],E=360/v,C=360/m.length,M=45/6.5,O=[],j=[],L=[],k=[],B=[],R=[],S=[],D=[],T=[];var P=parseInt(m.length+v+_.length+x.length+b.length)+1;const I=window.matchMedia("(prefers-reduced-motion: reduce)");function W(){if(I.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;e=document.createElement("canvas"),n=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",o?(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=s,e.height=c),n.font="10px sans-serif",n.textAlign="center",n.textBaseline="middle";for(let t=0;t0)if(o){const e=r.getBoundingClientRect();a.x=t.touches[0].clientX-e.left,a.y=t.touches[0].clientY-e.top}else a.x=t.touches[0].clientX,a.y=t.touches[0].clientY}function F(t){if(o){const e=r.getBoundingClientRect();a.x=t.clientX-e.left,a.y=t.clientY-e.top}else a.x=t.clientX,a.y=t.clientY}function X(){!function(){L[0]=Math.round(O[0]+=(a.y-O[0])*f),k[0]=Math.round(j[0]+=(a.x-j[0])*f);for(let t=1;t=c-80&&(O[t-1]=c-80),j[t-1]>=s-80&&(j[t-1]=s-80)}(),function(){n.clearRect(0,0,s,c);const t=new Date,e=t.getSeconds(),i=Math.PI*(e-15)/30,o=t.getMinutes(),r=Math.PI*(o-15)/30,a=t.getHours(),l=Math.PI*(a-3)/6+Math.PI*parseInt(t.getMinutes())/360;for(let t=0;t{I.matches?U():W()},W(),{destroy:U}},e.emojiCursor=function(t){const e=t&&t.emoji||["😀","😂","😆","😊"];let n=t&&t.element,i=n||document.body,o=window.innerWidth,r=window.innerHeight;const s={x:o/2,y:o/2},c={x:o/2,y:o/2};let a=0;const l=[],h=[];let u,d,p;const f=window.matchMedia("(prefers-reduced-motion: reduce)");function g(){if(f.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;u=document.createElement("canvas"),d=u.getContext("2d"),u.style.top="0px",u.style.left="0px",u.style.pointerEvents="none",n?(u.style.position="absolute",i.appendChild(u),u.width=i.clientWidth,u.height=i.clientHeight):(u.style.position="fixed",document.body.appendChild(u),u.width=o,u.height=r),d.font="21px serif",d.textBaseline="middle",d.textAlign="center",e.forEach((t=>{let e=d.measureText(t),n=document.createElement("canvas"),i=n.getContext("2d");n.width=e.width,n.height=2*e.actualBoundingBoxAscent,i.textAlign="center",i.font="21px serif",i.textBaseline="middle",i.fillText(t,n.width/2,e.actualBoundingBoxAscent),h.push(n)})),i.addEventListener("mousemove",m,{passive:!0}),i.addEventListener("touchmove",A,{passive:!0}),i.addEventListener("touchstart",A,{passive:!0}),window.addEventListener("resize",y),v()}function y(t){o=window.innerWidth,r=window.innerHeight,n?(u.width=i.clientWidth,u.height=i.clientHeight):(u.width=o,u.height=r)}function A(t){if(t.touches.length>0)for(let e=0;e{if(n){const e=i.getBoundingClientRect();s.x=t.clientX-e.left,s.y=t.clientY-e.top}else s.x=t.clientX,s.y=t.clientY;Math.hypot(s.x-c.x,s.y-c.y)>1&&(w(s.x,s.y,h[Math.floor(Math.random()*e.length)]),c.x=s.x,c.y=s.y,a=t.timeStamp)}))}function w(t,e,n){l.push(new x(t,e,n))}function v(){!function(){if(0!=l.length){d.clearRect(0,0,o,r);for(let t=0;t=0;t--)l[t].lifeSpan<0&&l.splice(t,1);0==l.length&&d.clearRect(0,0,o,r)}}(),p=requestAnimationFrame(v)}function _(){u.remove(),cancelAnimationFrame(p),i.removeEventListener("mousemove",m),i.removeEventListener("touchmove",A),i.removeEventListener("touchstart",A),window.addEventListener("resize",y)}function x(t,e,n){const i=Math.floor(60*Math.random()+80);this.initialLifeSpan=i,this.lifeSpan=i,this.velocity={x:(Math.random()<.5?-1:1)*(Math.random()/2),y:.4*Math.random()+.8},this.position={x:t,y:e},this.canv=n,this.update=function(t){this.position.x+=this.velocity.x,this.position.y+=this.velocity.y,this.lifeSpan--,this.velocity.y+=.05;const 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 f.onchange=()=>{f.matches?_():g()},g(),{destroy:_}},e.fairyDustCursor=function(t){let e=t&&t.colors||["#D61C59","#E7D84B","#1B8798"],n=t&&t.element,i=n||document.body,o=window.innerWidth,r=window.innerHeight;const s={x:o/2,y:o/2},c={x:o/2,y:o/2},a=[],l=[];let h,u,d;const p=window.matchMedia("(prefers-reduced-motion: reduce)");function f(){if(p.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;h=document.createElement("canvas"),u=h.getContext("2d"),h.style.top="0px",h.style.left="0px",h.style.pointerEvents="none",n?(h.style.position="absolute",i.appendChild(h),h.width=i.clientWidth,h.height=i.clientHeight):(h.style.position="fixed",i.appendChild(h),h.width=o,h.height=r),u.font="21px serif",u.textBaseline="middle",u.textAlign="center",e.forEach((t=>{let e=u.measureText("*"),n=document.createElement("canvas"),i=n.getContext("2d");n.width=e.width,n.height=e.actualBoundingBoxAscent+e.actualBoundingBoxDescent,i.fillStyle=t,i.textAlign="center",i.font="21px serif",i.textBaseline="middle",i.fillText("*",n.width/2,e.actualBoundingBoxAscent),l.push(n)})),i.addEventListener("mousemove",A),i.addEventListener("touchmove",y,{passive:!0}),i.addEventListener("touchstart",y,{passive:!0}),window.addEventListener("resize",g),w()}function g(t){o=window.innerWidth,r=window.innerHeight,n?(h.width=i.clientWidth,h.height=i.clientHeight):(h.width=o,h.height=r)}function y(t){if(t.touches.length>0)for(let e=0;e{if(n){const e=i.getBoundingClientRect();s.x=t.clientX-e.left,s.y=t.clientY-e.top}else s.x=t.clientX,s.y=t.clientY;Math.hypot(s.x-c.x,s.y-c.y)>1.5&&(m(s.x,s.y,l[Math.floor(Math.random()*e.length)]),c.x=s.x,c.y=s.y)}))}function m(t,e,n){a.push(new _(t,e,n))}function w(){!function(){if(0!=a.length){u.clearRect(0,0,o,r);for(let t=0;t=0;t--)a[t].lifeSpan<0&&a.splice(t,1);0==a.length&&u.clearRect(0,0,o,r)}}(),d=requestAnimationFrame(w)}function v(){h.remove(),cancelAnimationFrame(d),i.removeEventListener("mousemove",A),i.removeEventListener("touchmove",y),i.removeEventListener("touchstart",y),window.addEventListener("resize",g)}function _(t,e,n){const i=Math.floor(30*Math.random()+60);this.initialLifeSpan=i,this.lifeSpan=i,this.velocity={x:(Math.random()<.5?-1:1)*(Math.random()/2),y:.7*Math.random()+.9},this.position={x:t,y:e},this.canv=n,this.update=function(t){this.position.x+=this.velocity.x,this.position.y+=this.velocity.y,this.lifeSpan--,this.velocity.y+=.02;const 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():f()},f(),{destroy:v}},e.followingDotCursor=function(t){let e,n,i=t&&t.element,o=i||document.body,r=window.innerWidth,s=window.innerHeight,c={x:r/2,y:r/2},a=new function(t,e,n,i){this.position={x:t,y:e},this.width=10,this.lag=10,this.moveTowards=function(t,e,n){this.position.x+=(t-this.position.x)/this.lag,this.position.y+=(e-this.position.y)/this.lag,n.fillStyle=l,n.beginPath(),n.arc(this.position.x,this.position.y,this.width,0,2*Math.PI),n.fill(),n.closePath()}}(r/2,s/2,10,10),l=t?.color||"#323232a6";const h=window.matchMedia("(prefers-reduced-motion: reduce)");function u(){if(h.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;e=document.createElement("canvas"),n=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",i?(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=s),o.addEventListener("mousemove",p),window.addEventListener("resize",d),f()}function d(t){r=window.innerWidth,s=window.innerHeight,i?(e.width=o.clientWidth,e.height=o.clientHeight):(e.width=r,e.height=s)}function p(t){if(i){const e=o.getBoundingClientRect();c.x=t.clientX-e.left,c.y=t.clientY-e.top}else c.x=t.clientX,c.y=t.clientY}function f(){n.clearRect(0,0,r,s),a.moveTowards(c.x,c.y,n),requestAnimationFrame(f)}function g(){e.remove(),cancelAnimationFrame(f),o.removeEventListener("mousemove",p),window.addEventListener("resize",d)}return h.onchange=()=>{h.matches?g():u()},u(),{destroy:g}},e.ghostCursor=function(t){let e,n,i,o=t&&t.element,r=o||document.body,s=window.innerWidth,c=window.innerHeight,a={x:s/2,y:s/2},l=[],h=new Image;h.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 u=window.matchMedia("(prefers-reduced-motion: reduce)");function d(){if(u.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;e=document.createElement("canvas"),n=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",o?(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=s,e.height=c),r.addEventListener("mousemove",g),r.addEventListener("touchmove",f,{passive:!0}),r.addEventListener("touchstart",f,{passive:!0}),window.addEventListener("resize",p),A()}function p(t){s=window.innerWidth,c=window.innerHeight,o?(e.width=r.clientWidth,e.height=r.clientHeight):(e.width=s,e.height=c)}function f(t){if(t.touches.length>0)for(let e=0;e=0;t--)l[t].lifeSpan<0&&l.splice(t,1);0==l.length&&n.clearRect(0,0,s,c)}}(),i=requestAnimationFrame(A)}function m(){e.remove(),cancelAnimationFrame(i),r.removeEventListener("mousemove",g),r.removeEventListener("touchmove",f),r.removeEventListener("touchstart",f),window.addEventListener("resize",p)}function w(t,e,n){this.initialLifeSpan=40,this.lifeSpan=40,this.position={x:t,y:e},this.image=n,this.update=function(t){this.lifeSpan--;const e=Math.max(this.lifeSpan/this.initialLifeSpan,0);t.globalAlpha=e,t.drawImage(this.image,this.position.x,this.position.y)}}return u.onchange=()=>{u.matches?m():d()},d(),{destroy:m}},e.rainbowCursor=function(t){let e,n,i,o=t&&t.element,r=o||document.body,s=window.innerWidth,c=window.innerHeight,a={x:s/2,y:s/2},l=[];const h=t?.length||20,u=t?.colors||["#FE0000","#FD8C00","#FFE500","#119F0B","#0644B3","#C22EDC"],d=t?.size||3;let p=!1;const f=window.matchMedia("(prefers-reduced-motion: reduce)");function g(){if(f.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;e=document.createElement("canvas"),n=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",o?(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=s,e.height=c),r.addEventListener("mousemove",A),window.addEventListener("resize",y),m()}function y(t){s=window.innerWidth,c=window.innerHeight,o?(e.width=r.clientWidth,e.height=r.clientHeight):(e.width=s,e.height=c)}function A(t){if(o){const e=r.getBoundingClientRect();a.x=t.clientX-e.left,a.y=t.clientY-e.top}else a.x=t.clientX,a.y=t.clientY;if(!1===p){p=!0;for(let t=0;t{n.beginPath(),n.strokeStyle=e,t.length&&n.moveTo(t[0].x,t[0].y+i*(d-1)),t.forEach(((t,e)=>{0!==e&&n.lineTo(t.x,t.y+i*d)})),n.lineWidth=d,n.lineCap="round",n.stroke()}))}(),i=requestAnimationFrame(m)}function w(){e.remove(),cancelAnimationFrame(i),r.removeEventListener("mousemove",A),window.addEventListener("resize",y)}function v(t,e){this.position={x:t,y:e}}return f.onchange=()=>{f.matches?w():g()},g(),{destroy:w}},e.snowflakeCursor=function(t){let e,n,i,o=t&&t.element,r=o||document.body,s=["❄️"],c=window.innerWidth,a=window.innerHeight,l={x:c/2,y:c/2},h=[],u=[];const d=window.matchMedia("(prefers-reduced-motion: reduce)");function p(){if(d.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;e=document.createElement("canvas"),n=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",o?(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=c,e.height=a),n.font="12px serif",n.textBaseline="middle",n.textAlign="center",s.forEach((t=>{let e=n.measureText(t),i=document.createElement("canvas"),o=i.getContext("2d");i.width=e.width,i.height=2*e.actualBoundingBoxAscent,o.textAlign="center",o.font="12px serif",o.textBaseline="middle",o.fillText(t,i.width/2,e.actualBoundingBoxAscent),u.push(i)})),r.addEventListener("mousemove",y),r.addEventListener("touchmove",g,{passive:!0}),r.addEventListener("touchstart",g,{passive:!0}),window.addEventListener("resize",f),m()}function f(t){c=window.innerWidth,a=window.innerHeight,o?(e.width=r.clientWidth,e.height=r.clientHeight):(e.width=c,e.height=a)}function g(t){if(t.touches.length>0)for(let e=0;e=0;t--)h[t].lifeSpan<0&&h.splice(t,1);0==h.length&&n.clearRect(0,0,c,a)}}(),i=requestAnimationFrame(m)}function w(){e.remove(),cancelAnimationFrame(i),r.removeEventListener("mousemove",y),r.removeEventListener("touchmove",g),r.removeEventListener("touchstart",g),window.addEventListener("resize",f)}function v(t,e,n){const i=Math.floor(60*Math.random()+80);this.initialLifeSpan=i,this.lifeSpan=i,this.velocity={x:(Math.random()<.5?-1:1)*(Math.random()/2),y:1+Math.random()},this.position={x:t,y:e},this.canv=n,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;const e=Math.max(this.lifeSpan/this.initialLifeSpan,0),n=2*this.lifeSpan*.0174533;t.translate(this.position.x,this.position.y),t.rotate(n),t.drawImage(this.canv,-this.canv.width/2*e,-this.canv.height/2,this.canv.width*e,this.canv.height*e),t.rotate(-n),t.translate(-this.position.x,-this.position.y)}}return d.onchange=()=>{d.matches?w():p()},p(),{destroy:w}},e.springyEmojiCursor=function(t){let e,n,i,o,r=t&&t.emoji||"🤪",s=t&&t.element,c=s||document.body,a=window.innerWidth,l=window.innerHeight,h={x:a/2,y:a/2},u=[];const d=window.matchMedia("(prefers-reduced-motion: reduce)");function p(){if(d.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;e=document.createElement("canvas"),n=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",s?(e.style.position="absolute",c.appendChild(e),e.width=c.clientWidth,e.height=c.clientHeight):(e.style.position="fixed",document.body.appendChild(e),e.width=a,e.height=l),n.font="16px serif",n.textBaseline="middle",n.textAlign="center";let t=n.measureText(r),i=document.createElement("canvas"),h=i.getContext("2d");i.width=t.width,i.height=2*t.actualBoundingBoxAscent,h.textAlign="center",h.font="16px serif",h.textBaseline="middle",h.fillText(r,i.width/2,t.actualBoundingBoxAscent),o=i;let p=0;for(p=0;p<7;p++)u[p]=new _(o);c.addEventListener("mousemove",y),c.addEventListener("touchmove",g,{passive:!0}),c.addEventListener("touchstart",g,{passive:!0}),window.addEventListener("resize",f),A()}function f(t){a=window.innerWidth,l=window.innerHeight,s?(e.width=c.clientWidth,e.height=c.clientHeight):(e.width=a,e.height=l)}function g(t){if(t.touches.length>0)if(s){const e=c.getBoundingClientRect();h.x=t.touches[0].clientX-e.left,h.y=t.touches[0].clientY-e.top}else h.x=t.touches[0].clientX,h.y=t.touches[0].clientY}function y(t){if(s){const e=c.getBoundingClientRect();h.x=t.clientX-e.left,h.y=t.clientY-e.top}else h.x=t.clientX,h.y=t.clientY}function A(){!function(){e.width=e.width,u[0].position.x=h.x,u[0].position.y=h.y;for(let t=1;t<7;t++){let i=new w(0,0);t>0&&v(t-1,t,i),t<6&&v(t+1,t,i);let o,r,s=new w(10*-u[t].velocity.x,10*-u[t].velocity.y),c=new w((i.X+s.X)/1,(i.Y+s.Y)/1+50);u[t].velocity.x+=.01*c.X,u[t].velocity.y+=.01*c.Y,Math.abs(u[t].velocity.x)<.1&&Math.abs(u[t].velocity.y)<.1&&Math.abs(c.X)<.1&&Math.abs(c.Y)<.1&&(u[t].velocity.x=0,u[t].velocity.y=0),u[t].position.x+=u[t].velocity.x,u[t].position.y+=u[t].velocity.y,o=e.clientHeight,r=e.clientWidth,u[t].position.y>=o-11-1&&(u[t].velocity.y>0&&(u[t].velocity.y=.7*-u[t].velocity.y),u[t].position.y=o-11-1),u[t].position.x>=r-11&&(u[t].velocity.x>0&&(u[t].velocity.x=.7*-u[t].velocity.x),u[t].position.x=r-11-1),u[t].position.x<0&&(u[t].velocity.x<0&&(u[t].velocity.x=.7*-u[t].velocity.x),u[t].position.x=0),u[t].draw(n)}}(),i=requestAnimationFrame(A)}function m(){e.remove(),cancelAnimationFrame(i),c.removeEventListener("mousemove",y),c.removeEventListener("touchmove",g),c.removeEventListener("touchstart",g),window.addEventListener("resize",f)}function w(t,e){this.X=t,this.Y=e}function v(t,e,n){let i=u[t].position.x-u[e].position.x,o=u[t].position.y-u[e].position.y,r=Math.sqrt(i*i+o*o);if(r>10){let t=10*(r-10);n.X+=i/r*t,n.Y+=o/r*t}}function _(t){this.position={x:h.x,y:h.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 d.onchange=()=>{d.matches?m():p()},p(),{destroy:m}},e.textFlag=function(t){let e,n,i,o=t||{},r=t&&t.element,s=r||document.body,c=o.text?" "+t.text:" Your Text Here",a=o.font||"monospace",l=o.textSize||12,h=l+"px "+a,u=o.gap||l+2,d=0,p=[],f=window.innerWidth,g=window.innerHeight,y={x:f/2,y:f/2};for(let t=0;t0;t--)p[t].x=p[t-1].x+u,p[t].y=p[t-1].y,n.font=h,n.fillText(p[t].letter,p[t].x,p[t].y);let i=p[0].x,o=p[0].y;i+=(y.x-i)/5+t+2,o+=(y.y-o)/5+e,p[0].x=i,p[0].y=o}(),i=requestAnimationFrame(_)}function x(){e.remove(),cancelAnimationFrame(i),s.removeEventListener("mousemove",v),window.addEventListener("resize",w)}return A.onchange=()=>{A.matches?x():m()},m(),{destroy:x}},e.trailingCursor=function(t){let e,n,i,o=t&&t.element,r=o||document.body,s=window.innerWidth,c=window.innerHeight,a={x:s/2,y:s/2},l=[];const h=t?.particles||15,u=t?.rate||.4,d=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,f=new Image;f.src=d;const g=window.matchMedia("(prefers-reduced-motion: reduce)");function y(){if(g.matches)return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"),!1;e=document.createElement("canvas"),n=e.getContext("2d"),e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",o?(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=s,e.height=c),r.addEventListener("mousemove",m),window.addEventListener("resize",A),w()}function A(t){s=window.innerWidth,c=window.innerHeight,o?(e.width=r.clientWidth,e.height=r.clientHeight):(e.width=s,e.height=c)}function m(t){if(o){const e=r.getBoundingClientRect();a.x=t.clientX-e.left,a.y=t.clientY-e.top}else a.x=t.clientX,a.y=t.clientY;if(!1===p){p=!0;for(let t=0;t{g.matches?v():y()},y(),{destroy:v}}}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var n=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t](n,n.exports,__webpack_require__),n.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 n in e)__webpack_require__.o(e,n)&&!__webpack_require__.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var __webpack_exports__={};(()=>{var t,e,n=(t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)},function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}),i=function(){function t(){}return t.prototype.check=function(t){return Math.random()<.01*t},t.prototype.enable=function(){this.settings.enabled=!0},t.prototype.disable=function(){this.settings.enabled=!1},t.prototype.toggle=function(t){void 0===t&&(t=null),this.settings.enabled=null===t?!this.settings.enabled:t},t}(),o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(i),r=__webpack_require__(562),s=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),c=function(){function t(){this.ui=new r.d(this),this.core_settings=new a,this.jokes={}}return t.prototype.check=function(t){return Math.random()<.01*t},t.prototype.add=function(t){this.jokes[t.id]=t},t.prototype.addCustom=function(t,e,n){void 0===n&&(n=null);var o=new(function(n){function i(){var e=null!==n&&n.apply(this,arguments)||this;return e.id=t,e.title="Пользовательская шутка",e.description="Для шутки не определено описание",e.settings={chance:10,enabled:!0},e}return s(i,n),i.prototype.start=function(){e.call(this,this.settings)},i}(i));return Object.assign(o.settings,null!=n?n:{}),this.add(o),o},Object.defineProperty(t.prototype,"settings",{get:function(){var t={};t.core=this.core_settings;for(var e=0,n=Object.entries(this.jokes);e=0)return!0;var t=new Date,e=t.getMonth()+1,n=t.getDate();return 4===e&&1===n&&this.check(this.core_settings.chance)},t.prototype.regularStart=function(){this.regularCheck()&&(this.ui.show(),this.startAll())},t}(),a=function(){this.chance=100,this.enabled=!0,this.testers=[]},l=__webpack_require__(311),h=__webpack_require__.n(l),u=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),d=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.id="shake",e.title="Форумо-трясение",e.description="Страница форума начинает трястись",e.settings=new p,e.data_name="april-fools-shake",e}return u(e,t),e.prototype.rand=function(t){return t+this.settings.force*(2*Math.random()-1)},e.prototype.start=function(){var t=this;this.items=h()(this.settings.selector),this.items.each((function(e,n){var i={};t.settings.directions.forEach((function(t){i[t]=parseInt(h()(n).css("margin-"+t))})),h()(n).data(t.data_name,i)})),this.interval_id=setInterval((function(){t.items.each((function(e,n){for(var i=h()(n).data(t.data_name),o=0,r=Object.entries(i);o0?"тся":"ться"})))}))},e}(i),y=function(){this.enabled=!0,this.chance=20,this.selector=".post-content"},A=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),m=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.id="mirror",e.title="Зеркало",e.description="Элементы форума отражаются (по крайней мере, пытаются)",e.settings=new w,e}return A(e,t),e.prototype.start=function(){h()(".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"'),h()(".post-links, .post-links ul, .post h3 span").css("margin-left","0"),h()(".post h3 span").css("margin-right","25em")},e}(i),w=function(){this.enabled=!1,this.chance=30},v=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),_=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.id="carnival",e.title="Карнавал",e.description="Аватарки приобретают интересные цвета",e.settings=new x,e}return v(e,t),e.prototype.start=function(){var t=this;h()(this.settings.selector).each((function(e,n){for(var i=[],o=0,r=Object.entries(t.settings.variants);o0&&h()(n).css({filter:i.join(" ")})}))},e}(i),x=function(){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}},b=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),E=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.id="crazy_letters",e.title="Мама, Я сОшЛа С уМа!",e.description="иМеНа ЗаБоРчИкОм",e.settings=new C,e}return b(e,t),e.prototype.start=function(){var t=this;h()(this.settings.selector).each((function(e,n){for(var i=h()(t).text(),o="",r=0;r0;o--){var r=Math.floor(Math.random()*(o+1));e=[i[r],i[o]],i[o]=e[0],i[r]=e[1]}return O(O([n[0]],i,!0),[n[n.length-1]],!1).join("")},e.prototype.processNode=function(t){var e;t.textContent=null===(e=t.textContent)||void 0===e?void 0:e.replace(/([А-Яа-яA-Za-z]+)/gm,this.shuffleLetters)},e.prototype.start=function(){var t=this;h()(this.settings.selector).find("*").contents().filter((function(t,e){return e.nodeType===Node.TEXT_NODE})).each((function(e,n){return t.processNode(n)}))},e}(i),L=function(){this.enabled=!0,this.chance=20,this.selector=".post-content",this.shuffle_chance=50},k=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),B=__webpack_require__(442),R=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.id="cursor_effects",e.title="Красивый курсор",e.description="Эффекты, следующие за курсором",e.settings=new T,e}return k(n,t),n.prototype.enableAll=function(){for(var t=0,e=Object.keys(this.settings.effects);t0&&o[o.length-1])||6!==c[0]&&2!==c[0])){s=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]>>16,2246822507)^Math.imul(o^o>>>13,3266489909);var c=4294967296*(2097151&(o=Math.imul(o^o>>>16,2246822507)^Math.imul(i^i>>>13,3266489909)))+(i>>>0);return Math.floor(Math.pow(Math.sin(c),2)*n)%n},e.prototype.resetSeed=function(){new Date;var t=60*(new Date).getUTCHours()+(new Date).getUTCMinutes();this.seed=Math.floor(t/this.settings.change_frequency),console.log("Seed reset:",t,this.seed)},e.prototype.selectRandom=function(t,e){for(var n=Object.keys(e),i=n.reduce((function(t,n){return t+e[n]}),0),o=this.prng(t,this.seed++,i),r=0,s=0,c=n;s=0,enabled:e.indexOf("!")<0,weight:10*(e.indexOf("$")>=0?.5:1)*(e.indexOf("%")>=0?.5:1)*(e.indexOf("^")>=0?2:1)}))})),n}window.BuildStupdiTitleVariant=q,window.AprilJokes=(S=[d,g,m,_,E,j,R,F],D=new c,S.forEach((function(t){D.add(new t)})),$((function(){D.regularStart()})),D)})()})(); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index b67457f..5023cce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,6 +26,7 @@ "grunt-browserify": "^6.0.0", "grunt-contrib-uglify": "^5.2.2", "grunt-jsdoc-to-markdown": "^6.0.0", + "html-loader": "^4.2.0", "jsdoc-babel": "^0.5.0", "jsdoc-to-markdown": "^8.0.0", "markdown-it": "^13.0.1", @@ -3615,6 +3616,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/camel-case": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", + "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", + "dev": true, + "dependencies": { + "pascal-case": "^3.1.2", + "tslib": "^2.0.3" + } + }, "node_modules/caniuse-lite": { "version": "1.0.30001470", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001470.tgz", @@ -3716,6 +3727,27 @@ "safe-buffer": "^5.0.1" } }, + "node_modules/clean-css": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.2.0.tgz", + "integrity": "sha512-2639sWGa43EMmG7fn8mdVuBSs6HuWaSor+ZPoFWzenBc6oN+td8YhTfghWXZ25G1NiiSvz8bOFBS7PdSbTiqEA==", + "dev": true, + "dependencies": { + "source-map": "~0.6.0" + }, + "engines": { + "node": ">= 10.0" + } + }, + "node_modules/clean-css/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", @@ -4436,6 +4468,16 @@ "npm": ">=1.2" } }, + "node_modules/dot-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", + "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", + "dev": true, + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "node_modules/duplexer": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", @@ -5877,6 +5919,68 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, + "node_modules/html-loader": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/html-loader/-/html-loader-4.2.0.tgz", + "integrity": "sha512-OxCHD3yt+qwqng2vvcaPApCEvbx+nXWu+v69TYHx1FO8bffHn/JjHtE3TTQZmHjwvnJe4xxzuecetDVBrQR1Zg==", + "dev": true, + "dependencies": { + "html-minifier-terser": "^7.0.0", + "parse5": "^7.0.0" + }, + "engines": { + "node": ">= 14.15.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + } + }, + "node_modules/html-minifier-terser": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/html-minifier-terser/-/html-minifier-terser-7.1.0.tgz", + "integrity": "sha512-BvPO2S7Ip0Q5qt+Y8j/27Vclj6uHC6av0TMoDn7/bJPhMWHI2UtR2e/zEgJn3/qYAmxumrGp9q4UHurL6mtW9Q==", + "dev": true, + "dependencies": { + "camel-case": "^4.1.2", + "clean-css": "5.2.0", + "commander": "^9.4.1", + "entities": "^4.4.0", + "param-case": "^3.0.4", + "relateurl": "^0.2.7", + "terser": "^5.15.1" + }, + "bin": { + "html-minifier-terser": "cli.js" + }, + "engines": { + "node": "^14.13.1 || >=16.0.0" + } + }, + "node_modules/html-minifier-terser/node_modules/commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "dev": true, + "engines": { + "node": "^12.20.0 || >=14" + } + }, + "node_modules/html-minifier-terser/node_modules/entities": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz", + "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==", + "dev": true, + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/htmlescape": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.1.tgz", @@ -7142,6 +7246,15 @@ "node": ">=8" } }, + "node_modules/lower-case": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", + "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", + "dev": true, + "dependencies": { + "tslib": "^2.0.3" + } + }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -7811,6 +7924,16 @@ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" }, + "node_modules/no-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", + "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", + "dev": true, + "dependencies": { + "lower-case": "^2.0.2", + "tslib": "^2.0.3" + } + }, "node_modules/node-fetch": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", @@ -8847,6 +8970,16 @@ "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", "dev": true }, + "node_modules/param-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", + "integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==", + "dev": true, + "dependencies": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "node_modules/parents": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parents/-/parents-1.0.1.tgz", @@ -8918,6 +9051,40 @@ "node": ">=0.10.0" } }, + "node_modules/parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dev": true, + "dependencies": { + "entities": "^4.4.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5/node_modules/entities": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz", + "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==", + "dev": true, + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/pascal-case": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", + "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", + "dev": true, + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "node_modules/path-browserify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", @@ -9623,6 +9790,15 @@ "jsesc": "bin/jsesc" } }, + "node_modules/relateurl": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz", + "integrity": "sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/remove-trailing-separator": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", diff --git a/package.json b/package.json index 95c9db8..abdd919 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "grunt-browserify": "^6.0.0", "grunt-contrib-uglify": "^5.2.2", "grunt-jsdoc-to-markdown": "^6.0.0", + "html-loader": "^4.2.0", "jsdoc-babel": "^0.5.0", "jsdoc-to-markdown": "^8.0.0", "markdown-it": "^13.0.1", diff --git a/settings.compact.js b/settings.compact.js index ff92bb7..f183193 100644 --- a/settings.compact.js +++ b/settings.compact.js @@ -16,7 +16,7 @@ window.AprilJokes.settings = { enabled: false, chance: 30, }, - + carnival: { enabled: true, chance: 30, @@ -127,4 +127,34 @@ window.AprilJokes.settings = { }, }, }, + + stupid_title: { + enabled: true, + chance: 20, + gender_resolver: null, + rude: false, + change_frequency: 5, + 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, + }, + variants: { + adj: { + ...window.AprilJokes.settings.stupid_title.variants.adj, + ...BuildStupdiTitleVariant(true, 'скромный, шутливый, !грубый'), + ...BuildStupdiTitleVariant(false, 'скромная, шутливая, !грубая'), + }, + noun: { ...window.AprilJokes.settings.stupid_title.variants.noun, }, + verb: { ...window.AprilJokes.settings.stupid_title.variants.verb, }, + place: { ...window.AprilJokes.settings.stupid_title.variants.place, }, + adv: { ...window.AprilJokes.settings.stupid_title.variants.adv, }, + p: { ...window.AprilJokes.settings.stupid_title.variants.p, }, + }, + }, } \ No newline at end of file diff --git a/settings.example.js b/settings.example.js index 4af4661..3aaa951 100644 --- a/settings.example.js +++ b/settings.example.js @@ -37,7 +37,7 @@ window.AprilJokes.settings = { * @author Kozhilya */ shake: { - enabled: true, + enabled: false, chance: 1, /** @@ -379,4 +379,74 @@ window.AprilJokes.settings = { }, }, }, + + /** + * **Глупые статусы** + * + * Каждому пользователю даётся новый глупый статус. + * + * @author Kozhilya + */ + stupid_title: { + enabled: true, + chance: 20, + + /** + * Определение пола по имени. + * По умолчанию род устанавливается случайным образом + * + * Если установлено значение `null`, система попытается загрузить пол, установленный в настройках аккаунта. Если этот пол определить невозможно, то он будет выбран случайно. Эта настройка позволяет изменить это поведение, если ваш форум обладает ролевой системой, в которой пол определяется иным образом. + * + * @param name Имя персонажа + * @returns true, если мужской род; false, если женский род + */ + gender_resolver: null, + + /** + * Разрешить возможно оскорбительные слова + */ + rude: false, + + /** + * Частота смены статусов (в минутах) + */ + change_frequency: 5, + + /** + * Разрешённые схемы формирования статусов + * + * {adj} - прилагательное + * {noun} - имя существительно + * {verb} - глагол + * {adv} - наречие + * {p} - знак препинания + */ + 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, + }, + + /** + * Вариант слов. + * Смотрите раздел описания скрипта, что бы настроить это поле + */ + variants: { + adj: { + ...window.AprilJokes.settings.stupid_title.variants.adj, + ...BuildStupdiTitleVariant(true, 'скромный, шутливый, !грубый'), + ...BuildStupdiTitleVariant(false, 'скромная, шутливая, !грубая'), + }, + noun: { ...window.AprilJokes.settings.stupid_title.variants.noun, }, + verb: { ...window.AprilJokes.settings.stupid_title.variants.verb, }, + place: { ...window.AprilJokes.settings.stupid_title.variants.place, }, + adv: { ...window.AprilJokes.settings.stupid_title.variants.adv, }, + p: { ...window.AprilJokes.settings.stupid_title.variants.p, }, + }, + }, } \ No newline at end of file diff --git a/src/html.d.ts b/src/html.d.ts new file mode 100644 index 0000000..56b1935 --- /dev/null +++ b/src/html.d.ts @@ -0,0 +1,4 @@ +declare module "*.html" { + const content: string; + export default content; +} \ No newline at end of file diff --git a/src/html/button.html b/src/html/button.html new file mode 100644 index 0000000..a3646ae --- /dev/null +++ b/src/html/button.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/html/styles.html b/src/html/styles.html new file mode 100644 index 0000000..14ee2e5 --- /dev/null +++ b/src/html/styles.html @@ -0,0 +1,66 @@ + \ No newline at end of file diff --git a/src/html/window.html b/src/html/window.html new file mode 100644 index 0000000..5d4b981 --- /dev/null +++ b/src/html/window.html @@ -0,0 +1,15 @@ +
+
+ + +
+ \ No newline at end of file diff --git a/src/joke.ts b/src/joke.ts index db5374d..9377908 100644 --- a/src/joke.ts +++ b/src/joke.ts @@ -22,6 +22,16 @@ export abstract class Joke { */ abstract id: string; + /** + * Заголовок шутки + */ + abstract title: string; + + /** + * Описание шутки + */ + abstract description: string; + /** * Настройки шутки */ diff --git a/src/joker.ts b/src/joker.ts index a0baea0..0452246 100644 --- a/src/joker.ts +++ b/src/joker.ts @@ -1,4 +1,6 @@ -import { Joke, JokeSettings } from "./joke"; +import { stat } from "fs"; +import { Joke, JokeSettings, StopableJoke } from "./joke"; +import { JokerUI } from "./ui"; /** * Блок обработки перво-апрельских шуток @@ -6,6 +8,8 @@ import { Joke, JokeSettings } from "./joke"; * @author Kozhilya */ export class JokerClass { + ui: JokerUI = new JokerUI(this); + /** * Проверка вероятности * @@ -32,10 +36,14 @@ export class JokerClass { * @param handler Метод, выполняющий шутку * @param settings Объект настроек шутки */ - addCustom(id: string, handler: Function, settings: JokeSettings|null = null) { + addCustom(id: string, handler: Function, settings: JokeSettings|null = null): Joke { const joke = new class extends Joke { id = id; + title = 'Пользовательская шутка'; + + description = 'Для шутки не определено описание'; + settings: JokeSettings = { chance: 10, enabled: true }; start() { @@ -46,6 +54,8 @@ export class JokerClass { Object.assign(joke.settings, settings ?? {}); this.add(joke); + + return joke; } /** @@ -113,6 +123,74 @@ export class JokerClass { } } + /** + * Переключение шутки + */ + toggleJoke(joke_id: string, state: boolean) { + const joke = this.jokes[joke_id]; + joke.settings.enabled = state; + + if (joke instanceof StopableJoke && !state) { + joke.stop(); + } + + this.saveUserStates(); + } + + /** + * Сохранение пользовательских настроек + */ + saveUserStates() { + const states: any = {}; + + for (const key of Object.keys(this.jokes)) { + states[key] = this.jokes[key].settings.enabled; + } + + fetch('/api.php?' + $.param({ + method: 'storage.set', + user_id: ( window).UserID, + key: 'april-fools', + token: ( window).ForumAPITicket, + value: JSON.stringify(states), + timer: 24 * 60 + })); + } + + /** + * Загрузка пользовательских настроек + */ + async loadUserStates() { + const response = await fetch('/api.php?' + $.param({ + method: 'storage.get', + user_id: ( window).UserID, + key: 'april-fools', + })); + const json = await response.json(); + + if (json.error) { + return; + } + + const data = JSON.parse(json.response.storage.data['april-fools']); + + for (const key of Object.keys(this.jokes)) { + this.jokes[key].settings.enabled = data[key]; + } + } + + async clearUserStates() { + await fetch('/api.php?' + $.param({ + method: 'storage.delete', + user_id: ( window).UserID, + key: 'april-fools', + token: ( window).ForumAPITicket, + })); + + return; + } + + /** * Запуск шутки * @@ -141,15 +219,33 @@ export class JokerClass { } } - regularStart(): void { + regularCheck(): boolean { + if (!this.core_settings.enabled) { + return false; + } + + if (this.core_settings.testers.indexOf(( window).UserID) >= 0) { + return true; + } + const today = new Date(); - const month = today.getMonth() + 1; // Note that getMonth() returns 0-indexed month, so we need to add 1 + const month = today.getMonth() + 1; const day = today.getDate(); - if (month !== 4 || day !== 1 || !this.core_settings.enabled || !this.check(this.core_settings.chance)) { + if (month !== 4 || day !== 1) { + return false; + } + + return this.check(this.core_settings.chance); + } + + async regularStart() { + if (!this.regularCheck()) { return; } + await this.loadUserStates(); + this.ui.show(); this.startAll(); } @@ -181,4 +277,6 @@ interface SettingsMap { class CoreSettings implements JokeSettings { chance = 100; enabled = true; + + testers: number[] = []; } \ No newline at end of file diff --git a/src/jokes/carnival.ts b/src/jokes/carnival.ts index a0e0435..47873b5 100644 --- a/src/jokes/carnival.ts +++ b/src/jokes/carnival.ts @@ -10,7 +10,11 @@ import { JokerClass } from "../joker"; * @author Kozhilya */ export class CarnivalJoke extends Joke { - id = 'carnival' + id = 'carnival'; + + title = 'Карнавал'; + + description = 'Аватарки приобретают интересные цвета'; settings = new CarnivalJokeSettings; diff --git a/src/jokes/crazy_letters.ts b/src/jokes/crazy_letters.ts index ea87661..2b0f91e 100644 --- a/src/jokes/crazy_letters.ts +++ b/src/jokes/crazy_letters.ts @@ -11,6 +11,10 @@ import $ from "jquery"; export class CrazyLettersJoke extends Joke { id = 'crazy_letters'; + title = 'Мама, Я сОшЛа С уМа!'; + + description = 'иМеНа ЗаБоРчИкОм'; + settings = new CrazyLettersJokeSettings; start(): void { diff --git a/src/jokes/crazy_punctuation.ts b/src/jokes/crazy_punctuation.ts deleted file mode 100644 index f8754c9..0000000 --- a/src/jokes/crazy_punctuation.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { Joke, JokeSettings, StopableJoke } from "../joke"; -import $ from "jquery"; - -/** - * **Бешеные запятые** - * - * Запятые после слов - * - * @author Kozhilya - */ -export class CrazyPunctuationJoke extends Joke { - id = 'crazy_punctuation'; - - settings = new CrazyPunctuationJokeSettings; - - punctuationSymbols: string[]|null = null; - - private shufflePunctuation(text: string): string { - if (this.punctuationSymbols === null) { - this.punctuationSymbols = this.settings.symbols.split(''); - } - const words = text.split(" "); - - const shuffledWords = words.map(word => { - const characters = word.split(""); - - // Filter out any non-punctuation characters - const punctuation = characters.filter(char => this.punctuationSymbols.includes(char)); - - // Shuffle the punctuation array - const shuffledPunctuation = punctuation.sort(() => Math.random() - 0.5); - - // Loop through each character in the word and replace punctuation with shuffled punctuation - let index = 0; - return characters.map(char => { - if (this.punctuationSymbols.includes(char)) { - return shuffledPunctuation[index++]; - } - return char; - }).join(""); - }); - - // Join the shuffled words array into a single string with spaces - return shuffledWords.join(" "); - } - - start(): void { - const items = $(this.settings.selector).find('*').contents().filter((_, node) => node.nodeType === Node.TEXT_NODE); - - items.each((_, node) => { - node.textContent = this.shufflePunctuation(node.textContent); - }) - } -} - -export class CrazyPunctuationJokeSettings implements JokeSettings { - enabled: boolean = true; - - chance: number = 20; - - /** - * Селектор всех элементов, которые будут затронуты - */ - selector: string = '.post-content p'; - - /** - * Мигрирующие знаки - */ - symbols: string = ',.;:?!-()[]{}\'"'; - - -} \ No newline at end of file diff --git a/src/jokes/cursor.ts b/src/jokes/cursor.ts index f3c15bc..298c82a 100644 --- a/src/jokes/cursor.ts +++ b/src/jokes/cursor.ts @@ -15,6 +15,10 @@ const cursor_effects = require("cursor-effects"); export class CursorEffectsJoke extends StopableJoke { id = 'cursor_effects'; + title = 'Красивый курсор'; + + description = 'Эффекты, следующие за курсором'; + settings = new CursorEffectsJokeSettings; active_cursor_effect: any; @@ -43,7 +47,7 @@ export class CursorEffectsJoke extends StopableJoke { } getRandomEffect(): CursorEffectsEnum { - const elements = Object.keys(CursorEffectsEnum).map(e => e); + const elements = Object.values(CursorEffectsEnum).map(e => e); const totalWeight = elements.reduce((sum, element) => sum + this.weight(element), 0); const randomWeight = Math.random() * totalWeight; diff --git a/src/jokes/humanitarian_hell.ts b/src/jokes/humanitarian_hell.ts index 3e8e1bf..658de9d 100644 --- a/src/jokes/humanitarian_hell.ts +++ b/src/jokes/humanitarian_hell.ts @@ -10,6 +10,10 @@ import $ from "jquery"; */ export class HumanitarianHellJoke extends Joke { id = 'humanitarian_hell'; + + title = 'Ад гуманитария'; + + description = 'Все "тся" заменяются на "ться", а все "ться" на "тся"'; settings = new HumanitarianHellJokeSettings; diff --git a/src/jokes/letter_chaos.ts b/src/jokes/letter_chaos.ts index 0defdda..771e023 100644 --- a/src/jokes/letter_chaos.ts +++ b/src/jokes/letter_chaos.ts @@ -12,6 +12,10 @@ import { JokerClass } from "../joker"; export class LetterChaosJoke extends Joke { id = 'letter_chaos'; + title = 'Буквенный хаос'; + + description = 'Все буквы в словах, кроме первой и последней, перемешены.'; + settings = new LetterChaosJokeSettings; punctuationSymbols: string[] | null = null; diff --git a/src/jokes/mirror.ts b/src/jokes/mirror.ts index 94a098d..53cd7a1 100644 --- a/src/jokes/mirror.ts +++ b/src/jokes/mirror.ts @@ -10,6 +10,10 @@ import $ from "jquery"; */ export class MirrorJoke extends Joke { id = 'mirror'; + + title = 'Зеркало'; + + description = 'Элементы форума отражаются (по крайней мере, пытаются)'; settings = new MirrorJokeSettings; diff --git a/src/jokes/shake.ts b/src/jokes/shake.ts index 47e3e1d..d3542bc 100644 --- a/src/jokes/shake.ts +++ b/src/jokes/shake.ts @@ -11,6 +11,10 @@ import $ from "jquery"; export class ShakeJoke extends StopableJoke { id = 'shake'; + title = 'Форумо-трясение'; + + description = 'Страница форума начинает трястись'; + settings = new ShakeJokeSettings; private interval_id: NodeJS.Timer; @@ -63,7 +67,7 @@ export class ShakeJoke extends StopableJoke { } export class ShakeJokeSettings implements JokeSettings { - enabled: boolean = true; + enabled: boolean = false; chance: number = 1; diff --git a/src/jokes/stupid_title.ts b/src/jokes/stupid_title.ts new file mode 100644 index 0000000..9ef6a3f --- /dev/null +++ b/src/jokes/stupid_title.ts @@ -0,0 +1,312 @@ +import { Joke, JokeSettings, StopableJoke } from "../joke"; +import $ from "jquery"; + +/** + * **Глупые статусы** + * + * Каждому пользователю даётся новый глупый статус. + * + * @author Kozhilya + */ +export class StupidTitleJoke extends Joke { + id = 'stupid_title'; + + title = 'Глупые статусы'; + + description = 'Каждому пользователю даётся новый глупый статус.'; + + settings = new StupidTitleJokeSettings; + + private loadedGenders: any = null; + + async loadGenders(): Promise { + const names = $('.pa-author a') + .map((_, elem) => elem.innerText).toArray() + .reduce((arr: string[], name: string) => { + if (arr.indexOf(name) < 0){ + arr.push(name); + } + return arr + }, []); + + const url = '/api.php?' + $.param({ method: 'users.get', fields: 'username,sex', username: names }); + const response = await fetch(url); + const json = await response.json(); + + this.loadedGenders = {}; + + if (json.error) { + return; + } + + json.response.users.forEach((element: any) => { + if (element.sex === '0') { + return; + } + + this.loadedGenders[element.username] = element.sex === '1'; + }); + } + + resolveGender(name: string): boolean { + if (this.settings.gender_resolver !== null) { + return !!this.settings.gender_resolver.call(this, name); + } + + if (name in this.loadedGenders) { + return !!this.loadedGenders[name]; + } + + this.resetSeed(); + return this.selectRandom(name, { 'm': 1, 'f': 1 }) === 'm'; + } + + async start(): Promise { + await this.loadGenders(); + + const cache: any = {}; + + $('.post-author').each((_, root) => { + const name = $('.pa-author a', root).text(); + if (!name) { + return; + } + + if (!(name in cache)) { + this.resetSeed(); + cache[name] = this.generatePhrase(name); + } + + $('.pa-title', root).text(cache[name]); + }); + } + + private prng(name: string, seed: number, limit: number): number { + /* + https://github.com/bryc/code/blob/master/jshash/experimental/cyrb53.js + + cyrb53 (c) 2018 bryc (github.com/bryc) + A fast and simple hash function with decent collision resistance. + Largely inspired by MurmurHash2/3, but with a focus on speed/simplicity. + Public domain. Attribution appreciated. + */ + let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed; + for (let i = 0, ch; i < name.length; i++) { + ch = name.charCodeAt(i); + h1 = Math.imul(h1 ^ ch, 2654435761); + h2 = Math.imul(h2 ^ ch, 1597334677); + } + h1 = Math.imul(h1 ^ (h1>>>16), 2246822507) ^ Math.imul(h2 ^ (h2>>>13), 3266489909); + h2 = Math.imul(h2 ^ (h2>>>16), 2246822507) ^ Math.imul(h1 ^ (h1>>>13), 3266489909); + + const value = 4294967296 * (2097151 & h2) + (h1>>>0); + + return Math.floor(Math.pow(Math.sin(value), 2) * limit) % limit; + } + + private seed = 0; + + private resetSeed(): void { + const date = new Date(); + const time = new Date().getUTCHours() * 60 + new Date().getUTCMinutes(); + this.seed = Math.floor(time / this.settings.change_frequency); + + console.log('Seed reset:', time, this.seed); + } + + private selectRandom(name: string, variants: StupidTitleWeightedVariants): string { + const elements = Object.keys(variants); + const totalWeight = elements.reduce((sum, element) => sum + variants[element], 0); + const randomWeight = this.prng(name, this.seed++, totalWeight); + + let currentWeight = 0; + for (const element of elements) { + currentWeight += variants[element]; + if (randomWeight <= currentWeight) { + return element; + } + } + + throw new Error("Тебя быть тут не должно..."); + } + + private buildVariants(type: string, gender: boolean): StupidTitleWeightedVariants { + const result: StupidTitleWeightedVariants = {}; + const variants: StupidTitleVariant = this.settings.variants[type]; + + for (const iterator of Object.entries(variants)) { + const word = iterator[0]; + const wordSettings = iterator[1]; + + if (!wordSettings.enabled || (wordSettings.gender === !gender)) { + continue; + } + + if (!this.settings.rude && wordSettings.rude) { + continue; + } + + result[word] = wordSettings.weight; + } + + return result; + } + + private capitalizeFirst(str: string): string { + return str.charAt(0).toUpperCase() + str.slice(1); + } + + generatePhrase(name: string): string { + const gender = this.resolveGender(name); + const prhase = this.selectRandom(name, this.settings.schemas); + + return this.capitalizeFirst(prhase.replace(/\{(.+?)\}/g, (_, type: string) => { + const variants = this.buildVariants(type, gender); + + return this.selectRandom(name, variants); + })); + } +} + +export class StupidTitleJokeSettings implements JokeSettings { + enabled: boolean = true; + chance: number = 100; + + /** + * Определение пола по имени. + * По умолчанию род устанавливается случайным образом + * + * Если установлено значение `null`, система попытается загрузить пол, установленный в настройках аккаунта. Если этот пол определить невозможно, то он будет выбран случайно. Эта настройка позволяет изменить это поведение, если ваш форум обладает ролевой системой, в которой пол определяется иным образом. + * + * @param name Имя персонажа + * @returns true, если мужской род; false, если женский род + */ + gender_resolver: Function | null = null; + + /** + * Разрешить возможно оскорбительные варианты + */ + rude: boolean = false; + + /** + * Частота смены статусов (в минутах) + */ + change_frequency: number = 5; + + /** + * Разрешённые схемы формирования статусов + * + * {adj} - прилагательное + * {noun} - имя существительно + * {verb} - глагол + * {adv} - наречие + * {place} - дополнение места + * {p} - знак препинания + */ + schemas: StupidTitleWeightedVariants = { + '{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, + }; + + /** + * Вариант слов + * Смотрите раздел описания скрипта, что бы настроить это поле + */ + variants: StupidTitleVariants = { + adj: { + ...buildVariant(true, 'жесткий,^удачливый,низкий,знакомый,откровенный,^мирный,грамотный,вкусный,виртуальный,пышный,провинциальный,$жирный,заинтересованный,объективный,^оригинальный,пожилой,чистый,особенный,выгодный,громадный,обыкновенный,чужой,ударный,^солнечный,истинный,посторонний,южный,седой,$бесполезный,острый,пестрый,формальный,повседневный,невозможный,$жалкий,целый,$глупый,последний,выходной,серьезный,подземный,небесный,любимый,былой,семейный,далекий,северный,суровый,гигантский,иностранный,родной,конструктивный,показательный,нужный,чрезвычайный,гордый,банальный,открытый,независимый,запасной,мстительный,грубый,алчный,мелочный,хладнокровный,спокойный,терпеливый,креативный,активный,адекватный,застенчивый,опрятный,безнадёжный,уверенный в себе,доброжелательный,ласковый,робкий,воспитанный,самовлюблённый,деятельный,двуличный,верный'), + ...buildVariant(false, 'жесткая,^удачливая,низкая,знакомая,откровенная,^мирная,грамотная,вкусная,виртуальная,пышная,провинциальная,$жирная,заинтересованная,объективная,^оригинальная,пожилая,чистая,особенная,выгодная,громадная,обыкновенная,чужая,ударная,^солнечная,истинная,посторонняя,южная,седая,$бесполезная,острая,пестрая,формальная,повседневная,невозможная,$жалкая,целая,$глупая,последняя,выходная,серьезная,подземная,небесная,любимая,былая,семейная,далекая,северная,суровая,гигантская,иностранная,родная,конструктивная,показательная,нужная,чрезвычайная,гордая,банальная,открытая,независимая,запасная,мстительная,грубая,алчная,мелочная,хладнокровная,спокаяная,терпеливая,креативная,активная,адекватная,застенчивая,опрятная,безнадёжная,уверенная в себе,доброжелательная,ласковая,робкая,воспитанная,самовлюблённая,деятельная,двуличная,верная'), + }, + noun: { + ...buildVariant(null, ''), + + ...buildVariant(true, 'орёл, ниндзя, манекен, пузырь, бродяга, рыцарь, кентавр, зайц, диван, наследник, сын, джентльмен, басурманин, карасик, $злоумышленник, $раб, хоббит, одиночка, отец, кролик, бруталище, дворф, актёр, %дед, спортсмен, $балбес, %мальчег, лев, ёж, организм, монах, хоббит, борец, тигр, монстр, массажист, мачо, эльф, ледник, жук, кот, зомби, проказник, дракон, носорог, волк, лесоруб, кит, %дедушка, динозавр, бард, кулак, принц, %сынок, мальчик, товарищ, ёжик, сурикат'), + + ...buildVariant(false, 'заноза, волторна, $личинка, детка, %бабушка, простуда, черепашка, мышь, волчица, деревяшка, пиранья, каруселька, красотка, леди, %дочка, орлица, принцесса, $ведьма, травка, актриса, наследница, %деффачка, горгулья, белочка, акула, машинка, конфетка, знаменитость, косточка, спортсменка, панда, мать, львица, эльфийка, $злоумышленница, чертовка, дворфиха, кошка, $рабыня, скамеечка, дочь, монашка, бактерия, рыбка, бусинка, $бабка, девочка, валькирия, килька, бабочка, милашка, крышка, тигрица, рыбка, русалочка'), + }, + verb: { + ...buildVariant(null, 'встаёт, снимает, приказывает, указывает, собирается, чувствует опасность, орёт, болеет, поздравляет, освобождает, поздравляет, бежит, берёт и делает, молчит, радуется, прощает, читает, снимает, снимается в фильме, что-то скрывает, думает, имеет план и придерживается его, тянет, работает, меняется, ловит, отказаться куда-то идти, заходит, замирает, оформляет, нарушает, отказывается что-то делать, шепчет, снимается в сериале, скрывается, учит, спрашивает, идёт, отказывается вставать, прибывает, отказывается, забывает, получает, плывёт, отвечает, поглядывает, говорит, просыпается, соединяет, оглядывается'), + + ...buildVariant(true, 'женится, женился, успел, не успел, смог, скрылся, заработался, познал дзен, присел, обиделся, проснулся, взял и сделал, додумался, не спал'), + + ...buildVariant(false, 'выходит замуж, вышла замуж, успела, не успела, смогла, скрылась, заработалась, познала дзен, присела, обиделась, проснулась, взяла и сделала, додумалась, не спала'), + }, + place: { + ...buildVariant(null, 'где-то, в пустыне, на пляже, под дождём, %под проливным дождём, в квартире, %в тёплой и уютной квартире, в космосе, в театре, в филармонии, на заснеженной вершине, на конференции, на форуме, в очереди, в лесу, в джунглях, под водой'), + }, + adv: { + ...buildVariant(null, 'счастливо, уныло, грустно, позже, немедленно, регулярно, вновь, опять, уже, внезапно, предсказуемо, медленно, быстро, %молниеносно, $грубо, безрассудно, осмысленно, расчётливо'), + }, + p: { + '': new StupidTitleSetting({ weight: 10 }), + '.': new StupidTitleSetting({ weight: 10 }), + '...': new StupidTitleSetting({ weight: 5 }), + '!': new StupidTitleSetting({ weight: 5 }), + '!!!': new StupidTitleSetting({ weight: 2 }), + '?': new StupidTitleSetting({ weight: 2 }), + '?!': new StupidTitleSetting({ weight: 1 }), + }, + }; + +} + +interface StupidTitleVariants { + [key: string]: StupidTitleVariant +} + +interface StupidTitleVariant { + [key: string]: StupidTitleSetting +} + +interface StupidTitleWeightedVariants { + [key: string]: number +} + +class StupidTitleSetting { + weight: number = 10; + + enabled: boolean = true; + + rude: boolean = false; + + gender: boolean|null = null; + + constructor(options: any = new Object) { + for (const iterator of Object.entries(options)) { + if (iterator[0] in this) { + ( this)[iterator[0]] = iterator[1]; + } + } + } +} + +function buildVariant(gender: boolean|null, input: string): StupidTitleVariant +{ + const result: StupidTitleVariant = {}; + const words = input.split(',').map(word => word.trim()); + + words.forEach(word => { + const clean_word = word.replace(/[^А-ЯЁа-яёA-Za-z\- ]/g, ''); + + if (clean_word === '') { + return; + } + + result[clean_word] = new StupidTitleSetting({ + gender, + rude: word.indexOf('$') >= 0, + enabled: word.indexOf('!') < 0, + weight: 10 * ((word.indexOf('$') >= 0) ? 0.5 : 1) * ((word.indexOf('%') >= 0) ? 0.5 : 1) * ((word.indexOf('^') >= 0) ? 2 : 1) + }); + }); + + return result; +} + +(window as any).BuildStupdiTitleVariant = buildVariant; \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 9636927..f364710 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,9 +5,9 @@ import { HumanitarianHellJoke } from "./jokes/humanitarian_hell"; import { MirrorJoke } from "./jokes/mirror"; import { CarnivalJoke } from "./jokes/carnival"; import { CrazyLettersJoke } from "./jokes/crazy_letters"; -import { CrazyPunctuationJoke } from "./jokes/crazy_punctuation"; import { LetterChaosJoke } from "./jokes/letter_chaos"; -import { CursorEffectsJoke } from "./jokes/cursor" +import { CursorEffectsJoke } from "./jokes/cursor"; +import { StupidTitleJoke } from "./jokes/stupid_title"; (window as any).AprilJokes = ((jokes: JokeClassList): JokerClass => { const cl = new JokerClass(); @@ -16,7 +16,7 @@ import { CursorEffectsJoke } from "./jokes/cursor" cl.add(new joke()); }); - cl.regularStart(); + $(() => cl.regularStart()); return cl; })([ @@ -25,9 +25,9 @@ import { CursorEffectsJoke } from "./jokes/cursor" MirrorJoke, CarnivalJoke, CrazyLettersJoke, - CrazyPunctuationJoke, LetterChaosJoke, CursorEffectsJoke, + StupidTitleJoke, ]); interface JokeClassList extends Array Joke> {} \ No newline at end of file diff --git a/src/ui.ts b/src/ui.ts new file mode 100644 index 0000000..7d67cdb --- /dev/null +++ b/src/ui.ts @@ -0,0 +1,62 @@ +/// +import { JokerClass } from "./joker"; +import $ from "jquery"; +import button_html from "./html/button.html"; +import styles_html from "./html/styles.html"; +import window_html from "./html/window.html"; + + +export class JokerUI { + joker: JokerClass; + + constructor(joker: JokerClass) { + this.joker = joker; + + $('link[rel="stylesheet"]').eq(0).before(styles_html); + + const button = this.button; + + button.hide(); + (button).mybbModal({ + title: "Настройки первоапрельских шуток", + content: () => this.render(), + closer: true, + noscroll: true, + escClose: true, + }); + } + + get button() { + let button = $('.april-fools__button'); + + if (button.length === 0) { + button = $(button_html).appendTo('body'); + } + + return button; + } + + show() { + this.button.show(); + } + + render(): JQuery { + const result: JQuery = $('
').html(window_html); + const row_template = $('#april-fools__window-row', result).html(); + const joke_container = $('.april-fools__jokes', result); + + for (const joke of Object.values(this.joker.jokes)) { + const row = $(eval('`' + row_template + '`')); + $('input[type="checkbox"]', row).prop('checked', joke.settings.enabled) + .on('click', e => this.joker.toggleJoke(joke.id, (e).currentTarget.checked)); + joke_container.append(row); + } + + $('button', result).on('click', async () => { + await this.joker.clearUserStates(); + window.location.reload(); + }); + + return $('.april-fools__content', result); + } +} \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 4b2ce9b..3a95cfb 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -40,6 +40,10 @@ const config = { test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i, type: "asset", }, + { + test: /\.html$/i, + loader: "html-loader", + }, // Add your rules for custom modules here // Learn more about loaders from https://webpack.js.org/loaders/ ], @@ -50,6 +54,9 @@ const config = { externals: { jquery: 'jQuery', }, + watchOptions: { + aggregateTimeout: 20, + }, }; module.exports = () => {