Return true on show/hide success

master
Vitaliy Filippov 2014-09-05 10:32:57 +00:00
parent f140faedb9
commit 0b13659427
1 changed files with 5 additions and 25 deletions

View File

@ -2,7 +2,7 @@
Homepage: http://yourcmc.ru/wiki/SimpleAutocomplete
License: MPL 2.0+ (http://www.mozilla.org/MPL/2.0/)
Version: 2014-09-04
Version: 2014-09-05
(c) Vitaliy Filippov 2011-2014
Usage:
@ -377,7 +377,10 @@ SimpleAutocomplete.prototype.hide = function()
if (!this.persist)
{
if (!this.skipHideCounter)
{
this.hintLayer.style.display = 'none';
return true;
}
else
this.skipHideCounter = 0;
}
@ -392,6 +395,7 @@ SimpleAutocomplete.prototype.show = function()
this.hintLayer.style.top = (p.top+this.input.offsetHeight) + 'px';
this.hintLayer.style.left = p.left + 'px';
this.hintLayer.style.display = '';
return true;
}
};
@ -563,21 +567,6 @@ SimpleAutocomplete.GlobalMouseDown = function(ev)
// *** UTILITY FUNCTIONS ***
// Remove this section if you already have these functions defined somewhere else
// Cross-browser add/remove event listeners
var addListener = function()
{
return window.addEventListener
? function(el, type, fn) { el.addEventListener(type, fn, false); }
: function(el, type, fn) { el.attachEvent('on'+type, fn); };
}();
var removeListener = function()
{
return window.removeEventListener
? function(el, type, fn) { el.removeEventListener(type, fn, false); }
: function(el, type, fn) { el.detachEvent('on'+type, fn); };
}();
// Cancel event bubbling and/or default action
var stopEvent = function(ev, cancelBubble, preventDefault)
{
@ -594,15 +583,6 @@ var stopEvent = function(ev, cancelBubble, preventDefault)
return !preventDefault;
};
// Remove leading and trailing whitespace
if (!String.prototype.trim)
{
String.prototype.trim = function()
{
return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
};
}
// Get element position, relative to the top-left corner of page
var getOffset = function(elem)
{