• <script type="text/javascript">jQuery(document).ready(function(){let event=new Event('oxygenVSBInitToggleJs');document.dispatchEvent(event)});document.addEventListener("oxygenVSBInitToggleJs",function(){oxygenVSBInitToggleState()},!1);oxygenVSBInitToggleState=function(){jQuery('.oxy-toggle').each(function(){var initial_state=jQuery(this).attr('data-oxy-toggle-initial-state'),toggle_target=jQuery(this).attr('data-oxy-toggle-target'),active_class=jQuery(this).attr('data-oxy-toggle-active-class');if(initial_state=='closed'){if(!toggle_target){jQuery(this).next().hide()}else{jQuery(toggle_target).hide()}
    jQuery(this).children('.oxy-expand-collapse-icon').addClass('oxy-eci-collapsed');jQuery(this).removeClass(active_class)}else{jQuery(this).addClass(active_class)}})}
    jQuery("body").on('click','.oxy-toggle',function(){var toggle_target=jQuery(this).attr('data-oxy-toggle-target'),active_class=jQuery(this).attr('data-oxy-toggle-active-class');jQuery(this).toggleClass(active_class)
    jQuery(this).children('.oxy-expand-collapse-icon').toggleClass('oxy-eci-collapsed');if(!toggle_target){jQuery(this).next().toggle()}else{jQuery(toggle_target).toggle()}
    jQuery(window).trigger('resize')})</script>

    Above script from oxygen page builder is still loaded even if unloaded site-wide from WPACU. @gabelivan Could you please look into it?

    • This topic was modified 5 years, 5 months ago by Rookie.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Gabe Livan

    (@gabelivan)

    @alriksson does it show as unloaded in the hardcoded list? This is important to understand if the rule is saved properly. In some cases, when the hardcoded asset contains specific strings that change on every page load (e.g. timestamps or security nonces) and in this instance, the unloading won’t work since the saved hardcoded asset (marked for unloading) is different (even by one character) then the most recent loaded one. I’m thinking of a solution for this such as unloading hardcoded scripts based on specific patterns.

    I’ve checked the code you provided and it doesn’t seem to have bits that change on every page load. So, it could be a bug. Let me know if it’s saving or not after you mark it as unloaded.

    Thread Starter Rookie

    (@alriksson)

    does it show as unloaded in the hardcoded list?

    @gabelivan Yes it’s a part of a bigger one. This is the full script in a read-friendly layout:

    <script type="text/javascript">
    
    			jQuery(document).ready(function() {
                    let event = new Event('oxygenVSBInitToggleJs');
                    document.dispatchEvent(event);
    			});
    
                document.addEventListener("oxygenVSBInitToggleJs",function(){
                    oxygenVSBInitToggleState();
                },false);
    
    			oxygenVSBInitToggleState = function() {
    
    				jQuery('.oxy-toggle').each(function() {
    				
    					var initial_state = jQuery(this).attr('data-oxy-toggle-initial-state'),
    					   toggle_target = jQuery(this).attr('data-oxy-toggle-target'),
                           active_class = jQuery(this).attr('data-oxy-toggle-active-class');
    				
    					if (initial_state == 'closed') {
    						if (!toggle_target) {
    							jQuery(this).next().hide();
    						} else {
    							jQuery(toggle_target).hide();
    						}
    						jQuery(this).children('.oxy-expand-collapse-icon').addClass('oxy-eci-collapsed');
                            jQuery(this).removeClass(active_class)
    					}
                        else {
                            jQuery(this).addClass(active_class)
                        }
    				});
    			}
    
                jQuery("body").on('click', '.oxy-toggle', function() {
    
                    var toggle_target  = jQuery(this).attr('data-oxy-toggle-target'),
                        active_class   = jQuery(this).attr('data-oxy-toggle-active-class');
    
                    jQuery(this).toggleClass(active_class)
                    jQuery(this).children('.oxy-expand-collapse-icon').toggleClass('oxy-eci-collapsed');
    
                    if (!toggle_target) {
                        jQuery(this).next().toggle();
                    } else {
                        jQuery(toggle_target).toggle();
                    }
    
                    // force 3rd party plugins to rerender things inside the toggle
                    jQuery(window).trigger('resize');
                });
    		</script>

    Sometimes I experience issue with wp-admin version and soemtimes have to do chnage to frontend to unload.

    But yeah the code seems generic and is loaded once tabs or accordion is used. So not globally hardcoded but once used it’s loaded. So maybe this cause issues? But most pages use it in this case.

    https://oxygenbuilder.com/try/ might be helpful for your investigation.

    • This reply was modified 5 years, 5 months ago by Rookie.
    Thread Starter Rookie

    (@alriksson)

    @gabelivan Any update on this one?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Fail to unload certain hardcoded scripts’ is closed to new replies.