Skip to content

Instantly share code, notes, and snippets.

@IlyaDonskikh
Last active August 29, 2015 14:27
Show Gist options
  • Save IlyaDonskikh/5dcb658d53a8989807cd to your computer and use it in GitHub Desktop.
Save IlyaDonskikh/5dcb658d53a8989807cd 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