WC_Plugin_Updates::generic_modal_js()
Common JS for initializing and managing thickbox-based modals.
Метод класса: WC_Plugin_Updates{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->generic_modal_js();
Код WC_Plugin_Updates::generic_modal_js() WC Plugin Updates::generic modal js WC 9.3.3
<?php protected function generic_modal_js() { ?> <script> ( function( $ ) { // Initialize thickbox. tb_init( '.wc-thickbox' ); var old_tb_position = false; // Make the WC thickboxes look good when opened. $( '.wc-thickbox' ).on( 'click', function( evt ) { var $overlay = $( '#TB_overlay' ); if ( ! $overlay.length ) { $( 'body' ).append( '<div id="TB_overlay"></div><div id="TB_window" class="wc_untested_extensions_modal_container"></div>' ); } else { $( '#TB_window' ).removeClass( 'thickbox-loading' ).addClass( 'wc_untested_extensions_modal_container' ); } // WP overrides the tb_position function. We need to use a different tb_position function than that one. // This is based on the original tb_position. if ( ! old_tb_position ) { old_tb_position = tb_position; } tb_position = function() { $( '#TB_window' ).css( { marginLeft: '-' + parseInt( ( TB_WIDTH / 2 ), 10 ) + 'px', width: TB_WIDTH + 'px' } ); $( '#TB_window' ).css( { marginTop: '-' + parseInt( ( TB_HEIGHT / 2 ), 10 ) + 'px' } ); }; }); // Reset tb_position to WP default when modal is closed. $( 'body' ).on( 'thickbox:removed', function() { if ( old_tb_position ) { tb_position = old_tb_position; } }); })( jQuery ); </script> <?php }