Skip to content

Commit 2a84a12

Browse files
qwerty541harryzcy
authored andcommitted
feat(wakatime card): add disable animations query option (anuraghazra#3496)
* feat(wakatime card): add disable animations query option * docs
1 parent 729d2af commit 2a84a12

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
@@ -31,6 +31,7 @@ export const handler = async (req, res, env) => {
3131
api_domain,
3232
border_radius,
3333
border_color,
34+
disable_animations,
3435
} = req.query;
3536

3637
res.setHeader("Content-Type", "image/svg+xml");
@@ -88,6 +89,7 @@ export const handler = async (req, res, env) => {
8889
locale: locale ? locale.toLowerCase() : null,
8990
layout,
9091
langs_count,
92+
disable_animations: parseBoolean(disable_animations),
9193
}),
9294
);
9395
} catch (err) {

readme.md

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

427428
***
428429

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
@@ -225,6 +225,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
225225
langs_count = languages.length,
226226
border_radius,
227227
border_color,
228+
disable_animations,
228229
} = options;
229230

230231
const shouldHideLangs = Array.isArray(hide) && hide.length > 0;
@@ -389,6 +390,10 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
389390
},
390391
});
391392

393+
if (disable_animations) {
394+
card.disableAnimations();
395+
}
396+
392397
card.setHideBorder(hide_border);
393398
card.setHideTitle(hide_title);
394399
card.setCSS(

0 commit comments

Comments
 (0)