Skip to content

Commit 33d9dc7

Browse files
committedMay 8, 2024·
Add cf branch converter
1 parent 9f995ff commit 33d9dc7

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
 

‎cf-pages-converter/index.html

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>CF Pages Branch Converter</title>
7+
<style>
8+
.wrapper {
9+
height: 100dvh;
10+
width: 100%;
11+
display: flex;
12+
align-items: center;
13+
justify-content: center;
14+
flex-direction: column;
15+
gap: 2rem;
16+
text-align: center;
17+
font-family: sans-serif;
18+
color: rgb(17, 24, 39);
19+
}
20+
21+
input {
22+
padding: 0.25rem 0.5rem;
23+
border-radius: 4px;
24+
border: 1px solid black;
25+
width: 100%;
26+
}
27+
28+
#result {
29+
font-weight: bold;
30+
}
31+
</style>
32+
</head>
33+
<body>
34+
35+
<div class="wrapper">
36+
<div>
37+
<h1>Paste Branch</h1>
38+
<input type="text" id="branch" oninput="convert(this.value)" onchange="convert(this.value)" />
39+
</div>
40+
41+
<div id="result"></div>
42+
<button type="button" onclick="copy()">Copy</button>
43+
44+
<script>
45+
function convert(val) {
46+
result.innerText = val.replaceAll(/[^a-zA-Z\d]/g, '-').toLowerCase();
47+
}
48+
49+
function copy() {
50+
navigator.clipboard.writeText(result.innerText)
51+
}
52+
</script>
53+
</div>
54+
</html>

0 commit comments

Comments
 (0)
Please sign in to comment.