Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

Latest commit

 

History

History
73 lines (63 loc) · 1.51 KB

File metadata and controls

73 lines (63 loc) · 1.51 KB
title contributors issues
Zopim
user name
fpleme
Fernão Paes Leme
user name
reed
Nick Reed
repo number
rails/turbolinks
131

Zopim Live Chat Widget

zopim.com/product

Official Implementation

<body>
  <script>
  window.$zopim || (function(d,s){
    var z = $zopim = function(c){
      z._.push(c)
    }, $ = z.s = d.createElement(s), e = d.getElementsByTagName(s)[0];
    z.set = function(o){
      z.set._.push(o)
    };
    z._= [];
    z.set._ = [];
    $.async = !0;
    $.setAttribute('charset','utf-8');
    $.src = '//cdn.zopim.com/?MY_APP_KEY';
    z.t = +new Date;
    $.type='text/javascript';
    e.parentNode.insertBefore($,e)
  })(document,'script');
  </script>
</body>

Solution

Remove the supplied javascript and add the following to your application's javascript.

function zopim_chat(){
  $('[__jx__id], embed#__zopnetworkswf').remove();
  window.$zopim = null;
  (function(d,s){
    var z = $zopim = function(c){
      z._.push(c)
    }, $ = z.s = d.createElement(s), e = d.body.getElementsByTagName(s)[0];
    z.set = function(o){
      z.set._.push(o)
    };
    z._ = [];
    z.set._ = [];
    $.async = !0;
    $.setAttribute('charset','utf-8');
    $.src = '//cdn.zopim.com/?MY_APP_KEY';
    z.t = +new Date;
    $.type = 'text/javascript';
    e.parentNode.insertBefore($,e)
  })(document,'script');
}

$(document).on("ready page:load", function() {
  zopim_chat();
});