Skip to content

Instantly share code, notes, and snippets.

@ushironoko
Last active November 26, 2021 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ushironoko/375a46e834214fba708a49151e739723 to your computer and use it in GitHub Desktop.
Save ushironoko/375a46e834214fba708a49151e739723 to your computer and use it in GitHub Desktop.
remove amazon url referre & copy on clipboard
// https://chrome.google.com/webstore/detail/scriptautorunner/gpgjofmpmjjopcogjgdldidobhmjmdbm?hl=ja-jp
const refURL = location.href
const sliceURL = refURL.indexOf("ref") ? refURL.slice(0,refURL.indexOf("ref")) : refURL
const amazonUrlCopyButton = document.createElement("button")
amazonUrlCopyButton.addEventListener('click', () => navigator.clipboard.writeText(sliceURL))
amazonUrlCopyButton.textContent = "URLをコピー"
amazonUrlCopyButton.classList.add("a-button", "a-button-primary", "a-button-small")
amazonUrlCopyButton.style.width="120px"
amazonUrlCopyButton.style.height="30px"
amazonUrlCopyButton.style.fontSize="12px"
const titleSection = document.querySelector("#productTitle")
titleSection.insertAdjacentElement("beforeend", amazonUrlCopyButton)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment