a script to show techdog tracks like 1-1, 2-7, 6-11 on bandcamp
// ==UserScript==
// @name TECHDOG 1-7 Re-numbering
// @namespace http://tampermonkey.net/
// @version 1.1
// @description a script to show techdog tracks like 1-1, 2-7, 6-11 on bandcamp
// @author CiNoP
// @license MIT
// @match https://patriciataxxon.bandcamp.com/album/techdog-1-7
// @grant none
// ==/UserScript==
(function() {
'use strict';
function renumber() {
const tracks = document.querySelectorAll('.track_number');
tracks.forEach((div, index) => {
const globalNum = index + 1;
const n = Math.ceil(globalNum / 11);
const localNum = globalNum - 11 * (n - 1);
const newText = `${n}-${localNum}.`;
if (div.textContent !== newText) {
div.textContent = newText;
div.style.whiteSpace = 'nowrap';
const parentCell = div.closest('.track-number-col');
if (parentCell) {
parentCell.style.width = '45px';
}
}
});
}
renumber();
const observer = new MutationObserver(renumber);
observer.observe(document.body, { childList: true, subtree: true });
})();