@hortonstudio/main 1.2.4 → 1.2.5
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.
- package/index.js +22 -4
- package/package.json +1 -1
package/index.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
// ver 1.2.
|
1
|
+
// ver 1.2.4
|
2
2
|
|
3
3
|
const API_NAME = 'hsmain';
|
4
4
|
|
5
|
-
console.log(`🟢 ${API_NAME} v1.2.
|
5
|
+
console.log(`🟢 ${API_NAME} v1.2.4 initializing...`);
|
6
6
|
console.log('🔍 DOM state:', document.readyState);
|
7
7
|
console.log('🔍 Script URL:', import.meta.url);
|
8
8
|
|
@@ -229,10 +229,28 @@ const initializeAPI = () => {
|
|
229
229
|
const existingRequests = Array.isArray(existingAPI) ? existingAPI : [];
|
230
230
|
console.log(`📝 Existing queued requests:`, existingRequests);
|
231
231
|
|
232
|
-
|
233
|
-
|
232
|
+
// Try multiple approaches to find the script tag
|
233
|
+
let scripts = [...document.querySelectorAll(`script[data-hs-main][src="${import.meta.url}"]`)];
|
234
234
|
console.log(`📄 Found ${scripts.length} script tags with exact src match`);
|
235
|
+
|
236
|
+
// Fallback: find any script with data-hs-main
|
237
|
+
if (scripts.length === 0) {
|
238
|
+
scripts = [...document.querySelectorAll('script[data-hs-main]')];
|
239
|
+
console.log(`📄 Fallback: Found ${scripts.length} script tags with data-hs-main`);
|
240
|
+
}
|
241
|
+
|
242
|
+
// Fallback: find script with similar src (same package name)
|
243
|
+
if (scripts.length === 0) {
|
244
|
+
scripts = [...document.querySelectorAll('script[src*="@hortonstudio/main"]')];
|
245
|
+
console.log(`📄 Fallback: Found ${scripts.length} script tags with @hortonstudio/main`);
|
246
|
+
}
|
247
|
+
|
248
|
+
const scriptTag = scripts[0];
|
235
249
|
console.log(`🏷️ Using script tag:`, scriptTag);
|
250
|
+
if (scriptTag) {
|
251
|
+
console.log(`🏷️ Script src:`, scriptTag.src);
|
252
|
+
console.log(`🏷️ Script attributes:`, [...scriptTag.attributes].map(a => `${a.name}="${a.value}"`).join(' '));
|
253
|
+
}
|
236
254
|
|
237
255
|
// Handle rich text blocks
|
238
256
|
const richTextBlocks = document.querySelectorAll('.w-richtext');
|