Current Path : /storage/v11800/romasitenew/public_html/wp-content/plugins/ht-script-pro/admin/js/ |
Linux v11800 5.3.0-1023-aws #25~18.04.1-Ubuntu SMP Fri Jun 5 15:19:18 UTC 2020 aarch64
|
Current File : /storage/v11800/romasitenew/public_html/wp-content/plugins/ht-script-pro/admin/js/admin.js |
(function($) {
"use strict";
var cat_field_desc = $("input[name='_ihafs_show_on']:checked").val();
console.log(cat_field_desc);
set_cat_tag_title_txt(cat_field_desc);
$('.ihafs-pro-select2').select2();
var $current_show_on = jQuery('.cmb2-id--ihafs-show-on li input[checked="checked"]').attr('value');
// show/hide exclude page/post when click on full_website
var $exclude_selector = jQuery('.cmb2-id--ihafs-exclude-pages,.cmb2-id--ihafs-exclude-posts');
$exclude_selector.slideUp();
if( $current_show_on == 'full_website' ){
$exclude_selector.slideDown();
}
jQuery('.cmb2-id--ihafs-show-on li input').on('click', function() {
var $clicked_value = this.getAttribute('value');
if( $clicked_value == 'full_website'){
$exclude_selector.slideDown();
} else {
$exclude_selector.slideUp();
}
});
// show/hide page list when click on only page
var $pages_list_selector = jQuery('.cmb2-id--ihafs-pages-list');
$pages_list_selector.slideUp();
if( $current_show_on == 'only_pages'){
$pages_list_selector.slideDown();
}
jQuery('.cmb2-id--ihafs-show-on li input').on('click', function() {
var $clicked_value = this.getAttribute('value');
if( $clicked_value == 'only_pages'){
$pages_list_selector.slideDown();
} else {
$pages_list_selector.slideUp();
}
});
// show/hide post list when click on only post
var $posts_list_selector = jQuery('.cmb2-id--ihafs-posts-list');
$posts_list_selector.slideUp();
if( $current_show_on == 'only_posts'){
$posts_list_selector.slideDown();
}
jQuery('.cmb2-id--ihafs-show-on li input').on('click', function() {
var $clicked_value = this.getAttribute('value');
if( $clicked_value == 'only_posts'){
$posts_list_selector.slideDown();
} else {
$posts_list_selector.slideUp();
}
});
// show/hide categories list when click on only categories and Categoyr Archinves
var $categories_list_selector = jQuery('.cmb2-id--ihafs-categories-list');
$categories_list_selector.slideUp();
if( $current_show_on == 'only_categories' || $current_show_on == 'category_archives'){
$categories_list_selector.slideDown();
}
jQuery('.cmb2-id--ihafs-show-on li input').on('click', function() {
var $clicked_value = this.getAttribute('value');
if( $clicked_value == 'only_categories' || $clicked_value == 'category_archives'){
$categories_list_selector.slideDown();
} else {
$categories_list_selector.slideUp();
}
set_cat_tag_title_txt($clicked_value);
});
// show/hide woocommerce categories list when click on only categories
var $woo_categories_list_selector = jQuery('.cmb2-id--ihafs-woo-categories-list');
$woo_categories_list_selector.slideUp();
if( $current_show_on == 'woo_categories' || $current_show_on == 'product_category_archives'){
$woo_categories_list_selector.slideDown();
}
jQuery('.cmb2-id--ihafs-show-on li input').on('click', function() {
var $clicked_value = this.getAttribute('value');
if( $clicked_value == 'woo_categories' || $clicked_value == 'product_category_archives'){
$woo_categories_list_selector.slideDown();
} else {
$woo_categories_list_selector.slideUp();
}
set_cat_tag_title_txt($clicked_value);
});
// show/hide page id field list when click on only categories
var $page_ids = jQuery('.cmb2-id--ihafs-page-ids');
$page_ids.slideUp();
if( $current_show_on == 'page_ids'){
$page_ids.slideDown();
}
jQuery('.cmb2-id--ihafs-show-on li input').on('click', function() {
var $clicked_value = this.getAttribute('value');
if( $clicked_value == 'page_ids'){
$page_ids.slideDown();
} else {
$page_ids.slideUp();
}
});
// show/hide tags list when click on only tags
var $tags_list_selector = jQuery('.cmb2-id--ihafs-tags-list');
$tags_list_selector.slideUp();
if( $current_show_on == 'only_tags' || $current_show_on == 'tag_archives'){
$tags_list_selector.slideDown();
}
jQuery('.cmb2-id--ihafs-show-on li input').on('click', function() {
var $clicked_value = this.getAttribute('value');
if( $clicked_value == 'only_tags' || $clicked_value == 'tag_archives'){
$tags_list_selector.slideDown();
} else {
$tags_list_selector.slideUp();
}
set_cat_tag_title_txt($clicked_value);
});
function set_cat_tag_title_txt(filed_desc){
var $cat_title_slectior;
var $cat_title_txt;
if('category_archives' == filed_desc || 'only_categories' == filed_desc){
$cat_title_slectior = document.querySelector('.cmb2-id--ihafs-categories-list .cmb-td');
$cat_title_txt = $cat_title_slectior.childNodes[0];
if(filed_desc == 'category_archives'){
$cat_title_txt.nodeValue = "Select the categories below. The script will show on the selected category archive page.If you don't select any category, the script will show on all category archives by default.";
}else{
$cat_title_txt.nodeValue = 'Select the categories below. The script will show on the blog posts, which has any one of your selected categories.';
}
}else if('tag_archives' == filed_desc || 'only_tags' == filed_desc){
$cat_title_slectior = document.querySelector('.cmb2-id--ihafs-tags-list .cmb-td');
$cat_title_txt = $cat_title_slectior.childNodes[0];
if(filed_desc == 'tag_archives'){
$cat_title_txt.nodeValue = "Select the tags below. The script will show on the selected tag archive page.If you don't select any tag, the script will show on all tag archives by default";
}else{
$cat_title_txt.nodeValue = 'Select the tags below. The script will show on the blog posts, which has any one of your selected tags..';
}
}else if('woo_categories' == filed_desc || 'product_category_archives' == filed_desc){
$cat_title_slectior = document.querySelector('.cmb2-id--ihafs-woo-categories-list .cmb-td');
$cat_title_txt = $cat_title_slectior.childNodes[0];
if(filed_desc == 'product_category_archives'){
$cat_title_txt.nodeValue = "Select the product categories below. The script will show on the selected product archive page.If you don't select any product category, the script will show on all product category archives by default";
}else{
$cat_title_txt.nodeValue = 'Select the categories below. The script will show on the products, which has any one of your selected categories.';
}
}
}
})(jQuery);