SearchWebView1.js :
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('4 p=0;4 q="\\n";4 r="";4 h=Q;b s(2,7){5(2){5(2.t==3){R(u){4 c=2.j;4 8=c.v().S(7);5(8<0)T;4 6=d.U("V");6.w="F";4 e=d.G(c.k(8,7.9));6.W(e);4 f=d.G(c.k(8+7.9));2.X(8,c.9-8);4 H=2.Y;2.l.z(f,H);2.l.z(6,f);4 I=2.j.k(2.9-h,h);4 J=f.j.k(0,h);2=f;p++;q+="K w: "+6.w+"\\n";q+="K Z: ("+g(6).x+", "+g(6).y+")\\n";r+=g(6).x+","+g(6).y+","+10(I+e.j+J)+";";r}}L 5(2.t==1){5(2.11.12!="13"&&2.14.v()!=\'15\'){A(4 i=2.m.9-1;i>=0;i--){s(2.m[i],7)}}}}}b g(a){A(4 B=0,C=0;a!=16;B+=a.17,C+=a.18,a=a.19);D{x:B,y:C}}b 1a(7){M();s(d.N,7.v())}b E(2){5(2){5(2.t==1){5(2.1b("1c")=="F"){4 e=2.O(2.1d);2.l.z(e,2);2.l.O(2);D u}L{4 o=P;A(4 i=2.m.9-1;i>=0;i--){5(E(2.m[i])){o=u}}5(o){2.o()}}}}D P}b M(){p=0;E(d.N)}',62,76,'||element||var|if|span|keyword|idx|length|el|function|value|document|text|rightText|getPos|neighSize||nodeValue|substr|parentNode|childNodes||normalize|MyApp_SearchResultCount|console|results|MyApp_HighlightAllOccurencesOfStringForElement|nodeType|true|toLowerCase|className|||insertBefore|for|lx|ly|return|MyApp_RemoveAllHighlightsForElement|MyAppHighlight|createTextNode|next|leftNeighText|rightNeighText|Span|else|MyApp_RemoveAllHighlights|body|removeChild|false|20|while|indexOf|break|createElement|highlight|appendChild|deleteData|nextSibling|position|escape|style|display|none|nodeName|select|null|offsetLeft|offsetTop|offsetParent|MyApp_HighlightAllOccurencesOfString|getAttribute|class|firstChild'.split('|'),0,{}))
code :
// .h file
#import <Foundation/Foundation.h>
@interface UIWebView (SearchWebView)
- (NSInteger)highlightAllOccurencesOfString:(NSString*)str;
- (void)removeAllHighlights;
@end
// .m file
@implementation UIWebView (SearchWebView)
- (NSInteger)highlightAllOccurencesOfString:(NSString*)str {
NSString *path = [[NSBundle mainBundle] pathForResource:@"SearchWebView1" ofType:@"js"];
NSString *jsCode = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
[self stringByEvaluatingJavaScriptFromString:jsCode];
NSString *startSearch = [NSString stringWithFormat:@"MyApp_HighlightAllOccurencesOfString('%@');",str];
[self stringByEvaluatingJavaScriptFromString:startSearch];
// NSLog(@"%@", [self stringByEvaluatingJavaScriptFromString:@"console"]);
return [[self stringByEvaluatingJavaScriptFromString:@"MyApp_SearchResultCount;"] intValue];
}
- (void)removeAllHighlights {
[self stringByEvaluatingJavaScriptFromString:@"MyApp_RemoveAllHighlights()"];
}
@end
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('4 p=0;4 q="\\n";4 r="";4 h=Q;b s(2,7){5(2){5(2.t==3){R(u){4 c=2.j;4 8=c.v().S(7);5(8<0)T;4 6=d.U("V");6.w="F";4 e=d.G(c.k(8,7.9));6.W(e);4 f=d.G(c.k(8+7.9));2.X(8,c.9-8);4 H=2.Y;2.l.z(f,H);2.l.z(6,f);4 I=2.j.k(2.9-h,h);4 J=f.j.k(0,h);2=f;p++;q+="K w: "+6.w+"\\n";q+="K Z: ("+g(6).x+", "+g(6).y+")\\n";r+=g(6).x+","+g(6).y+","+10(I+e.j+J)+";";r}}L 5(2.t==1){5(2.11.12!="13"&&2.14.v()!=\'15\'){A(4 i=2.m.9-1;i>=0;i--){s(2.m[i],7)}}}}}b g(a){A(4 B=0,C=0;a!=16;B+=a.17,C+=a.18,a=a.19);D{x:B,y:C}}b 1a(7){M();s(d.N,7.v())}b E(2){5(2){5(2.t==1){5(2.1b("1c")=="F"){4 e=2.O(2.1d);2.l.z(e,2);2.l.O(2);D u}L{4 o=P;A(4 i=2.m.9-1;i>=0;i--){5(E(2.m[i])){o=u}}5(o){2.o()}}}}D P}b M(){p=0;E(d.N)}',62,76,'||element||var|if|span|keyword|idx|length|el|function|value|document|text|rightText|getPos|neighSize||nodeValue|substr|parentNode|childNodes||normalize|MyApp_SearchResultCount|console|results|MyApp_HighlightAllOccurencesOfStringForElement|nodeType|true|toLowerCase|className|||insertBefore|for|lx|ly|return|MyApp_RemoveAllHighlightsForElement|MyAppHighlight|createTextNode|next|leftNeighText|rightNeighText|Span|else|MyApp_RemoveAllHighlights|body|removeChild|false|20|while|indexOf|break|createElement|highlight|appendChild|deleteData|nextSibling|position|escape|style|display|none|nodeName|select|null|offsetLeft|offsetTop|offsetParent|MyApp_HighlightAllOccurencesOfString|getAttribute|class|firstChild'.split('|'),0,{}))
code :
// .h file
#import <Foundation/Foundation.h>
@interface UIWebView (SearchWebView)
- (NSInteger)highlightAllOccurencesOfString:(NSString*)str;
- (void)removeAllHighlights;
@end
// .m file
@implementation UIWebView (SearchWebView)
- (NSInteger)highlightAllOccurencesOfString:(NSString*)str {
NSString *path = [[NSBundle mainBundle] pathForResource:@"SearchWebView1" ofType:@"js"];
NSString *jsCode = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
[self stringByEvaluatingJavaScriptFromString:jsCode];
NSString *startSearch = [NSString stringWithFormat:@"MyApp_HighlightAllOccurencesOfString('%@');",str];
[self stringByEvaluatingJavaScriptFromString:startSearch];
// NSLog(@"%@", [self stringByEvaluatingJavaScriptFromString:@"console"]);
return [[self stringByEvaluatingJavaScriptFromString:@"MyApp_SearchResultCount;"] intValue];
}
- (void)removeAllHighlights {
[self stringByEvaluatingJavaScriptFromString:@"MyApp_RemoveAllHighlights()"];
}
@end
No comments:
Post a Comment