MooBot-song-player song-name helpera

Make craftwar's obs plugin (https://craftwarblog.blogspot.com/2018/01/obs-plugin-playing-song.html) able to get NightBot-AutoDJ song name.

Från och med 2020-03-01. Se den senaste versionen.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @author craftwar
// @name MooBot-song-player song-name helpera
// @description Make craftwar's obs plugin (https://craftwarblog.blogspot.com/2018/01/obs-plugin-playing-song.html) able to get NightBot-AutoDJ song name.
// @copyright 2020, craftwar (https://craftwarblog.blogspot.com/)
// @license GPL-3.0-or-later; https://www.gnu.org/licenses/gpl-3.0.txt
// @homepageURL https://github.com/craftwar/userscript/tree/master/MooBot-song-name-helper
// @version 0.1.20200301
// @namespace github.com.craftwar
// @match https://moo.bot/*
// @grant none
// @run-at document-end
// ==/UserScript==


(() => {
	const body_observer = new MutationObserver((record, observer) => {
		const song_list = document.querySelector(".widget-song-requests-list");
		if (song_list) {
			observer.disconnect();

			const song_observer = new MutationObserver(() => {
				document.title = song_list.querySelector(".widget-song-requests-list-text > h4:first-child").firstChild.wholeText + " - YouTube";
			});
			song_observer.observe(song_list, { subtree: true, childList: true });
		}
	});
	const body_element = document.querySelector("body");
	body_observer.observe(body_element, { subtree: true, childList: true });
})();