Wayback Machine Toolbar Link Fixer

Fixes encoded ampersands on Wayback Machine's captures graph

Від 30.12.2015. Дивіться остання версія.

// ==UserScript==
// @name          Wayback Machine Toolbar Link Fixer
// @namespace     DoomTay
// @description   Fixes encoded ampersands on Wayback Machine's captures graph
// @version       1.0.0
// @include       http://web.archive.org/web/*
// @include       https://web.archive.org/web/*

// ==/UserScript==

var toolbarNav = document.getElementById("wm-graph-anchor");

function fixLink()
{
	while(toolbarNav.href.indexOf("&") > -1) toolbarNav.href = toolbarNav.href.replace("&","&");
}

fixLink();

var observer = new MutationObserver(function(mutations) {
	mutations.forEach(function(mutation) {
		if(mutation.type == "attributes") fixLink();
	});    
});

var config = { attributes: true, childList: true, characterData: true, subtree: true, attributeFilter: ["href"] };
observer.observe(toolbarNav, config);