PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.8.0
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.8.0
8.8.0 8.7.9 8.7.8 8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 8.5.5 All 536 releases
chatbot / qc-rating-feature / js / rating.js

rating.js in WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services 8.8.0, at qc-rating-feature/js/rating.js

86 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery(document).ready(function(){
2
3 jQuery(document).on( 'click', '.qcbot-feedback .notice-dismiss', function(){
4 var notice_type = jQuery(this).parents('.qcbot-feedback.is-dismissible').attr('data-dismiss-type');
5 jQuery.ajax({
6 url: qcld_rating_object.ajax_url,
7 data: {
8 action: 'qc_chatbot_feedback_notice_dismiss',
9 dismiss_notice: notice_type
10 },
11 success: function(){ }
12 })
13 } )
14
15 jQuery(document).on( 'click', '.qcbot-blackfriday .notice-dismiss', function(){
16 var notice_type = jQuery(this).parents('.qcbot-blackfriday.is-dismissible').attr('data-dismiss-type');
17 jQuery.ajax({
18 url: qcld_rating_object.ajax_url,
19 data: {
20 action: 'qc_chatbot_blackfriday_notice_dismiss',
21 dismiss_notice: notice_type
22 },
23 success: function(){ }
24 })
25 } )
26
27 // AI Review Generator
28 jQuery(document).on( 'click', '#qc-write-review-ai', function(e){
29 e.preventDefault();
30
31 var container = jQuery('#qc-ai-review-container');
32 var textarea = jQuery('#qc-ai-review-text');
33
34 container.slideDown();
35 container.addClass('loading');
36 textarea.val('');
37
38 jQuery.ajax({
39 url: qcld_rating_object.ajax_url,
40 type: 'POST',
41 data: {
42 action: 'qc_chatbot_generate_review_ai',
43 nonce: qcld_rating_object.nonce
44 },
45 success: function(response){
46 container.removeClass('loading');
47 if(response.success && response.data && response.data.review) {
48 textarea.val(response.data.review);
49 } else {
50 textarea.val('Failed to generate review. Please try again.');
51 }
52 },
53 error: function() {
54 container.removeClass('loading');
55 textarea.val('Failed to connect to the server. Please try again.');
56 }
57 });
58 });
59
60 // Copy to Clipboard
61 jQuery(document).on( 'click', '#qc-copy-review-btn', function(e){
62 e.preventDefault();
63
64 var textarea = document.getElementById('qc-ai-review-text');
65 if(!textarea || !textarea.value) {
66 return;
67 }
68
69 textarea.select();
70 textarea.setSelectionRange(0, 99999); /* For mobile devices */
71
72 navigator.clipboard.writeText(textarea.value).then(function() {
73 var btn = jQuery('#qc-copy-review-btn');
74 var btnText = btn.find('.qc-btn-text');
75
76 btn.addClass('copied');
77 btnText.text('Copied!');
78
79 setTimeout(function() {
80 btn.removeClass('copied');
81 btnText.text('Copy to Clipboard');
82 }, 2000);
83 });
84 });
85
86 });