/** * Enqueue frontend CSS/JS * * @since 4.0.0 */ public function maybe_enqueue_styles_scripts() { $handle = 'sv-wc-payment-gateway-my-payment-methods'; wp_enqueue_style($handle, $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/css/frontend/' . $handle . '.min.css', array(), SV_WC_Plugin::VERSION); wp_enqueue_style('dashicons'); // if there are tokens to display, add the custom JS if ($this->has_tokens) { // if there are no WC 2.6+ core tokens, hide the "No saved methods found." notice // TODO: remove this when we fully support the core payment methods table {CW 2016-05-17} if (SV_WC_Plugin_Compatibility::is_wc_version_gte_2_6() && !(bool) wc_get_customer_saved_methods_list(get_current_user_id())) { wc_enqueue_js('$( "table.wc-' . $this->get_plugin()->get_id_dasherized() . '-my-payment-methods" ).prev( ".woocommerce-Message.woocommerce-Message--info" ).hide();'); } wp_enqueue_script('jquery-tiptip', WC()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip.min.js', array('jquery'), WC_VERSION, true); // add confirm javascript when deleting payment methods wc_enqueue_js(' $( ".wc-' . $this->get_plugin()->get_id_dasherized() . '-payment-method-actions .button.tip" ).tipTip(); $( ".wc-' . $this->get_plugin()->get_id_dasherized() . '-payment-method-actions a.delete-payment-method" ).on( "click", function( e ) { if ( $( this ).hasClass( "disabled" ) || ! confirm( "' . esc_js(esc_html__('Are you sure you want to delete this payment method?', 'woocommerce-plugin-framework')) . '" ) ) { e.preventDefault(); } } ); '); } }