Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shorten url with v.gd #17

Closed
wants to merge 1 commit into from
Closed

Conversation

abhishekmj303
Copy link

I use this feature very often, so thought of opening a PR.
I totally agree if you think this goes against its philosophy

  • Use JSONP method to call api
  • Use async/await to fix shortenUrl
  • Apply linting

- Use JSONP method to call api
- Use async/await to fix shortenUrl
- Apply linting
@bokub
Copy link
Owner

bokub commented Mar 31, 2023

Hello !

What you can do if you do this manually very often, is to copy & paste the following code in a browser bookmark:

javascript:void(generateLink("url"),interval=setInterval((()=>{if(!byId("copy").classList.contains("hidden")){clearInterval(interval),window.shortenUrlCallback=l=>{document.body.removeChild(e),l.shorturl&&(byId("copy-link").value=l.shorturl)};let e=document.createElement("script");e.src="https://v.gd/create.php?format=json&callback=shortenUrlCallback&url="+encodeURIComponent(byId("copy-link").value),document.body.appendChild(e)}}),10))

Then, just click on the bookmark to generate a link and shorten it with one single click!

image

@abhishekmj303
Copy link
Author

Thanks for the bookmark code. Didn't thought we could run js like that with bookmark.

Anyway, I'll be maintaining fork since I use it with my friends who also need this functionality.
Deployed on: nopaste303.vercel.app

@bokub
Copy link
Owner

bokub commented Apr 5, 2023

Great idea ! I'll close this PR if you don't mind

@bokub bokub closed this Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants