maps
This commit is contained in:
@@ -2,38 +2,42 @@ var enterBtn = document.getElementById("enter");
|
||||
var authorizeButton = document.getElementById('authorize-button');
|
||||
var signoutButton = document.getElementById('signout-button');
|
||||
|
||||
var createBtn = document.getElementById('create-event');
|
||||
var runCommandBtn = document.getElementById('create-event');
|
||||
enterBtn.addEventListener("click", captureInput);
|
||||
var actualCommand = '';
|
||||
var command = '';
|
||||
|
||||
function captureInput() {
|
||||
var dict = {
|
||||
"gcal": makeEvent,
|
||||
"googlecalendar": makeEvent,
|
||||
"mapsd": directionsURL,
|
||||
"directions": directionsURL
|
||||
};
|
||||
|
||||
var input = String(document.getElementById("input").value);
|
||||
untilSpace = input.indexOf(' ');
|
||||
var untilSpace = input.indexOf(' ');
|
||||
command = input.substring(0, untilSpace);
|
||||
console.log(command);
|
||||
signoutButton.click();
|
||||
|
||||
if (command in dict) {
|
||||
console.log('isAValidCommmand');
|
||||
actualCommand = input.substring(untilSpace+1);
|
||||
createBtn.addEventListener("click", function () {
|
||||
console.log('successfully clicked createbtn');
|
||||
makeEvent(actualCommand);
|
||||
runCommandBtn.addEventListener("click", function () {
|
||||
console.log('successfully ran command');
|
||||
dict[command](actualCommand);
|
||||
});
|
||||
|
||||
if (gapi.auth2.getAuthInstance().isSignedIn.get()) {
|
||||
console.log('already signed in');
|
||||
createBtn.click();
|
||||
runCommandBtn.click();
|
||||
}
|
||||
else {
|
||||
authorizeButton.click();
|
||||
setTimeout(alert("Run Command again!"), 10000);
|
||||
setTimeout(alert("Run Command again!"), 1000);
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.log("not a valid command");
|
||||
alert.log("Not a valid command");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user