Changeset 4724
- Timestamp:
- 04/26/07 09:33:46 (1 year ago)
- Files:
-
- Footagehead/trunk/FHFutabaHandler.h (added)
- Footagehead/trunk/FHFutabaHandler.m (added)
- Footagehead/trunk/FHHTMLHandler.m (modified) (2 diffs)
- Footagehead/trunk/FHHTMLParser.h (modified) (1 diff)
- Footagehead/trunk/FHHTMLParser.m (modified) (2 diffs)
- Footagehead/trunk/FHURLHandler.m (modified) (2 diffs)
- Footagehead/trunk/Footagehead.xcodeproj/project.pbxproj (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Footagehead/trunk/FHHTMLHandler.m
r4723 r4724 29 29 #import "NSImage-FHAdditions.h" 30 30 #import "FHFile.h" 31 #import "FHFutabaHandler.h" 31 32 #import "FHHTMLHandler.h" 32 33 #import "FHHTMLParser.h" 33 34 34 35 @implementation FHHTMLHandler 36 37 + (Class)handlerForURL:(WIURL *)url { 38 NSString *host; 39 40 host = [url host]; 41 42 if([host hasSuffix:@"4chan.org"]) 43 return [FHFutabaHandler class]; 44 45 return self; 46 } 47 48 49 50 #pragma mark - 35 51 36 52 - (id)initHandlerWithURL:(WIURL *)url HTML:(NSString *)html { … … 56 72 - (NSArray *)files { 57 73 NSArray *links; 58 NSArray *types;59 74 FHFile *file; 60 75 NSUInteger i, index, count; 61 76 62 77 if(!_files) { 63 types = [NSImage FHImageFileTypes];64 78 links = [FHHTMLParser imageLinksInHTML:_html baseURL:[self URL]]; 65 79 count = [links count]; Footagehead/trunk/FHHTMLParser.h
r4706 r4724 30 30 31 31 + (NSArray *)imageLinksInHTML:(NSString *)html baseURL:(WIURL *)baseURL; 32 + (NSArray *)imageLinksInHTML:(NSString *)html baseURL:(WIURL *)baseURL type:(int)type; 32 33 33 34 @end Footagehead/trunk/FHHTMLParser.m
r4723 r4724 31 31 #import "FHSettings.h" 32 32 33 @implementation FHHTMLParser : WIObject33 @implementation FHHTMLParser 34 34 35 35 + (NSArray *)imageLinksInHTML:(NSString *)html baseURL:(WIURL *)baseURL { 36 return [self imageLinksInHTML:html baseURL:baseURL type:[FHSettings intForKey:FHHTMLImageType]]; 37 } 38 39 40 41 + (NSArray *)imageLinksInHTML:(NSString *)html baseURL:(WIURL *)baseURL type:(int)type { 36 42 NSScanner *scanner; 37 43 NSMutableArray *links, *urls; … … 49 55 skipSet = [NSCharacterSet characterSetWithCharactersInString:@" =\r\n\t\"\'<>"]; 50 56 51 switch( [FHSettings intForKey:FHHTMLImageType]) {57 switch(type) { 52 58 case FHHTMLImageOnlyInline: 53 59 tokens = [NSArray arrayWithObject:@"SRC"]; Footagehead/trunk/FHURLHandler.m
r4706 r4724 97 97 NSStringEncoding nsEncoding; 98 98 CFStringEncoding cfEncoding; 99 Class class; 99 100 100 101 nsEncoding = NSISOLatin1StringEncoding; … … 109 110 110 111 text = [NSString stringWithData:data encoding:nsEncoding]; 112 113 class = [FHHTMLHandler handlerForURL:url]; 111 114 112 return [[ FHHTMLHandlerallocWithZone:zone] initHandlerWithURL:url HTML:text];115 return [[class allocWithZone:zone] initHandlerWithURL:url HTML:text]; 113 116 } 114 117 else if([mime containsSubstring:@"xml"]) { Footagehead/trunk/Footagehead.xcodeproj/project.pbxproj
r4716 r4724 103 103 A58BE56A09BA054F00C3C20D /* White.tiff in Resources */ = {isa = PBXBuildFile; fileRef = A58BE56709BA054F00C3C20D /* White.tiff */; }; 104 104 A58BE56B09BA054F00C3C20D /* Gray.tiff in Resources */ = {isa = PBXBuildFile; fileRef = A58BE56809BA054F00C3C20D /* Gray.tiff */; }; 105 A597A4960BE0889A00C3E4DE /* FHFutabaHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = A597A4940BE0889A00C3E4DE /* FHFutabaHandler.m */; }; 105 106 A599A110075F94F400A03BA5 /* FHFileCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A599A10E075F94F400A03BA5 /* FHFileCell.m */; }; 106 107 A5A183F00BDD5231004788EF /* FHWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A5A183EE0BDD5231004788EF /* FHWindowController.m */; }; … … 316 317 A58BE56809BA054F00C3C20D /* Gray.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Gray.tiff; sourceTree = "<group>"; }; 317 318 A591E22C056686CB00215980 /* prefix.pch */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = prefix.pch; sourceTree = "<group>"; }; 319 A597A4940BE0889A00C3E4DE /* FHFutabaHandler.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; path = FHFutabaHandler.m; sourceTree = "<group>"; }; 320 A597A4950BE0889A00C3E4DE /* FHFutabaHandler.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = FHFutabaHandler.h; sourceTree = "<group>"; }; 318 321 A599A10D075F94F400A03BA5 /* FHFileCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FHFileCell.h; sourceTree = "<group>"; }; 319 322 A599A10E075F94F400A03BA5 /* FHFileCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FHFileCell.m; sourceTree = "<group>"; }; … … 703 706 A5B1F9AA067BCF0100111D0A /* FHHTMLHandler.m */, 704 707 A5B1F9A9067BCF0100111D0A /* FHHTMLHandler.h */, 708 A597A4740BE0888600C3E4DE /* HTML Handlers */, 705 709 A5B1FBC4067D01C200111D0A /* FHImageHandler.m */, 706 710 A5B1FBC5067D01C200111D0A /* FHImageHandler.h */, … … 716 720 ); 717 721 name = "Feed Handlers"; 722 sourceTree = "<group>"; 723 }; 724 A597A4740BE0888600C3E4DE /* HTML Handlers */ = { 725 isa = PBXGroup; 726 children = ( 727 A597A4940BE0889A00C3E4DE /* FHFutabaHandler.m */, 728 A597A4950BE0889A00C3E4DE /* FHFutabaHandler.h */, 729 ); 730 name = "HTML Handlers"; 718 731 sourceTree = "<group>"; 719 732 }; … … 1128 1141 A5B1F617067B3B7900111D0A /* FHFileHandler.m in Sources */, 1129 1142 77EAC0D5084C6D1F006C9F69 /* FHFlickrHandler.m in Sources */, 1143 A597A4960BE0889A00C3E4DE /* FHFutabaHandler.m in Sources */, 1130 1144 A5B1F611067B3AA100111D0A /* FHHandler.m in Sources */, 1131 1145 A5B1F9AC067BCF0200111D0A /* FHHTMLHandler.m in Sources */,
