This repository has been archived by the owner on May 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.html
108 lines (93 loc) · 3.52 KB
/
template.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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<base target="_top">
<script>
// Event triggered after clicking Mark Like button
function updateButton(status, btnId) {
if (status) {
$( "#"+btnId ).after(' <i class="fa fa-check-circle" style="color:green"></i>');
} else {
$( "#"+btnId ).after(' <i class="fa fa-times-circle" style="color:red"></i>');
}
}
// OnClickEvent - Mark Liked on Slack
$(document).on("click", ".marks", function(e){
var btnId = $(this).attr('id');
var ts = $(this).val();
google.script.run.withSuccessHandler(updateButton).withUserObject(btnId).onClickBtn(ts);
})
// OnClick Enlarge iframe
$(document).on("click", ".enlarge", function(e){
var iframeid = $(this).attr('value');
var iframe = $('#' + iframeid);
iframe.height(iframe.height() + 150);
})
// Prevent forms from submitting.
function preventFormSubmit() {
var forms = document.querySelectorAll('form');
for (var i = 0; i < forms.length; i++) {
forms[i].addEventListener('submit', function(event) {
event.preventDefault();
});
}
}
window.addEventListener('load', preventFormSubmit);
// Update content after Event submitted
function update(stream) {
$('#output').html(stream);
}
// Submit Event when Reload button is clicked
function handleFormSubmit(formObject) {
google.script.run.withSuccessHandler(update).doReload(formObject);
}
</script>
<!-- CSS style -->
<style>
.fb-post { padding: 10px; margin: 1.5em ; text-align: -webkit-center; }
.fb-iframe { background-color: white; }
.liked-post { background-color: aliceblue; }
</style>
<!-- End of CSS style -->
</head>
<body>
<div id="status">
</div>
<!-- login button -->
<button id="logout" type="submit" style="float:right;">Logout</button>
<script>
$("#logout").click(function(){
google.script.run.resetAuth();
alert("The paragraph was clicked.");
pattern = /story_fbid=([0-9]+)|id=([0-9]+)/g
});
</script>
<!-- End of login button -->
<!-- Reload form -->
<form id="FetchForm" onsubmit="handleFormSubmit(this)" style="display:inline-table;">
Num of Message: <input type="number" name="read_limit" min="1" max="100" value="20">
<input id="reload" type="submit" value="Reload">
</form>
<!-- End Reload form -->
<!-- Hide button-->
<button id="hide" value="false">Hide Liked</button>
<script>
$("#hide").click(function(){
if ($(this).val() == 'false') {
$('.liked-post').hide();
$(this).val('true');
$(this).html('Show Liked');
}
else {
$('.liked-post').show();
$(this).val('false');
$(this).html('Hide Liked');
}
});
</script>
<!-- End of Hide button-->
<hr>
</body>
</html>