An open API service indexing awesome lists of open source software.

https://github.com/akira-cn/upvote-anywhere

Generate a SVG button that allows you to get upvoted anywhere.
https://github.com/akira-cn/upvote-anywhere

Last synced: 25 days ago
JSON representation

Generate a SVG button that allows you to get upvoted anywhere.

Awesome Lists containing this project

README

        

# Upvote Anywhere

Generate a SVG button that allows you to get upvoted anywhere.

**[👁️‍🗨️ Generate my upvote button ⬆️](https://wp2aqcqkj5.us.aircode.run/create)**

## To be used in GitHub README


Do you like Upvote Anywhere? If you do, please give it an upvote.

## To be used in Any Web App

[Try it in CodePen](https://codepen.io/akira-cn-the-selector/pen/XWorRbL)

```html
Do you like Upvote Anywhere? If you do, please give it an upvote.

upvoteBtn.addEventListener('click', async (event) => {
event.preventDefault();
await fetch('https://wp2aqcqkj5.us.aircode.run/upvote', {
method: 'POST',
headers: {
'content-type': 'application/json',
},
body: JSON.stringify({id: '64dc8e2885f13fbcd52be970'}),
});
upvoteBtn.src = "https://wp2aqcqkj5.us.aircode.run/show?id=64dc8e2885f13fbcd52be970&t=" + Date.now();
});

```

## Cookie Policy

Since Upvote Anywhere requires using cookies to track upvote status, when it's used on third-party websites and operated through fetch, it relies on the other party's CORS policy. For instance, CodePen's policy doesn't allow cross-site cookies, which means Upvote Anywhere can't record the voted status. However, we can use a GET request to https://wp2aqcqkj5.us.aircode.run/upvote to store the cookie on the original site, then redirect back to the target URL, just as we've done in our GitHub README.

## Distribution

Upvote Anywhere is build on [AirCode](https://aircode.io/).

You can easily get a copy and launch your app on [AirCode](https://aircode.io/) by clicking the button below.

[![Deploy with AirCode](https://aircode.io/aircode-deploy-button.svg)](https://aircode.io/dashboard?owner=akira-cn&repo=upvote-anywhere&branch=main&path=&appname=upvote)