Skip to content

Commit d9aa5bb

Browse files
committed
Update filebrowser.js
1 parent 97bbdb9 commit d9aa5bb

File tree

1 file changed

+26
-38
lines changed

1 file changed

+26
-38
lines changed

filebrowser.js

Lines changed: 26 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -859,44 +859,6 @@ function addHTMLItemListeners() {
859859
}
860860

861861
})
862-
863-
// if item is a file
864-
if (item.classList.contains('file')
865-
&& item.querySelector('.push-wrapper')) {
866-
867-
item.querySelector('.push-wrapper')
868-
.addEventListener('contextmenu', () => {
869-
870-
let commitMessage;
871-
872-
// get selected branch
873-
let selBranch = treeLoc[1].split(':')[1];
874-
875-
// open push screen
876-
commitMessage = prompt('Push \''+ item.innerText + (selBranch ? '\' to branch \'' + selBranch + '\'?' : '\'?'),
877-
'Type push description...');
878-
879-
// if canceled push, return
880-
if (!commitMessage) return;
881-
882-
// if not specified message
883-
if (commitMessage === 'Type push description...') {
884-
885-
// show default message
886-
commitMessage = 'Update ' + item.innerText;
887-
888-
}
889-
890-
891-
// play push animation
892-
playPushAnimation(item.querySelector('.push-wrapper'));
893-
894-
// push file
895-
pushFileFromHTML(item, commitMessage);
896-
897-
})
898-
899-
}
900862

901863
})
902864

@@ -927,6 +889,32 @@ function clickedOnFileHTML(fileEl, event) {
927889

928890
} else {
929891

892+
// if not logged in to git
893+
if (gitToken == '') {
894+
895+
function openLogin() {
896+
897+
const authURL = 'https://github.com/login/oauth/authorize?client_id=7ede3eed3185e59c042d&scope=repo,user,write:org';
898+
899+
if (isMobile) {
900+
901+
window.location.href = authURL;
902+
903+
} else {
904+
905+
window.open(authURL, 'Login with Github', 'height=575,width=575');
906+
907+
}
908+
909+
}
910+
911+
showDialog(openLogin, 'Login to save this file.', 'Login');
912+
913+
return;
914+
915+
}
916+
917+
930918
let commitMessage;
931919

932920
// if ctrl/meta/shift-clicked on push button

0 commit comments

Comments
 (0)