[open-ils-commits] r230 - servres/trunk/conifer/static (gfawcett)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Mar 26 11:58:28 EDT 2009
Author: gfawcett
Date: 2009-03-26 11:58:26 -0400 (Thu, 26 Mar 2009)
New Revision: 230
Modified:
servres/trunk/conifer/static/menublocks.js
Log:
require 'linger' over menublock openers before triggering.
These are the little gray arrows beside the item-names that trigger
the 'about/edit' menus to pop up. Previously, if you sailed your mouse
over one of them while moving across the screen, they would pop
open. Aggravating. Now a moment of linger-time (currently 200ms) over
the arrows is needed to trigger the menu. Much nicer.
Modified: servres/trunk/conifer/static/menublocks.js
===================================================================
--- servres/trunk/conifer/static/menublocks.js 2009-03-26 02:46:06 UTC (rev 229)
+++ servres/trunk/conifer/static/menublocks.js 2009-03-26 15:58:26 UTC (rev 230)
@@ -3,12 +3,13 @@
$('div').click(hideblocks);
}
+var LINGER = 200; // # milliseconds linger-time required to trigger menu
var blocknum = 0;
function make_opener() {
var menublock = $(this);
var blockid = 'menublock' + (blocknum++);
menublock.attr('id', blockid);
- var opener = '<a class="menublockopener" onmouseover="openblock(\'' + blockid + '\');" href="javascript:openblock(\'' + blockid + '\');">»</a>';
+ var opener = '<a class="menublockopener" onmouseout="maybe_cancelblock(\'' + blockid + '\');" onmouseover="maybe_openblock(\'' + blockid + '\');" href="javascript:openblock(\'' + blockid + '\');">»</a>';
menublock.before(opener);
menublock.hide();
}
@@ -17,10 +18,30 @@
$('span.menublock').hide();
}
+// the block we are scheduling to open (due to a mouseover).
+var block_to_open = null;
+
+function maybe_cancelblock(bid) {
+ // if it is not open yet, this will stop it from opening.
+ block_to_open = null;
+}
+
+function maybe_openblock(bid) {
+ // it's 'maybe' because it's cancellable. You have to linger for
+ // LINGER milliseconds for the open to happen; otherwise
+ // maybe_cancelblock() will prevent it.
+ block_to_open = bid;
+ var cmd = 'openblock("' + bid + '")';
+ setTimeout(cmd, LINGER);
+}
+
function openblock(bid) {
- if (!resequencing) {
- hideblocks();
- $('#' + bid).fadeIn('fast');
+ if (!resequencing) { // it's annoying during reseq.
+ if (block_to_open == bid) {
+ hideblocks();
+ $('#' + bid).fadeIn('fast');
+ block_to_open = null;
+ }
}
}
More information about the open-ils-commits
mailing list