External Links Enhanced v1.2 (#536)

This commit is contained in:
QxxxGit
2025-04-21 22:49:26 -04:00
committed by GitHub
parent 820b0969c3
commit 319ec3d2c4
8 changed files with 54 additions and 6 deletions

View File

@@ -0,0 +1,11 @@
# v1.2 (2025-04-21)
## New icons
* Bluesky (bsky.app) ~~ as custom icon
* IMDB (imdb.com)
* Wordpress (wordpress.com)
## Fixes
* Fixed caching issue (thanks feederbox!)

View File

@@ -6,8 +6,11 @@ Plugin that adds additional icons for external links.
The following sites are supported out of the box:
* Bluesky (bsky.app) ~~ as custom icon
* Facebook (facebook.com)
* IMDB (imdb.com)
* Instagram (instagram.com)
* OnlyFans (onlyfans.com) ~~ as custom icon
* Patreon (patreon.com)
* Reddit (reddit.com)
* Telegram (telegram.com | t.me)
@@ -16,6 +19,7 @@ The following sites are supported out of the box:
* Twitch (twitch.tv)
* Twitter (twitter.com | x.com)
* VK (vk.com)
* Wordpress (wordpress.com)
* YouTube (youtube.com)
Want more icons? It's pretty simple to add your own; however, it's recommended to request an icon to be added the CommunityScripts repository. When you install the plugin from the CommunityScripts repository, it will come bundled with icons that the community has contributed.

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16px" height="14px" viewBox="0 0 15 14" version="1.1">
<g id="surface1">
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(6.666667%,52.156866%,99.607843%);fill-opacity:1;" d="M 3.394531 1.164062 C 5.054688 2.480469 6.84375 5.15625 7.5 6.589844 C 8.15625 5.15625 9.945312 2.480469 11.605469 1.164062 C 12.804688 0.210938 14.75 -0.523438 14.75 1.816406 C 14.75 2.285156 14.496094 5.75 14.347656 6.308594 C 13.828125 8.265625 11.945312 8.761719 10.265625 8.460938 C 13.199219 8.988281 13.945312 10.734375 12.332031 12.480469 C 9.273438 15.800781 7.9375 11.648438 7.59375 10.585938 C 7.53125 10.390625 7.5 10.300781 7.5 10.378906 C 7.5 10.300781 7.46875 10.390625 7.40625 10.585938 C 7.0625 11.648438 5.726562 15.800781 2.667969 12.480469 C 1.054688 10.734375 1.800781 8.988281 4.734375 8.460938 C 3.054688 8.761719 1.171875 8.265625 0.652344 6.308594 C 0.503906 5.75 0.25 2.285156 0.25 1.816406 C 0.25 -0.523438 2.195312 0.210938 3.394531 1.164062 Z M 3.394531 1.164062 "/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,4 +1,10 @@
[
{
"name": "bluesky",
"icon": "bluesky.svg",
"addresses": ["bsky.app"],
"regex": "^https?:\/\/(?:www\\.)?bsky.app\/profile\/(.*?)\/"
},
{
"name": "onlyfans",
"icon": "onlyfans.svg",

0
plugins/externalLinksEnhanced/custom/onlyfans.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -5,12 +5,12 @@
width: 100%;
height: 100%;
}
.external-links-button .btn.link.youtube {
color: red;
}
.external-links-button .btn.link.facebook {
color: #1877f2;
}
.external-links-button .btn.link.imdb {
color: #f5c518;
}
.external-links-button .btn.link.patreon {
color: #f96854;
}
@@ -35,3 +35,9 @@
.external-links-button .btn.link.vk {
color: #4c75a3;
}
.external-links-button .btn.link.wordpress {
color: gray;
}
.external-links-button .btn.link.youtube {
color: red;
}

View File

@@ -6,6 +6,7 @@
var { faLink } = libraries.FontAwesomeSolid;
var {
faFacebook,
faImdb,
faInstagram,
faPatreon,
faReddit,
@@ -15,6 +16,7 @@
faTwitch,
faTwitter,
faVk,
faWordpress,
faYoutube
} = libraries.FontAwesomeBrands;
var customAssetPath = "./plugin/externalLinksEnhanced/assets/custom";
@@ -27,6 +29,11 @@
icon: faFacebook,
addresses: ["facebook.com"]
},
{
name: "imdb",
icon: faImdb,
addresses: ["imdb.com"]
},
{
name: "instagram",
icon: faInstagram,
@@ -73,6 +80,12 @@
icon: faVk,
addresses: ["vk.com"]
},
{
name: "wordpress",
icon: faWordpress,
addresses: ["wordpress.com"],
regex: "^https?\\://(.+)wordpress.com/"
},
{
name: "youtube",
icon: faYoutube,
@@ -89,7 +102,9 @@
// src/utils/svg.ts
var loadSvgIcon = async (file) => {
try {
const svg = await fetch(`${customAssetPath}/${file}`).then((response) => response.text()).then((str) => {
const svg = await fetch(`${customAssetPath}/${file}`, {
cache: "no-store"
}).then((response) => response.text()).then((str) => {
const domParser = new DOMParser();
const doc = domParser.parseFromString(str, "image/svg+xml");
const svgElement = doc.querySelector("svg");
@@ -121,7 +136,7 @@
// src/utils/json.ts
var getCustomDefinitions = async () => {
try {
const json = await fetch(customDefinitionsPath).then((response) => response.json()).then((data) => data);
const json = await fetch(customDefinitionsPath, { cache: "no-store" }).then((response) => response.json()).then((data) => data);
return json;
} catch (e) {
console.error(`Error loading custom definitions: ${e}`);

View File

@@ -1,6 +1,6 @@
name: External Links Enhanced
description: Adds additional icons for external links.
version: 1.1
version: 1.2
ui:
javascript:
- externalLinksEnhanced.js