appscms-tools-theme 5.1.8 → 5.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,299 @@
1
+ // Auto-generated JS for Product Description
2
+ document.addEventListener("DOMContentLoaded", function () {
3
+ const form = document.getElementById("contentToolForm");
4
+ const tool = "product_description";
5
+
6
+ // Wait for Quill to be initialized
7
+ let quill;
8
+ const checkQuill = setInterval(() => {
9
+ if (window.quill) {
10
+ quill = window.quill;
11
+ clearInterval(checkQuill);
12
+ }
13
+ }, 100);
14
+
15
+ let input0 = form.querySelector('[name="input0"]');
16
+ let input1 = form.querySelector('[name="input1"]');
17
+ let language = form.querySelector('[name="language"]');
18
+ let tone = form.querySelector('[name="tone"]');
19
+
20
+ form.addEventListener("submit", async function (e) {
21
+ e.preventDefault();
22
+
23
+ // Check if Quill is available
24
+ if (!quill) {
25
+ console.error("Quill editor not found");
26
+ return;
27
+ }
28
+
29
+ // Show loading state
30
+ const submitButton = form.querySelector('button[type="submit"]');
31
+ const originalText = submitButton ? submitButton.textContent : '';
32
+ if (submitButton) {
33
+ submitButton.textContent = 'Generating...';
34
+ submitButton.disabled = true;
35
+ }
36
+
37
+ const options = {};
38
+
39
+ options["input[0]"] = input0.value;
40
+ options["input[1]"] = input1.value;
41
+ options["language"] = language.value;
42
+ options["tone"] = tone.value;
43
+
44
+ const body = {
45
+ tool: tool,
46
+ llm: "gemini",
47
+ model_name: "gemini-2.0-flash",
48
+ options: options
49
+ };
50
+
51
+ try {
52
+ const response = await fetch("https://contentool-api.onrender.com/api/v1/ecommerce-tools/product-description", {
53
+ method: "POST",
54
+ headers: {
55
+ "Content-Type": "application/json"
56
+ },
57
+ body: JSON.stringify(body)
58
+ });
59
+
60
+ const data = await response.json();
61
+
62
+ if (data.result) {
63
+ // Clear the editor first
64
+ quill.setText('');
65
+
66
+ // Parse and render markdown content
67
+ renderMarkdownToQuill(data.result, quill);
68
+
69
+ console.log("✅ Content generated successfully");
70
+ } else {
71
+ quill.setText("No output received from server.");
72
+ }
73
+ } catch (err) {
74
+ console.error("❌ API Error:", err);
75
+ quill.setText("Error: " + err.message);
76
+ } finally {
77
+ // Reset button state
78
+ if (submitButton) {
79
+ submitButton.textContent = originalText;
80
+ submitButton.disabled = false;
81
+ }
82
+ }
83
+ });
84
+ });
85
+
86
+ // Function to render markdown content to Quill editor
87
+ function renderMarkdownToQuill(markdownText, quill) {
88
+ // Clear editor
89
+ quill.setText('');
90
+
91
+ let index = 0;
92
+ const lines = markdownText.split('\n');
93
+
94
+ lines.forEach((line, lineIndex) => {
95
+ if (line.trim() === '') {
96
+ // Empty line - add line break
97
+ if (lineIndex < lines.length - 1) {
98
+ quill.insertText(index, '\n');
99
+ index += 1;
100
+ }
101
+ return;
102
+ }
103
+
104
+ // Handle different markdown patterns
105
+ if (line.startsWith('**') && line.endsWith('**') && line.length > 4) {
106
+ // Bold text (like **Product Title:** or **Key Features:**)
107
+ const text = line.replace(/^\*\*(.*?)\*\*$/, '$1');
108
+ quill.insertText(index, text, { 'bold': true });
109
+ index += text.length;
110
+ } else if (line.includes('**')) {
111
+ // Mixed bold and normal text (like **Product Title:** Coffee Mug)
112
+ const parts = line.split('**');
113
+ for (let i = 0; i < parts.length; i++) {
114
+ if (parts[i]) {
115
+ if (i % 2 === 1) {
116
+ // Odd index = bold text
117
+ quill.insertText(index, parts[i], { 'bold': true });
118
+ index += parts[i].length;
119
+ } else {
120
+ // Even index = normal text
121
+ quill.insertText(index, parts[i]);
122
+ index += parts[i].length;
123
+ }
124
+ }
125
+ }
126
+ } else if (line.startsWith('- ')) {
127
+ // Bullet points
128
+ const text = line.substring(2); // Remove '- '
129
+ quill.insertText(index, '• ' + text);
130
+ index += text.length + 2;
131
+ } else if (line.match(/^\d+\.\s/)) {
132
+ // Numbered lists
133
+ const match = line.match(/^(\d+\.\s)(.*)$/);
134
+ if (match) {
135
+ const number = match[1];
136
+ const content = match[2];
137
+
138
+ // Insert number in bold
139
+ quill.insertText(index, number, { 'bold': true });
140
+ index += number.length;
141
+
142
+ // Insert content in normal text
143
+ quill.insertText(index, content);
144
+ index += content.length;
145
+ } else {
146
+ quill.insertText(index, line);
147
+ index += line.length;
148
+ }
149
+ } else if (line.startsWith('### ')) {
150
+ // Headers (H3)
151
+ const text = line.substring(4);
152
+ quill.insertText(index, text, { 'bold': true });
153
+ index += text.length;
154
+ } else if (line.startsWith('## ')) {
155
+ // Headers (H2)
156
+ const text = line.substring(3);
157
+ quill.insertText(index, text, { 'bold': true, 'size': 'large' });
158
+ index += text.length;
159
+ } else if (line.startsWith('# ')) {
160
+ // Headers (H1)
161
+ const text = line.substring(2);
162
+ quill.insertText(index, text, { 'bold': true, 'size': 'huge' });
163
+ index += text.length;
164
+ } else if (line.startsWith('*') && line.endsWith('*') && line.length > 2) {
165
+ // Italic text
166
+ const text = line.replace(/^\*(.*?)\*$/, '$1');
167
+ quill.insertText(index, text, { 'italic': true });
168
+ index += text.length;
169
+ } else {
170
+ // Normal text
171
+ quill.insertText(index, line);
172
+ index += line.length;
173
+ }
174
+
175
+ // Add line break if not the last line
176
+ if (lineIndex < lines.length - 1) {
177
+ quill.insertText(index, '\n');
178
+ index += 1;
179
+ }
180
+ });
181
+ }
182
+
183
+ // Alternative function using marked.js if available
184
+ function renderMarkdownToQuillWithMarked(markdownText, quill) {
185
+ if (typeof marked !== 'undefined') {
186
+ try {
187
+ // Convert markdown to HTML
188
+ const html = marked.parse(markdownText);
189
+
190
+ // Create a temporary div to parse HTML
191
+ const tempDiv = document.createElement('div');
192
+ tempDiv.innerHTML = html;
193
+
194
+ // Clear editor
195
+ quill.setText('');
196
+
197
+ let index = 0;
198
+
199
+ // Process each child element
200
+ tempDiv.childNodes.forEach((node) => {
201
+ if (node.nodeType === Node.TEXT_NODE) {
202
+ const text = node.textContent.trim();
203
+ if (text) {
204
+ quill.insertText(index, text);
205
+ index += text.length;
206
+ }
207
+ } else if (node.nodeType === Node.ELEMENT_NODE) {
208
+ switch (node.tagName.toLowerCase()) {
209
+ case 'h1':
210
+ quill.insertText(index, node.textContent, { 'bold': true, 'size': 'huge' });
211
+ index += node.textContent.length;
212
+ break;
213
+ case 'h2':
214
+ quill.insertText(index, node.textContent, { 'bold': true, 'size': 'large' });
215
+ index += node.textContent.length;
216
+ break;
217
+ case 'h3':
218
+ case 'h4':
219
+ case 'h5':
220
+ case 'h6':
221
+ quill.insertText(index, node.textContent, { 'bold': true });
222
+ index += node.textContent.length;
223
+ break;
224
+ case 'strong':
225
+ case 'b':
226
+ quill.insertText(index, node.textContent, { 'bold': true });
227
+ index += node.textContent.length;
228
+ break;
229
+ case 'em':
230
+ case 'i':
231
+ quill.insertText(index, node.textContent, { 'italic': true });
232
+ index += node.textContent.length;
233
+ break;
234
+ case 'ul':
235
+ node.querySelectorAll('li').forEach((li) => {
236
+ quill.insertText(index, '• ' + li.textContent + '\n');
237
+ index += li.textContent.length + 3;
238
+ });
239
+ break;
240
+ case 'ol':
241
+ node.querySelectorAll('li').forEach((li, i) => {
242
+ const number = `${i + 1}. `;
243
+ quill.insertText(index, number, { 'bold': true });
244
+ index += number.length;
245
+ quill.insertText(index, li.textContent + '\n');
246
+ index += li.textContent.length + 1;
247
+ });
248
+ break;
249
+ case 'p':
250
+ const pText = node.textContent.trim();
251
+ if (pText) {
252
+ quill.insertText(index, pText + '\n');
253
+ index += pText.length + 1;
254
+ }
255
+ break;
256
+ case 'br':
257
+ quill.insertText(index, '\n');
258
+ index += 1;
259
+ break;
260
+ default:
261
+ const defaultText = node.textContent.trim();
262
+ if (defaultText) {
263
+ quill.insertText(index, defaultText);
264
+ index += defaultText.length;
265
+ }
266
+ }
267
+ }
268
+ });
269
+
270
+ // Add final formatting cleanup
271
+ if (index > 0) {
272
+ quill.insertText(index, '\n');
273
+ }
274
+
275
+ } catch (error) {
276
+ console.error('Error parsing markdown with marked.js:', error);
277
+ // Fallback to basic markdown parsing
278
+ renderMarkdownToQuill(markdownText, quill);
279
+ }
280
+ } else {
281
+ // Fallback to basic markdown parsing
282
+ renderMarkdownToQuill(markdownText, quill);
283
+ }
284
+ }
285
+
286
+ // Enhanced function that tries marked.js first, then falls back to basic parsing
287
+ function renderContentToQuill(content, quill) {
288
+ // Try to detect if content is markdown
289
+ const hasMarkdownPatterns = /\*\*|\*|#{1,6}\s|^\s*[-*+]\s|^\s*\d+\.\s/m.test(content);
290
+
291
+ if (hasMarkdownPatterns && typeof marked !== 'undefined') {
292
+ renderMarkdownToQuillWithMarked(content, quill);
293
+ } else if (hasMarkdownPatterns) {
294
+ renderMarkdownToQuill(content, quill);
295
+ } else {
296
+ // Plain text
297
+ quill.setText(content);
298
+ }
299
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appscms-tools-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.8
4
+ version: 5.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - vivek-appscms
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-14 00:00:00.000000000 Z
11
+ date: 2025-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -63,6 +63,11 @@ files:
63
63
  - README.md
64
64
  - _data/.DS_Store
65
65
  - _data/about/en/about.json
66
+ - _data/aitools/en/ai-article-writer.json
67
+ - _data/aitools/en/amazon-product-bullet-points-generator.json
68
+ - _data/aitools/en/amazon-product-description-generator.json
69
+ - _data/aitools/en/brand-name-generator.json
70
+ - _data/aitools/en/product-description.json
66
71
  - _data/blog/alertbar.yml
67
72
  - _data/blog/authors.yml
68
73
  - _data/blog/blog.yml
@@ -121,6 +126,11 @@ files:
121
126
  - _includes/Usp/usp.html
122
127
  - _includes/adblocker.html
123
128
  - _includes/adsense/adsense.html
129
+ - _includes/aitools/ai-article-writer.html
130
+ - _includes/aitools/amazon-product-bullet-points-generator.html
131
+ - _includes/aitools/amazon-product-description-generator.html
132
+ - _includes/aitools/brand-name-generator.html
133
+ - _includes/aitools/product-description.html
124
134
  - _includes/alternates/alternates.html
125
135
  - _includes/appscms/.DS_Store
126
136
  - _includes/appscms/category-tabs/category-tabs.html
@@ -237,6 +247,7 @@ files:
237
247
  - _layouts/calculator.html
238
248
  - _layouts/categories.html
239
249
  - _layouts/contactUs.html
250
+ - _layouts/content-tool-ai copy 2.html
240
251
  - _layouts/content-tool-ai copy.html
241
252
  - _layouts/content-tool-ai-2.html
242
253
  - _layouts/content-tool-ai.html
@@ -551,6 +562,10 @@ files:
551
562
  - assets/js/TopScroll.js
552
563
  - assets/js/adBlocker.js
553
564
  - assets/js/ads.js
565
+ - assets/js/ai-article-writer.js
566
+ - assets/js/amazon-product-bullet-points-generator.js
567
+ - assets/js/amazon-product-bullet-points-generator3.js
568
+ - assets/js/amazon-product-description-generator.js
554
569
  - assets/js/append-div.js
555
570
  - assets/js/appscms-infographics.js
556
571
  - assets/js/appscms-login.js
@@ -559,6 +574,7 @@ files:
559
574
  - assets/js/appscms-theme.js
560
575
  - assets/js/batch.js
561
576
  - assets/js/blog-topic-ideas.js
577
+ - assets/js/brand-name-generator.js
562
578
  - assets/js/calculator-tooltip.js
563
579
  - assets/js/devtools.js
564
580
  - assets/js/face-api.js
@@ -604,6 +620,7 @@ files:
604
620
  - assets/js/partytown/partytown-sw.js
605
621
  - assets/js/perspective.min.js
606
622
  - assets/js/photo-effects.json
623
+ - assets/js/product-description.js
607
624
  - assets/js/redirectResult.js
608
625
  - assets/js/sharePage.js
609
626
  - assets/js/testing-batch.js