Больше дополнений
This commit is contained in:
+453
-261
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -21,7 +21,7 @@
|
|||||||
"uglify-js": "^3.17.4"
|
"uglify-js": "^3.17.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "grunt & npm run jsdoc",
|
"compile": "tsc & grunt uglify",
|
||||||
"jsdoc": "cmd /r \"jsdoc2md --files ./src/**/*.ts --configure ./jsdoc2md.json > ./docs/april-fools.md\""
|
"jsdoc": "cmd /r \"jsdoc2md --files ./src/**/*.ts --configure ./jsdoc2md.json > ./docs/april-fools.md\""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
import { Joke, JokeSettings, StopableJoke } from "../joke";
|
||||||
|
import $ from "jquery";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* **Бешеные запятые**
|
||||||
|
*
|
||||||
|
* Запятые после слов
|
||||||
|
*
|
||||||
|
* @author Kozhilya
|
||||||
|
*/
|
||||||
|
export class CrazyPunctuationJoke extends Joke {
|
||||||
|
settings: CrazyPunctuationJokeSettings;
|
||||||
|
|
||||||
|
private transform(text: string): string {
|
||||||
|
let newText = "";
|
||||||
|
|
||||||
|
for (let i = 0; i < text.length; i++) {
|
||||||
|
const currentChar = text[i];
|
||||||
|
const nextChar = text[i + 1];
|
||||||
|
|
||||||
|
if (this.settings.symbols.includes(currentChar)) {
|
||||||
|
newText += currentChar;
|
||||||
|
} else if (nextChar === " " || this.settings.symbols.includes(nextChar)) {
|
||||||
|
newText += currentChar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newText;
|
||||||
|
}
|
||||||
|
|
||||||
|
private process(node): void {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
start(): void {
|
||||||
|
const items = $(this.settings.selector).find('*').contents().filter((_, node) => node.nodeType === Node.TEXT_NODE);
|
||||||
|
|
||||||
|
items.each((_, node) => {
|
||||||
|
console.log(node);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CrazyPunctuationJokeSettings implements JokeSettings {
|
||||||
|
chance: number = 20;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Селектор всех элементов, которые будут затронуты
|
||||||
|
*/
|
||||||
|
selector: string = '.post-content';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Мигрирующие знаки
|
||||||
|
*/
|
||||||
|
symbols: string = ',.;:?!-()[]{}\'"';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -14,7 +14,6 @@ export class MirrorJoke extends Joke {
|
|||||||
start(): void {
|
start(): void {
|
||||||
$('.post, .post h3, .post-links, .post-author, .post-content')
|
$('.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"');
|
.css('transform', 'scaleX(-1)').css('-moz-transform', 'scaleX(-1)').css('-moz-transform', 'scaleX(-1)').css('filter', 'FlipH').css('-ms-filter', '"FlipH"');
|
||||||
$('#pun-title #title-logo').animate('')
|
|
||||||
$('.post-links, .post-links ul, .post h3 span').css('margin-left', '0');
|
$('.post-links, .post-links ul, .post h3 span').css('margin-left', '0');
|
||||||
$('.post h3 span').css('margin-right', '25em');
|
$('.post h3 span').css('margin-right', '25em');
|
||||||
}
|
}
|
||||||
|
|||||||
+10
@@ -1,6 +1,11 @@
|
|||||||
import { AprilFoolsJokeClass } from "./handler";
|
import { AprilFoolsJokeClass } from "./handler";
|
||||||
import { Joke } from "./joke";
|
import { Joke } from "./joke";
|
||||||
import { ShakeJoke } from "./jokes/shake";
|
import { ShakeJoke } from "./jokes/shake";
|
||||||
|
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";
|
||||||
|
|
||||||
(window as any).AprilJokes = ((jokes: JokeClassList): AprilFoolsJokeClass => {
|
(window as any).AprilJokes = ((jokes: JokeClassList): AprilFoolsJokeClass => {
|
||||||
const cl = new AprilFoolsJokeClass();
|
const cl = new AprilFoolsJokeClass();
|
||||||
@@ -12,6 +17,11 @@ import { ShakeJoke } from "./jokes/shake";
|
|||||||
return cl;
|
return cl;
|
||||||
})([
|
})([
|
||||||
ShakeJoke,
|
ShakeJoke,
|
||||||
|
HumanitarianHellJoke,
|
||||||
|
MirrorJoke,
|
||||||
|
CarnivalJoke,
|
||||||
|
CrazyLettersJoke,
|
||||||
|
CrazyPunctuationJoke,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
interface JokeClassList extends Array<new () => Joke> {}
|
interface JokeClassList extends Array<new () => Joke> {}
|
||||||
Reference in New Issue
Block a user