Bug 1933093 - Move matchEntry helper into static.js in cZ. r=frg
This commit is contained in:
Родитель
7637a2ebbd
Коммит
de296fbdb0
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче