Compare commits
5 commits
9eb0976b35
...
eb97f4b5f0
Author | SHA1 | Date | |
---|---|---|---|
eb97f4b5f0 | |||
4e983710ef | |||
4f27683c0b | |||
2e069d54ec | |||
ce174d4d2b |
11 changed files with 32 additions and 11 deletions
BIN
gfx/bttv_original.png
(Stored with Git LFS)
BIN
gfx/bttv_original.png
(Stored with Git LFS)
Binary file not shown.
BIN
gfx/icon.xcf
(Stored with Git LFS)
Normal file
BIN
gfx/icon.xcf
(Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "lmlfc-bttv",
|
||||
"version": "0.0.1",
|
||||
"version": "0.1",
|
||||
"author": "Jörn-Michael Miehe <joern-michael.miehe@lenaisten.de>",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
|
|
BIN
public/img/icon-128.png
(Stored with Git LFS)
Normal file
BIN
public/img/icon-128.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
public/img/icon-16.png
(Stored with Git LFS)
Normal file
BIN
public/img/icon-16.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
public/img/icon-32.png
(Stored with Git LFS)
Normal file
BIN
public/img/icon-32.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
public/img/icon-48.png
(Stored with Git LFS)
Normal file
BIN
public/img/icon-48.png
(Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -1,8 +1,14 @@
|
|||
{
|
||||
"manifest_version": 3,
|
||||
"name": "LMLFC-BTTV",
|
||||
"version": "1.0",
|
||||
"description": "Add the reading time to Chrome Extension documentation articles",
|
||||
"name": "BTTV für Schnatzbox",
|
||||
"description": "Macht \"bttv:kekw\" und co. in der \"Schnatzbox\" verfügbar.",
|
||||
"version": "0.1",
|
||||
"icons": {
|
||||
"16": "img/icon-16.png",
|
||||
"32": "img/icon-32.png",
|
||||
"48": "img/icon-48.png",
|
||||
"128": "img/icon-128.png"
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"js": ["main.js"],
|
||||
|
@ -11,7 +17,7 @@
|
|||
],
|
||||
"web_accessible_resources": [
|
||||
{
|
||||
"resources": ["bttv.png"],
|
||||
"resources": ["img/sb_button.png"],
|
||||
"matches": ["*://*.lenameyerlandrut-fanclub.de/*"]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -28,7 +28,7 @@ async function bttv_get_url(code: string): Promise<Emote> {
|
|||
|
||||
return {
|
||||
code: code,
|
||||
url: `https://cdn.betterttv.net/emote/${matches[0].id}/1x.${matches[0].imageType}`,
|
||||
url: `//cdn.betterttv.net/emote/${matches[0].id}/1x.${matches[0].imageType}`,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ async function get_emotes(codes: Iterable<string>): Promise<EmoteMap> {
|
|||
|
||||
// queue emote jobs
|
||||
const queue = [...codes_set].map((code) => bttv_get_url(code));
|
||||
console.log("[lmlfc-bttv] queueing", queue.length, "jobs");
|
||||
console.log("[lmlfc-bttv] queued", queue.length, "jobs");
|
||||
|
||||
// run
|
||||
const result: EmoteMap = {};
|
||||
|
@ -52,7 +52,7 @@ async function get_emotes(codes: Iterable<string>): Promise<EmoteMap> {
|
|||
|
||||
async function process_text(text: string): Promise<string> {
|
||||
const matches = [...text.matchAll(emote_regex)];
|
||||
const emotes = await get_emotes(matches.map((elem) => elem[1]));
|
||||
const emotes = await get_emotes(matches.map(([_, code]) => code));
|
||||
|
||||
for (const emote of matches.reverse()) {
|
||||
const [match, code] = emote;
|
||||
|
@ -80,7 +80,7 @@ async function process_text(text: string): Promise<string> {
|
|||
btn.style.setProperty("margin-right", "4px");
|
||||
|
||||
const img = document.createElement("img");
|
||||
img.setAttribute("src", chrome.runtime.getURL("bttv.png"));
|
||||
img.setAttribute("src", chrome.runtime.getURL("img/sb_button.png"));
|
||||
img.style.setProperty("vertical-align", "middle");
|
||||
|
||||
btn.addEventListener("click", async (event) => {
|
||||
|
|
Loading…
Reference in a new issue