-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
97 lines (88 loc) · 2.72 KB
/
index.html
File metadata and controls
97 lines (88 loc) · 2.72 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://unpkg.com/@picocss/pico@latest/css/pico.min.css">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.slim.js"></script>
<title>Encoding tools</title>
<style>
:root {
--muted-color: #73828c;
}
.invalid {
color: var(--form-element-invalid-border-color);
background-image: var(--icon-invalid);
background-position: left;
background-position-y: 4px;
padding-left: 2rem;
}
.half-height {
height: calc(45vh - 90px);
}
</style>
</head>
<body>
<div id="app"></div>
<script type="text/x-template" id="page-contents">
<div>
<header class="container">
<nav>
<ul>
<li>Tool:</li>
<li><a @click="setTool('#html')" href="#html">HTML</a></li>
<li><a @click="setTool('#url')" href="#url">URL</a></li>
<li><a @click="setTool('#unicode')" href="#unicode">UNICODE</a></li>
<li><a @click="setTool('#base64')" href="#base64">BASE64</a></li>
<li><a @click="setTool('#json')" href="#json">JSON</a></li>
</ul>
</nav>
</header>
<main class="container">
<div role="document">
<component v-bind:is="component"></component>
</div>
</main>
</div>
</script>
<script type="module">
import HtmlEscape from './html-escape.js';
import UrlEscape from './url-escape.js';
import UnicodeEscape from './unicode-escape.js';
import JsonEscape from './json-escape.js';
import Base64 from './base64.js';
var app = new Vue({
el: '#app',
template: '#page-contents',
components: {
'html-escape': HtmlEscape,
'url-escape': UrlEscape,
'base64': Base64,
'unicode-escape': UnicodeEscape,
'json-escape': JsonEscape
},
data: function() {
return {
component: 'html-escape'
}
},
mounted: function() {
this.setTool(location.hash)
},
methods: {
setTool: function(tool) {
const components = {
'#url': 'url-escape',
'#html': 'html-escape',
'#base64': 'base64',
'#unicode': 'unicode-escape',
'#json': 'json-escape'
}
this.component = components[tool] || 'html-escape'
}
}
})
</script>
</body>
</html>