adsf
This commit is contained in:
+4
-1
@@ -8,7 +8,10 @@
|
|||||||
<link rel="stylesheet" type="text/css" href="main.css">
|
<link rel="stylesheet" type="text/css" href="main.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container main-bg">
|
|
||||||
|
<button id="authorize-button" style="opacity: 0;">asd</button>
|
||||||
|
|
||||||
|
<div class="container main-bg" id="content">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-8 search-col">
|
<div class="col-xs-8 search-col">
|
||||||
<div id="search-cont">
|
<div id="search-cont">
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
var enterBtn = document.getElementById("enter");
|
var enterBtn = document.getElementById("enter");
|
||||||
|
var authorizeButton = document.getElementById('authorize-button');
|
||||||
enterBtn.addEventListener("click", captureInput);
|
enterBtn.addEventListener("click", captureInput);
|
||||||
|
|
||||||
function captureInput() {
|
function captureInput() {
|
||||||
@@ -14,18 +15,16 @@ function captureInput() {
|
|||||||
command = input.substring(0, untilSpace);
|
command = input.substring(0, untilSpace);
|
||||||
console.log(command);
|
console.log(command);
|
||||||
if (command in dict) {
|
if (command in dict) {
|
||||||
|
authorizeButton.click();
|
||||||
dict[command](input.substring(untilSpace+1));
|
dict[command](input.substring(untilSpace+1));
|
||||||
google_auth();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("not a valid command");
|
console.log("not a valid command");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function google_auth() {
|
|
||||||
// Client ID and API key from the Developer Console
|
// 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
|
// 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"];
|
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 SCOPES = "https://www.googleapis.com/auth/calendar";
|
||||||
|
|
||||||
var authorizeButton = document.getElementById('authorize-button');
|
var authorizeButton = document.getElementById('authorize-button');
|
||||||
var signoutButton = document.getElementById('signout-button');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On load, called to load the auth2 library and API client library.
|
* 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.
|
// Handle the initial sign-in state.
|
||||||
updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get());
|
updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get());
|
||||||
authorizeButton.onclick = handleAuthClick;
|
authorizeButton.onclick = handleAuthClick;
|
||||||
signoutButton.onclick = handleSignoutClick;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,14 +66,7 @@ function google_auth() {
|
|||||||
* appropriately. After a sign-in, the API is called.
|
* appropriately. After a sign-in, the API is called.
|
||||||
*/
|
*/
|
||||||
function updateSigninStatus(isSignedIn) {
|
function updateSigninStatus(isSignedIn) {
|
||||||
if (isSignedIn) {
|
console.log('hey');
|
||||||
authorizeButton.style.display = 'none';
|
|
||||||
signoutButton.style.display = 'block';
|
|
||||||
listUpcomingEvents();
|
|
||||||
} else {
|
|
||||||
authorizeButton.style.display = 'block';
|
|
||||||
signoutButton.style.display = 'none';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -86,13 +76,6 @@ function google_auth() {
|
|||||||
gapi.auth2.getAuthInstance().signIn();
|
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
|
* Append a pre element to the body containing the given message
|
||||||
* as its text node. Used to display the results of the API call.
|
* as its text node. Used to display the results of the API call.
|
||||||
@@ -136,4 +119,3 @@ function google_auth() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user