Repository navigation
Expand file tree
/
Copy pathLongdiscoTest.html
More file actions
227 lines (195 loc) · 8.75 KB
/
Copy pathLongdiscoTest.html
File metadata and controls
227 lines (195 loc) · 8.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
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
218
219
220
221
222
223
224
225
226
227
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center; /* Center content vertically */
background-color: #f0f0f0; /* Set background color */
min-height: 100vh; /* Ensure full viewport height */
}
h1 {
background-color: #4CAF50; /* Header background color */
color: white; /* Header text color */
padding: 10px; /* Header padding */
text-align: center;
}
#container {
display: flex;
flex: 1;
justify-content: space-between; /* Space out the elements */
width: 90%; /* Set the container width */
background-color: #fff; /* Container background color */
border-radius: 5px; /* Add border radius */
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Add shadow */
margin-top: 20px; /* Add top margin */
}
#leftBox, #rightBox {
flex: 1;
padding: 20px; /* Increase padding */
box-sizing: border-box;
}
#leftBox textarea, #rightBox textarea {
width: 100%; /* Full width text areas */
padding: 10px; /* Padding for text areas */
border: 1px solid #ccc; /* Add a border */
border-radius: 5px; /* Add border radius */
}
#convertButton {
margin-top: 10px; /* Add top margin */
padding: 10px 20px; /* Increase padding */
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
#counter {
margin-top: 10px;
}
#htmlBox {
flex: 1;
padding: 20px; /* Increase padding */
box-sizing: border-box;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
margin-top: 20px;
}
#htmlBox h2 {
margin-top: 0;
color: #4CAF50; /* Heading color */
}
#htmlOutput {
border: 1px solid #ccc;
padding: 10px;
border-radius: 5px;
}
/* Style for the converted text */
#rightBox #outputBox {
border: 1px solid #4CAF50; /* Border color for converted text */
padding: 10px;
border-radius: 5px;
background-color: #f0f0f0; /* Background color for converted text */
color: #333; /* Text color for converted text */
font-family: Arial, sans-serif;
font-size: 16px;
line-height: 1.6;
}
</style>
</head>
<body>
<h1> WS Long Description Tool </h1>
<div id="container">
<div id="leftBox">
<grammarly-editor-plugin clientId="client_7LYtAZtGKRVHfCaESL3J8R" data-v-552086f4>
<textarea id="inputBox" rows="10" placeholder="Enter text"></textarea>
</grammarly-editor-plugin>
<div id="leftCounter" class="counter"></div>
</div>
<div id="rightBox">
<textarea id="outputBox" rows="10" placeholder="Converted text"></textarea>
<div id="rightCounter" class="counter"></div>
</div>
<button id="convertButton" onclick="convertLongDescription()">Convert</button>
</div>
<div id="htmlBox" style="width: 80%;">
<h2>Fix Special Characters</h2>
<div id="htmlOutput"></div>
<button onclick="convertToHTML()">Click to Fix Special Characters</button>
<button onclick="copyToClipboard()">Copy HTML</button> <!-- Add the copy button -->
</div>
<div>
<h1>Instructions: <a href="https://docs.google.com/document/d/1dvMZ7-vK3PykbRRRWjDSqgFD-uFATRzMAZLkm9Gaxp0/edit#heading=h.x5plgr8op2n5">Phase 4 Review and Revise Product Long Description</a></h1>
<ol>
<li><strong>The Long Description will start with the First Link which will contain the Product Title/Name, which will be the first line of the Enter Text Box.</strong></li>
<li><strong>Followed by the first line of the Product Title, there would be 5 Bullet Pointers encapsulated as below Example:
<pre>
<p> <strong>Title</strong> </p>
<ul>
<li>Feature Bullet 1</li>
<li>Feature Bullet 2</li>
<li>Feature Bullet 3</li>
<li>Feature Bullet 4</li>
<li>Feature Bullet 5</li>
</ul>
</pre>
<li><strong> All product-long descriptions need to have at least five bullets.
<li><strong>If the product has fewer than five bullets
First, see if any of the existing bullets can be broken up into separate claims/features
If more bullets are still needed, pull info out of the product's short description or label, prioritizing features, claims, and product size
Claims are things like “Paraben Free,” “Vegan”, “Organic,” and “Cruelty-Free”
<li><strong><a href="https://drive.google.com/file/d/16AB6UCd5ihPNpo3wC0zolrRuiIGuonOY/view?usp=sharing">The trick for Long Description Video(Old)</a>
<li><strong><a href="https://drive.google.com/file/d/1g3sg5r3wXkmNhFSejqmtInTzVtX-6tLi/view?usp=sharing">Notes for Long Description</a>
<li><strong><a href="https://docs.google.com/spreadsheets/d/1nm0R_-snilgPF8V7PUbiHCYo3BKrajBpd8_bFahzB5s/edit#gid=0">Long Description Quick Input Formula Template(Old)</a>
<li><strong><a href="https://www.awesomescreenshot.com/video/22489102?key=e9f93dc4825d3da467b464db6b818f22">How to Use above Tool? Video</a>
</strong></li>
<ul id="bulletList">
<!-- Bullet points will be added dynamically here -->
</ul>
</ol>
</div>
<div id="app"></div>
<script src="./index.mjs" type="module"></script>
<script src="https://cdn.jsdelivr.net/npm/@grammarly/editor-sdk?clientId=client_7LYtAZtGKRVHfCaESL3J8R"></script>
##########################################################################################
<script>
function convertLongDescription() {
var inputText = document.getElementById('inputBox').value;
var outputText = document.getElementById('outputBox');
var leftCounter = document.getElementById('leftCounter');
var rightCounter = document.getElementById('rightCounter');
// Split the input text into lines
var lines = inputText.split('\n');
// Use a default title
var productTitle = "Title";
// Create the Long Description structure with a blank line after the title
var longDescription = '<p><strong>' + productTitle + '</strong></p>\n\n<ul>\n';
// Iterate through all the lines and add them as list items
for (var i = 0; i < lines.length; i++) {
// Skip empty lines
if (lines[i].trim() !== '') {
// Ensure we don't exceed the number of lines in input
var bulletPoint = lines[i];
// Add bullet points with proper formatting
longDescription += '<li>' + bulletPoint + '</li>\n';
}
}
longDescription += '</ul>';
outputText.innerHTML = longDescription;
// Update character counter
leftCounter.innerText = 'Characters: ' + inputText.length;
rightCounter.innerText = 'Characters: ' + longDescription.length;
}
// Function to convert the input into HTML format
function convertToHTML() {
var inputText = document.getElementById('inputBox').value;
var htmlOutput = document.getElementById('htmlOutput');
// Replace special character codes with symbols
var formattedText = inputText.replace(/"/g, '"');
formattedText = formattedText.replace(/&/g, '&');
formattedText = formattedText.replace(/</g, '<');
formattedText = formattedText.replace(/>/g, '>');
// Split the input text into lines
var lines = formattedText.split('\n');
// Start with an empty HTML structure for the list
var htmlDescription = '<ul>\n';
for (var i = 0; i < lines.length; i++) {
// Skip empty lines
if (lines[i].trim() !== '') {
htmlDescription += ' <li>' + lines[i] + '</li>\n';
}
}
htmlDescription += '</ul>';
// Set the innerHTML to insert HTML correctly
htmlOutput.innerHTML = htmlDescription;
}
</script>
</body>
</html>