Changeset 3483242
- Timestamp:
- 03/15/2026 06:10:09 PM (2 weeks ago)
- Location:
- speedora-total-website-speed-optimization
- Files:
-
- 2 deleted
- 4 edited
-
tags/1.0.0/README.md (deleted)
-
tags/1.0.0/assets/js/admin.js (modified) (1 diff)
-
tags/1.0.0/includes/class-minify.php (modified) (2 diffs)
-
trunk/README.md (deleted)
-
trunk/assets/js/admin.js (modified) (1 diff)
-
trunk/includes/class-minify.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
speedora-total-website-speed-optimization/tags/1.0.0/assets/js/admin.js
r3483024 r3483242 3 3 */ 4 4 5 jQuery(document).ready(function($) { 6 // Tab switching 7 $('.SPEEDORA-nav-item').on('click', function(e) { 5 jQuery( document ).ready( function( $ ) { 6 try { 7 // Tab switching (only on our settings page). 8 $( '.SPEEDORA-nav-item' ).on( 'click', function( e ) { 8 9 e.preventDefault(); 9 10 10 // Remove active class from all tabs and nav items11 $('.SPEEDORA-tab').removeClass('active');12 $('.SPEEDORA-nav-item').removeClass('active');11 // Remove active class from all tabs and nav items. 12 $( '.SPEEDORA-tab' ).removeClass( 'active' ); 13 $( '.SPEEDORA-nav-item' ).removeClass( 'active' ); 13 14 14 // Add active class to clicked nav item15 $(this).addClass('active');15 // Add active class to clicked nav item. 16 $( this ).addClass( 'active' ); 16 17 17 // Get the tab ID and show it 18 const tabId = $(this).data('tab'); 19 $('#' + tabId).addClass('active'); 18 // Get the tab ID and show it. 19 var tabId = $( this ).data( 'tab' ); 20 if ( tabId ) { 21 $( '#' + tabId ).addClass( 'active' ); 22 } 20 23 21 // Scroll to tab22 $('.SPEEDORA-main').scrollTop(0);23 });24 // Scroll to tab. 25 $( '.SPEEDORA-main' ).scrollTop( 0 ); 26 } ); 24 27 25 // Handle form submissions for tools 26 $('form').on('submit', function() { 27 const action = $(this).find('button[type="submit"]:focus').val(); 28 29 if (action === 'optimize_database') { 30 if (typeof SPEEDORAData !== 'undefined' && SPEEDORAData.confirmOptimize) { 31 if (!confirm(SPEEDORAData.confirmOptimize)) { 28 // Handle form submissions for our plugin tools/settings only. 29 $( '#SPEEDORA-settings-form, .SPEEDORA-tools form' ).on( 'submit', function() { 30 var $form = $( this ); 31 var $btn = $form.find( 'button[type="submit"]:focus' ); 32 var action = $btn.length ? $btn.val() : $form.find( 'input[name="action"]' ).val(); 33 34 if ( ! action ) { 35 return true; 36 } 37 38 if ( action === 'optimize_database' ) { 39 var msg = 'This may take a while. Continue?'; 40 if ( typeof SPEEDORAData !== 'undefined' && SPEEDORAData.confirmOptimize ) { 41 msg = SPEEDORAData.confirmOptimize; 42 } 43 if ( ! window.confirm( msg ) ) { 32 44 return false; 33 45 } 34 } else if (!confirm('This may take a while. Continue?')) {35 return false;36 46 } 37 }38 47 39 if (action === 'clear_cache') { 40 if (typeof SPEEDORAData !== 'undefined' && SPEEDORAData.confirmClear) { 41 if (!confirm(SPEEDORAData.confirmClear)) { 48 if ( action === 'clear_cache' ) { 49 var clearMsg = 'Are you sure you want to clear all cache?'; 50 if ( typeof SPEEDORAData !== 'undefined' && SPEEDORAData.confirmClear ) { 51 clearMsg = SPEEDORAData.confirmClear; 52 } 53 if ( ! window.confirm( clearMsg ) ) { 42 54 return false; 43 55 } 44 } else if (!confirm('Are you sure you want to clear all cache?')) {45 return false;46 56 } 57 58 return true; 59 } ); 60 61 // Placeholder: SPEEDORAData may carry extra info for future AJAX ops. 62 if ( typeof SPEEDORAData !== 'undefined' ) { 63 // No-op for now. 47 64 } 48 } );49 50 // AJAX handlers for async operations51 if (typeof SPEEDORAData !== 'undefined') {52 // You can add AJAX handlers here for async operations65 } catch ( e ) { 66 // Swallow any unexpected errors to avoid breaking the admin console. 67 if ( window && window.console && console.error ) { 68 console.error( 'Speedora admin script error:', e ); 69 } 53 70 } 54 55 // Show success/error messages 56 if (typeof wp !== 'undefined' && wp.notices) { 57 // Notices are handled by WordPress 58 } 59 }); 71 } ); 60 72 61 73 -
speedora-total-website-speed-optimization/tags/1.0.0/includes/class-minify.php
r3483024 r3483242 19 19 */ 20 20 public static function SPEEDORA_setup_minification() { 21 // Never touch admin area scripts/styles – avoid breaking block editor and core JS. 22 if ( is_admin() ) { 23 return; 24 } 25 21 26 if ( SPEEDORA_Settings::SPEEDORA_is_optimization_enabled( 'minify_html' ) ) { 22 27 add_filter( 'the_content', array( self::class, 'SPEEDORA_minify_html' ) ); … … 162 167 */ 163 168 public static function SPEEDORA_modify_script_tags( $tag, $handle ) { 169 // Do not modify script tags in admin; many core scripts rely on exact loading order. 170 if ( is_admin() ) { 171 return $tag; 172 } 164 173 // Get excluded scripts that should not be deferred/async 165 174 $excluded = array( 'jquery-core', 'jquery' ); -
speedora-total-website-speed-optimization/trunk/assets/js/admin.js
r3483024 r3483242 3 3 */ 4 4 5 jQuery(document).ready(function($) { 6 // Tab switching 7 $('.SPEEDORA-nav-item').on('click', function(e) { 5 jQuery( document ).ready( function( $ ) { 6 try { 7 // Tab switching (only on our settings page). 8 $( '.SPEEDORA-nav-item' ).on( 'click', function( e ) { 8 9 e.preventDefault(); 9 10 10 // Remove active class from all tabs and nav items11 $('.SPEEDORA-tab').removeClass('active');12 $('.SPEEDORA-nav-item').removeClass('active');11 // Remove active class from all tabs and nav items. 12 $( '.SPEEDORA-tab' ).removeClass( 'active' ); 13 $( '.SPEEDORA-nav-item' ).removeClass( 'active' ); 13 14 14 // Add active class to clicked nav item15 $(this).addClass('active');15 // Add active class to clicked nav item. 16 $( this ).addClass( 'active' ); 16 17 17 // Get the tab ID and show it 18 const tabId = $(this).data('tab'); 19 $('#' + tabId).addClass('active'); 18 // Get the tab ID and show it. 19 var tabId = $( this ).data( 'tab' ); 20 if ( tabId ) { 21 $( '#' + tabId ).addClass( 'active' ); 22 } 20 23 21 // Scroll to tab22 $('.SPEEDORA-main').scrollTop(0);23 });24 // Scroll to tab. 25 $( '.SPEEDORA-main' ).scrollTop( 0 ); 26 } ); 24 27 25 // Handle form submissions for tools 26 $('form').on('submit', function() { 27 const action = $(this).find('button[type="submit"]:focus').val(); 28 29 if (action === 'optimize_database') { 30 if (typeof SPEEDORAData !== 'undefined' && SPEEDORAData.confirmOptimize) { 31 if (!confirm(SPEEDORAData.confirmOptimize)) { 28 // Handle form submissions for our plugin tools/settings only. 29 $( '#SPEEDORA-settings-form, .SPEEDORA-tools form' ).on( 'submit', function() { 30 var $form = $( this ); 31 var $btn = $form.find( 'button[type="submit"]:focus' ); 32 var action = $btn.length ? $btn.val() : $form.find( 'input[name="action"]' ).val(); 33 34 if ( ! action ) { 35 return true; 36 } 37 38 if ( action === 'optimize_database' ) { 39 var msg = 'This may take a while. Continue?'; 40 if ( typeof SPEEDORAData !== 'undefined' && SPEEDORAData.confirmOptimize ) { 41 msg = SPEEDORAData.confirmOptimize; 42 } 43 if ( ! window.confirm( msg ) ) { 32 44 return false; 33 45 } 34 } else if (!confirm('This may take a while. Continue?')) {35 return false;36 46 } 37 }38 47 39 if (action === 'clear_cache') { 40 if (typeof SPEEDORAData !== 'undefined' && SPEEDORAData.confirmClear) { 41 if (!confirm(SPEEDORAData.confirmClear)) { 48 if ( action === 'clear_cache' ) { 49 var clearMsg = 'Are you sure you want to clear all cache?'; 50 if ( typeof SPEEDORAData !== 'undefined' && SPEEDORAData.confirmClear ) { 51 clearMsg = SPEEDORAData.confirmClear; 52 } 53 if ( ! window.confirm( clearMsg ) ) { 42 54 return false; 43 55 } 44 } else if (!confirm('Are you sure you want to clear all cache?')) {45 return false;46 56 } 57 58 return true; 59 } ); 60 61 // Placeholder: SPEEDORAData may carry extra info for future AJAX ops. 62 if ( typeof SPEEDORAData !== 'undefined' ) { 63 // No-op for now. 47 64 } 48 } );49 50 // AJAX handlers for async operations51 if (typeof SPEEDORAData !== 'undefined') {52 // You can add AJAX handlers here for async operations65 } catch ( e ) { 66 // Swallow any unexpected errors to avoid breaking the admin console. 67 if ( window && window.console && console.error ) { 68 console.error( 'Speedora admin script error:', e ); 69 } 53 70 } 54 55 // Show success/error messages 56 if (typeof wp !== 'undefined' && wp.notices) { 57 // Notices are handled by WordPress 58 } 59 }); 71 } ); 60 72 61 73 -
speedora-total-website-speed-optimization/trunk/includes/class-minify.php
r3483024 r3483242 19 19 */ 20 20 public static function SPEEDORA_setup_minification() { 21 // Never touch admin area scripts/styles – avoid breaking block editor and core JS. 22 if ( is_admin() ) { 23 return; 24 } 25 21 26 if ( SPEEDORA_Settings::SPEEDORA_is_optimization_enabled( 'minify_html' ) ) { 22 27 add_filter( 'the_content', array( self::class, 'SPEEDORA_minify_html' ) ); … … 162 167 */ 163 168 public static function SPEEDORA_modify_script_tags( $tag, $handle ) { 169 // Do not modify script tags in admin; many core scripts rely on exact loading order. 170 if ( is_admin() ) { 171 return $tag; 172 } 164 173 // Get excluded scripts that should not be deferred/async 165 174 $excluded = array( 'jquery-core', 'jquery' );
Note: See TracChangeset
for help on using the changeset viewer.