Skip to content

Instantly share code, notes, and snippets.

@mathieucaroff
Last active September 11, 2022 06:53
Show Gist options
  • Save mathieucaroff/bbfc55991afdf220b88a886e155c99b9 to your computer and use it in GitHub Desktop.
Save mathieucaroff/bbfc55991afdf220b88a886e155c99b9 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Align Youtube Ponies@Dawn
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Make the video always occupy the same column, so as to make them easier to find
// @author Mathieu CAROFF
// @match https://www.youtube.com/channel/UCSJW3EMxeuQXZ00h4bihXvA/videos
// @grant none
// ==/UserScript==
(function() {
console.log("PADALIGNER start ok")
let leftmostUrlTitlePair = [ // these urls must be in the order of apparition of their videos in the page
["https://www.youtube.com/watch?v=o1fbn-v-Iw0", "MathematicPony - Polaris [Indie Pop]"],
["https://www.youtube.com/watch?v=ajAWhcgRY54", "Kholat - The Soft Glow Of A Paper Lantern [Chill Trap]"],
["https://www.youtube.com/watch?v=JmjPW8AAf94", "Vanware - Isekai (feat. Cosmic Fox, Sunset, Snap! Scoop! Scandal! & Soundnix) [Glitch Hop]"],
["https://www.youtube.com/watch?v=dxf7cH4f0rg", "Jet Zeith - Speakers [Big Room House]"],
["https://www.youtube.com/watch?v=pn6Gp-plR0Q", "Dijit - I Wish I Wasn't (feat. Lemon) [Melodic Dubstep]"],
["https://www.youtube.com/watch?v=RbEsdTfB-WA", "Koa & BlueBrony - Maybe I'm Not [Pop Rock]"],
["https://www.youtube.com/watch?v=iXWYhhO9tEM", "Barend Rauch - Shadow [Big Room House]"],
["https://www.youtube.com/watch?v=8n_2iFjpr3c", "Scraton - Riches [Moombahton/Electro Pop]"],
["https://www.youtube.com/watch?v=ipxgil8A0Lg", "L Train, 4EverfreeBrony & Koa - Battle Royale [Electro Swing]"],
["https://www.youtube.com/watch?v=zAH1WFmczkA", "Zenith Live release Party!"],
["https://www.youtube.com/watch?v=lrc5w8jaxQQ", "Canvas & Evr! - Find Me (feat. Kleyna & Liefsong) [Melodic Dubstep/Future Garage]"],
["https://www.youtube.com/watch?v=Q0kVakdb9_8", "UndreamedPanic & bank pain - Night Light [Melodic Dubstep]"],
["https://www.youtube.com/watch?v=NIsjWYh-GWE", "Jayden Vega & Dropper Vampire - Waiting For You [Big Room House]"],
["https://www.youtube.com/watch?v=G-kV5y8pQ0k", "bank pain, Hay Tea & John Kenza - Naïveté [Drum & Bass]"],
["https://www.youtube.com/watch?v=dA9GLaor25I", "ILLUMNATION - Longest Night II: The Dawn (feat. Koron Korak) [Folk]"],
["https://www.youtube.com/watch?v=tunk0Aa4Hm8", "Exiark - Let There Be Light (feat. Chi-Chi) [Dubstep]"],
["https://www.youtube.com/watch?v=1C58yl-eP2I", "Hay Tea & ALfiux - Revive [Chillout]"],
["https://www.youtube.com/watch?v=o9wbZYkdT_w", "Mufaya - Stellar Endeavour [Orchestral/Electronic]"],
["https://www.youtube.com/watch?v=mO8_T94yN0A", "4EverfreeBrony - Who Named Us [Rock]"],
["https://www.youtube.com/watch?v=ixNvD1r2o2c", "L-Train - Books And Branches [Electro Swing]"],
["https://www.youtube.com/watch?v=TKwnXSDnOkI", "ThatMusicBrony - Among The Stars (Hearse Percy Remix) [House]"],
["https://www.youtube.com/watch?v=hUpKJO9e0bs", "Whirly Tail - Flee (feat. Koa) [Liquid Drum & Bass]"],
["https://www.youtube.com/watch?v=MpX_1LfoUSw", "STEVENJAXX - Fly With You [Progressive House]"],
["https://www.youtube.com/watch?v=EzkwUcCaaUg", "4EverfreeBrony - Leave Me Awake (feat. Bronwyn) [Pop Ballad]"],
["https://www.youtube.com/watch?v=etiPJbogx_U", "FORSAKE - Reminisce (feat. Namii & MelodyBrony) [Orchestral Pop/Melodic Dubstep]"],
["https://www.youtube.com/watch?v=Yd75f26Yd58", "Thrasher - Digital Wasteland [Metal/Trance]"],
["https://www.youtube.com/watch?v=tB8BAXkWHu4", "Violin Melody - Sundown"],
["https://www.youtube.com/watch?v=FxKPSYB0kHA", "Redspark - through the currents"],
["https://www.youtube.com/watch?v=ihG4jQrnT0U", "Koa - Shattered"],
["https://www.youtube.com/watch?v=nGlCBel0LGs", "Jyc Row, Francis Vace & WoodLore - Warriors Of Griffonstone [Celtic Rock]"],
["https://www.youtube.com/watch?v=lf-3xMsGA3Q", "Tw3Lv3 - deepest depths"],
["https://www.youtube.com/watch?v=rKcdzhpMRM8", "funky venture"],
["https://www.youtube.com/watch?v=JVXtm9G0gSQ", "delusion"],
["https://www.youtube.com/watch?v=Xu4RaD0WE2A", "song for seapony lyra"],
["https://www.youtube.com/watch?v=pCKtRLBfU5s", "never left you"],
["https://www.youtube.com/watch?v=Eor3StDzBsQ", "sun of the night"],
["https://www.youtube.com/watch?v=nhbcU7E_XOU", "ice angel"],
["https://www.youtube.com/watch?v=K1CnAnCOBho", "stay"],
["https://www.youtube.com/watch?v=xhvuOWb9mIY", "witch"],
["https://www.youtube.com/watch?v=0EOp7cHSCbY", "introversion"],
["https://www.youtube.com/watch?v=v2dVJ4d-SKA", "deadline"],
["https://www.youtube.com/watch?v=Vz_6mkeSQOg", "birdcall"],
["https://www.youtube.com/watch?v=hvGF2EyK1-c", "cyberpink"],
["https://www.youtube.com/watch?v=B8Eh6zkBKGQ", "FWLR - OMG"],
["https://www.youtube.com/watch?v=mk9LBvTx30E", "whats up with the sun"],
["https://www.youtube.com/watch?v=8D47_hKE2go", "go with me"],
["https://www.youtube.com/watch?v=3nZscI-JXMc", "space and time"],
["https://www.youtube.com/watch?v=hJGpQseQp-Q", "phoenix"],
["https://www.youtube.com/watch?v=i44tp3NeJog", "nocturne"],
["https://www.youtube.com/watch?v=7MAhky7jROQ", "take flight"],
["https://www.youtube.com/watch?v=r3UqlK4jhBs", "mufaya - old kid's piano"],
["https://www.youtube.com/watch?v=fZiMI_KOpzs", "collective memories"],
["https://www.youtube.com/watch?v=vJ8yejb1hWc", "reverse rain"],
["https://www.youtube.com/watch?v=jHTvwtqhATE", "fonky chonk"],
["https://www.youtube.com/watch?v=oyBsEOSSoc0", "LOROU - epoch"],
["https://www.youtube.com/watch?v=GyHc2_HEj6E", "ill fly hight"],
["https://www.youtube.com/watch?v=mw-NKRblre4", "magic water"],
["https://www.youtube.com/watch?v=hVonXg6nYe0", "dome"],
["https://www.youtube.com/watch?v=UdBmx-v0864", "bat pony"],
["https://www.youtube.com/watch?v=fB7NtRAstbo", "paper lady"],
["https://www.youtube.com/watch?v=Hv9KFj8v5HM", "seventh element"],
["https://www.youtube.com/watch?v=abRKMGzVaPU", "eve"],
["https://www.youtube.com/watch?v=0eopWE1e0Lw", "breaking of dawn"],
["https://www.youtube.com/watch?v=-zhnaG9Jxqg", "on your own"],
]
let indexOffset = 0
let k = 0
let processPage = () => {
for (; k < leftmostUrlTitlePair.length; k++) {
let [url, title] = leftmostUrlTitlePair[k]
// /\ this is efficiency!
let link = document.querySelector(`#contents [href="/${url.split("/").slice(-1)[0]}"]`)
if (!link) return
// \/
// though it will break if any of the videos listed in the leftmosturl index is removed
let element = link.parentElement.parentElement.parentElement
let children = [...element.parentElement.children]
let index = children.indexOf(element)
let mod = (index + indexOffset) % 6
console.log(`PADALIGNER title ${title}, index ${index}, mod ${mod}`)
if (index > 0 && mod > 0) {
indexOffset += 6 - mod
let marginSize = `calc( 50% - ${mod * 107}px )`
children[index - mod].style.marginLeft = marginSize
children[index - 1].style.marginRight = marginSize
}
}
}
document.body.addEventListener("click", processPage, true)
processPage()
console.log("PADALIGNER end ok")
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment