From: Sarven Capadisli Date: Sat, 5 Dec 2009 23:12:56 +0000 (+0000) Subject: Preliminary UI for Play/Pause behaviour on hover state for notices X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a555963f979a26e1276e28b56f2cab048155d7fd;p=quix0rs-gnu-social.git Preliminary UI for Play/Pause behaviour on hover state for notices --- diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index ce0297339d..a760158b02 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');