From a555963f979a26e1276e28b56f2cab048155d7fd Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sat, 5 Dec 2009 23:12:56 +0000 Subject: Preliminary UI for Play/Pause behaviour on hover state for notices --- plugins/Realtime/realtimeupdate.js | 57 ++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 21 deletions(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index ce0297339..a760158b0 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -191,13 +191,13 @@ RealtimeUpdate = { initActions: function(url, timeline, path) { - var NP = $('#notices_primary'); - NP.prepend(''); + $('#notices_primary').prepend(''); RealtimeUpdate._pluginPath = path; RealtimeUpdate.initPlayPause(); RealtimeUpdate.initAddPopup(url, timeline, RealtimeUpdate._pluginPath); + RealtimeUpdate.addNoticesHover(); }, initPlayPause: function() @@ -207,14 +207,14 @@ RealtimeUpdate = { showPause: function() { - RT_PP = $('#realtime_playpause'); - RT_PP.empty(); - RT_PP.append(''); + RealtimeUpdate._paused = false; + RealtimeUpdate.showQueuedNotices(); - RT_P = $('#realtime_pause'); - RT_P.bind('click', function() { - RealtimeUpdate._paused = true; + $('#realtime_playpause').remove(); + $('#realtime_actions').prepend('
  • '); + $('#realtime_pause').bind('click', function() { + RealtimeUpdate.removeNoticesHover(); RealtimeUpdate.showPlay(); return false; }); @@ -222,18 +222,14 @@ RealtimeUpdate = { showPlay: function() { - RT_PP = $('#realtime_playpause'); - RT_PP.empty(); - RT_PP.append(' '); + RealtimeUpdate._paused = true; - RT_P = $('#realtime_play'); - RT_P.bind('click', function() { - RealtimeUpdate._paused = false; + $('#realtime_playpause').remove(); + $('#realtime_actions').prepend('
  • '); + $('#realtime_play').bind('click', function() { + RealtimeUpdate.addNoticesHover(); RealtimeUpdate.showPause(); - - RealtimeUpdate.showQueuedNotices(); - return false; }); }, @@ -259,13 +255,32 @@ RealtimeUpdate = { $('#realtime_playpause #queued_counter').empty(); }, + addNoticesHover: function() + { + $('#notices_primary .notices').hover( + function() { + if (RealtimeUpdate._paused === false) { + RealtimeUpdate.showPlay(); + } + }, + function() { + if (RealtimeUpdate._paused === true) { + RealtimeUpdate.showPause(); + } + } + ); + }, + + removeNoticesHover: function() + { + $('#notices_primary .notices').unbind('hover'); + }, + initAddPopup: function(url, timeline, path) { - var NP = $('#realtime_timeline'); - NP.append(''); + $('#realtime_timeline').append(''); - var PP = $('#realtime_popup'); - PP.bind('click', function() { + $('#realtime_popup').bind('click', function() { window.open(url, '', 'toolbar=no,resizable=yes,scrollbars=yes,status=no,menubar=no,personalbar=no,location=no,width=500,height=550'); -- cgit v1.2.3-54-g00ecf