| @@ -1,7 +1,35 @@ | ||
| 1 | 1 | jQuery(function ($) { |
| 2 | 2 | |
| 3 | 3 | $(document).ready(function () { |
| 4 | + var wpChatbotTabSections = { | |
| 5 | + started: '#section-flip-1', | |
| 6 | + general: '#section-flip-2', | |
| 7 | + themes: '#section-flip-3', | |
| 8 | + social: '#section-flip-51', | |
| 9 | + language: '#section-flip-5', | |
| 10 | + support: '#section-flip-4', | |
| 11 | + startmenu: '#section-flip-6', | |
| 12 | + ai: '#section-flip-7', | |
| 13 | + rpl: '#section-flip-9', | |
| 14 | + custom_css: '#section-flip-13' | |
| 15 | + }; | |
| 16 | + | |
| 17 | + function wpChatbotShowTabSection(tabData, fallbackIndex, sectionSelector) { | |
| 18 | + $(".content-wrap section").removeClass('content-current'); | |
| 19 | + | |
| 20 | + if (sectionSelector) { | |
| 21 | + $(sectionSelector).addClass('content-current'); | |
| 22 | + return; | |
| 23 | + } | |
| 24 | + | |
| 25 | + if (wpChatbotTabSections[tabData]) { | |
| 26 | + $(wpChatbotTabSections[tabData]).addClass('content-current'); | |
| 27 | + return; | |
| 28 | + } | |
| 29 | + | |
| 30 | + $(".content-wrap section").eq(fallbackIndex).addClass('content-current'); | |
| 31 | + } | |
| 4 | 32 | |
| 5 | 33 | var sbdstoredNoticeId = localStorage.getItem('qcld_wpbot_Notice_set'); |
| 6 | 34 | var qcld_chatbot_Notice_time_set = localStorage.getItem('qcld_wpbot_Notice_time_set'); |
| 7 | 35 | var notice_current_time = Math.round(new Date().getTime() / 1000); |
| @@ -26,10 +54,8 @@ | ||
| 26 | 54 | }); |
| 27 | 55 | |
| 28 | 56 | if(localStorage.getItem('tabData')){ |
| 29 | 57 | |
| 30 | - $(".content-wrap section").removeClass('content-current'); | |
| 31 | - | |
| 32 | 58 | $(".wp-chatbot-tabs nav ul li").each(function (index, elm) { |
| 33 | 59 | |
| 34 | 60 | if(localStorage.getItem('tabData')==$(this).attr('tab-data')){ |
| 35 | 61 | |
| @@ -34,9 +60,9 @@ | ||
| 34 | 60 | if(localStorage.getItem('tabData')==$(this).attr('tab-data')){ |
| 35 | 61 | |
| 36 | 62 | $(this).addClass('tab-current'); |
| 37 | 63 | |
| 38 | - $(".content-wrap section").eq(index).addClass('content-current'); | |
| 64 | + wpChatbotShowTabSection($(this).attr('tab-data'), index, $(this).attr('data-section')); | |
| 39 | 65 | |
| 40 | 66 | }else{ |
| 41 | 67 | |
| 42 | 68 | $(this).removeClass('tab-current'); |
| @@ -58,15 +84,13 @@ | ||
| 58 | 84 | // Remove others tab and contents |
| 59 | 85 | |
| 60 | 86 | $(".wp-chatbot-tabs nav ul li").removeClass('tab-current'); |
| 61 | 87 | |
| 62 | - $(".content-wrap section").removeClass('content-current'); | |
| 63 | - | |
| 64 | 88 | // add current tab and contents |
| 65 | 89 | |
| 66 | 90 | $(this).parent().addClass('tab-current'); |
| 67 | 91 | |
| 68 | - $(".content-wrap section").eq($(".wp-chatbot-tabs nav ul li a ").index(this)).addClass('content-current'); | |
| 92 | + wpChatbotShowTabSection($(this).parent().attr('tab-data'), $(".wp-chatbot-tabs nav ul li a ").index(this), $(this).parent().attr('data-section')); | |
| 69 | 93 | |
| 70 | 94 | //Change action url , set add localStorge and url change. |
| 71 | 95 | |
| 72 | 96 | $('#wp-chatbot-admin-form').attr('action',$(this).attr('href')); |
| @@ -1067,9 +1091,9 @@ | ||
| 1067 | 1091 | drop: function(event, ui) { |
| 1068 | 1092 | var droppable = $(this); |
| 1069 | 1093 | var draggable = ui.draggable; |
| 1070 | 1094 | // Move draggable into droppable |
| 1071 | - draggable.clone().removeClass("qc_draggable_item").addClass("qc_draggable_item_remove").appendTo(droppable); | |
| 1095 | + draggable.clone().removeClass("qc_draggable_item").addClass("qc_draggable_item_remove").removeAttr("style").appendTo(droppable); | |
| 1072 | 1096 | jQuery('#qc_wpbot_menu_order').val(jQuery('#qc_menu_area').html().trim()); |
| 1073 | 1097 | } |
| 1074 | 1098 | }); |
| 1075 | 1099 | $('#wp_chatbot_floatingiconbg_color, #wp_chatbot_text_color, #wp_chatbot_link_color,#wp_chatbot_link_hover_color,#wp_chatbot_bot_msg_bg_color,#wp_chatbot_bot_msg_text_color,#wp_chatbot_user_msg_bg_color,#wp_chatbot_header_background_color,#wp_chatbot_user_msg_text_color,#wp_chatbot_buttons_bg_color,#wp_chatbot_buttons_text_color,#wp_chatbot_theme_primary_color,#wp_chatbot_theme_secondary_color').wpColorPicker(); |
| @@ -1510,13 +1534,17 @@ | ||
| 1510 | 1534 | }) //Additional Code - 04-12-2023 ends here |
| 1511 | 1535 | } |
| 1512 | 1536 | var settingsRag = document.getElementById("save_rag_setting"); |
| 1513 | 1537 | if (settingsRag) { |
| 1538 | + $('.qcl-openai').on('change', '.rag_auto_sync_enabled', function () { | |
| 1539 | + $('.rag_auto_sync_enabled').prop('checked', this.checked); | |
| 1540 | + }); | |
| 1541 | + | |
| 1514 | 1542 | $('.qcl-openai').on('click', '#save_rag_setting', function () { |
| 1515 | 1543 | |
| 1516 | 1544 | var rag_embed_pages = $('#rag_embed_pages').is(':checked') ? 1 : 0; |
| 1517 | 1545 | var rag_embed_posts = $('#rag_embed_posts').is(':checked') ? 1 : 0; |
| 1518 | - var rag_auto_sync_enabled = $('#rag_auto_sync_enabled').is(':checked') ? 1 : 0; | |
| 1546 | + var rag_auto_sync_enabled = $('.rag_auto_sync_enabled').first().is(':checked') ? 1 : 0; | |
| 1519 | 1547 | var rag_embed_str = $('#rag_embed_str').is(':checked') ? 1 : 0; |
| 1520 | 1548 | |
| 1521 | 1549 | var rag_embed_cpts = []; |
| 1522 | 1550 | $('.rag_embed_cpts_checkbox:checked').each(function() { |
| @@ -1572,9 +1600,9 @@ | ||
| 1572 | 1600 | btn.text('Saving settings...'); |
| 1573 | 1601 | |
| 1574 | 1602 | var rag_embed_pages = $('#rag_embed_pages').is(':checked') ? 1 : 0; |
| 1575 | 1603 | var rag_embed_posts = $('#rag_embed_posts').is(':checked') ? 1 : 0; |
| 1576 | - var rag_auto_sync_enabled = $('#rag_auto_sync_enabled').is(':checked') ? 1 : 0; | |
| 1604 | + var rag_auto_sync_enabled = $('.rag_auto_sync_enabled').first().is(':checked') ? 1 : 0; | |
| 1577 | 1605 | var rag_embed_str = $('#rag_embed_str').is(':checked') ? 1 : 0; |
| 1578 | 1606 | |
| 1579 | 1607 | var rag_embed_cpts = []; |
| 1580 | 1608 | $('.rag_embed_cpts_checkbox:checked').each(function() { |