Skip to content

Instantly share code, notes, and snippets.

@tobiashm
Created September 23, 2019 12:07
Show Gist options
  • Save tobiashm/f2e6827dccc90bd37213498992a74325 to your computer and use it in GitHub Desktop.
Save tobiashm/f2e6827dccc90bd37213498992a74325 to your computer and use it in GitHub Desktop.
Safari userscript
window.addEventListener('load', function() {
if (!document.location.href.startsWith('https://app.clubhouse.io/')) { return; }
function isDropdownNode(node) {
return node.nodeType === Node.ELEMENT_NODE && node.classList.contains('dropdown');
}
document.addEventListener('DOMNodeInserted', function(event) {
var insertedNode = event.target;
if (!isDropdownNode(insertedNode)) return;
Array.from(insertedNode.querySelectorAll('input[class^="git-branch"]')).forEach(function (input) {
input.value = input.value.replace(/\b\w+\/ch(\d+)\//, 'ch$1/');
});
}, false);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment