Файловый менеджер - Редактировать - /home/admin/domains/octawebtools.com/public_html/wp-content/plugins/website-image-extractor/script.js
�азад
jQuery(document).ready(function($) { const extractBtn = $('#extract-btn'); const urlInput = $('#url-input'); const resultsSection = $('#results-section'); const imageGrid = $('#image-grid'); const loading = $('#loading'); const imageCount = $('#image-count'); const tabLinks = $('.tabs li'); // Extract images extractBtn.on('click', function() { const url = urlInput.val().trim(); if (!url) { showNotification('Please enter a valid website URL', 'danger'); urlInput.focus(); return; } // Show loading resultsSection.show(); loading.show(); imageGrid.html(''); // AJAX call $.ajax({ url: wie_ajax.ajax_url, type: 'POST', dataType: 'json', data: { action: 'wie_extract_images', nonce: wie_ajax.nonce, url: url }, success: function(response) { loading.hide(); if (response.success) { const images = response.data; renderImages(images); imageCount.text(images.length); showNotification(`Successfully extracted ${images.length} images`, 'success'); } else { showNotification(response.data, 'danger'); } }, error: function(xhr) { loading.hide(); showNotification('An error occurred. Please try again.', 'danger'); } }); }); // Render images to the grid function renderImages(images) { imageGrid.html(''); images.forEach(function(img) { // Create a card for each image const imageCard = $('<div>', { class: 'image-card', 'data-format': img.format }); // Image element const imgElement = $('<img>', { src: img.src, alt: img.alt, loading: 'lazy', onerror: "this.onerror=null;this.src='https://via.placeholder.com/300/eee/ccc?text=Image+Not+Available'" }); const imagePlaceholder = $('<div>', { class: 'image-placeholder' }).append(imgElement); const imageInfo = $('<div>', { class: 'image-info' }).append( $('<div>', { class: 'image-title', text: img.alt || 'Untitled' }), $('<div>', { class: 'image-format', text: img.format.toUpperCase() }), $('<div>', { class: 'image-actions' }).append( $('<button>', { class: 'button is-small is-primary download-btn', html: '<span class="icon"><i class="fas fa-download"></i></span><span>Download</span>' }).on('click', function(e) { e.stopPropagation(); downloadImage(img.src, img.alt || 'image'); }), $('<button>', { class: 'button is-small is-light', html: '<span class="icon"><i class="fas fa-external-link-alt"></i></span>' }).on('click', function() { window.open(img.src, '_blank'); }) ) ); imageCard.append(imagePlaceholder, imageInfo); imageGrid.append(imageCard); }); } // Download image function downloadImage(src, filename) { // Create a temporary link const link = document.createElement('a'); link.href = src; link.download = filename || 'image'; link.target = '_blank'; // Create a custom event to force download const event = document.createEvent('MouseEvents'); event.initEvent('click', true, true); // Add link to DOM and trigger click document.body.appendChild(link); link.dispatchEvent(event); document.body.removeChild(link); // Show download notification showNotification(`Downloading: ${filename || 'image'}`, 'success'); } // Tab filtering tabLinks.on('click', function() { const tab = $(this); const tabName = tab.data('tab'); tabLinks.removeClass('is-active'); tab.addClass('is-active'); $('.image-card').each(function() { const card = $(this); if (tabName === 'all' || card.data('format') === tabName) { card.show(); } else { card.hide(); } }); }); // Show notification function showNotification(message, type) { // Remove any existing notifications (except the info one that is fixed) $('.notification:not(.is-info)').remove(); const colors = { success: 'is-success', danger: 'is-danger', info: 'is-info' }; const notification = $('<div>', { class: 'notification ' + (colors[type] || 'is-info'), css: { 'animation': 'fadeIn 0.3s ease' } }).html('<button class="delete"></button>' + message); $('.wie-container').prepend(notification); // Auto remove after 5 seconds setTimeout(() => { notification.fadeOut(300, function() { $(this).remove(); }); }, 5000); // Delete button notification.find('.delete').on('click', function() { notification.remove(); }); } // Set sample URL urlInput.val('https://travel-blog-example.com'); // Add animation to cards when they appear function animateCards() { $('.image-card').each(function(i) { $(this).css('animation-delay', i * 0.1 + 's'); $(this).addClass('animated'); }); } // Initialize animation setTimeout(animateCards, 100); });
| ver. 1.4 |
Github
|
.
| PHP 8.1.32 | Генераци� �траницы: 0 |
proxy
|
phpinfo
|
�а�тройка