forked from jirawatee/LINE-Bot-Live-Score
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathliff.html
57 lines (53 loc) · 1.8 KB
/
liff.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Select your team</title>
</head>
<body>
<table width="100%">
<tr>
<td width="50%">
<img src="https://upload.wikimedia.org/wikipedia/en/thumb/0/0c/Liverpool_FC.svg/300px-Liverpool_FC.svg.png"
width="100%" onclick="sendMessage('liverpool')">
</td>
<td width="50%">
<img
src="https://tot-tmp.azureedge.net/media/2280/spurs-blue-no-text-300x300.png?anchor=center&mode=crop&width=300"
width="100%" onclick="sendMessage('tottenham')">
</td>
</tr>
</table>
<script src="https://d.line-scdn.net/liff/1.0/sdk.js"></script>
<script>
window.onload = function (e) {
liff.init(function (data) {
initializeApp(data);
});
};
function sendMessage(team) {
switch (team) {
case 'liverpool':
msg = {
type: 'image',
originalContentUrl: 'https://upload.wikimedia.org/wikipedia/en/thumb/0/0c/Liverpool_FC.svg/300px-Liverpool_FC.svg.png',
previewImageUrl: 'https://upload.wikimedia.org/wikipedia/en/thumb/0/0c/Liverpool_FC.svg/300px-Liverpool_FC.svg.png'
}
break;
case 'tottenham':
msg = {
type: 'image',
originalContentUrl: 'https://tot-tmp.azureedge.net/media/2280/spurs-blue-no-text-300x300.png?anchor=center&mode=crop&width=300',
previewImageUrl: 'https://tot-tmp.azureedge.net/media/2280/spurs-blue-no-text-300x300.png?anchor=center&mode=crop&width=300'
}
break;
}
liff.sendMessages([msg]).then(() => {
liff.closeWindow();
}).catch(function (error) {
alert("Error sending message: " + error);
});
}
</script>
</body>
</html>