diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index e1fcb680..12ee8eea 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -21,10 +21,12 @@ // require_tree . +// // If not your turn, poll the table $(document).ready(function(){ setInterval(function() { - // $('#table-component').load("#{request.path} #table-component"); - $('#play-to-beat').load("#{request.path} #play-to-beat"); - $('#play-buttons').load("#{request.path} #play-buttons"); + if ( $('.taking-turn.player[data-soft-token=' + soft_token + ']').length < 1 ) { + $('#flash_message').load(window.location.pathname +" #flash_message"); + $('#table-component').load(window.location.pathname +" #table-component"); + } }, 2000); });