-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainpage.html
106 lines (91 loc) · 3.08 KB
/
mainpage.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Italic Serif Word Generator</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
padding: 20px;
background-color: #f0f0f0;
}
#container {
position: relative;
width: 80%;
height: 500px;
margin: 20px auto;
border: 2px solid #ccc;
background-color: white;
overflow: hidden;
}
.word {
position: absolute;
font-family: "Times New Roman", serif;
font-style: italic;
font-size: 24px;
background-color: yellow;
padding: 5px;
border-radius: 4px;
}
#userInput {
font-size: 18px;
padding: 10px;
width: 300px;
margin-bottom: 20px;
}
button {
font-size: 18px;
padding: 10px 20px;
cursor: pointer;
}
</style>
</head>
<body>
<h1>Italic Serif Word Generator</h1>
<p>Enter a word below and click "Generate" to display multiple highlighted italic words!</p>
<input type="text" id="userInput" placeholder="Enter a word">
<button onclick="generateWords()">Generate</button>
<div id="container"></div>
<script>
// Mapping of regular characters to italic serif Unicode equivalents
const charMap = {
'a': '𝑎', 'b': '𝑏', 'c': '𝑐', 'd': '𝑑', 'e': '𝑒', 'f': '𝑓', 'g': '𝑔', 'h': 'ℎ',
'i': '𝑖', 'j': '𝑗', 'k': '𝑘', 'l': '𝑙', 'm': '𝑚', 'n': '𝑛', 'o': '𝑜', 'p': '𝑝',
'q': '𝑞', 'r': '𝑟', 's': '𝑠', 't': '𝑡', 'u': '𝑢', 'v': '𝑣', 'w': '𝑤', 'x': '𝑥',
'y': '𝑦', 'z': '𝑧',
'A': '𝐴', 'B': '𝐵', 'C': '𝐶', 'D': '𝐷', 'E': '𝐸', 'F': '𝐹', 'G': '𝐺', 'H': '𝐻',
'I': '𝐼', 'J': '𝐽', 'K': '𝐾', 'L': '𝐿', 'M': '𝑀', 'N': '𝑁', 'O': '𝑂', 'P': '𝑃',
'Q': '𝑄', 'R': '𝑅', 'S': '𝑆', 'T': '𝑇', 'U': '𝑈', 'V': '𝑉', 'W': '𝑊', 'X': '𝑋',
'Y': '𝑌', 'Z': '𝑍'
};
function convertToSerifItalicUnicode(input) {
let italicText = '';
for (let i = 0; i < input.length; i++) {
let char = input[i];
italicText += charMap[char] || char;
}
return italicText;
}
function generateWords() {
let input = document.getElementById('userInput').value;
if (input.length > 2) {
let container = document.getElementById('container');
// Create multiple words in random positions
for (let i = 0; i < 5; i++) {
let word = document.createElement('div');
word.classList.add('word');
word.textContent = convertToSerifItalicUnicode(input);
// Random positioning within the container
let xPos = Math.random() * (container.offsetWidth - 100);
let yPos = Math.random() * (container.offsetHeight - 40);
word.style.left = `${xPos}px`;
word.style.top = `${yPos}px`;
container.appendChild(word);
}
}
}
</script>
</body>
</html>