-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
76 lines (72 loc) · 2.06 KB
/
Copy pathindex.html
File metadata and controls
76 lines (72 loc) · 2.06 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ppt by imtaotao</title>
<link rel="stylesheet" href="ppt/lib/highlight/highlight.css">
<style>
body {
margin: 0;
background: rgb(49, 54, 64);
}
#loading {
top: 0;
bottom: 0;
left: 0;
right: 0;
display: flex;
position: fixed;
font-size: 20px;
color: #727272;
align-items: center;
flex-direction: column;
justify-content: center;
}
</style>
</head>
<body>
<div id="loading">
<div>加载中...</div>
</div>
<div id="root"></div>
<script src="ppt/lib/impress.js"></script>
<script src="ppt/lib/highlight/highlight.pack.js" no-entry></script>
<script src="ppt/lib/css-module.js" no-entry></script>
<script src="ppt/lib/liberty.js" no-entry></script>
<script src="ppt/lib/liberty-plugin.js" no-entry></script>
<script>
const basePATH = location.hostname.includes('github') || window.__GARFISH__ ? '/co-share' : ''
window.onerror = function(error) {
console.error('Occur error.')
const dom = document.getElementById('loading')
if (dom) {
dom.innerHTML = `
<div>您的浏览器版本不支持阅览此 ppt </div>
<div>请在 pc 端打开</div>
`
}
}
// 启动模块加载器
Liberty.addPlugin('.css', res => {
const { path, resource } = res
if (path.includes('global') || path.includes('lib')) {
const styleNode = document.createElement('style')
styleNode.textContent = resource
document.head.appendChild(styleNode)
return null
}
return CssModule(res)
})
Liberty.addPlugin('.grs', GrassPlugin)
Liberty.addPlugin('.grs', Liberty.plugins.jsPlugin)
Liberty.init({
exname: '.grs',
alias: {
comp: basePATH + '/ppt/component',
Grass: 'https://cdn.jsdelivr.net/gh/imtaotao/Grass/dist/grass.common.js',
},
})(basePATH + '/ppt/index.js')
</script>
</body>
</html>