Wayback Machine Toolbar Link Fixer

Fixes encoded ampersands on Wayback Machine's captures graph

Verze ze dne 30. 12. 2015. Zobrazit nejnovější verzi.

  1. // ==UserScript==
  2. // @name Wayback Machine Toolbar Link Fixer
  3. // @namespace DoomTay
  4. // @description Fixes encoded ampersands on Wayback Machine's captures graph
  5. // @version 1.0.0
  6. // @include http://web.archive.org/web/*
  7. // @include https://web.archive.org/web/*
  8.  
  9. // ==/UserScript==
  10.  
  11. var toolbarNav = document.getElementById("wm-graph-anchor");
  12.  
  13. function fixLink()
  14. {
  15. while(toolbarNav.href.indexOf("&") > -1) toolbarNav.href = toolbarNav.href.replace("&","&");
  16. }
  17.  
  18. fixLink();
  19.  
  20. var observer = new MutationObserver(function(mutations) {
  21. mutations.forEach(function(mutation) {
  22. if(mutation.type == "attributes") fixLink();
  23. });
  24. });
  25.  
  26. var config = { attributes: true, childList: true, characterData: true, subtree: true, attributeFilter: ["href"] };
  27. observer.observe(toolbarNav, config);