This commit is contained in:
Josh at WLTechBlog
2025-12-16 14:01:21 -07:00
parent 148b948a4b
commit 6f9839ee86

View File

@@ -13059,8 +13059,8 @@ func (d *Daemon) extractDiviStructure(tabID string, timeout int) (*DiviStructure
} }
// JavaScript to extract Divi structure // JavaScript to extract Divi structure
jsCode := ` // Note: page.Eval expects a function expression, not an IIFE
(function() { jsCode := `() => {
const result = { const result = {
url: window.location.href, url: window.location.href,
sections: [], sections: [],
@@ -13198,8 +13198,7 @@ func (d *Daemon) extractDiviStructure(tabID string, timeout int) (*DiviStructure
}); });
return result; return result;
})(); }`
`
// Execute JavaScript with timeout // Execute JavaScript with timeout
var resultData interface{} var resultData interface{}
@@ -13265,8 +13264,8 @@ func (d *Daemon) extractDiviImages(tabID string, timeout int) ([]DiviImage, erro
} }
// JavaScript to extract images // JavaScript to extract images
jsCode := ` // Note: page.Eval expects a function expression, not an IIFE
(function() { jsCode := `() => {
const images = []; const images = [];
let imageIndex = 0; let imageIndex = 0;
@@ -13310,8 +13309,7 @@ func (d *Daemon) extractDiviImages(tabID string, timeout int) ([]DiviImage, erro
}); });
return images; return images;
})(); }`
`
// Execute JavaScript with timeout // Execute JavaScript with timeout
var resultData interface{} var resultData interface{}
@@ -13377,8 +13375,8 @@ func (d *Daemon) extractDiviContent(tabID string, timeout int) (*DiviContent, er
} }
// JavaScript to extract content // JavaScript to extract content
jsCode := ` // Note: page.Eval expects a function expression, not an IIFE
(function() { jsCode := `() => {
const result = { const result = {
url: window.location.href, url: window.location.href,
modules: [], modules: [],
@@ -13458,8 +13456,7 @@ func (d *Daemon) extractDiviContent(tabID string, timeout int) (*DiviContent, er
result.metadata.total_images = result.images.length; result.metadata.total_images = result.images.length;
return result; return result;
})(); }`
`
// Execute JavaScript with timeout // Execute JavaScript with timeout
var resultData interface{} var resultData interface{}