Created
November 6, 2013 17:10
-
-
Save guwordpressbrasil/7340121 to your computer and use it in GitHub Desktop.
Vários scripts no enqueue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rise_load_scripts() { | |
wp_register_script('main', url_fresh('js/main.js',false),array('jquery'),null); | |
wp_register_script('tooltip', url_fresh('js/vendor/wTooltip.1.7.min.js',false),array('jquery'),null); | |
wp_register_script('zoom', url_fresh('js/vendor/jquery.zoom-min.js',false),array('jquery'),null); | |
wp_register_script('tools', url_fresh('js/vendor/jquery.tools.min.js',false),array('jquery'),null); | |
wp_register_script('mailcheck', url_fresh('js/vendor/mailcheck.min.js',false),array('jquery'),null); | |
wp_register_script('masked', url_fresh('js/vendor/jquery.maskedinput-1.3.min.js',false),array('jquery'),null); | |
wp_register_script('moeda', url_fresh('js/vendor/accounting.min.js',false),array('jquery'),null); | |
wp_register_script('conversao', url_fresh('js/vendor/money.min.js',false),array('jquery'),null); | |
wp_register_script('maxlength', url_fresh('js/vendor/maxlength.min.js',false),array('jquery'),null); | |
wp_register_script('autosize', url_fresh('js/vendor/jquery.autosize-min.js',false),array('jquery'),null); | |
if(is_page('pedidos')){ | |
wp_enqueue_script('pedidos', url_fresh('js/page-pedidos.js',false),array('jquery','moeda','conversao'),null); | |
wp_localize_script('pedidos', 'rise', array( | |
'openexchangerates' => Carrinho::get_openexchangerates(), | |
'lang' => qtrans_getLanguage() | |
) | |
); | |
} | |
if(is_page('faq')){ | |
wp_enqueue_script('main'); | |
} | |
if(is_front_page()){ | |
wp_enqueue_script('frontpage', url_fresh('js/front-page.js',false),array('jquery','moeda','conversao'),null); | |
wp_localize_script('frontpage', 'rise', array( | |
'openexchangerates' => Carrinho::get_openexchangerates(), | |
'lang' => qtrans_getLanguage() | |
) | |
); | |
} | |
if(is_tax('categoria')){ | |
wp_enqueue_script('categoria', url_fresh('js/taxonomy-categoria.js',false),array('jquery','main','tooltip','moeda', 'conversao'),null); | |
wp_localize_script('categoria', 'rise', array( | |
'openexchangerates' => Carrinho::get_openexchangerates(), | |
'lang' => qtrans_getLanguage() | |
) | |
); | |
} | |
if(is_singular('produto')){ | |
wp_enqueue_script('produto', url_fresh('js/single-produto.js',false),array('jquery','main','tooltip','zoom','tools','mailcheck','moeda', 'conversao'),null); | |
wp_localize_script('produto', 'rise', array( | |
'tamanho' => __('Você deve escolher um tamanho!', 'rise'), | |
'mailcheck' => __('Você quis dizer','rise'), | |
'validator_email' => __('Por favor, entre com um e-mail válido','rise'), | |
'validator_required' => __('Por favor, este campo é obrigatório','rise'), | |
'openexchangerates' => Carrinho::get_openexchangerates(), | |
'lang' => qtrans_getLanguage() | |
) | |
); | |
} | |
if(is_page('carrinho')){ | |
wp_enqueue_script('carrinho', url_fresh('js/page-carrinho.js',false),array('jquery','main','masked','tools','moeda', 'conversao'),null); | |
wp_localize_script('carrinho', 'rise', array( | |
'validator_all' => __('Por favor, corrija os dados deste campo','rise'), | |
'validator_required' => __('Por favor, este campo é obrigatório','rise'), | |
'ajaxurl' => admin_url( 'admin-ajax.php' ), | |
'ajaxerro' => __('Serviço indisponível no momento!<br>Clique em "Calcular frete" para tentar novamente.','rise'), | |
'ajaxnull' => __('Erro desconhecido!','rise'), | |
'desconto_de' => __('Desconto de','rise'), | |
'lang' => qtrans_getLanguage(), | |
'openexchangerates' => Carrinho::get_openexchangerates() | |
//'carrinho_nonce' => wp_create_nonce( 'nonce' ) | |
) | |
); | |
} | |
if(is_page('checkout')){ | |
wp_enqueue_script('checkout', url_fresh('js/page-checkout.js',false),array('jquery','main','tooltip','masked','tools','mailcheck','moeda','conversao','maxlength','autosize'),null); | |
wp_localize_script('checkout', 'rise', array( | |
'mailcheck' => __('Você quis dizer','rise'), | |
'validator_email' => __('Por favor, entre com um e-mail válido','rise'), | |
'validator_all' => __('Por favor, corrija os dados deste campo','rise'), | |
'validator_required' => __('Por favor, este campo é obrigatório','rise'), | |
'validator_repsenha' => __('A senha digitada não coincide com a anterior','rise'), | |
'ajaxurl' => admin_url( 'admin-ajax.php' ), | |
'ajaxerro' => __('Erro na comunicação com o servidor!','rise'), | |
//'checkout_nonce' => wp_create_nonce( 'nonce' ), | |
'checkout_erro' => __('Ocorreu um erro no processo de checkout que impede a conclusão do pedido','rise'), | |
'lang' => qtrans_getLanguage(), | |
'openexchangerates' => Carrinho::get_openexchangerates() | |
) | |
); | |
} | |
if(is_page('login')){ | |
wp_enqueue_script('login', url_fresh('js/page-login.js',false),array('jquery','main','tools'),null); | |
wp_localize_script('login', 'rise', array( | |
'validator_email' => __('Por favor, entre com um e-mail válido','rise'), | |
'validator_all' => __('Por favor, corrija os dados deste campo','rise'), | |
'validator_required' => __('Por favor, este campo é obrigatório','rise'), | |
'ajaxurl' => admin_url( 'admin-ajax.php' ), | |
'ajaxerro' => __('Erro na comunicação com o servidor!','rise'), | |
'ajaxnull' => __('Erro desconhecido!','rise'), | |
'url_site' => get_bloginfo('url').'/'.qtrans_getLanguage().'/' | |
) | |
); | |
} | |
if(is_page('esqueci')){ | |
wp_enqueue_script('esqueci', url_fresh('js/page-esqueci.js',false),array('jquery','main','tools'),null); | |
wp_localize_script('esqueci', 'rise', array( | |
'validator_email' => __('Por favor, entre com um e-mail válido','rise'), | |
'validator_all' => __('Por favor, corrija os dados deste campo','rise'), | |
'validator_required' => __('Por favor, este campo é obrigatório','rise'), | |
'ajaxurl' => admin_url( 'admin-ajax.php' ), | |
'ajaxerro' => __('Erro na comunicação com o servidor!','rise'), | |
'ajaxnull' => __('Erro desconhecido!','rise'), | |
'url_site' => get_bloginfo('url').'/'.qtrans_getLanguage().'/' | |
) | |
); | |
} | |
} | |
add_action('wp_enqueue_scripts', 'rise_load_scripts'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment