-
-
Save theAJFM/c15535c0b7a994b126f41e127466d48a to your computer and use it in GitHub Desktop.
A useful bookmarklet to submit a page content along with input for tags to a webhook / endpoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function() | |
{ | |
var tags = prompt("Enter relevant tags for the article:",""); | |
var form = document.createElement('form'); | |
form.style.visibility = 'hidden'; | |
form.method = 'post'; | |
form.action = '<link to your webhook>'; | |
form.target = 'response'; | |
inputTitle = document.createElement('input'); | |
inputTitle.name = 'title'; | |
inputTitle.value = document.title; | |
form.appendChild(inputTitle); | |
inputTags = document.createElement('input'); | |
inputTags.name = 'tags'; | |
inputTags.value = tags; | |
form.appendChild(inputTags); | |
inputUrl = document.createElement('input'); | |
inputUrl.name = 'url'; | |
inputUrl.value = window.location.href; | |
form.appendChild(inputUrl); | |
dataTitle = document.createElement('input'); | |
dataTitle.name = 'data'; | |
dataTitle.value = document.querySelector('*').outerHTML; | |
form.appendChild(dataTitle); | |
document.body.appendChild(form); | |
form.submit(); | |
} | |
)(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment