Compare commits
No commits in common. "eb97f4b5f00ffd9193206a2a2af1cfd35f44ff01" and "9eb0976b355a2b7a1558da57dd086dfc801cbf0d" have entirely different histories.
eb97f4b5f0
...
9eb0976b35
11 changed files with 11 additions and 32 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)
BIN
gfx/icon.xcf
(Stored with Git LFS)
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "lmlfc-bttv",
|
"name": "lmlfc-bttv",
|
||||||
"version": "0.1",
|
"version": "0.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)
BIN
public/img/icon-128.png
(Stored with Git LFS)
Binary file not shown.
BIN
public/img/icon-16.png
(Stored with Git LFS)
BIN
public/img/icon-16.png
(Stored with Git LFS)
Binary file not shown.
BIN
public/img/icon-32.png
(Stored with Git LFS)
BIN
public/img/icon-32.png
(Stored with Git LFS)
Binary file not shown.
BIN
public/img/icon-48.png
(Stored with Git LFS)
BIN
public/img/icon-48.png
(Stored with Git LFS)
Binary file not shown.
|
@ -1,14 +1,8 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "BTTV für Schnatzbox",
|
"name": "LMLFC-BTTV",
|
||||||
"description": "Macht \"bttv:kekw\" und co. in der \"Schnatzbox\" verfügbar.",
|
"version": "1.0",
|
||||||
"version": "0.1",
|
"description": "Add the reading time to Chrome Extension documentation articles",
|
||||||
"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"],
|
||||||
|
@ -17,7 +11,7 @@
|
||||||
],
|
],
|
||||||
"web_accessible_resources": [
|
"web_accessible_resources": [
|
||||||
{
|
{
|
||||||
"resources": ["img/sb_button.png"],
|
"resources": ["bttv.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: `//cdn.betterttv.net/emote/${matches[0].id}/1x.${matches[0].imageType}`,
|
url: `https://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] queued", queue.length, "jobs");
|
console.log("[lmlfc-bttv] queueing", 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(([_, code]) => code));
|
const emotes = await get_emotes(matches.map((elem) => elem[1]));
|
||||||
|
|
||||||
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("img/sb_button.png"));
|
img.setAttribute("src", chrome.runtime.getURL("bttv.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