forked from Placekey/placekey-googlesheets-addon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetKey.html
60 lines (51 loc) · 1.99 KB
/
setKey.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!DOCTYPE html>
<html>
<head>
<base target="_top" />
<?!= include('Stylesheet'); ?>
<script>
function insert() {
var els = document.getElementById("key").value;
console.log(els);
google.script.run.withFailureHandler(failHandler).withSuccessHandler(google.script.host.close).setUserProperties(els);
}
</script>
</head>
<body>
<div id="theBlock" style="display: none">
<h2 class="type-h2">Enter your API Key</h2>
<div class="form__group mt-25">
<label for="key" class="form__label">API Key</label>
<input id="key" type="text" class="form__control" placeholder="Enter your api key here" spellcheck="false" />
</div>
<div class="footer mt-25">
<a class="text-black" href="https://placekey.io/faq" target="_blank" rel="noopener">FAQ</a>
<a id="getApi" class="btn ml-15" href="https://dev.placekey.io/default/register" target="_blank" rel="noopener">Get a Free API Key</a>
<button id="finish" class="btn-solid ml-15" onclick="insert()">Finish Setup</button>
</div>
</div>
<div id="error" style="display: none">
<p class="text-red">There was an error with authorization. Please use the addon with your browser default account.</p>
<div class="text-center mt-15">
<a id="finish" class="btn-solid" onclick="google.script.host.close()">Close</a>
</div>
</div>
<script>
google.script.run.withFailureHandler(failHandler).withSuccessHandler(successHandler).testUser();
document.addEventListener(
"DOMContentLoaded",
function () {
var inputKey = document.getElementById("storedKey").value;
document.getElementById("key").value = inputKey;
},
false
);
function failHandler() {
document.getElementById("error").style.display = "block";
}
function successHandler() {
document.getElementById("theBlock").style.display = "block";
}
</script>
</body>
</html>