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/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`. *** 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(