Return true on show/hide success
parent
f140faedb9
commit
0b13659427
30
hinter.js
30
hinter.js
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Homepage: http://yourcmc.ru/wiki/SimpleAutocomplete
|
Homepage: http://yourcmc.ru/wiki/SimpleAutocomplete
|
||||||
License: MPL 2.0+ (http://www.mozilla.org/MPL/2.0/)
|
License: MPL 2.0+ (http://www.mozilla.org/MPL/2.0/)
|
||||||
Version: 2014-09-04
|
Version: 2014-09-05
|
||||||
(c) Vitaliy Filippov 2011-2014
|
(c) Vitaliy Filippov 2011-2014
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
@ -377,7 +377,10 @@ SimpleAutocomplete.prototype.hide = function()
|
||||||
if (!this.persist)
|
if (!this.persist)
|
||||||
{
|
{
|
||||||
if (!this.skipHideCounter)
|
if (!this.skipHideCounter)
|
||||||
|
{
|
||||||
this.hintLayer.style.display = 'none';
|
this.hintLayer.style.display = 'none';
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
this.skipHideCounter = 0;
|
this.skipHideCounter = 0;
|
||||||
}
|
}
|
||||||
|
@ -392,6 +395,7 @@ SimpleAutocomplete.prototype.show = function()
|
||||||
this.hintLayer.style.top = (p.top+this.input.offsetHeight) + 'px';
|
this.hintLayer.style.top = (p.top+this.input.offsetHeight) + 'px';
|
||||||
this.hintLayer.style.left = p.left + 'px';
|
this.hintLayer.style.left = p.left + 'px';
|
||||||
this.hintLayer.style.display = '';
|
this.hintLayer.style.display = '';
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -563,21 +567,6 @@ SimpleAutocomplete.GlobalMouseDown = function(ev)
|
||||||
// *** UTILITY FUNCTIONS ***
|
// *** UTILITY FUNCTIONS ***
|
||||||
// Remove this section if you already have these functions defined somewhere else
|
// 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
|
// Cancel event bubbling and/or default action
|
||||||
var stopEvent = function(ev, cancelBubble, preventDefault)
|
var stopEvent = function(ev, cancelBubble, preventDefault)
|
||||||
{
|
{
|
||||||
|
@ -594,15 +583,6 @@ var stopEvent = function(ev, cancelBubble, preventDefault)
|
||||||
return !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
|
// Get element position, relative to the top-left corner of page
|
||||||
var getOffset = function(elem)
|
var getOffset = function(elem)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue