Created
August 26, 2015 09:46
-
-
Save FiNGAHOLiC/a23c8f831a5140910483 to your computer and use it in GitHub Desktop.
Zopim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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