File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed
src/components/global-assign-hook-component/plugins Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change 22
33 // 检索字符串数据库
44
5- const stringsDB = window . cc11001100_hook . stringsDB ;
5+ const cc11001100_hook = window . cc11001100_hook ;
6+ const stringsDB = cc11001100_hook . stringsDB ;
67
7- window . cc11001100_hook . search = function ( pattern , isEquals = true ) {
8+ window . search = cc11001100_hook . search = function ( pattern , isEquals = true ) {
89 const result = [ ] ;
910 for ( let s of stringsDB . varValueDb ) {
1011 if ( isEquals ? s . value === pattern : s . value . indexOf ( pattern ) !== - 1 ) {
2021 } ) ;
2122 }
2223 }
24+ showResult ( result ) ;
25+ }
2326
27+ window . searchByName = cc11001100_hook . searchByName = function ( pattern , isEquals = false ) {
28+ const result = [ ] ;
29+ for ( let s of stringsDB . varValueDb ) {
30+ if ( isEquals ? s . name === pattern : s . name . indexOf ( pattern ) !== - 1 ) {
31+ const codeInfo = parseCodeLocation ( s . codeLocation )
32+ result . push ( {
33+ name : s . name ,
34+ value : abbreviationPattern ( pattern , s . value ) ,
35+ type : s . type ,
36+ execOrder : s . execOrder ,
37+ codeName : codeInfo . codeName ,
38+ codeAddress : codeInfo . codeAddress ,
39+ execTimes : stringsDB . codeLocationExecuteTimesCount [ s . codeLocation ]
40+ } ) ;
41+ }
42+ }
43+ showResult ( result ) ;
44+ }
2445
46+ function showResult ( result ) {
2547 if ( ! result . length ) {
2648 console . log ( "没有搜索到结果。" ) ;
2749 return ;
Original file line number Diff line number Diff line change 1313
1414 function stringPutToDB ( name , value , type ) {
1515
16- if ( typeof value !== "string" || ! value ) {
16+ // 不止是string
17+ if ( ! value ) {
1718 return ;
1819 }
1920
2021 // 获取代码位置
2122 const codeLocation = getCodeLocation ( ) ;
2223 varValueDb . push ( {
2324 name,
24- value,
25+ // 默认情况下把所有变量都toString保存到字符串池子中
26+ value : value + "" ,
2527 type,
2628 execOrder : execOrderCounter ++ ,
2729 codeLocation
You can’t perform that action at this time.
0 commit comments