Skip to content

Instantly share code, notes, and snippets.

@giodamelio
Last active April 4, 2022 13:01
Show Gist options
  • Save giodamelio/c97f71a12eec5c142f21f757a6ba4d8a to your computer and use it in GitHub Desktop.
Save giodamelio/c97f71a12eec5c142f21f757a6ba4d8a to your computer and use it in GitHub Desktop.
A bookmarklet to process the current page to Outline.com and redirect afterwards.
fetch(
"https://outlineapi.com/v3/parse_article?source_url=" +
encodeURIComponent(window.location)
)
.then(res => res.json())
.then(body => {
if (body.error) {
return alert(`Outline Bookmarklet Error: ${body.error}`);
}
window.location.href = `https://outline.com/${body.data.short_code}`
})
.catch(err => {
alert("Outline Bookmarklet Error. See console for details.");
console.error(err);
});
@on4r
Copy link

on4r commented Jun 16, 2019

Nice, works fine if you add v3 to the outlineapi url
https://outlineapi.com/v3/parse_article?source_url=...

@giodamelio
Copy link
Author

Thanks for the tip on the API url change @on4r. Updated.

@Gatienzo
Copy link

Gatienzo commented Sep 29, 2020

When I copy and paste the script into Firefox address properties in bookmarks the save button does not function. How do I add this bookmarklet?

@fnurl
Copy link

fnurl commented Apr 6, 2021

Just add this as your bookmark and outline.com will take care of the rest

javascript:window.location='https://outline.com/' + window.location

(adding this comment because I got here when trying to create a bookmarklet, but could not get this to work with cross origin policy restrictions)

@virtuallyvlad
Copy link

Just add this as your bookmark and outline.com will take care of the rest

javascript:window.location='https://outline.com/' + window.location

yup, this works. thank you 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment