-
Notifications
You must be signed in to change notification settings - Fork 13
/
main.js
24 lines (18 loc) · 894 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(function() {
var buttonElement = document.querySelector("a.get-repo-btn");
if ( buttonElement === null ) {
return;
}
buttonElement.removeAttribute('href');
buttonElement.innerText = 'Open in Tower';
buttonElement.setAttribute('aria-label', buttonElement.getAttribute('aria-label').replace('GitHub Desktop', 'Tower'));
buttonElement.removeAttribute('data-open-app');
buttonElement.addEventListener('click', function(event) {
event.preventDefault();
var repoModalElement = buttonElement.parentElement.parentElement;
var inputElements = repoModalElement.querySelectorAll('input[type="text"]');
var isSSH = repoModalElement.classList.contains('on');
var activeInputElement = inputElements[isSSH ? 1 : 0];
window.location.href = 'gittower://openRepo/' + encodeURI(activeInputElement.value);
});
}());