Skip to content

Instantly share code, notes, and snippets.

@mediasota
Forked from IlyaDonskikh/synсChatScript.js
Last active August 29, 2015 14:27
Show Gist options
  • Save mediasota/8a534c5aa9a253e37c4a to your computer and use it in GitHub Desktop.
Save mediasota/8a534c5aa9a253e37c4a to your computer and use it in GitHub Desktop.
lastActionTime = new Date()
syncInterval = 30000
$('*').on 'blur change click dblclick error focus focusin focusout hover keydown keypress keyup load mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup resize scroll select submit', ->
lastActionTime = new Date()
setInterval (->
currentTime = new Date()
timeLimit = currentTime - lastActionTime
if timeLimit > syncInterval
element = $('.add_last_messages_action_JS')
element.trigger('click')
lastActionTime = currentTime
), 500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment