-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
121 lines (109 loc) · 2.52 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<html>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-171628500-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-171628500-1');
</script>
<meta charset="utf-8">
<title>Renumber Widget</title>
<link type="text/css" rel="stylesheet" href="css/style.css"/>
</head>
<body>
<div>
<div class="title-block">
<h2 class="title">Renumber Widget</h2>
</div>
<div class="title-block">
<button onclick="renum()" class="btn">CONVERT</button>
</div>
</div>
<div class="content">
<div class="box">
<textarea placeholder="Type here" type="text" id="input" class="textarea text box-padding"></textarea>
</div>
<div id="denum-ed" class="box text box-padding" style="left:32%"></div>
<div id="renum-ed" class="box text box-padding" style="left:64%"></div>
</div>
<script>
function renum() {
var trimmed = document.getElementById("input").value
.trim()
.replace(/^\"/, "")
.replace(/\"$/, "")
.trim()
.split('\n');
var denum = trimmed.map(x => x.replace(/[0-9]+\.\s*/, ""));
var renum = [];
for (var i = 0; i < denum.length; i++) {
renum.push((i + 1) + '. ' + denum[i]);
}
document.getElementById("denum-ed").innerHTML=arrayToHtml(denum);
document.getElementById("renum-ed").innerHTML=arrayToHtml(renum);
}
function arrayToHtml(arr) {
return arr.map(x => x + '</br>').join('');
}
</script>
<style>
body {
font-family: Verdana,sans-serif;
}
.text {
font-family: Verdana,sans-serif;
font-size: 16px;
}
.title {
font-size: 24px;
color: #263238;
}
.title-block {
display: inline-block;
margin-right: 30px;
}
.content {
position: relative;
}
.box {
position: absolute;
top: 0;
display: inline-block;
height: 80vh;
width: 30%;
background-color: #FFFFFF;
box-shadow: 0px 0px 14px rgba(0, 0, 0, 0.07);
border-radius: 6px;
}
.box-padding {
padding: 8px 8px;
}
.textarea {
height: 100%;
width: 100%;
border: none;
}
.textarea:focus {
outline: none !important;
border: 3px solid #04AA6D;
}
.textarea:focus::placeholder {
color: transparent;
}
.btn {
color: #FFFFFF;
background-color: #04AA6D !important;
border-radius: 6px;
display: inline-block;
padding: 8px 16px;
vertical-align: middle;
text-align: center;
cursor: pointer;
border: none;
}
</style>
<script type="text/javascript" src="js/script.js"></script>
</body>
</html>