Skip to content

Instantly share code, notes, and snippets.

@polymorphm
Created October 20, 2011 07:59
Show Gist options
  • Save polymorphm/1300637 to your computer and use it in GitHub Desktop.
Save polymorphm/1300637 to your computer and use it in GitHub Desktop.
// -*- mode: javascript; coding: utf-8 -*-
//
// <copyright-and-licence-header--blahblahblah>
(function ($) {
'use strict'
var HAS_ONLINE_OPERATORS_URL = '/webim/has_online_operators.php'
function has_online_operators (callback) {
$.post(HAS_ONLINE_OPERATORS_URL, {}, (function (data) {
if (!data.errors) {
callback(data.is_online)
}
}))
}
$(function () {
has_online_operators(function (is_online) {
if (is_online) {
// if operator is online -- begin button show-animation
var webim_client = $('.WebimClientButtonObject')
webim_client.css({
display: 'block',
position: 'fixed',
right: '0',
bottom: '0',
zIndex: '100',
height: '0',
overflow: 'hidden',
})
webim_client.animate({
height: '90px',
}, 2000)
}
})
})
})(jQuery)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment