| @@ -27,34 +27,22 @@ | ||
| 27 | 27 | if ( is_admin() ) { |
| 28 | 28 | return; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; | |
| 32 | - $suffix_css = ( is_rtl() ? '-rtl' : '' ) . $suffix; | |
| 31 | + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; | |
| 33 | 32 | |
| 34 | - wp_enqueue_style( 'orderable', ORDERABLE_ASSETS_URL . 'frontend/css/main' . $suffix_css . '.css', array(), ORDERABLE_VERSION ); | |
| 35 | - wp_enqueue_script( 'orderable', ORDERABLE_ASSETS_URL . 'frontend/js/main' . $suffix . '.js', array( 'jquery', 'wc-add-to-cart' ), ORDERABLE_VERSION, true ); | |
| 33 | + wp_enqueue_style( 'orderable', ORDERABLE_ASSETS_URL . 'frontend/css/main' . $suffix . '.css', array(), ORDERABLE_VERSION ); | |
| 34 | + wp_enqueue_script( 'orderable', ORDERABLE_ASSETS_URL . 'frontend/js/main' . $suffix . '.js', array( 'jquery' ), ORDERABLE_VERSION, true ); | |
| 36 | 35 | |
| 37 | 36 | wp_add_inline_style( 'orderable', self::get_styles() ); |
| 38 | 37 | |
| 39 | - wp_localize_script( | |
| 40 | - 'orderable', | |
| 41 | - 'orderable_vars', | |
| 42 | - array( | |
| 43 | - 'i18n' => array( | |
| 44 | - 'out_of_stock' => __( 'Sorry, that product is out of stock.', 'orderable' ), | |
| 45 | - 'unavailable' => __( 'Sorry, that product is unavailable.', 'orderable' ), | |
| 46 | - 'no_exist' => __( 'Sorry, that combination does not exist.', 'orderable' ), | |
| 47 | - ), | |
| 48 | - 'ajax_url' => WC()->ajax_url(), | |
| 49 | - /** | |
| 50 | - * If the option "Enable AJAX add to cart buttons on archives" is not enabled, | |
| 51 | - * we need to turn off the click event for .add_to_cart_button elements on drawer.js | |
| 52 | - * to keep the AJAX behaviour only on Mini cart. | |
| 53 | - */ | |
| 54 | - 'woocommerce_enable_ajax_add_to_cart' => 'yes' === get_option( 'woocommerce_enable_ajax_add_to_cart' ), | |
| 55 | - ) | |
| 56 | - ); | |
| 38 | + wp_localize_script( 'orderable', 'orderable_vars', array( | |
| 39 | + 'i18n' => array( | |
| 40 | + 'out_of_stock' => __( 'Sorry, that product is out of stock.', 'orderable' ), | |
| 41 | + 'unavailable' => __( 'Sorry, that product is unavailable.', 'orderable' ), | |
| 42 | + 'no_exist' => __( 'Sorry, that combination does not exist.', 'orderable' ), | |
| 43 | + ), | |
| 44 | + ) ); | |
| 57 | 45 | |
| 58 | 46 | do_action( 'orderable_after_frontend_assets' ); |
| 59 | 47 | } |
| 60 | 48 | |
| @@ -77,9 +65,9 @@ | ||
| 77 | 65 | '.orderable-button--filled, .orderable-drawer__cart .orderable-mini-cart__buttons .button.checkout { border-color: %1$s; background: %1$s !important; color: #fff; }', |
| 78 | 66 | '.orderable-button--filled.orderable-button--hover, .orderable-button--filled:hover, .orderable-button--filled:active, .orderable-button--filled:focus, .orderable-drawer__cart .orderable-mini-cart__buttons .button.checkout:hover, .orderable-drawer__cart .orderable-mini-cart__buttons .button.checkout:active, .orderable-drawer__cart .orderable-mini-cart__buttons .button.checkout:focus { border-color: %1$s; background: %1$s !important; }', |
| 79 | 67 | '.orderable-button--loading:after { border-top-color: %1$s; border-left-color: %1$s; }', |
| 80 | 68 | '.orderable-product-option--checked .orderable-product-option__label-state { border-color: %1$s !important; }', |
| 81 | - ".orderable-products-list .orderable-product__title { font-size: {$product_title_font_size}px; line-height: {$product_title_line_height}px; }", | |
| 69 | + ".orderable-product__title { font-size: {$product_title_font_size}px; line-height: {$product_title_line_height}px; }", | |
| 82 | 70 | ".orderable-product__actions-price .amount { font-size: {$product_price_font_size}px; line-height: {$product_price_line_height}px; }", |
| 83 | 71 | ); |
| 84 | 72 | |
| 85 | 73 | return apply_filters( 'orderable_styles', sprintf( implode( '', $styles ), $brand_color ) ); |
| @@ -92,31 +80,16 @@ | ||
| 92 | 80 | if ( ! is_admin() || ! Orderable_Settings::is_settings_page() ) { |
| 93 | 81 | return; |
| 94 | 82 | } |
| 95 | 83 | |
| 96 | - $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; | |
| 97 | - $style_deps = apply_filters( 'orderable_admin_style_deps', array( 'wc-admin-layout' ) ); | |
| 98 | - $script_deps = apply_filters( 'orderable_admin_script_deps', array( 'jquery' ) ); | |
| 84 | + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; | |
| 99 | 85 | |
| 100 | - wp_enqueue_style( 'orderable', ORDERABLE_ASSETS_URL . 'admin/css/main' . $suffix . '.css', $style_deps, ORDERABLE_VERSION ); | |
| 86 | + wp_enqueue_style( 'orderable', ORDERABLE_ASSETS_URL . 'admin/css/main' . $suffix . '.css', array(), ORDERABLE_VERSION ); | |
| 101 | 87 | wp_enqueue_style( 'select2', ORDERABLE_ASSETS_URL . 'vendor/select2/select2' . $suffix . '.css', array(), ORDERABLE_VERSION ); |
| 102 | 88 | |
| 103 | - wp_enqueue_media(); | |
| 104 | - wp_enqueue_script( 'orderable-select2', ORDERABLE_ASSETS_URL . 'vendor/select2/select2' . $suffix . '.js', $script_deps, ORDERABLE_VERSION ); | |
| 89 | + wp_enqueue_script( 'orderable-select2', ORDERABLE_ASSETS_URL . 'vendor/select2/select2' . $suffix . '.js', array( 'jquery' ), ORDERABLE_VERSION ); | |
| 105 | 90 | wp_enqueue_script( 'orderable-jquery-multi-select', ORDERABLE_ASSETS_URL . 'vendor/jquery-multi-select/jquery.multi-select' . $suffix . '.js', array( 'jquery' ), ORDERABLE_VERSION ); |
| 106 | 91 | wp_enqueue_script( 'orderable', ORDERABLE_ASSETS_URL . 'admin/js/main' . $suffix . '.js', array( 'jquery' ), ORDERABLE_VERSION ); |
| 107 | - | |
| 108 | - wp_localize_script( | |
| 109 | - 'orderable', | |
| 110 | - 'orderable_vars', | |
| 111 | - array( | |
| 112 | - 'i18n' => array( | |
| 113 | - 'confirm_remove_service_hours' => __( 'Are you sure you want to remove these service hours?', 'orderable' ), | |
| 114 | - ), | |
| 115 | - ) | |
| 116 | - ); | |
| 117 | - | |
| 118 | - do_action( 'orderable_admin_assets_enqueued' ); | |
| 119 | 92 | } |
| 120 | 93 | |
| 121 | 94 | /** |
| 122 | 95 | * Add body classes. |
| @@ -136,9 +109,9 @@ | ||
| 136 | 109 | /** |
| 137 | 110 | * Adjust brightness of hex. |
| 138 | 111 | * |
| 139 | 112 | * @param string $hex |
| 140 | - * @param int $steps | |
| 113 | + * @param int $steps | |
| 141 | 114 | * |
| 142 | 115 | * @return string |
| 143 | 116 | */ |
| 144 | 117 | public static function adjust_hex( $hex, $steps ) { |
| @@ -155,12 +128,12 @@ | ||
| 155 | 128 | $color_parts = str_split( $hex, 2 ); |
| 156 | 129 | $return = '#'; |
| 157 | 130 | |
| 158 | 131 | foreach ( $color_parts as $color ) { |
| 159 | - $color = hexdec( $color ); // Convert to decimal | |
| 160 | - $color = max( 0, min( 255, $color + $steps ) ); // Adjust color | |
| 132 | + $color = hexdec( $color ); // Convert to decimal | |
| 133 | + $color = max( 0, min( 255, $color + $steps ) ); // Adjust color | |
| 161 | 134 | $return .= str_pad( dechex( $color ), 2, '0', STR_PAD_LEFT ); // Make two char hex code |
| 162 | 135 | } |
| 163 | 136 | |
| 164 | 137 | return $return; |
| 165 | 138 | } |
| 166 | -} | |
| 139 | +} | |