Source
this.dom.input.value = document.getElementById('line_' + this.hlIndex).getAttribute('needle');
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
var LCL_SUGGESTS = [];
function createSuggest(oid) {
var sid = LCL_SUGGESTS.length;
LCL_SUGGESTS[sid] = new CSuggest(sid, oid);
return sid;
}
var CSuggest = function(id, objid) {
this.id = id;
this.cleanCache();
this.dom.input = document.getElementById(objid);
addListener(this.dom.input, 'keyup', this.keyPressed.bindAsEventListener(this));
addListener(this.dom.input, 'blur', this.suggestBlur.bindAsEventListener(this));
addListener(window, 'resize', this.positionSuggests.bindAsEventListener(this));
this.timeoutNeedle = null;
this.userNeedle = this.dom.input.value;
};
CSuggest.prototype = {
// public
'useLocal': true, // use cache to find suggests
'useServer': true, // use server to find suggests
'saveToCache': true, // save results to cache
'cacheTimeOut': 60, // cache timeout (seconds)
'suggestLimit': 15, // suggestion show limit
'searchDelay': 200, // milliseconds
// private
'id': null, // sugg obj identity
'rpcid': 0, // rpc request id
'needles': {}, // searched strings
'userNeedle': '', // userNeedle
'timeoutNeedle': null, // Timeout reference
'cache': {
'time': 0, // cache creation time
'list': {}, // cache by word
'needle': {} // cache by needle
},
'dom': {
'input': null, // DOM node input
'suggest': null, // DOM node suggest div
'sugtab': null // DOM node suggests table
},
'hlIndex': 0, // indicates what row should be highlighted
'suggestCount': 0, // suggests shown
'mouseOverSuggest': false, // indicates if mouse is over suggests
needleChange: function(e) {
this.hlIndex = 0;
this.suggestCount = 0;
clearTimeout(this.timeoutNeedle);
var target = e.target,
needle = target.value.toLowerCase();
if (empty(needle)) {
this.hideSuggests();
return true;
}
this.userNeedle = target.value;
this.needles[needle] = {'needle': needle, 'list': {}};
var found = false;