Revision: 2691
https://sourceforge.net/p/mrbs/code/2691/
Author: cimorrison
Date: 2013-02-10 18:44:50 +0000 (Sun, 10 Feb 2013)
Log Message:
-----------
Prevented page refresh when the mouse is hovering over a resize handler (ie the
user is about to start a resize)
Modified Paths:
--------------
mrbs/trunk/web/js/refresh.js.php
mrbs/trunk/web/js/resizable.js.php
Modified: mrbs/trunk/web/js/refresh.js.php
===================================================================
--- mrbs/trunk/web/js/refresh.js.php 2013-02-10 13:30:56 UTC (rev 2690)
+++ mrbs/trunk/web/js/refresh.js.php 2013-02-10 18:44:50 UTC (rev 2691)
@@ -60,6 +60,7 @@
if (typeof intervalId !== 'undefined')
{
window.clearInterval(intervalId);
+ intervalId = undefined;
}
if (!pageHidden)
{
@@ -77,7 +78,7 @@
var oldInitRefresh = init;
init = function(args) {
oldInitRefresh.apply(this, [args]);
-
+
refreshPage = function refreshPage() {
if (!isHidden() && !refreshPage.disabled)
{
@@ -99,14 +100,15 @@
// (1) Empty the existing table in order to get rid of
events
// and data and prevent memory leaks, (2) insert the
updated
// table HTML, (3) clear the existing interval timer and
then
- // (4) trigger a window load event so that the resizable
bookings
- // are re-created and a new interval timer is started
+ // (4) trigger a window load event so that the resizable
+ // bookings are re-created and a new timer started.
?>
if (!isHidden() && !refreshPage.disabled)
{
table.empty();
table.html(result);
window.clearInterval(intervalId);
+ intervalId = undefined;
$(window).trigger('load');
}
},
@@ -115,9 +117,12 @@
};
<?php
- // Set an interval timer to refresh the page.
+ // Set an interval timer to refresh the page, unless there's already one
in place
?>
- intervalId = setInterval(refreshPage, <?php echo $refresh_rate * 1000 ?>);
+ if (typeof intervalId === 'undefined')
+ {
+ intervalId = setInterval(refreshPage, <?php echo $refresh_rate * 1000
?>);
+ }
<?php
Modified: mrbs/trunk/web/js/resizable.js.php
===================================================================
--- mrbs/trunk/web/js/resizable.js.php 2013-02-10 13:30:56 UTC (rev 2690)
+++ mrbs/trunk/web/js/resizable.js.php 2013-02-10 18:44:50 UTC (rev 2691)
@@ -1205,6 +1205,49 @@
getTableData(table, tableData);
}
});
+
+ <?php
+ // We want to disable page refresh if the user is hovering over
+ // the resizable handles. We trigger a mouseenter event on page
+ // load so we can work out whether the mouse is over the handle
+ // on page load (but we only need to trigger one event)
+ ?>
+ var mouseDown = false;
+ $('div.clone .ui-resizable-handle')
+ .mouseenter(function(e) {
+ if (!mouseDown)
+ {
+ if ($(this).is(':hover'))
+ {
+ turnOffPageRefresh();
+ }
+ else
+ {
+ turnOnPageRefresh();
+ }
+ }
+ })
+ .mouseleave(function() {
+ if (!mouseDown)
+ {
+ turnOnPageRefresh();
+ }
+ })
+ .mousedown(function() {
+ mouseDown = true;
+ if ($(this).is(':hover'))
+ {
+ turnOffPageRefresh();
+ }
+ })
+ .mouseup(function() {
+ mouseDown = false;
+ if (!$(this).is(':hover'))
+ {
+ turnOnPageRefresh();
+ }
+ })
+ .first().trigger('mouseenter');
<?php // also need to redraw and recalibrate if the multiple bookings
are clicked ?>
table.find('div.multiple_control')
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits