Files
mybb-april-fools/src/jokes/humanitarian_hell.ts
T

38 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { Joke, JokeSettings, StopableJoke } from "../joke";
import $ from "jquery";
/**
* **Ад гуманитария**
*
* Все "тся" заменяются на "ться", а все "ться" на "тся"
*
* @author Kozhilya
*/
export class HumanitarianHellJoke extends Joke {
id = 'humanitarian_hell';
title = 'Ад гуманитария';
description = 'Все "тся" заменяются на "ться", а все "ться" на "тся"';
settings = new HumanitarianHellJokeSettings;
start(): void {
$(this.settings.selector).each(function () {
$(this).html($(this).html().replace(/(ть?ся)/g, function (fnd) {
return (fnd.indexOf('ь') > 0) ? 'тся' : 'ться';
}));
});
}
}
export class HumanitarianHellJokeSettings implements JokeSettings {
enabled: boolean = true;
chance: number = 20;
/**
* Селектор всех элементов, которые будут затронуты
*/
selector: string = '.post-content';
}