Skip to content

Instantly share code, notes, and snippets.

@FiNGAHOLiC
Created August 26, 2015 09:46
Show Gist options
  • Save FiNGAHOLiC/a23c8f831a5140910483 to your computer and use it in GitHub Desktop.
Save FiNGAHOLiC/a23c8f831a5140910483 to your computer and use it in GitHub Desktop.
Zopim
(function () {
var zopim = {
elems: {},
setElements: function () {
var elems = this.elems;
elems.button = $('.zopim');
elems.iframe = elems.button.find('iframe').contents();
elems.label = elems.iframe.find('.mobile .greeting');
},
exec: function () {
var elems = this.elems;
if (!elems.iframe.length) {
setTimeout($.proxy(function () {
this.setElements();
this.exec();
}, this), 100);
return;
}
if (elems.label.length) {
elems.button.css('width', 185);
elems.label.text('お困りですか?');
}
setTimeout(function () {
$zopim.livechat.button.show();
}, 100);
}
};
$zopim(function () {
$zopim.livechat.setOnConnected(function () {
zopim.setElements();
zopim.exec();
});
$zopim.livechat.window.onHide(function () {
$zopim.livechat.button.show();
});
});
} ());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment