-
Notifications
You must be signed in to change notification settings - Fork 0
/
Feedback.html
108 lines (95 loc) · 4.29 KB
/
Feedback.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?
let locale = 'en';
try{ locale = getUserLocale(); }
catch(e){ alertMe("Error: " + e.message + "\r\nFile: " + e.fileName + "\r\nLine: " + e.lineNumber); }
?>
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons.css">
<style>
textarea { width: 100%; height: 230px; }
#thankyou,#tryagain { display:none; text-align: justify; margin-top:100px; }
.closeme { margin-top: 30px; }
.apps-share-sprite {
background-image: url(<?!= include('EmailIcon'); ?>);
}
.scb-container, .scb-icon {
display: inline-block;
}
.scb-button-icon {
margin: -3px 2px 0px -5px;
vertical-align: middle!important;
}
.scb-public-icon-white, .scb-public-icon-black, .scb-unlisted-icon-white, .scb-unlisted-icon-black, .scb-domain-public-icon-white, .scb-domain-public-icon-black, .scb-domain-unlisted-icon-white, .scb-domain-unlisted-icon-black, .scb-privately-shared-icon-white, .scb-privately-shared-icon-black, .scb-private-icon-white, .scb-private-icon-black, .scb-mail-icon {
width: 21px;
height: 21px;
background-repeat: no-repeat;
vertical-align: bottom;
}
.scb-mail-icon { background-size: cover; }
#messageToUser {
border: 1px solid Gray;
background-color: pink;
color: Gray;
padding: 12px;
}
</style>
</head>
<body>
<div id="messageToUser"></div>
<input id="idAccountOfEffectiveUsr" type="hidden" style="display:none" value="<?!= Session.getEffectiveUser().getEmail(); ?>"/>
<script>
let failedAcctTest = function(rtrn) {
$('.spinner').hide();
let usrWhoLoaded = document.getElementById('idAccountOfEffectiveUsr').textContent;
if (usrWhoLoaded !== rtrn) {
document.getElementById('messageToUser').textContent = "<?=__('The Add-on loaded under the account:',locale)?>" + " <" + usrWhoLoaded + ">" +
"\n\n" + "<?=__('However you are also logged into another account in this browser:',locale)?>" + " <" + rtrn + ">" +
"\n\n" + "<?=__('Being logged into multiple accounts in the same browser session causes authorization errors.',locale)?>" +
"\n\n" + "<?=__('In order to proceed, you must either log out of all accounts, and log back into the account that installed the add-on, or open an incognito window, log in with the account that installed the add-on and use the add-on from that window.',locale)?>" +
"\n\n" + "<?=__('The best practice to avoid these problems is to login to your accounts using the browser\'s own account manager. That way you have a different browser session for each account that you would like to use.',locale)?>";
}
},
successAcctTest = function(rtrn) {
$('#messageToUser').hide();
};
</script>
<div id="initial">
<div class="form-group">
<label><b><?=__('Write your observations about BibleGet I/O',locale)?></b><br />
<textarea id="feedback-msg"></textarea>
</label>
</div>
<div style="text-align:right;">
<button id="sendmessage" class="action goog-inline-block"><span class="scb-icon apps-share-sprite scb-button-icon scb-mail-icon"> </span><?=__('Send Message',locale)?></button>
</div>
</div>
<div id="thankyou">
<span><?=__('Your message was delivered successfully. Thank you for getting in touch with us!',locale)?></span>
<div style="text-align:center;"><button class="gray closeme"><?=__('CLOSE',locale)?></button></div>
</div>
<div id="tryagain">
<span><?=__("Your message was not delivered successfully... Please try to send again.",locale)?></span>
<div style="text-align:center;"><button class="gray closeme"><?=__('CLOSE',locale)?></button></div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
google.script.run.withFailureHandler(failedAcctTest).withSuccessHandler(successAcctTest).getEffectiveUserEM();
$('#sendmessage').click(function(){
var msg = $('#feedback-msg').val();
google.script.run.withSuccessHandler(thankyou).withFailureHandler(tryagain).sendMail(msg);
});
$('.closeme').click(function(){
google.script.host.close();
});
});
let thankyou = function(){
$('#initial').fadeOut("slow",function(){ $('#thankyou').fadeIn("slow"); });
}
let tryagain = function(){
$('#initial').fadeOut("slow",function(){ $('#tryagain').fadeIn("slow"); });
}
</script>
</body>