Skip to content

Commit cde8f92

Browse files
committed
feat(wakatime card): add disable animations query option (anuraghazra#3496)
* feat(wakatime card): add disable animations query option * docs
1 parent 49a2ac1 commit cde8f92

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

api/wakatime.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default async (req, res) => {
3030
api_domain,
3131
border_radius,
3232
border_color,
33+
disable_animations,
3334
} = req.query;
3435

3536
res.setHeader("Content-Type", "image/svg+xml");
@@ -83,6 +84,7 @@ export default async (req, res) => {
8384
locale: locale ? locale.toLowerCase() : null,
8485
layout,
8586
langs_count,
87+
disable_animations: parseBoolean(disable_animations),
8688
}),
8789
);
8890
} catch (err) {

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ If we don't support your language, please consider contributing! You can find mo
421421
* `layout` - Switches between two available layouts `default` & `compact`. Default `default`.
422422
* `langs_count` - Limits the number of languages on the card, defaults to all reported languages *(number)*.
423423
* `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`.
424+
* `disable_animations` - Disables all animations in the card *(boolean)*. Default: `false`.
424425

425426
***
426427

src/cards/types.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type WakaTimeOptions = CommonOptions & {
5454
custom_title: string;
5555
layout: "compact" | "normal";
5656
langs_count: number;
57+
disable_animations: boolean;
5758
};
5859

5960
export type GistCardOptions = CommonOptions & {

src/cards/wakatime-card.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
218218
langs_count = languages.length,
219219
border_radius,
220220
border_color,
221+
disable_animations,
221222
} = options;
222223

223224
const shouldHideLangs = Array.isArray(hide) && hide.length > 0;
@@ -382,6 +383,10 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
382383
},
383384
});
384385

386+
if (disable_animations) {
387+
card.disableAnimations();
388+
}
389+
385390
card.setHideBorder(hide_border);
386391
card.setHideTitle(hide_title);
387392
card.setCSS(

0 commit comments

Comments
 (0)