mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactor(key) isContainStrAtBegin -> RegExp
This commit is contained in:
parent
c54f7d39fb
commit
033c1308d2
1 changed files with 5 additions and 6 deletions
|
|
@ -110,16 +110,15 @@ var CloudCmd, Util, DOM;
|
|||
}
|
||||
|
||||
function setCurrentByLetter(pKeyCode) {
|
||||
var i, n, name, isCurrent, isContain, byName, firstByName,
|
||||
var i, n, name, isCurrent, isMatch, byName, firstByName,
|
||||
skipCount = 0,
|
||||
skipN = 0,
|
||||
setted = false,
|
||||
current = Info.element,
|
||||
panel = Info.panel,
|
||||
files = Info.files,
|
||||
SMALL = 32,
|
||||
char = String.fromCharCode(pKeyCode),
|
||||
charSmall = String.fromCharCode(pKeyCode + SMALL);
|
||||
regExp = new RegExp('^' + char + '.*$', 'i');
|
||||
|
||||
n = Chars.length;
|
||||
for (i = 0; i < n; i++)
|
||||
|
|
@ -134,11 +133,11 @@ var CloudCmd, Util, DOM;
|
|||
|
||||
n = files.length;
|
||||
for (i = 0; i < n; i++) {
|
||||
current = files[i];
|
||||
current = files[i];
|
||||
name = DOM.getCurrentName(current);
|
||||
isContain = Util.isContainStrAtBegin(name, [char, charSmall]);
|
||||
isMatch = name.match(regExp);
|
||||
|
||||
if (isContain) {
|
||||
if (isMatch) {
|
||||
byName = DOM.getCurrentFileByName(name);
|
||||
|
||||
if (!skipCount) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue