Last active
April 11, 2019 04:40
-
-
Save ryanml/1993704961791ad3b9211ac5bc3589d6 to your computer and use it in GitHub Desktop.
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 Hide Snapshots | |
// @namespace https://github.com/ryanml | |
// @version 1.0 | |
// @description Hides testing snapshots in Github PR file view | |
// @author ryanml | |
// @match *://github.com/brave/brave-ui/pull/*/files | |
// @grant none | |
// ==/UserScript== | |
// This can be changed | |
const snapshotDir = '__snapshots__' | |
const hideSnapshotFiles = () => { | |
const files = document.querySelectorAll('.file') | |
for (let f = 0; f < files.length; f++) { | |
const fileLink = files[f].querySelector('.link-gray-dark') | |
if (fileLink.innerHTML.indexOf(snapshotDir) > -1) { | |
files[f].className = files[f].className.replace('Details--on', '') | |
} | |
} | |
} | |
const assemble = () => { | |
const filesParent = document.querySelector('#files') | |
new MutationObserver(hideSnapshotFiles) | |
.observe(filesParent, {childList: true, subtree: true}) | |
hideSnapshotFiles() | |
} | |
window.onload = assemble |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment