Last active
October 13, 2015 00:38
-
-
Save jesus2099/4111760 to your computer and use it in GitHub Desktop.
Freso special: mb. NO MORE <A> IN <H1> PLEASE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name mb. NO MORE <A> IN <H1> PLEASE | |
// @version 2013.0205.1554 | |
// @description musicbrainz.org: Remove all anchors from primary headers (special script for Freso, can be incompatible with other scripts relying on <h1>'s <a>) | |
// @namespace jesus2099/shamo | |
// @author Tristan DANIEL (PATATE12 aka. jesus2099/shamo) | |
// @licence CC BY-NC-SA 3.0 FR (http://creativecommons.org/licenses/by-nc-sa/3.0/fr/) | |
// @grant none | |
// @match *://musicbrainz.org/* | |
// @match *://beta.musicbrainz.org/* | |
// @match *://test.musicbrainz.org/* | |
// @run-at document-end | |
// ==/UserScript== | |
if(self.location.href.match(/^https?:\/\/((beta|test)\.)?musicbrainz\.org\/.*$/)){/*@matchopera*/(function(){"use strict"; | |
var them = document.querySelectorAll("div#page h1 a"); | |
for (var t=0; t<them.length; t++) { | |
them[t].parentNode.replaceChild(a2span(them[t]), them[t]); | |
} | |
function a2span(a) {/* compatibilly with http://userscripts.org/scripts/show/108889 */ | |
var span = document.createElement("span"); | |
for (var at=0; at<a.attributes.length; at++) { | |
span.setAttribute(a.attributes[at].name, a.attributes[at].value); | |
} | |
return span.appendChild(document.createTextNode(them[t].textContent)).parentNode; | |
} | |
})();} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment