Difference between revisions of "MediaWiki:Common.js"

From Online Support Wiki
Jump to navigation Jump to search
m
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
/* Any JavaScript here will be loaded for all users on every page load. */
 
/* Any JavaScript here will be loaded for all users on every page load. */
 +
//Start of HappyFox Live Chat Script
 +
window.HFCHAT_CONFIG = {
 +
    EMBED_TOKEN: 'ea83d280-c091-11ea-a122-a18adb1b3bea',
 +
    ASSETS_URL: 'https://widget.happyfoxchat.com/v2/visitor'
 +
  };
 +
  (function () {
 +
    var scriptTag = document.createElement('script')
 +
    scriptTag.type = 'text/javascript'
 +
    scriptTag.async = true
 +
    scriptTag.src = window.HFCHAT_CONFIG.ASSETS_URL + '/js/widget-loader.js'
 +
 +
    var s = document.getElementsByTagName('script')[0]
 +
    s.parentNode.insertBefore(scriptTag, s)
 +
  })()
 +
 +
HFCHAT_CONFIG.options = {
 +
  showBadgeOnLoad: false, // Will hide badge only on load
 +
};
 +
 +
window.HFCHAT_CONFIG.onload = function() {
 +
  var HappyFoxChat = this;
 +
  document.getElementById('hf-chat').addEventListener('click', function(e){
 +
      e.preventDefault();
 +
      HappyFoxChat.showWidget();
 +
      HappyFoxChat.expandChatbox();
 +
  });
 +
};

Latest revision as of 21:01, 8 December 2020

/* Any JavaScript here will be loaded for all users on every page load. */
//Start of HappyFox Live Chat Script
window.HFCHAT_CONFIG = {
    EMBED_TOKEN: 'ea83d280-c091-11ea-a122-a18adb1b3bea',
    ASSETS_URL: 'https://widget.happyfoxchat.com/v2/visitor'
  };
  (function () {
    var scriptTag = document.createElement('script')
    scriptTag.type = 'text/javascript'
    scriptTag.async = true
    scriptTag.src = window.HFCHAT_CONFIG.ASSETS_URL + '/js/widget-loader.js'

    var s = document.getElementsByTagName('script')[0]
    s.parentNode.insertBefore(scriptTag, s)
  })()

HFCHAT_CONFIG.options = {
   showBadgeOnLoad: false, // Will hide badge only on load
};

window.HFCHAT_CONFIG.onload = function() {
   var HappyFoxChat = this;
   document.getElementById('hf-chat').addEventListener('click', function(e){
      e.preventDefault();
      HappyFoxChat.showWidget();
      HappyFoxChat.expandChatbox();
   });
};