-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColorKeywords.html
More file actions
217 lines (202 loc) · 7.51 KB
/
ColorKeywords.html
File metadata and controls
217 lines (202 loc) · 7.51 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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<!DOCTYPE html>
<html>
<head>
<title>Keyword Formatter</title>
<style>
.angle-brackets {
color: red;
}
</style>
</head>
<body>
<h1>Keyword Formatter</h1>
<!-- Text box for input -->
<textarea id="unformattedText" rows="5" cols="40" placeholder="Insert unformatted text here"></textarea>
<br>
<!-- Convert button -->
<button onclick="convertText()">Convert</button>
<br>
<!-- Text box for formatted output -->
<div id="formattedText"></div>
<script>
// Your JavaScript code here
var keywords = {
"allergy medicine": "red",
"allergy meds": "red",
"allergy pills": "red",
"allergy relief": "red",
"childrens allergy meds": "red",
"childrens allergy medicine": "red",
"childrens allergy relief": "red",
"childrens allergy pills": "red",
"allergy tablets": "red",
"allergy tabs": "red",
"allergy travel pack": "red",
"cetirizine": "red",
"antihistamine": "red",
"24 hour allergy relief": "red",
"allergy capsules": "red",
"cleansing wipes": "red",
"gentle wash": "red",
"baby gentle wash": "red",
"foaming cleanser": "red",
"texture renewing body cream": "red",
"texture renewing body lotion": "red",
"kids body wash": "red",
"kids body lotion": "red",
"baby oil": "red",
"baby lotion": "red",
"nourishing baby wash": "red",
"gentle baby body wash": "red",
"baby cleansing cloths": "red",
"gentle cleansing cloths": "red",
"newborn body wash": "red",
"newborn shampoo": "red",
"baby shampoo": "red",
"bedtime baby wash": "red",
"calming baby wash": "red",
"baby powder": "red",
"baby conditioner": "red",
"head to toe cleansing cloths": "red",
"hand and face cleansing wipes": "red",
"baby wipes": "red",
"newborn lotion": "red",
"baby oil gel": "red",
"kids shampoo": "red",
"kids conditioner": "red",
"lotion": "red",
"body lotion": "red",
"moisturizing lotion": "red",
"moisturizing body lotion": "red",
"moisturizer": "red",
"daily moisturizer": "red",
"dry skin": "red",
"body wash": "red",
"body scrub": "red",
"exfoliating body wash": "red",
"exfoliating body scrub": "red",
"moisturizing body wash": "red",
"fragrance free body scrub": "red",
"fragrance free body lotion": "red",
"frangrance free lotion": "red",
"daily moisturizing body lotion": "red",
"oil mist": "red",
"moisturizing oil mist": "red",
"body gel": "red",
"gel cream": "red",
"body oil": "red",
"health care": "red",
"bandages": "red",
"first aid": "red",
"first aid kit": "red",
"oral care": "red",
"oral hygiene": "red",
"mouthwash": "red",
"oral rinse": "red",
"mouth care": "red",
"mouth rinse": "red",
"mint mouthwash": "red",
"cool mint mouthwash": "red",
"total care mouthwash": "red",
"oral antiseptic": "red",
"antiseptic mouthwash": "red",
"anticavity mouthwash": "red",
"anticavity": "red",
"antiseptic": "red",
"antigingivitus": "red",
"fluoride": "red",
"dental health": "red",
"fluoride mouthwash": "red",
"floss": "red",
"fresh breath": "red",
"bad breath": "red",
"mint": "red",
"fresh mint mouthwash": "red",
"alcohol free mouthwash": "red",
"alcohol free": "red",
"zero alcohol mouthwash": "red",
"plaque": "red",
"pain medicine": "red",
"pain meds": "red",
"pain relief": "red",
"acetaminophen": "red",
"extra strength pain relief": "red",
"kids pain meds": "red",
"kids pain medicine": "red",
"kids pain relief": "red",
"childrens pain relief": "red",
"childrens pain meds": "red",
"childrens pain medicine": "red",
"fever medicine": "red",
"arthritis relief": "red",
"arthritis medicine": "red",
"arthritis meds": "red",
"muscle ache medicine": "red",
"muscle ache relief": "red",
"muscle pain relief": "red",
"night time pain medicine": "red",
"night time pain relief": "red",
"fever reducer": "red",
"ibuprofen": "red",
"nsaid": "red",
"liquid fever relief": "red",
"fever relief syrup": "red",
"kids sleep aid": "red",
"sunscreen": "red",
"moisturizing sunscreen": "red",
"sunscreen lotion": "red",
"sunscreen spray": "red",
"sunscreen stick": "red",
"spf moisturizer": "red",
"spf daily moisturizer": "red",
"allergy": "red",
"kids allergy": "red",
"pain": "red",
"pain - children's": "red",
"body lotion": "red",
"hair care": "red",
"baby lotion": "red",
"baby treatments": "red",
"baby wash": "red",
"oral - mouthwash": "red",
"first aid": "red",
"body lotion - sunscreen": "red",
"digestive": "red",
"body wash": "red",
"men's hair": "red",
"vitamins - kids": "red"
};
// Function to format keywords in text
function formatKeywordsInText(text) {
// Split the text into words
var words = text.split(" ");
// Create a formatted sentence
var formattedSentence = "";
// Loop through the words and format keywords
for (var i = 0; i < words.length; i++) {
var word = words[i];
var color = keywords[word.toLowerCase()];
if (color) {
// If the word is a keyword, format it
formattedSentence += '<span style="font-weight: bold; color: ' + color + ';">' + word + '</span>';
} else {
// If not a keyword, append the word as is
formattedSentence += word;
}
// Add a space after each word
formattedSentence += " ";
}
return formattedSentence;
}
// Function to convert and display formatted text
function convertText() {
// Get the unformatted text from the input text box
var unformattedText = document.getElementById("unformattedText").value;
// Format the text using the formatKeywordsInText function
var formattedText = formatKeywordsInText(unformattedText);
// Set the formatted text as the content of the output text box
document.getElementById("formattedText").innerHTML = formattedText;
}
</script>
</body>
</html>