Web Archive Save Link

Adds a save button to web archive pages.

  1. // ==UserScript==
  2. // @icon http://web.archive.org/favicon.ico
  3. // @name Web Archive Save Link
  4. // @version 2.0.0
  5. // @description Adds a save button to web archive pages.
  6. // @author Benji Grant
  7. // @license MIT
  8. // @match https://web.archive.org/web/*
  9. // @match http://web.archive.org/web/*
  10. // @grant none
  11. // @namespace https://greasyfork.org/users/4072
  12. // ==/UserScript==
  13.  
  14. document.body.addEventListener('load', () => {
  15. const pageURL = window.location.pathname.replace(/\/web\/\d+\//, '')
  16.  
  17. const saveLink = document.createElement('a')
  18. saveLink.href = `https://web.archive.org/save/${encodeURIComponent(pageURL)}`
  19. saveLink.style.fontFamily = 'sans-serif'
  20. saveLink.style.fontSize = '14px'
  21. saveLink.style.color = 'initial'
  22. saveLink.style.display = 'inline-block'
  23. saveLink.style.background = 'rgba(255,255,255,0.9)'
  24. saveLink.style.border = '5px solid black'
  25. saveLink.style.borderTop = '0'
  26. saveLink.style.borderRadius = '0 0 8px 8px'
  27. saveLink.style.boxShadow = '1px 1px 4px #333'
  28. saveLink.style.position = 'fixed'
  29. saveLink.style.top = '65px'
  30. saveLink.style.left = '25px'
  31. saveLink.style.padding = '8px 12px'
  32. saveLink.style.zIndex = '10000000000'
  33. saveLink.style.textDecoration = 'underline'
  34. saveLink.append(document.createTextNode('Save URL'))
  35.  
  36. document.querySelector('#wm-ipp-base').after(saveLink)
  37. })