-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive.html
96 lines (83 loc) · 2.58 KB
/
archive.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
<!DOCTYPE html>
<!-- This file is copied into each archive folder and can be used as a standalone, offline
web page to view archived rooms. -->
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>The Archiver</title>
<link rel="stylesheet" href="./assets/style.css"></link>
<script defer src="./assets/data.js"></script>
<script>
const model = {
data: null,
init() {
this.data = data;
document.title = data.room?.title || 'Webex Archives';
},
avatar(email) {
return './people/' + email + '.jpg';
},
name(email) {
return this.data.people?.find(d => d.emails[0] === email)?.displayName || email;
},
html(message) {
if (message.html) return message.html;
if (message.text) return message.text.replaceAll('\n', '<br/>');
return '';
},
thumb(file) {
return file?.type?.startsWith('image')
? './files/' + file.localName
: 'https://cdn2.iconfinder.com/data/icons/pittogrammi/142/95-512.png';
},
datetime(date) {
const d = new Date(date);
const o = {
weekday: 'short',
day: 'numeric',
month: 'short',
hour: '2-digit',
minute: '2-digit'
};
const currentYear = new Date().getFullYear();
if (currentYear !== d.getFullYear()) {
o.year = 'numeric';
};
return d.toLocaleDateString(undefined, o);
}
}
</script>
<script defer src="assets/alpine.js"></script>
</head>
<body
x-cloak
x-data="model"
>
<h1 x-text="data?.room?.title"></h1>
<section>
<template x-for="conversation in data?.conversations">
<div class="conversation">
<template x-for="message, i in conversation">
<div class="message">
<div class="header">
<img :src="avatar(message.personEmail)" class="avatar" :title="message.personEmail"/>
<div x-text="name(message.personEmail)"></div>
<div x-text="datetime(message.created)"></div>
</div>
<div x-html="html(message)" class="text"></div>
<div x-show="message.files?.length" class="files">
<template x-for="file in message.files">
<a :href="'files/' + file.localName" target="_blank">
<img :src="thumb(file)" />
</a>
</template>
</div>
</div>
</template>
</div>
</template>
</section>
</body>
</html>