Skip to content

Instantly share code, notes, and snippets.

@wilmoore
Last active June 5, 2024 20:46
Show Gist options
  • Select an option

  • Save wilmoore/c7b1bb918556828da7cc17b296736963 to your computer and use it in GitHub Desktop.

Select an option

Save wilmoore/c7b1bb918556828da7cc17b296736963 to your computer and use it in GitHub Desktop.
Software Engineering :: Web :: Browser :: Extension :: Development :: CUOL

Software Engineering :: Web :: Browser :: Extension :: Development :: CUOL

⪼ Made with 💜 by Polyglot.

Copy URL or Link

Input (window.location.href)
https://www.amazon.com/Segway-Electric-G30LP-Long-range-Lightweight/dp/B08BL4VPDR/ref=sr_1_7?crid=4PJ1N3DWB5F9&keywords=Segway%2BNinebot%2BScooter!%2BE2%2B%26%2BE2&qid=1702269013&sprefix=segway%2Bninebot%2Bscooter%2Be2%2B%26%2Be2%2Caps%2C209&sr=8-7&th=1
Output (Clipboard)

Probably should also log when in DEBUG mode

https://www.amazon.com/Segway-Electric-G30LP-Long-range-Lightweight/dp/B08BL4VPDR/ref=sr_1_7
Source
document.addEventListener("keydown", (event) => {
  const url = document.location.href.replace(document.location.search, '');
  const title = document.title;
  
  if (event.ctrlKey && event.key === "u") {
    const template = `${address}`;
    navigator.clipboard.writeText(template);
  }
  
  if (event.ctrlKey && event.key === "l") {
    const template = `[${title}](${url})`;
    navigator.clipboard.writeText(template);
  }
});
...
reference
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment