document.addEventListener('DOMContentLoaded', function() {
// Create the container for the PDF tools widget
const pdfToolsContainer = document.createElement('div');
pdfToolsContainer.className = 'pdf-tools-container';
pdfToolsContainer.style.maxWidth = '800px';
pdfToolsContainer.style.margin = '0 auto';
pdfToolsContainer.style.fontFamily = 'Arial, sans-serif';
// Add title
const title = document.createElement('h2');
title.textContent = 'PDF Tools';
title.style.textAlign = 'center';
title.style.color = '#333';
title.style.marginBottom = '30px';
pdfToolsContainer.appendChild(title);
// Create the tools grid
const toolsGrid = document.createElement('div');
toolsGrid.style.display = 'grid';
toolsGrid.style.gridTemplateColumns = 'repeat(auto-fit, minmax(250px, 1fr))';
toolsGrid.style.gap = '20px';
toolsGrid.style.padding = '0 15px';
// PDF Tools data
const tools = [
{
title: 'Merge PDF',
description: 'Combine PDFs in the order you want with the easiest PDF merger available.',
icon: '📄↔📄',
url: 'https://www.ilovepdf.com/merge_pdf'
},
{
title: 'Split PDF',
description: 'Separate one page or a whole set for easy conversion into independent PDF files.',
icon: '📄➡📄📄',
url: 'https://www.ilovepdf.com/split_pdf'
},
{
title: 'Compress PDF',
description: 'Reduce file size while optimizing for maximal PDF quality.',
icon: '📄↓',
url: 'https://www.ilovepdf.com/compress_pdf'
}
];
// Create tool cards
tools.forEach(tool => {
const toolCard = document.createElement('div');
toolCard.style.backgroundColor = '#fff';
toolCard.style.borderRadius = '8px';
toolCard.style.padding = '20px';
toolCard.style.boxShadow = '0 4px 8px rgba(0,0,0,0.1)';
toolCard.style.transition = 'transform 0.3s ease';
toolCard.style.cursor = 'pointer';
toolCard.style.display = 'flex';
toolCard.style.flexDirection = 'column';
toolCard.style.height = '100%';
// Add hover effect
toolCard.addEventListener('mouseenter', () => {
toolCard.style.transform = 'translateY(-5px)';
});
toolCard.addEventListener('mouseleave', () => {
toolCard.style.transform = 'none';
});
// Add click event to redirect to the tool
toolCard.addEventListener('click', () => {
window.open(tool.url, '_blank');
});
// Add icon
const icon = document.createElement('div');
icon.textContent = tool.icon;
icon.style.fontSize = '40px';
icon.style.textAlign = 'center';
icon.style.marginBottom = '15px';
toolCard.appendChild(icon);
// Add title
const cardTitle = document.createElement('h3');
cardTitle.textContent = tool.title;
cardTitle.style.margin = '0 0 10px 0';
cardTitle.style.color = '#2c3e50';
toolCard.appendChild(cardTitle);
// Add description
const description = document.createElement('p');
description.textContent = tool.description;
description.style.margin = '0';
description.style.color = '#7f8c8d';
description.style.fontSize = '14px';
toolCard.appendChild(description);
// Add button
const button = document.createElement('div');
button.textContent = 'Use Tool';
button.style.marginTop = '15px';
button.style.padding = '8px 15px';
button.style.backgroundColor = '#e74c3c';
button.style.color = 'white';
button.style.borderRadius = '4px';
button.style.display = 'inline-block';
button.style.alignSelf = 'flex-start';
button.style.fontSize = '14px';
toolCard.appendChild(button);
toolsGrid.appendChild(toolCard);
});
pdfToolsContainer.appendChild(toolsGrid);
// Add some custom CSS
const style = document.createElement('style');
style.textContent = `
@media (max-width: 600px) {
.pdf-tools-container {
padding: 0 10px;
}
}
`;
document.head.appendChild(style);
// Insert the widget into the page
const targetElement = document.querySelector('.elementor-widget-container'); // Adjust selector as needed
if (targetElement) {
targetElement.appendChild(pdfToolsContainer);
} else {
document.body.appendChild(pdfToolsContainer);
}
});
document.addEventListener('DOMContentLoaded', function() {
// Create the container for the PDF tools widget
const pdfToolsContainer = document.createElement('div');
pdfToolsContainer.className = 'pdf-tools-container';
pdfToolsContainer.style.maxWidth = '800px';
pdfToolsContainer.style.margin = '0 auto';
pdfToolsContainer.style.fontFamily = 'Arial, sans-serif';
// Add title
const title = document.createElement('h2');
title.textContent = 'PDF Tools';
title.style.textAlign = 'center';
title.style.color = '#333';
title.style.marginBottom = '30px';
pdfToolsContainer.appendChild(title);
// Create the tools grid
const toolsGrid = document.createElement('div');
toolsGrid.style.display = 'grid';
toolsGrid.style.gridTemplateColumns = 'repeat(auto-fit, minmax(250px, 1fr))';
toolsGrid.style.gap = '20px';
toolsGrid.style.padding = '0 15px';
// PDF Tools data
const tools = [
{
title: 'Merge PDF',
description: 'Combine PDFs in the order you want with the easiest PDF merger available.',
icon: '📄↔📄',
url: 'https://www.ilovepdf.com/merge_pdf'
},
{
title: 'Split PDF',
description: 'Separate one page or a whole set for easy conversion into independent PDF files.',
icon: '📄➡📄📄',
url: 'https://www.ilovepdf.com/split_pdf'
},
{
title: 'Compress PDF',
description: 'Reduce file size while optimizing for maximal PDF quality.',
icon: '📄↓',
url: 'https://www.ilovepdf.com/compress_pdf'
}
];
// Create tool cards
tools.forEach(tool => {
const toolCard = document.createElement('div');
toolCard.style.backgroundColor = '#fff';
toolCard.style.borderRadius = '8px';
toolCard.style.padding = '20px';
toolCard.style.boxShadow = '0 4px 8px rgba(0,0,0,0.1)';
toolCard.style.transition = 'transform 0.3s ease';
toolCard.style.cursor = 'pointer';
toolCard.style.display = 'flex';
toolCard.style.flexDirection = 'column';
toolCard.style.height = '100%';
// Add hover effect
toolCard.addEventListener('mouseenter', () => {
toolCard.style.transform = 'translateY(-5px)';
});
toolCard.addEventListener('mouseleave', () => {
toolCard.style.transform = 'none';
});
// Add click event to redirect to the tool
toolCard.addEventListener('click', () => {
window.open(tool.url, '_blank');
});
// Add icon
const icon = document.createElement('div');
icon.textContent = tool.icon;
icon.style.fontSize = '40px';
icon.style.textAlign = 'center';
icon.style.marginBottom = '15px';
toolCard.appendChild(icon);
// Add title
const cardTitle = document.createElement('h3');
cardTitle.textContent = tool.title;
cardTitle.style.margin = '0 0 10px 0';
cardTitle.style.color = '#2c3e50';
toolCard.appendChild(cardTitle);
// Add description
const description = document.createElement('p');
description.textContent = tool.description;
description.style.margin = '0';
description.style.color = '#7f8c8d';
description.style.fontSize = '14px';
toolCard.appendChild(description);
// Add button
const button = document.createElement('div');
button.textContent = 'Use Tool';
button.style.marginTop = '15px';
button.style.padding = '8px 15px';
button.style.backgroundColor = '#e74c3c';
button.style.color = 'white';
button.style.borderRadius = '4px';
button.style.display = 'inline-block';
button.style.alignSelf = 'flex-start';
button.style.fontSize = '14px';
toolCard.appendChild(button);
toolsGrid.appendChild(toolCard);
});
pdfToolsContainer.appendChild(toolsGrid);
// Add some custom CSS
const style = document.createElement('style');
style.textContent = `
@media (max-width: 600px) {
.pdf-tools-container {
padding: 0 10px;
}
}
`;
document.head.appendChild(style);
// Insert the widget into the page
const targetElement = document.querySelector('.elementor-widget-container'); // Adjust selector as needed
if (targetElement) {
targetElement.appendChild(pdfToolsContainer);
} else {
document.body.appendChild(pdfToolsContainer);
}
});