| 1 |
// ; (function ($) { |
| 2 |
// const hash = window.location.hash.replace('#', ''); |
| 3 |
// // Help page tab menu script. |
| 4 |
// $('.sp-smart-post__help').on('click', '.spspc-header-nav-menu a', function(e) { |
| 5 |
// if( $(this).hasClass('active') ) { |
| 6 |
// return; |
| 7 |
// } |
| 8 |
// let tabId = $(this).attr('data-id'); |
| 9 |
// $('.spspc-header-nav-menu a').each((i, item) => { |
| 10 |
// $(item).removeClass('active'); |
| 11 |
// $('#' + $(item).attr('data-id')).css('display', 'none'); |
| 12 |
// }) |
| 13 |
// $(this).addClass('active'); |
| 14 |
|
| 15 |
// $('#' + tabId).css('display', 'block'); |
| 16 |
|
| 17 |
// if('recommended-tab' === tabId){ |
| 18 |
// $('#menu-posts-sp_post_carousel ul li').each((i, item) => { |
| 19 |
// $(item).removeClass('current'); |
| 20 |
// }) |
| 21 |
// $('#menu-posts-sp_post_carousel ul li:nth-child(7)').addClass('current'); |
| 22 |
// } |
| 23 |
// if('lite-to-pro-tab' === tabId){ |
| 24 |
// $('#menu-posts-sp_post_carousel ul li').each((i, item) => { |
| 25 |
// $(item).removeClass('current'); |
| 26 |
// }) |
| 27 |
// $('#menu-posts-sp_post_carousel ul li:nth-child(8)').addClass('current'); |
| 28 |
// } |
| 29 |
// if(('get-start-tab' === tabId || 'about-us-tab' === tabId)){ |
| 30 |
// $('#menu-posts-sp_post_carousel ul li').each((i, item) => { |
| 31 |
// $(item).removeClass('current'); |
| 32 |
// }) |
| 33 |
// $('#menu-posts-sp_post_carousel ul li:nth-child(9)').addClass('current'); |
| 34 |
// } |
| 35 |
// }) |
| 36 |
|
| 37 |
// $('#menu-posts-sp_post_carousel').on('click', 'ul li a', (e) => { |
| 38 |
// var element = e.target.closest('a'); |
| 39 |
|
| 40 |
// if( 'edit.php?post_type=sp_post_carousel&page=pcp_help' === $(element).attr('href') ) { |
| 41 |
// $(element).attr('href', '#get-start'); |
| 42 |
// } |
| 43 |
|
| 44 |
// setTimeout(() => { |
| 45 |
// var hashValue = window.location.hash.replace('#', ''); |
| 46 |
// if(hashValue) { |
| 47 |
// $('#menu-posts-sp_post_carousel ul li').each((i, item) => { |
| 48 |
// $(item).removeClass('current'); |
| 49 |
// }) |
| 50 |
// } |
| 51 |
// if( 'recommended' === hashValue ) { |
| 52 |
// $('.sp-smart-post__help .spspc-header-nav-menu a[data-id="recommended-tab"]').trigger('click'); |
| 53 |
// $(element).parent().addClass('current') |
| 54 |
// } |
| 55 |
// if( 'lite-to-pro' === hashValue ) { |
| 56 |
// $('.sp-smart-post__help .spspc-header-nav-menu a[data-id="lite-to-pro-tab"]').trigger('click'); |
| 57 |
// $(element).parent().addClass('current') |
| 58 |
// } |
| 59 |
// if( 'get-start' === hashValue ) { |
| 60 |
// $('.sp-smart-post__help .spspc-header-nav-menu a[data-id="get-start-tab"]').trigger('click'); |
| 61 |
// $(element).parent().addClass('current') |
| 62 |
// } |
| 63 |
// }, 0); |
| 64 |
// }) |
| 65 |
|
| 66 |
// if( 'recommended' === hash ) { |
| 67 |
// $('.sp-smart-post__help .spspc-header-nav-menu a[data-id="recommended-tab"]').trigger('click'); |
| 68 |
// $('#menu-posts-sp_post_carousel ul li:nth-child(9)').removeClass('current'); |
| 69 |
// $('#menu-posts-sp_post_carousel ul li:nth-child(7)').addClass('current'); |
| 70 |
// } |
| 71 |
// if( 'lite-to-pro' === hash ) { |
| 72 |
// $('.sp-smart-post__help .spspc-header-nav-menu a[data-id="lite-to-pro-tab"]').trigger('click'); |
| 73 |
// $('#menu-posts-sp_post_carousel ul li:nth-child(9)').removeClass('current'); |
| 74 |
// $('#menu-posts-sp_post_carousel ul li:nth-child(8)').addClass('current'); |
| 75 |
// } |
| 76 |
// if( 'about-us' === hash ) { |
| 77 |
// $('.sp-smart-post__help .spspc-header-nav-menu a[data-id="about-us-tab"]').trigger('click'); |
| 78 |
// } |
| 79 |
|
| 80 |
// $('body').on('click', '.install-now', function(e) { |
| 81 |
// var _this = $(this); |
| 82 |
// var _href = _this.attr('href'); |
| 83 |
|
| 84 |
// _this.addClass('updating-message').html('Installing...'); |
| 85 |
|
| 86 |
// $.get(_href, function(data) { |
| 87 |
// location.reload(); |
| 88 |
// }); |
| 89 |
|
| 90 |
// e.preventDefault(); |
| 91 |
// }); |
| 92 |
|
| 93 |
// })(jQuery); |