Bug 1933093 - Move matchEntry helper into static.js in cZ. r=frg

This commit is contained in:
Ian Neal 2024-11-24 18:17:49 +00:00
Родитель 7637a2ebbd
Коммит de296fbdb0
2 изменённых файлов: 28 добавлений и 27 удалений

Просмотреть файл

@ -293,33 +293,6 @@ function utils_lcfn(text)
return text.toLowerCase();
}
function matchEntry (partialName, list, lcFn)
{
if ((typeof partialName == "undefined") ||
(String(partialName) == ""))
{
var ary = new Array();
for (var i in list)
ary.push(i);
return ary;
}
if (typeof lcFn != "function")
lcFn = utils_lcfn;
ary = new Array();
for (i in list)
{
if (lcFn(list[i]).indexOf(lcFn(partialName)) == 0)
ary.push(i);
}
return ary;
}
function encodeChar(ch)
{
return "%" + ch.charCodeAt(0).toString(16);

Просмотреть файл

@ -5422,3 +5422,31 @@ function showEventAlerts (type, event, message, nick, o, thisp, msgtype)
// yup. it is probably a MAC or NsIAlertsService is not initialized
}
}
function matchEntry(partialName, list, lcFn)
{
function utils_lcfn(text)
{
return text.toLowerCase();
};
let ary = new Array();
if ((typeof partialName == "undefined") || (String(partialName) == ""))
{
for (let i in list)
ary.push(i);
return ary;
}
if (typeof lcFn != "function")
lcFn = utils_lcfn;
for (let i in list)
{
if (lcFn(list[i]).indexOf(lcFn(partialName)) == 0)
ary.push(i);
}
return ary;
}