Created
May 31, 2022 02:03
-
-
Save mallendeo/8e28ee84e67ee6ad51f4a3849f8ab3e9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
{ | |
if (!_) { | |
const res = await fetch('https://cdn.jsdelivr.net/npm/lodash') | |
const text = await res.text() | |
eval(text) // load lodash | |
} | |
window.unmatchedMovies = new Set([]) | |
const checkMovies = () => { | |
let rows = document.querySelectorAll('[class^="VirtualTableRow-row"]') | |
for (let row of rows) { | |
const title = row.querySelector('div:nth-of-type(2)')?.textContent | |
const selectTitle = row.querySelector('[class^="ImportMovieTitle-titleContainer"] > div')?.textContent | |
const _title = _.deburr(_.toLower(title)).replace(/[():'\/\s+,-/?]/g, '').replace(/&/g, 'and') | |
const _selectTitle = _.deburr(_.toLower(selectTitle)).replace(/[():'\/\s+,-\?]/g, '').replace(/&/g, 'and') | |
if (_selectTitle && _title !== _selectTitle) { | |
if (!window.unmatchedMovies.has(title)) console.log(title, _title, _selectTitle) | |
window.unmatchedMovies.add(title) | |
} | |
} | |
} | |
const onDblClick = () => { | |
console.log(window.unmatchedMovies) | |
window.unmatchedMovies = null | |
document.body.removeEventListener('mousewheel', onScroll) | |
document.removeEventListener('dblclick', onDblClick) | |
} | |
let ticking = false | |
const onScroll = () => { | |
if (!ticking) { | |
window.requestAnimationFrame(() => { | |
checkMovies() | |
ticking = false | |
}); | |
ticking = true | |
} | |
} | |
document.addEventListener('dblclick', onDblClick) | |
document.body.addEventListener('mousewheel', onScroll) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment