-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
148 lines (144 loc) · 8.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>SlugifyPro: Advanced Text to Slug Converter with Separator and Case Options</title>
<meta name="description"
content="SlugifyPro is a comprehensive tool designed for generating slugs with advanced customization options. Easily choose your separator—hyphen, underscore, or dot—and set the case to either lowercase or as-is to meet your specific requirements.">
<meta property="og:title" content="SlugifyPro: Advanced Text to Slug Converter with Separator and Case Options">
<meta property="og:description"
content="SlugifyPro is a comprehensive tool designed for generating slugs with advanced customization options. Easily choose your separator—hyphen, underscore, or dot—and set the case to either lowercase or as-is to meet your specific requirements.">
<meta property="og:image" content="https://slug.env.com.bd/sharing-image.png">
<link rel="apple-touch-icon" sizes="57x57" href="apple-icon-57x57.png" />
<link rel="apple-touch-icon" sizes="60x60" href="apple-icon-60x60.png" />
<link rel="apple-touch-icon" sizes="72x72" href="apple-icon-72x72.png" />
<link rel="apple-touch-icon" sizes="76x76" href="apple-icon-76x76.png" />
<link rel="apple-touch-icon" sizes="114x114" href="apple-icon-114x114.png" />
<link rel="apple-touch-icon" sizes="120x120" href="apple-icon-120x120.png" />
<link rel="apple-touch-icon" sizes="144x144" href="apple-icon-144x144.png" />
<link rel="apple-touch-icon" sizes="152x152" href="apple-icon-152x152.png" />
<link rel="apple-touch-icon" sizes="180x180" href="apple-icon-180x180.png" />
<link rel="icon" type="image/png" sizes="192x192" href="android-icon-192x192.png" />
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="96x96" href="favicon-96x96.png" />
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png" />
<link rel="manifest" href="manifest.json" />
<meta name="msapplication-TileColor" content="#ffffff" />
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png" />
<meta name="theme-color" content="#ffffff" />
<link href="dist/main.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/alpinejs@3.13.0/dist/cdn.min.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/slugify@1.6.6/slugify.min.js"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono&display=swap" rel="stylesheet">
</head>
<body class="p-4 flex items-center justify-center min-h-screen bg-gray-100">
<div x-data="app()" class="space-y-4 bg-white p-6 rounded shadow-md w-full md:w-2/3 2xl:w-3/6">
<textarea x-model="input" placeholder="Input Text"
class="block w-full rounded border p-2 text-gray-900 shadow-sm placeholder:text-gray-500 sm:text-sm sm:leading-6 h-28 md:h-32"></textarea>
<fieldset class="mt-4">
<legend class="sr-only">Separator</legend>
<div class="space-y-4 sm:flex sm:items-center sm:space-x-10 sm:space-y-0">
<div class="flex items-center">
<input id="separatorHyphen" x-model="separator" type="radio" value="-" checked
class="h-4 w-4 border-gray-300 text-green-600 focus:ring-green-600">
<label for="separatorHyphen"
class="ml-3 block text-sm font-medium leading-6 text-gray-900">Hyphen</label>
</div>
<div class="flex items-center">
<input id="separatorUnderscore" x-model="separator" type="radio" value="_"
class="h-4 w-4 border-gray-300 text-green-600 focus:ring-green-600">
<label for="separatorUnderscore"
class="ml-3 block text-sm font-medium leading-6 text-gray-900">Underscore</label>
</div>
<div class="flex items-center">
<input id="separatorDot" x-model="separator" type="radio" value="."
class="h-4 w-4 border-gray-300 text-green-600 focus:ring-green-600">
<label for="separatorDot" class="ml-3 block text-sm font-medium leading-6 text-gray-900">Dot</label>
</div>
</div>
</fieldset>
<fieldset class="mt-4">
<legend class="sr-only">Case</legend>
<div class="space-y-4 sm:flex sm:items-center sm:space-x-10 sm:space-y-0">
<div class="flex items-center">
<input id="caseLower" x-model="caseType" type="radio" value="lower" checked
class="h-4 w-4 border-gray-300 text-green-600 focus:ring-green-600">
<label for="caseLower"
class="ml-3 block text-sm font-medium leading-6 text-gray-900">Lowercase</label>
</div>
<div class="flex items-center">
<input id="caseAsIs" x-model="caseType" type="radio" value="asis"
class="h-4 w-4 border-gray-300 text-green-600 focus:ring-green-600">
<label for="caseAsIs" class="ml-3 block text-sm font-medium leading-6 text-gray-900">As-is</label>
</div>
</div>
</fieldset>
<div>
<textarea @click="copyToClipboard(customSlugify(input))" x-text="customSlugify(input)"
class="block w-full rounded border p-2 text-gray-900 shadow-sm placeholder:text-gray-500 sm:text-sm sm:leading-6 bg-gray-100 h-28 md:h-32"
placeholder="Output Slug" readonly></textarea>
<button @click="copyToClipboard(customSlugify(input))" x-bind:disabled="isCopyDisabled"
x-bind:class="{'bg-gray-500': isCopyDisabled, 'bg-green-500': !isCopyDisabled}"
class="p-2 text-white rounded w-full mt-2 text-sm">Copy to clipboard</button>
</div>
<div x-show="showNotification" x-text="notification" class="p-2 bg-blue-500 text-white rounded text-sm"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="opacity-0 transform scale-90"
x-transition:enter-end="opacity-100 transform scale-100"
x-transition:leave="transition ease-in duration-300"
x-transition:leave-start="opacity-100 transform scale-100"
x-transition:leave-end="opacity-0 transform scale-90"></div>
</div>
<footer class="mt-10 text-center absolute bottom-0 w-full">
<p>© {{current_year}} <a href="https://devops.com.bd" target="_blank" rel="noopener noreferrer"
class="text-green-600">DevOps</a> &
<a href="https://github.com/SHSharkar" target="_blank" rel="noopener noreferrer" class="text-indigo-600">Md.
Sazzad Hossain Sharkar</a>
</p>
</footer>
<script>
function app() {
return {
input: '',
separator: '-',
caseType: 'lower',
showNotification: false,
notification: '',
get isCopyDisabled() {
return !this.input || !this.customSlugify(this.input);
},
customSlugify(input) {
let cleanStr = input.replace(/[^a-zA-Z0-9\s]/g, this.separator);
const options = {
replacement: this.separator,
remove: null,
lower: this.caseType === 'lower'
};
return slugify(cleanStr, options);
},
copyToClipboard(text) {
if (!text) return;
navigator.clipboard.writeText(text).then(() => {
this.notification = 'Copied to clipboard!';
this.showNotification = true;
setTimeout(() => this.showNotification = false, 1000);
}).catch(() => {
this.notification = 'Failed to copy!';
this.showNotification = true;
setTimeout(() => this.showNotification = false, 1000);
});
}
}
}
</script>
<script>
document.addEventListener('DOMContentLoaded', function () {
const footer = document.querySelector('footer p');
const year = new Date().getFullYear();
footer.innerHTML = footer.innerHTML.replace('{{current_year}}', year);
});
</script>
</body>
</html>