# supportcandy/2.3.1/asset/js/modal.js

SupportCandy – AI Customer Support Ticket System &amp; Live Chatbot Agent, version 2.3.1. 52 lines.

- Page: https://pluginprobe.com/plugins/supportcandy/2.3.1/code/asset/js/modal.js
- Raw: https://pluginprobe.com/plugins/supportcandy/2.3.1/raw/asset/js/modal.js
- Modified: 2022-07-21T08:20:56+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/supportcandy/2.3.1/code/asset/js/modal.js#L10-L20`.

```javascript

jQuery(document).ready(function(){
  
  jQuery('#wpsc_popup_background,.wpsc_popup_close').click(function(){
    wpsc_modal_close();
  });
  
  jQuery(document).keyup(function(e){
    if (e.keyCode == 27) { 
      wpsc_modal_close();
    }
  });
  
});

function wpsc_modal_open(title){
  jQuery('#wpsc_popup_title h3').text(title);
  jQuery('#wpsc_popup_body').html(wpsc_admin.loading_html);
  jQuery('.wpsc_popup_action').hide();
  jQuery('#wpsc_popup_container,#wpsc_popup_background').show();
}

function wpsc_modal_close(){
  jQuery('#wpsc_popup_container,#wpsc_popup_background').hide();
}

function wpsc_modal_close_thread(tinymce_toolbar){
  
  jQuery('#wpsc_popup_container,#wpsc_popup_background').hide();
  var is_tinymce = (typeof tinyMCE != "undefined") && tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden();
  if(is_tinymce){
    tinymce.init({
      selector:'#wpsc_reply_box',
      body_id: 'wpsc_reply_box',
      menubar: false,
      statusbar: false,
      autoresize_min_height: 150,
      wp_autoresize_on: true,
      plugins: [
          'wpautoresize lists link image directionality'
      ],
      toolbar:  tinymce_toolbar.join() +' | wpsc_templates',
      branding: false,
      autoresize_bottom_margin: 20,
      browser_spellcheck : true,
      relative_urls : false,
      remove_script_host : false,
      convert_urls : true
    });
  }
}

```
