Click on the opening/ending music title to search for the music title on youtube on a new tab.
Ajankohdalta
// ==UserScript==
// @name Search Openings/Ending on Youtube - MAL
// @namespace Search_Ops_Ends
// @version 0.1
// @description Click on the opening/ending music title to search for the music title on youtube on a new tab.
// @author hacker09
// @match https://myanimelist.net/anime/*
// @match https://myanimelist.net/manga/*
// @icon https://www.google.com/s2/favicons?domain=myanimelist.net
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
if (document.querySelectorAll('span[class*="theme-song"]').length !== 0) //If there's at least one op/end listed on the page
{ //Starts the if condition
document.querySelectorAll('span[class*="theme-song"]').forEach(function(el) { //For each op/end
var title = el.innerText.split(': ')[1].split('(ep')[0].trim(); //Save the op/end title on a variable
el.style.cursor = 'pointer'; //Make the op/end title element look like it's clickable
el.onclick = function() //When the op/end title is clicked
{ //Starts the onclick function
window.open('https://www.youtube.com/results?search_query=' + title, 'blank'); //Search the music title on youtube on a new tab
}; //Finishes the onclick function
}); //Finishes the for each condition
} //Finishes the if condition
})();