From cc555721e09b7f5f97eace2a52c099b4f69913d5 Mon Sep 17 00:00:00 2001 From: Alexandr Date: Wed, 22 Nov 2023 20:32:04 +0200 Subject: [PATCH 1/2] feat(wakatime card): add disable animations query option --- api/wakatime.js | 2 ++ src/cards/types.d.ts | 1 + src/cards/wakatime-card.js | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/api/wakatime.js b/api/wakatime.js index 732b05a5a9468..d00e773f7be52 100644 --- a/api/wakatime.js +++ b/api/wakatime.js @@ -30,6 +30,7 @@ export default async (req, res) => { api_domain, border_radius, border_color, + disable_animations, } = req.query; res.setHeader("Content-Type", "image/svg+xml"); @@ -83,6 +84,7 @@ export default async (req, res) => { locale: locale ? locale.toLowerCase() : null, layout, langs_count, + disable_animations: parseBoolean(disable_animations), }), ); } catch (err) { diff --git a/src/cards/types.d.ts b/src/cards/types.d.ts index d55d1c6e552ff..a1230231246ee 100644 --- a/src/cards/types.d.ts +++ b/src/cards/types.d.ts @@ -54,6 +54,7 @@ type WakaTimeOptions = CommonOptions & { custom_title: string; layout: "compact" | "normal"; langs_count: number; + disable_animations: boolean; }; export type GistCardOptions = CommonOptions & { diff --git a/src/cards/wakatime-card.js b/src/cards/wakatime-card.js index a6a203dad9c29..22b93aa521ae6 100644 --- a/src/cards/wakatime-card.js +++ b/src/cards/wakatime-card.js @@ -218,6 +218,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => { langs_count = languages.length, border_radius, border_color, + disable_animations, } = options; const shouldHideLangs = Array.isArray(hide) && hide.length > 0; @@ -382,6 +383,10 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => { }, }); + if (disable_animations) { + card.disableAnimations(); + } + card.setHideBorder(hide_border); card.setHideTitle(hide_title); card.setCSS( From 18443991ea1e88f1d01543750b9345d638c91858 Mon Sep 17 00:00:00 2001 From: Alexandr Date: Wed, 22 Nov 2023 20:47:45 +0200 Subject: [PATCH 2/2] docs --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index 0f1067166cd91..bec204dc15fed 100644 --- a/readme.md +++ b/readme.md @@ -421,6 +421,7 @@ If we don't support your language, please consider contributing! You can find mo * `layout` - Switches between two available layouts `default` & `compact`. Default `default`. * `langs_count` - Limits the number of languages on the card, defaults to all reported languages *(number)*. * `api_domain` - Sets a custom API domain for the card, e.g. to use services like [Hakatime](https://github.com/mujx/hakatime) or [Wakapi](https://github.com/muety/wakapi) *(string)*. Default `Waka API`. +* `disable_animations` - Disables all animations in the card *(boolean)*. Default: `false`. ***