Return add/remove listener functions back

master
Vitaliy Filippov 2014-09-05 15:03:50 +00:00
parent 8093f628e8
commit 62acbb95b8
2 changed files with 25 additions and 1 deletions

View File

@ -567,6 +567,21 @@ 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)
{ {
@ -583,6 +598,15 @@ 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)
{ {

2
hinter.min.js vendored

File diff suppressed because one or more lines are too long