Skip to content

Commit fc24c2b

Browse files
committed
Fehlerbehebung
1 parent c4ae71a commit fc24c2b

File tree

9 files changed

+1101
-466
lines changed

9 files changed

+1101
-466
lines changed

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ['*']
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: 16
20+
21+
- name: Create package
22+
run: |
23+
rm -rf *.tar.gz
24+
npx --yes wspackager@latest
25+
26+
- name: Check file existence
27+
id: check_files
28+
uses: andstor/[email protected]
29+
with:
30+
files: "*.tar.gz"
31+
32+
- name: On Build Failure
33+
if: steps.check_files.outputs.files_exists == 'false'
34+
run: |
35+
echo "Packaging FAILED" && exit 1
36+
37+
- name: Release
38+
uses: softprops/[email protected]
39+
if: startsWith(github.ref, 'refs/tags/') && steps.check_files.outputs.files_exists == 'true'
40+
with:
41+
files: "*.tar.gz"

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
*.tar
22
*.tar.gz
33
node_modules/
4-
files/js/*

files/js/Hanashi/Twemoji/Data.js

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

files/js/Hanashi/Twemoji/Parser.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
var __importDefault = (this && this.__importDefault) || function (mod) {
2+
return (mod && mod.__esModule) ? mod : { "default": mod };
3+
};
4+
define(["require", "exports", "./Data", "./Util"], function (require, exports, Data_1, Util_1) {
5+
"use strict";
6+
Object.defineProperty(exports, "__esModule", { value: true });
7+
exports.TwemojiParser = void 0;
8+
Data_1 = __importDefault(Data_1);
9+
Util_1 = __importDefault(Util_1);
10+
class TwemojiParser {
11+
constructor(options = {}) {
12+
this.emojiDataPath = window.WCF_PATH + 'js/Hanashi/Twemoji/twemoji.json';
13+
this.emojiSize = 24;
14+
this.selector = undefined;
15+
if (options.selector != null) {
16+
this.selector = options.selector;
17+
}
18+
if (options.dataPath != null) {
19+
this.emojiDataPath = options.dataPath;
20+
}
21+
if (options.size != null) {
22+
this.emojiSize = options.size;
23+
}
24+
if (this.selector == null) {
25+
console.error('no selector configured');
26+
}
27+
const twemojiData = Data_1.default.getTwemojiData();
28+
if (twemojiData.emo != null) {
29+
this.emojis = twemojiData.emo;
30+
}
31+
this.parse();
32+
}
33+
parse(selector = undefined) {
34+
if (this.emojis == null) {
35+
return;
36+
}
37+
if (selector == null) {
38+
selector = this.selector;
39+
}
40+
if (selector == null) {
41+
console.error('no selector configured');
42+
return;
43+
}
44+
const nodeList = document.querySelectorAll(selector);
45+
for (let [_, emoji] of Object.entries(this.emojis)) {
46+
const native = Util_1.default.getEmojiByUnifier(emoji.u);
47+
if (!native) {
48+
continue;
49+
}
50+
const x = emoji.c[0] * (this.emojiSize * -1);
51+
const y = emoji.c[1] * (this.emojiSize * -1);
52+
const icon = '<span class="haTwemojiIcon' + this.emojiSize + '" style="background-position: ' + x + 'px ' + y + 'px"></span>';
53+
nodeList.forEach(node => {
54+
if (!node.innerHTML.includes(native)) {
55+
return;
56+
}
57+
node.innerHTML = node.innerHTML.replace(new RegExp(native, 'g'), icon);
58+
});
59+
}
60+
}
61+
}
62+
exports.TwemojiParser = TwemojiParser;
63+
exports.default = TwemojiParser;
64+
});

0 commit comments

Comments
 (0)