Compare commits
2
Commits
3c3055eb1f
...
ca1a01a06e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca1a01a06e | ||
|
|
387b3925c6 |
@@ -1,4 +1,9 @@
|
|||||||
{
|
{
|
||||||
|
"ignorePatterns": [
|
||||||
|
"node_modules/",
|
||||||
|
"settings.*.js",
|
||||||
|
"webpack.*.js"
|
||||||
|
],
|
||||||
"plugins": ["@typescript-eslint"],
|
"plugins": ["@typescript-eslint"],
|
||||||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "google"],
|
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "google"],
|
||||||
"parser": "@babel/eslint-parser",
|
"parser": "@babel/eslint-parser",
|
||||||
|
|||||||
Vendored
+62
-24
File diff suppressed because one or more lines are too long
Generated
+8
-2
@@ -1,17 +1,18 @@
|
|||||||
{
|
{
|
||||||
"name": "mybb-april-fools",
|
"name": "mybb-april-fools",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mybb-april-fools",
|
"name": "mybb-april-fools",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"license": "https://forumd.ru/viewtopic.php?id=5751#rule",
|
"license": "https://forumd.ru/viewtopic.php?id=5751#rule",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/eslint-parser": "^7.24.1",
|
"@babel/eslint-parser": "^7.24.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
||||||
"cursor-effects": "^1.0.11",
|
"cursor-effects": "^1.0.11",
|
||||||
|
"ignore-loader": "^0.1.2",
|
||||||
"jquery": "^3.6.4",
|
"jquery": "^3.6.4",
|
||||||
"webpack-utf8-bom": "^1.4.0"
|
"webpack-utf8-bom": "^1.4.0"
|
||||||
},
|
},
|
||||||
@@ -7587,6 +7588,11 @@
|
|||||||
"node": ">= 4"
|
"node": ">= 4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/ignore-loader": {
|
||||||
|
"version": "0.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/ignore-loader/-/ignore-loader-0.1.2.tgz",
|
||||||
|
"integrity": "sha512-yOJQEKrNwoYqrWLS4DcnzM7SEQhRKis5mB+LdKKh4cPmGYlLPR0ozRzHV5jmEk2IxptqJNQA5Cc0gw8Fj12bXA=="
|
||||||
|
},
|
||||||
"node_modules/ignore-walk": {
|
"node_modules/ignore-walk": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-4.0.1.tgz",
|
||||||
|
|||||||
@@ -49,6 +49,7 @@
|
|||||||
"@babel/eslint-parser": "^7.24.1",
|
"@babel/eslint-parser": "^7.24.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
||||||
"cursor-effects": "^1.0.11",
|
"cursor-effects": "^1.0.11",
|
||||||
|
"ignore-loader": "^0.1.2",
|
||||||
"jquery": "^3.6.4",
|
"jquery": "^3.6.4",
|
||||||
"webpack-utf8-bom": "^1.4.0"
|
"webpack-utf8-bom": "^1.4.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,3 +23,24 @@ export function getTextNodes(
|
|||||||
filter((_, node) => node.nodeType === Node.TEXT_NODE);
|
filter((_, node) => node.nodeType === Node.TEXT_NODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let debugEnabled = ((scriptElement) => {
|
||||||
|
if (!(scriptElement instanceof HTMLScriptElement)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !/\.min\.js$/.test(scriptElement.src);
|
||||||
|
})(document.currentScript);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Отоброзить отладочное сообщение
|
||||||
|
*/
|
||||||
|
export function debug(...data: (string|number|object)[]) {
|
||||||
|
if (!debugEnabled) return;
|
||||||
|
console.log(...data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Включить отладку
|
||||||
|
*/
|
||||||
|
export function enableDebug() {
|
||||||
|
debugEnabled = true;
|
||||||
|
}
|
||||||
|
|||||||
+5
-2
@@ -1,6 +1,7 @@
|
|||||||
import './types/mybb.d.ts';
|
import './types/mybb.d';
|
||||||
import {Joke, JokeSettings, StoppableJoke} from './joke';
|
import {Joke, JokeSettings, StoppableJoke} from './joke';
|
||||||
import {JokerUI} from './ui';
|
import {JokerUI} from './ui';
|
||||||
|
import {debug} from './common';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Блок обработки перво-апрельских шуток
|
* Блок обработки перво-апрельских шуток
|
||||||
@@ -13,6 +14,7 @@ export class JokerClass {
|
|||||||
* Общие настройки системы
|
* Общие настройки системы
|
||||||
*/
|
*/
|
||||||
core_settings = new CoreSettings();
|
core_settings = new CoreSettings();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Перечисление всех шуток
|
* Перечисление всех шуток
|
||||||
*/
|
*/
|
||||||
@@ -235,9 +237,10 @@ export class JokerClass {
|
|||||||
|
|
||||||
if (!forced && (!joke.settings.enabled || !this.check(joke.settings.chance))
|
if (!forced && (!joke.settings.enabled || !this.check(joke.settings.chance))
|
||||||
) {
|
) {
|
||||||
|
debug(joke.title, '- шутка не включена');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
debug(joke.title, '- шутка включена');
|
||||||
joke.start();
|
joke.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
// / <reference path="html.d.ts"/>
|
import './types/html.d';
|
||||||
|
import './types/mybb.d';
|
||||||
import './types/html.d.ts';
|
|
||||||
import './types/mybb.d.ts';
|
|
||||||
|
|
||||||
import {JokerClass} from './joker';
|
import {JokerClass} from './joker';
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
|
|||||||
+14
-3
@@ -3,8 +3,9 @@ const webpack = require("webpack");
|
|||||||
const BomPlugin = require("webpack-utf8-bom");
|
const BomPlugin = require("webpack-utf8-bom");
|
||||||
const TerserPlugin = require("terser-webpack-plugin");
|
const TerserPlugin = require("terser-webpack-plugin");
|
||||||
const { libBanner } = require("./webpack.banner");
|
const { libBanner } = require("./webpack.banner");
|
||||||
|
const { libUpload } = require("./webpack.upload");
|
||||||
|
|
||||||
const isProduction = process.env.NODE_ENV == "production";
|
const isProduction = process.env.NODE_ENV === "production";
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
entry: "./src/main.ts",
|
entry: "./src/main.ts",
|
||||||
@@ -20,9 +21,19 @@ const config = {
|
|||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.(ts|tsx)$/i,
|
test: /\.tsx?$/i,
|
||||||
loader: "ts-loader",
|
loader: "ts-loader",
|
||||||
exclude: ["/node_modules/"],
|
exclude: /node_modules|\.d\.ts$/,
|
||||||
|
// exclude: ["/node_modules/|.d.ts"],
|
||||||
|
options: {
|
||||||
|
compilerOptions: {
|
||||||
|
noEmit: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.d\.ts$/i,
|
||||||
|
loader: 'ignore-loader'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
|
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
|
||||||
|
|||||||
+5
-5
@@ -1,16 +1,16 @@
|
|||||||
|
|
||||||
const { exec } = require("node:child_process");
|
const { exec } = require('node:child_process');
|
||||||
|
|
||||||
const libUpload = {
|
const libUpload = {
|
||||||
apply: (compiler) => {
|
apply: (compiler) => {
|
||||||
compiler.hooks.afterEmit.tap("AfterEmitPlugin", (compilation) => {
|
compiler.hooks.afterEmit.tap('AfterEmitPlugin', (compilation) => {
|
||||||
exec("./upload.sh", (err, stdout, stderr) => {
|
exec('./upload.sh', (err, stdout, stderr) => {
|
||||||
if (stdout) process.stdout.write(stdout);
|
if (stdout) process.stdout.write(stdout);
|
||||||
if (stderr) process.stderr.write(stderr);
|
if (stderr) process.stderr.write(stderr);
|
||||||
console.log("Uploaded.");
|
console.log('Uploaded.');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports
|
module.exports = { libUpload };
|
||||||
Reference in New Issue
Block a user