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",
|
"name": "lmlfc-bttv",
|
||||||
"version": "0.0.1",
|
"version": "0.1",
|
||||||
"author": "Jörn-Michael Miehe <joern-michael.miehe@lenaisten.de>",
|
"author": "Jörn-Michael Miehe <joern-michael.miehe@lenaisten.de>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"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,
|
"manifest_version": 3,
|
||||||
"name": "LMLFC-BTTV",
|
"name": "BTTV für Schnatzbox",
|
||||||
"version": "1.0",
|
"description": "Macht \"bttv:kekw\" und co. in der \"Schnatzbox\" verfügbar.",
|
||||||
"description": "Add the reading time to Chrome Extension documentation articles",
|
"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": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
"js": ["main.js"],
|
"js": ["main.js"],
|
||||||
|
@ -11,7 +17,7 @@
|
||||||
],
|
],
|
||||||
"web_accessible_resources": [
|
"web_accessible_resources": [
|
||||||
{
|
{
|
||||||
"resources": ["bttv.png"],
|
"resources": ["img/sb_button.png"],
|
||||||
"matches": ["*://*.lenameyerlandrut-fanclub.de/*"]
|
"matches": ["*://*.lenameyerlandrut-fanclub.de/*"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -28,7 +28,7 @@ async function bttv_get_url(code: string): Promise<Emote> {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
code: code,
|
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
|
// queue emote jobs
|
||||||
const queue = [...codes_set].map((code) => bttv_get_url(code));
|
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
|
// run
|
||||||
const result: EmoteMap = {};
|
const result: EmoteMap = {};
|
||||||
|
@ -52,7 +52,7 @@ async function get_emotes(codes: Iterable<string>): Promise<EmoteMap> {
|
||||||
|
|
||||||
async function process_text(text: string): Promise<string> {
|
async function process_text(text: string): Promise<string> {
|
||||||
const matches = [...text.matchAll(emote_regex)];
|
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()) {
|
for (const emote of matches.reverse()) {
|
||||||
const [match, code] = emote;
|
const [match, code] = emote;
|
||||||
|
@ -80,7 +80,7 @@ async function process_text(text: string): Promise<string> {
|
||||||
btn.style.setProperty("margin-right", "4px");
|
btn.style.setProperty("margin-right", "4px");
|
||||||
|
|
||||||
const img = document.createElement("img");
|
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");
|
img.style.setProperty("vertical-align", "middle");
|
||||||
|
|
||||||
btn.addEventListener("click", async (event) => {
|
btn.addEventListener("click", async (event) => {
|
||||||
|
|
Loading…
Reference in a new issue