Last active
July 30, 2017 20:58
-
-
Save noromanba/173e261aae4b083eff7c2cef48b8f5dc to your computer and use it in GitHub Desktop.
show detailed track-title on mixcloud.com for UserScript
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 MC full trackname | |
// @namespace https://noromanba.github.com | |
// @description show detailed track-title on mixcloud.com for UserScript | |
// @include https://www.mixcloud.com/* | |
// @grant none | |
// @noframes | |
// @run-at document-end | |
// @version 2017.7.30.0 | |
// @homepage https://gist.github.com/noromanba/173e261aae4b083eff7c2cef48b8f5dc | |
// @downloadURL https://gist.github.com/noromanba/173e261aae4b083eff7c2cef48b8f5dc/raw/mc-full-trackname.user.js | |
// @license MIT License https://nrm.mit-license.org/2017 | |
// @author noromanba https://noromanba.github.com | |
// @icon https://upload.wikimedia.org/wikipedia/commons/thumb/7/75/Vinyl_record.svg/512px-Vinyl_record.svg.png | |
// ==/UserScript== | |
// Icon (PD by NikNaks) | |
// https://commons.wikimedia.org/wiki/File%3AVinyl_record.svg | |
// Devel | |
// https://gist.github.com/noromanba/173e261aae4b083eff7c2cef48b8f5dc | |
(() => { | |
'use strict'; | |
const expand = () => { | |
const track = document.querySelector([ | |
'.player-current-audio .current-track', | |
]); | |
if (!track) return; | |
track.title = track.textContent; | |
}; | |
expand(); | |
// TODO DRY | |
const container = document.querySelector([ | |
'.player-current-audio .current-track', | |
]) || document.body; | |
// TBD run at attribute modified (but text node) | |
new MutationObserver(records => { | |
records.forEach(record => { | |
expand(record.target); | |
}); | |
}).observe(container, { childList: true, subtree: true }); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment