Больше шуток

This commit is contained in:
2023-03-27 16:51:45 +04:00
parent f90f0c542b
commit f9cbc4461d
8 changed files with 166 additions and 189 deletions
+30
View File
@@ -0,0 +1,30 @@
import { Joke, JokeSettings, StopableJoke } from "../joke";
import $ from "jquery";
/**
* **Ад гуманитария**
*
* Все "тся" заменяются на "ться", а все "ться" на "тся".
*
* @author Kozhilya
*/
export class HumanitarianHellJoke extends Joke {
settings: 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 {
chance: number = 20;
/**
* Селектор всех элементов, которые будут затронуты
*/
selector: string = '.post-content';
}