From 2db68ba519e0a1aa5979d75dedff996711a51ffb Mon Sep 17 00:00:00 2001 From: Arjun Patel Date: Sat, 7 Oct 2017 03:04:33 -0700 Subject: [PATCH] adsf --- index.html | 5 ++++- main.js | 26 ++++---------------------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/index.html b/index.html index 6a68c64..5c7eaa2 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,10 @@ -
+ + + +
diff --git a/main.js b/main.js index 1e6833b..80e3d9c 100644 --- a/main.js +++ b/main.js @@ -1,5 +1,6 @@ var enterBtn = document.getElementById("enter"); +var authorizeButton = document.getElementById('authorize-button'); enterBtn.addEventListener("click", captureInput); function captureInput() { @@ -14,18 +15,16 @@ function captureInput() { command = input.substring(0, untilSpace); console.log(command); if (command in dict) { + authorizeButton.click(); dict[command](input.substring(untilSpace+1)); - google_auth(); } else { console.log("not a valid command"); } } - -function google_auth() { // Client ID and API key from the Developer Console - var CLIENT_ID = '282164278400-fibsdnpmvl7hnhu0v837mql3f5u0b8lu.apps.googleusercontent.com'; + var CLIENT_ID = '951578952608-igq1knaukc28hl3a7slj66l5lerijgue.apps.googleusercontent.com'; // Array of API discovery doc URLs for APIs used by the quickstart var DISCOVERY_DOCS = ["https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest"]; @@ -35,7 +34,6 @@ function google_auth() { var SCOPES = "https://www.googleapis.com/auth/calendar"; var authorizeButton = document.getElementById('authorize-button'); - var signoutButton = document.getElementById('signout-button'); /** * On load, called to load the auth2 library and API client library. @@ -60,7 +58,6 @@ function google_auth() { // Handle the initial sign-in state. updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get()); authorizeButton.onclick = handleAuthClick; - signoutButton.onclick = handleSignoutClick; }); } @@ -69,14 +66,7 @@ function google_auth() { * appropriately. After a sign-in, the API is called. */ function updateSigninStatus(isSignedIn) { - if (isSignedIn) { - authorizeButton.style.display = 'none'; - signoutButton.style.display = 'block'; - listUpcomingEvents(); - } else { - authorizeButton.style.display = 'block'; - signoutButton.style.display = 'none'; - } + console.log('hey'); } /** @@ -86,13 +76,6 @@ function google_auth() { gapi.auth2.getAuthInstance().signIn(); } - /** - * Sign out the user upon button click. - */ - function handleSignoutClick(event) { - gapi.auth2.getAuthInstance().signOut(); - } - /** * Append a pre element to the body containing the given message * as its text node. Used to display the results of the API call. @@ -136,4 +119,3 @@ function google_auth() { } }); } -}