// removeMedia.js function removeMedia($) { try { // Remove images $('img').remove(); // Remove video elements $('video, source[type^="video"], object, embed').remove(); // Remove audio elements $('audio, source[type^="audio"]').remove(); // Remove canvas elements $('canvas').remove(); // Remove SVG elements $('svg').remove(); // Remove picture elements $('picture').remove(); // Remove iframes $('iframe').remove(); // Remove media-specific attributes from elements $('[poster]').removeAttr('poster'); $('[background]').removeAttr('background'); // Remove inline media backgrounds $('*[style*="background"]').each((_, el) => { const $el = $(el); const style = $el.attr('style'); if (style) { const newStyle = style.replace(/background(-image)?:\s*url\([^)]+\);?/gi, ''); if (newStyle.trim()) { $el.attr('style', newStyle); } else { $el.removeAttr('style'); } } }); return { success: true, error: null }; } catch (err) { return { success: false, error: err.message }; } } module.exports = { removeMedia };