Created
January 26, 2010 11:48
-
-
Save mooz/286772 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
key.setViewKey('o', function (aEvent) { | |
prompt.reader( | |
{ | |
message : "Find file:", | |
group : "find-file", | |
flags : [ICON | IGNORE, 0], | |
completer : completer.fetch.directory( | |
{ | |
// hideDotFiles : true, | |
// mask : /\.(js|jpg|jpeg)$/, | |
filter: function (collection, query) { | |
let matched = []; | |
let remains = collection; | |
// head | |
remains = remains.filter(function (c) { | |
if (c.indexOf(query) === 0) { matched.push(c); return false; } | |
return true; | |
}); | |
// ignore case | |
let (query = query.toLowerCase()) | |
remains = remains.filter(function (c) { | |
if (c.toLowerCase().indexOf(query.toLowerCase()) === 0) { matched.push(c); return false; } | |
return true; | |
}); | |
if ("xulMigemoCore" in window) | |
return matched.concat(remains.filter(function (c) c.match(window.xulMigemoCore.getRegExp(query)))); | |
return matched; | |
} | |
} | |
), | |
callback : function (query) { | |
if (query) | |
{ | |
openUILinkIn(util.pathToURL(query), "tab"); | |
} | |
} | |
} | |
); | |
}, 'Find file'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment