-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext-shortener.html
More file actions
87 lines (71 loc) · 1.75 KB
/
Copy pathtext-shortener.html
File metadata and controls
87 lines (71 loc) · 1.75 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
<!DOCTYPE html>
<html>
<head>
<title>Text Shortener Tool</title>
<link rel="icon" href="favicon.png">
<style>
body {
font-family: Arial, sans-serif;
background: #f0f8ff;
padding: 20px;
display: flex;
flex-direction: column;
align-items: center;
}
h2 {
color: #007bff;
text-align: center;
}
#textBox {
width: 90%;
max-width: 500px;
min-height: 150px;
padding: 10px;
font-size: 16px;
border-radius: 8px;
border: 1px solid #ccc;
background: #fff;
margin-bottom: 15px;
outline: none;
overflow-y: auto;
white-space: pre-wrap;
}
button {
padding: 10px 20px;
font-size: 16px;
border: none;
background-color: #007bff;
color: white;
border-radius: 8px;
cursor: pointer;
margin-bottom: 15px;
}
button:hover {
background-color: #0056b3;
}
#output {
font-size: 16px;
margin-top: 20px;
color: #333;
}
</style>
</head>
<body>
<h2>Text Shortener Tool</h2>
<div id="textBox" contenteditable="true" placeholder="Paste or type your text here..."></div>
<button onclick="shortenText()">Shorten Text</button>
<div id="output"></div>
<script>
function shortenText() {
var content = document.getElementById("textBox").innerText.trim();
if (content.length <= 100) {
document.getElementById("output").innerText = "Text is already short!";
return;
}
// Shorten text to the first 100 characters and add ellipsis
var shortened = content.substring(0, 100) + "...";
document.getElementById("output").innerText = "Shortened Text: " + shortened;
}
</script>
</body>
</html>