Skip to content

[Request] Add timeline settings for star-history #202

@Nick2bad4u

Description

@Nick2bad4u

In the star-history user.js script:

    async function insertStarHistory() {
        const { user, repo } = getUserAndRepoOfCurrentPage()

        try { // to load/insert star history chart

            // Fetch image as blob
            const imgURL = sanitizeImgURL('https://api.star-history.com/svg?repos='
                + `${user}/${repo}&type=Date` + (isDarkMode() ? '&theme=dark' : ''))
            const response = await new Promise((resolve, reject) => xhr({
                method: 'GET', url: imgURL, responseType: 'blob', onload: resolve, onerror: reject
            }))
            if (response.status != 200) throw new Error('>> Failed to fetch image')

            if (!document.querySelector('#star-history')) {

Could you add a setting option we could set for &type=Date that lets us change it to type=timeline.

You could also use a few other settings if you want, for example: &legend=top-left vs &legend=bottom-right.

You could also add option for &logscale

for example this is valid:

https://api.star-history.com/svg?repos=name/repo&type=timeline&logscale&legend=bottom-right

## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=adamlui/userscripts&type=timeline&logscale&legend=bottom-right)](https://www.star-history.com/#adamlui/userscripts&type=timeline&logscale&legend=bottom-right)

## Star History

<a href="https://www.star-history.com/#adamlui/userscripts&type=timeline&logscale&legend=bottom-right">
 <picture>
   <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=adamlui/userscripts&type=timeline&theme=dark&logscale&legend=bottom-right" />
   <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=adamlui/userscripts&type=timeline&logscale&legend=bottom-right" />
   <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=adamlui/userscripts&type=timeline&logscale&legend=bottom-right" />
 </picture>
</a>

Etc

Example of diff settings:

Image

I can create a PR if you want

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions