зеркало из https://github.com/mozilla/gecko-dev.git
Bug 213832: about:config filtering enhancement: search for status/type/value and allow wildcards, patch by Christian Franke <Franke@computer.org>, r=neil+mconnor,
This commit is contained in:
Родитель
d65fad2850
Коммит
95fbb23132
|
@ -365,20 +365,34 @@ function onConfigUnload()
|
|||
|
||||
function FilterPrefs()
|
||||
{
|
||||
var substring = document.getElementById("textbox").value.toLowerCase();
|
||||
var substring = document.getElementById("textbox").value;
|
||||
var rex;
|
||||
// Check for "/regex/[i]"
|
||||
if (substring.charAt(0) == '/') {
|
||||
var r = substring.match(/^\/(.*)\/(i?)$/);
|
||||
try {
|
||||
rex = RegExp(r[1], r[2]);
|
||||
}
|
||||
catch (e) {
|
||||
return; // Do nothing on incomplete or bad RegExp
|
||||
}
|
||||
}
|
||||
|
||||
var prefCol = view.selection.currentIndex < 0 ? null : gPrefView[view.selection.currentIndex].prefCol;
|
||||
var array = gPrefView;
|
||||
var oldlen = gPrefView.length;
|
||||
gPrefView = gPrefArray;
|
||||
if (substring) {
|
||||
gPrefView = [];
|
||||
if (!rex)
|
||||
rex = RegExp(substring.replace(/([^* \w])/g, "\\$1").replace(/[*]/g, ".*"), "i");
|
||||
for (var i = 0; i < gPrefArray.length; ++i)
|
||||
if (gPrefArray[i].prefCol.toLowerCase().indexOf(substring) >= 0)
|
||||
if (rex.test(gPrefArray[i].prefCol + ";" + gPrefArray[i].valueCol))
|
||||
gPrefView.push(gPrefArray[i]);
|
||||
if (gFastIndex < gPrefArray.length)
|
||||
gPrefView.sort(gSortFunction);
|
||||
}
|
||||
view.treebox.invalidate();
|
||||
view.treebox.rowCountChanged(array.length, gPrefView.length - array.length);
|
||||
view.treebox.rowCountChanged(oldlen, gPrefView.length - oldlen);
|
||||
gotoPref(prefCol);
|
||||
document.getElementById("button").disabled = !substring;
|
||||
}
|
||||
|
|
|
@ -365,20 +365,34 @@ function onConfigUnload()
|
|||
|
||||
function FilterPrefs()
|
||||
{
|
||||
var substring = document.getElementById("textbox").value.toLowerCase();
|
||||
var substring = document.getElementById("textbox").value;
|
||||
var rex;
|
||||
// Check for "/regex/[i]"
|
||||
if (substring.charAt(0) == '/') {
|
||||
var r = substring.match(/^\/(.*)\/(i?)$/);
|
||||
try {
|
||||
rex = RegExp(r[1], r[2]);
|
||||
}
|
||||
catch (e) {
|
||||
return; // Do nothing on incomplete or bad RegExp
|
||||
}
|
||||
}
|
||||
|
||||
var prefCol = view.selection.currentIndex < 0 ? null : gPrefView[view.selection.currentIndex].prefCol;
|
||||
var array = gPrefView;
|
||||
var oldlen = gPrefView.length;
|
||||
gPrefView = gPrefArray;
|
||||
if (substring) {
|
||||
gPrefView = [];
|
||||
if (!rex)
|
||||
rex = RegExp(substring.replace(/([^* \w])/g, "\\$1").replace(/[*]/g, ".*"), "i");
|
||||
for (var i = 0; i < gPrefArray.length; ++i)
|
||||
if (gPrefArray[i].prefCol.toLowerCase().indexOf(substring) >= 0)
|
||||
if (rex.test(gPrefArray[i].prefCol + ";" + gPrefArray[i].valueCol))
|
||||
gPrefView.push(gPrefArray[i]);
|
||||
if (gFastIndex < gPrefArray.length)
|
||||
gPrefView.sort(gSortFunction);
|
||||
}
|
||||
view.treebox.invalidate();
|
||||
view.treebox.rowCountChanged(array.length, gPrefView.length - array.length);
|
||||
view.treebox.rowCountChanged(oldlen, gPrefView.length - oldlen);
|
||||
gotoPref(prefCol);
|
||||
document.getElementById("button").disabled = !substring;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче