Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
check
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_web
check
Commits
3c6f7aef
Commit
3c6f7aef
authored
Dec 16, 2020
by
Kim Eunchul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#40821 【TECSS Web 1.9.2.6】「or」「(」「半角スペース」で検索した時の結果が統一されていない
parent
a8ca3a66
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
24 deletions
+68
-24
abvw/js/contentview.js
+68
-24
No files found.
abvw/js/contentview.js
View file @
3c6f7aef
...
...
@@ -747,51 +747,106 @@ CONTENTVIEW.searchHandle = function() {
var
myQuery
;
var
myRegExpArr
=
[];
var
count
=
0
;
var
textReg
=
$
(
'#txtSearch'
).
val
().
replace
(
/
[
.*+?^${}|[
\]\\]
/g
,
"
\\
$&"
).
replace
(
"%"
,
"
\\
%"
).
replace
(
' '
,
'" "'
).
replace
(
"("
,
" ( "
).
replace
(
")"
,
" ) "
);;
var
textReg
=
$
(
'#txtSearch'
).
val
().
replace
(
/
\(
/g
,
"
\
( "
).
replace
(
/
\)
/g
,
"
\
) "
);
if
(
$
(
'#txtSearch'
).
val
()
==
'"("'
){
myRegExpArr
[
0
]
=
new
RegExp
(
"[
\
(]"
);
for
(
var
nIndex
=
0
;
nIndex
<
contentPage
.
length
;
nIndex
++
)
{
if
(
myRegExpArr
[
0
].
test
(
contentPage
[
nIndex
].
pageText
))
{
sPageNo
.
push
(
contentPage
[
nIndex
]);
}
}
}
else
if
(
$
(
'#txtSearch'
).
val
()
==
'")"'
){
myRegExpArr
[
0
]
=
new
RegExp
(
"[
\
)]"
);
for
(
var
nIndex
=
0
;
nIndex
<
contentPage
.
length
;
nIndex
++
)
{
if
(
myRegExpArr
[
0
].
test
(
contentPage
[
nIndex
].
pageText
))
{
sPageNo
.
push
(
contentPage
[
nIndex
]);
}
}
}
else
if
(
$
(
'#txtSearch'
).
val
()
==
'"or"'
){
myRegExpArr
[
0
]
=
new
RegExp
(
"or"
);
for
(
var
nIndex
=
0
;
nIndex
<
contentPage
.
length
;
nIndex
++
)
{
if
(
myRegExpArr
[
0
].
test
(
contentPage
[
nIndex
].
pageText
))
{
sPageNo
.
push
(
contentPage
[
nIndex
]);
}
}
}
else
if
(
$
(
'#txtSearch'
).
val
()
==
'"Or"'
){
myRegExpArr
[
0
]
=
new
RegExp
(
"Or"
);
for
(
var
nIndex
=
0
;
nIndex
<
contentPage
.
length
;
nIndex
++
)
{
if
(
myRegExpArr
[
0
].
test
(
contentPage
[
nIndex
].
pageText
))
{
sPageNo
.
push
(
contentPage
[
nIndex
]);
}
}
}
else
if
(
$
(
'#txtSearch'
).
val
()
==
'"oR"'
){
myRegExpArr
[
0
]
=
new
RegExp
(
"oR"
);
for
(
var
nIndex
=
0
;
nIndex
<
contentPage
.
length
;
nIndex
++
)
{
if
(
myRegExpArr
[
0
].
test
(
contentPage
[
nIndex
].
pageText
))
{
sPageNo
.
push
(
contentPage
[
nIndex
]);
}
}
}
else
if
(
$
(
'#txtSearch'
).
val
()
==
'"OR"'
){
myRegExpArr
[
0
]
=
new
RegExp
(
"OR"
);
for
(
var
nIndex
=
0
;
nIndex
<
contentPage
.
length
;
nIndex
++
)
{
if
(
myRegExpArr
[
0
].
test
(
contentPage
[
nIndex
].
pageText
))
{
sPageNo
.
push
(
contentPage
[
nIndex
]);
}
}
}
else
{
try
{
do
{
var
match
=
myRegexp
.
exec
(
textReg
);
if
(
match
!=
null
)
{
myArray
.
push
(
match
[
1
]
?
match
[
1
]
:
match
[
0
]
);
myArray
.
push
(
match
[
1
]
?
match
[
1
]
.
replace
(
/
\(
/g
,
"
\
("
).
replace
(
/
\)
/g
,
"
\
)"
)
:
match
[
0
].
replace
(
/
\(
/g
,
"
\
("
).
replace
(
/
\)
/g
,
"
\
)"
)
);
}
}
while
(
match
!=
null
);
if
(
myArray
[
0
].
charAt
(
0
)
==
"("
){
for
(
var
i
=
0
;
i
<
myArray
.
length
;
i
++
){
if
(
myArray
[
i
]
!=
"OR"
&&
myArray
[
i
]
!=
"or"
&&
myArray
[
i
]
!=
"Or"
&&
myArray
[
i
]
!=
"oR"
&&
myArray
[
i
]
!=
"("
&&
myArray
[
i
]
!=
")"
){
count
++
;
}
}
if
(
count
>
5
){
alert
(
'語句数は最大5つです'
);
return
;
}
if
(
myArray
[
0
]
==
"("
){
if
(
myArray
[
0
]
==
"("
){
if
(
myArray
[
1
]
!=
"("
){
myRegExpArr
[
1
]
=
new
RegExp
(
myArray
[
1
]);
myQuery
=
'( myRegExpArr[1].test(contentPage[nIndex].pageText)'
;
}
else
{
myRegExpArr
[
0
]
=
new
RegExp
(
myArray
[
0
].
slice
(
1
));
myQuery
=
'( myRegExpArr[0].test(contentPage[nIndex].pageText)'
;
count
++
;
}
myQuery
=
'( '
;
}
}
else
{
myRegExpArr
[
0
]
=
new
RegExp
(
myArray
[
0
]);
myQuery
=
'myRegExpArr[0].test(contentPage[nIndex].pageText)'
;
count
++
;
if
(
myArray
[
0
]
==
"OR"
||
myArray
[
0
]
==
"or"
||
myArray
[
0
]
==
"Or"
||
myArray
[
0
]
==
"oR"
){
myQuery
=
' || '
;
}
}
for
(
var
i
=
1
;
i
<
myArray
.
length
;
i
++
){
if
(
myArray
[
i
]
==
"OR"
||
myArray
[
i
]
==
"or"
||
myArray
[
i
]
==
"Or"
||
myArray
[
i
]
==
"oR"
){
myRegExpArr
[
i
]
=
new
RegExp
(
myArray
[
i
]);
}
else
if
(
myArray
[
i
]
.
charAt
(
0
)
==
"("
||
myArray
[
i
]
==
"("
){
}
else
if
(
myArray
[
i
]
==
"("
||
myArray
[
i
]
==
"("
){
if
(
myArray
[
i
]
==
"("
){
if
(
myArray
[
i
-
1
]
==
"OR"
||
myArray
[
i
-
1
]
==
"or"
||
myArray
[
i
-
1
]
==
"Or"
||
myArray
[
i
-
1
]
==
"oR"
){
myQuery
+=
' || ('
;
}
else
{
}
else
if
(
myArray
[
i
-
1
]
!=
"("
)
{
myQuery
+=
' && ('
;
}
else
{
myQuery
+=
' ('
;
}
}
else
{
if
(
myArray
[
i
-
1
]
==
"OR"
||
myArray
[
i
-
1
]
==
"or"
||
myArray
[
i
-
1
]
==
"Or"
||
myArray
[
i
-
1
]
==
"oR"
){
myRegExpArr
[
i
]
=
new
RegExp
(
myArray
[
i
].
slice
(
1
));
myQuery
+=
' || ( myRegExpArr['
+
i
+
'].test(contentPage[nIndex].pageText)'
;
count
++
;
}
else
{
myRegExpArr
[
i
]
=
new
RegExp
(
myArray
[
i
].
slice
(
1
));
myQuery
+=
' && ( myRegExpArr['
+
i
+
'].test(contentPage[nIndex].pageText)'
;
count
++
;
}
}
}
else
if
(
myArray
[
i
].
charAt
(
myArray
[
i
].
length
-
1
)
==
")"
||
myArray
[
i
]
==
")"
){
...
...
@@ -801,27 +856,22 @@ CONTENTVIEW.searchHandle = function() {
if
(
myArray
[
i
-
1
]
==
"OR"
||
myArray
[
i
-
1
]
==
"or"
||
myArray
[
i
-
1
]
==
"Or"
||
myArray
[
i
-
1
]
==
"oR"
){
myRegExpArr
[
i
]
=
new
RegExp
(
myArray
[
i
].
slice
(
0
,
-
1
));
myQuery
+=
' || myRegExpArr['
+
i
+
'].test(contentPage[nIndex].pageText) )'
;
count
++
;
}
else
{
myRegExpArr
[
i
]
=
new
RegExp
(
myArray
[
i
].
slice
(
0
,
-
1
));
myQuery
+=
' && myRegExpArr['
+
i
+
'].test(contentPage[nIndex].pageText) )'
;
count
++
;
}
}
}
else
{
if
(
myArray
[
i
-
1
]
==
"OR"
||
myArray
[
i
-
1
]
==
"or"
||
myArray
[
i
-
1
]
==
"Or"
||
myArray
[
i
-
1
]
==
"oR"
){
myRegExpArr
[
i
]
=
new
RegExp
(
myArray
[
i
]);
myQuery
+=
' || myRegExpArr['
+
i
+
'].test(contentPage[nIndex].pageText)'
;
count
++
;
}
else
{
if
(
myArray
[
i
-
1
]
==
"("
){
myRegExpArr
[
i
]
=
new
RegExp
(
myArray
[
i
]);
myQuery
+=
' myRegExpArr['
+
i
+
'].test(contentPage[nIndex].pageText)'
;
count
++
;
}
else
{
myRegExpArr
[
i
]
=
new
RegExp
(
myArray
[
i
]);
myQuery
+=
' && myRegExpArr['
+
i
+
'].test(contentPage[nIndex].pageText)'
;
count
++
;
}
}
}
...
...
@@ -833,7 +883,6 @@ CONTENTVIEW.searchHandle = function() {
for
(
var
nIndex
=
0
;
nIndex
<
contentPage
.
length
;
nIndex
++
)
{
if
(
eval
(
myQuery
))
{
//searchResult.push(contentPage[nIndex]);
sPageNo
.
push
(
contentPage
[
nIndex
]);
}
}
...
...
@@ -841,12 +890,7 @@ CONTENTVIEW.searchHandle = function() {
}
catch
(
error
){
searchText
=
"invaildsearchtextzeroresultfound"
;
}
if
(
count
>
5
){
alert
(
'語句数は最大5つです'
);
return
;
}
if
(
sPageNo
.
length
>
0
)
{
//title start
$
(
'#bookmarkBoxHdSearching'
).
children
().
remove
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment