-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.html
97 lines (91 loc) · 4.64 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<script src="pm.js"></script>
<script>
function OpenLeftSide() {
document.getElementById("leftside").style.width = "250px";
document.getElementById("main").style.marginLeft = "250px";
}
function CloseLeftSide() {
document.getElementById("leftside").style.width = "0";
document.getElementById("main").style.marginLeft = "0";
}
</script>
<link rel="stylesheet" href="styles.css">
<link rel="icon" href="favicon-32.png" sizes="32x32">
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300;400;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
<title>Lua Patterns Viewer</title>
<meta name="description" content="Lua Patterns Viewer. A tool for inspecting, analyzing and learning Lua patterns.">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.5">
<meta name="keywords" content="Lua, patterns, regex, lua patterns, pattern matching">
<meta property="og:title" content="Lua Patterns Viewer">
<meta property="og:description" content="A tool for inspecting, analyzing and learning Lua patterns.">
<meta property="og:type" content="website">
<meta name="og:image" itemprop="image" content="https://gitspartv.github.io/lua-patterns/lua-patterns-logo.png">
<meta name="twitter:image:src" content="https://gitspartv.github.io/lua-patterns/lua-patterns-logo.png">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Lua Patterns Viewer">
<meta name="twitter:description" content="A tool for inspecting, analyzing and learning Lua patterns.">
</head>
<body>
<div id="leftside">
<a href="javascript:void(0)" class="closebtn" onclick="CloseLeftSide()">Hide</a>
<div style="margin: 10px 10px 0px 10px;"><img src="lua-patterns-logo.png" alt="Logo"
style="width: 70%; display: block; margin-left: auto; margin-right: auto;"></div>
<p class="center">Lua Patterns Viewer 1.1.5<br><a href="https://www.lua.org/manual/5.4/manual.html#6.4.1"
style="text-decoration: none; font-weight: bold; color: #76a2ff">Lua Manual</a></p>
<p><br>Unimplemented:<br>- Reference Manual<br>- Match test<br>- Lua backslash escapes<br>- Unified token colors<br>- Proper explanations</p>
<div>
<p><br>Settings:</p>
<input type="checkbox" id="settings-compact-mode">
<script>
const body = document.querySelector("body")
const settings_compact_mode = document.getElementById("settings-compact-mode")
const pick_compact = ({target: checkbox}) => {
localStorage.setItem("settings-compact-mode", checkbox.checked)
if (checkbox.checked) {
body.classList.add("compact")
} else {
body.classList.remove("compact")
}
}
settings_compact_mode.checked = localStorage.getItem("settings-compact-mode") === "true"
settings_compact_mode.addEventListener('change', pick_compact)
pick_compact({target: settings_compact_mode})
</script>
<label for="settings-compact-mode" class="unselectable">Compact mode</label>
</div>
<p class="center">Made by Spar.<br><a href="https://github.com/GitSparTV/lua-patterns"
style="text-decoration: none; font-weight: bold; color: #76a2ff">GitHub</a><br><br>Analytics:<br><img src="http://hits.dwyl.com/GitSparTV/lua-patterns-web.svg?style=flat-square" alt="analytics counter"></a></p>
</div>
<span onclick="OpenLeftSide()">open info</span>
<div id="main">
<h1 style="font-size: min(2em,8vw);">Lua Patterns Viewer</h1>
<h3>👋 Hi! Do you like this site? Answer a few questions in this <a href="https://docs.google.com/forms/d/e/1FAIpQLSetAHnXKRohqCvVBP4S7svC0XZoYaqyZf9w5HBOeMmxgvdZ4A/viewform" target="_blank">Google form</a> to improve this tool!</h3>
<div style="padding: 0px 25px 10px 0px;"><input id="input" spellcheck="false" autocomplete="off"></div>
<div id="result" style="overflow-y:auto; max-height: 85vh;"></div>
<script>
const input = document.getElementById('input');
const inputHandler = function (e) {
if (e.target.value.length == 0) {
window.history.replaceState(null, null, location.pathname);
} else {
window.history.replaceState(null, null, "?pattern=" + encodeURIComponent(e.target.value))
}
PatternsPrint(e.target.value)
}
input.addEventListener('input', inputHandler);
input.focus();
input.select();
let showcase = "^^charsq+w-e*r?.%.(%a%c%d%g%l%p%s%u%w%x%z%A)[asd]%f[^not]%1%b{}[%]a-z]$$"
const GETparams = new URLSearchParams(window.location.search);
const GETpattern = GETparams.get('pattern');
if (GETpattern) showcase = GETpattern;
input.value = showcase
PatternsPrint(showcase)
</script>
</div>
</body>
</html>