Commit ae9bbd6b0bd3b34b819744d394f2b403ce617641
1 parent
4bdd50cf
no message
Showing
9 changed files
with
13 additions
and
179 deletions
CNLiveScioLive.xcodeproj/project.pbxproj
| @@ -34,9 +34,6 @@ | @@ -34,9 +34,6 @@ | ||
| 34 | 08384862215CAB1C00186618 /* UIColor+Change.m in Sources */ = {isa = PBXBuildFile; fileRef = 0838485B215CAB1C00186618 /* UIColor+Change.m */; }; | 34 | 08384862215CAB1C00186618 /* UIColor+Change.m in Sources */ = {isa = PBXBuildFile; fileRef = 0838485B215CAB1C00186618 /* UIColor+Change.m */; }; |
| 35 | 08384863215CAB1C00186618 /* UIColor+Change.m in Sources */ = {isa = PBXBuildFile; fileRef = 0838485B215CAB1C00186618 /* UIColor+Change.m */; }; | 35 | 08384863215CAB1C00186618 /* UIColor+Change.m in Sources */ = {isa = PBXBuildFile; fileRef = 0838485B215CAB1C00186618 /* UIColor+Change.m */; }; |
| 36 | 08384864215CAB1C00186618 /* UIColor+Change.m in Sources */ = {isa = PBXBuildFile; fileRef = 0838485B215CAB1C00186618 /* UIColor+Change.m */; }; | 36 | 08384864215CAB1C00186618 /* UIColor+Change.m in Sources */ = {isa = PBXBuildFile; fileRef = 0838485B215CAB1C00186618 /* UIColor+Change.m */; }; |
| 37 | - 08384865215CAB1C00186618 /* UIWebView+JavaScript.m in Sources */ = {isa = PBXBuildFile; fileRef = 08384860215CAB1C00186618 /* UIWebView+JavaScript.m */; }; | ||
| 38 | - 08384866215CAB1C00186618 /* UIWebView+JavaScript.m in Sources */ = {isa = PBXBuildFile; fileRef = 08384860215CAB1C00186618 /* UIWebView+JavaScript.m */; }; | ||
| 39 | - 08384867215CAB1C00186618 /* UIWebView+JavaScript.m in Sources */ = {isa = PBXBuildFile; fileRef = 08384860215CAB1C00186618 /* UIWebView+JavaScript.m */; }; | ||
| 40 | 08384868215CAB1C00186618 /* YWWebScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 08384861215CAB1C00186618 /* YWWebScrollView.m */; }; | 37 | 08384868215CAB1C00186618 /* YWWebScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 08384861215CAB1C00186618 /* YWWebScrollView.m */; }; |
| 41 | 08384869215CAB1C00186618 /* YWWebScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 08384861215CAB1C00186618 /* YWWebScrollView.m */; }; | 38 | 08384869215CAB1C00186618 /* YWWebScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 08384861215CAB1C00186618 /* YWWebScrollView.m */; }; |
| 42 | 0838486A215CAB1C00186618 /* YWWebScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 08384861215CAB1C00186618 /* YWWebScrollView.m */; }; | 39 | 0838486A215CAB1C00186618 /* YWWebScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 08384861215CAB1C00186618 /* YWWebScrollView.m */; }; |
| @@ -766,10 +763,8 @@ | @@ -766,10 +763,8 @@ | ||
| 766 | 08384856215CA75C00186618 /* OldVideoDetailViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OldVideoDetailViewController.m; sourceTree = "<group>"; }; | 763 | 08384856215CA75C00186618 /* OldVideoDetailViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OldVideoDetailViewController.m; sourceTree = "<group>"; }; |
| 767 | 0838485B215CAB1C00186618 /* UIColor+Change.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+Change.m"; sourceTree = "<group>"; }; | 764 | 0838485B215CAB1C00186618 /* UIColor+Change.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+Change.m"; sourceTree = "<group>"; }; |
| 768 | 0838485C215CAB1C00186618 /* YWWebScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YWWebScrollView.h; sourceTree = "<group>"; }; | 765 | 0838485C215CAB1C00186618 /* YWWebScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YWWebScrollView.h; sourceTree = "<group>"; }; |
| 769 | - 0838485D215CAB1C00186618 /* UIWebView+JavaScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIWebView+JavaScript.h"; sourceTree = "<group>"; }; | ||
| 770 | 0838485E215CAB1C00186618 /* Html5Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Html5Utils.h; sourceTree = "<group>"; }; | 766 | 0838485E215CAB1C00186618 /* Html5Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Html5Utils.h; sourceTree = "<group>"; }; |
| 771 | 0838485F215CAB1C00186618 /* UIColor+Change.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+Change.h"; sourceTree = "<group>"; }; | 767 | 0838485F215CAB1C00186618 /* UIColor+Change.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+Change.h"; sourceTree = "<group>"; }; |
| 772 | - 08384860215CAB1C00186618 /* UIWebView+JavaScript.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIWebView+JavaScript.m"; sourceTree = "<group>"; }; | ||
| 773 | 08384861215CAB1C00186618 /* YWWebScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YWWebScrollView.m; sourceTree = "<group>"; }; | 768 | 08384861215CAB1C00186618 /* YWWebScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YWWebScrollView.m; sourceTree = "<group>"; }; |
| 774 | 0838486B215CAD2E00186618 /* NewsVideoTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NewsVideoTableViewCell.h; sourceTree = "<group>"; }; | 769 | 0838486B215CAD2E00186618 /* NewsVideoTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NewsVideoTableViewCell.h; sourceTree = "<group>"; }; |
| 775 | 0838486C215CAD2E00186618 /* NewsVideoTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NewsVideoTableViewCell.m; sourceTree = "<group>"; }; | 770 | 0838486C215CAD2E00186618 /* NewsVideoTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NewsVideoTableViewCell.m; sourceTree = "<group>"; }; |
| @@ -1294,8 +1289,6 @@ | @@ -1294,8 +1289,6 @@ | ||
| 1294 | 0838485B215CAB1C00186618 /* UIColor+Change.m */, | 1289 | 0838485B215CAB1C00186618 /* UIColor+Change.m */, |
| 1295 | 0838485C215CAB1C00186618 /* YWWebScrollView.h */, | 1290 | 0838485C215CAB1C00186618 /* YWWebScrollView.h */, |
| 1296 | 08384861215CAB1C00186618 /* YWWebScrollView.m */, | 1291 | 08384861215CAB1C00186618 /* YWWebScrollView.m */, |
| 1297 | - 0838485D215CAB1C00186618 /* UIWebView+JavaScript.h */, | ||
| 1298 | - 08384860215CAB1C00186618 /* UIWebView+JavaScript.m */, | ||
| 1299 | 08E7998D24B2F52C00F15587 /* WKWebView+JavaScript.h */, | 1292 | 08E7998D24B2F52C00F15587 /* WKWebView+JavaScript.h */, |
| 1300 | 08E7998E24B2F52C00F15587 /* WKWebView+JavaScript.m */, | 1293 | 08E7998E24B2F52C00F15587 /* WKWebView+JavaScript.m */, |
| 1301 | ); | 1294 | ); |
| @@ -3071,7 +3064,6 @@ | @@ -3071,7 +3064,6 @@ | ||
| 3071 | 08B5C5B221536BFF00F5476E /* AlertViewTool.m in Sources */, | 3064 | 08B5C5B221536BFF00F5476E /* AlertViewTool.m in Sources */, |
| 3072 | 08585D80215B4C7200FC2CA2 /* PGDatePicker+TimeAndSecond.m in Sources */, | 3065 | 08585D80215B4C7200FC2CA2 /* PGDatePicker+TimeAndSecond.m in Sources */, |
| 3073 | 084ACE3B2154C8310089E035 /* CNLiveNewsUpPicTableViewCell.m in Sources */, | 3066 | 084ACE3B2154C8310089E035 /* CNLiveNewsUpPicTableViewCell.m in Sources */, |
| 3074 | - 08384865215CAB1C00186618 /* UIWebView+JavaScript.m in Sources */, | ||
| 3075 | 08C08FFA214FAFD400E23D16 /* UIViewController+XLSlideMenu.m in Sources */, | 3067 | 08C08FFA214FAFD400E23D16 /* UIViewController+XLSlideMenu.m in Sources */, |
| 3076 | 08585D6E215B4C7200FC2CA2 /* PGPickerView.m in Sources */, | 3068 | 08585D6E215B4C7200FC2CA2 /* PGPickerView.m in Sources */, |
| 3077 | 08FB8771215DD3C600DA5423 /* NewVoiceTableViewCell.m in Sources */, | 3069 | 08FB8771215DD3C600DA5423 /* NewVoiceTableViewCell.m in Sources */, |
| @@ -3109,7 +3101,6 @@ | @@ -3109,7 +3101,6 @@ | ||
| 3109 | 08C09008215082B700E23D16 /* XWTabBarModel.m in Sources */, | 3101 | 08C09008215082B700E23D16 /* XWTabBarModel.m in Sources */, |
| 3110 | 08C090882150C96C00E23D16 /* UIView+Extension.m in Sources */, | 3102 | 08C090882150C96C00E23D16 /* UIView+Extension.m in Sources */, |
| 3111 | 08B5C59D21534DB800F5476E /* CNLiveRegisterPhoneViewController.m in Sources */, | 3103 | 08B5C59D21534DB800F5476E /* CNLiveRegisterPhoneViewController.m in Sources */, |
| 3112 | - 08384866215CAB1C00186618 /* UIWebView+JavaScript.m in Sources */, | ||
| 3113 | 084ACDFE21547AE80089E035 /* CNLiveContactUsViewController.m in Sources */, | 3104 | 084ACDFE21547AE80089E035 /* CNLiveContactUsViewController.m in Sources */, |
| 3114 | 08C090612150C3B200E23D16 /* CNLiveReporterAskedViewController.m in Sources */, | 3105 | 08C090612150C3B200E23D16 /* CNLiveReporterAskedViewController.m in Sources */, |
| 3115 | 08B5C592215348A500F5476E /* CNMyAnnouncementsTableViewCell.m in Sources */, | 3106 | 08B5C592215348A500F5476E /* CNMyAnnouncementsTableViewCell.m in Sources */, |
| @@ -3265,7 +3256,6 @@ | @@ -3265,7 +3256,6 @@ | ||
| 3265 | 08C09009215082B700E23D16 /* XWTabBarModel.m in Sources */, | 3256 | 08C09009215082B700E23D16 /* XWTabBarModel.m in Sources */, |
| 3266 | 08C090892150C96C00E23D16 /* UIView+Extension.m in Sources */, | 3257 | 08C090892150C96C00E23D16 /* UIView+Extension.m in Sources */, |
| 3267 | 08B5C59E21534DB800F5476E /* CNLiveRegisterPhoneViewController.m in Sources */, | 3258 | 08B5C59E21534DB800F5476E /* CNLiveRegisterPhoneViewController.m in Sources */, |
| 3268 | - 08384867215CAB1C00186618 /* UIWebView+JavaScript.m in Sources */, | ||
| 3269 | 084ACDFF21547AE80089E035 /* CNLiveContactUsViewController.m in Sources */, | 3259 | 084ACDFF21547AE80089E035 /* CNLiveContactUsViewController.m in Sources */, |
| 3270 | 08C090622150C3B200E23D16 /* CNLiveReporterAskedViewController.m in Sources */, | 3260 | 08C090622150C3B200E23D16 /* CNLiveReporterAskedViewController.m in Sources */, |
| 3271 | 08B5C593215348A500F5476E /* CNMyAnnouncementsTableViewCell.m in Sources */, | 3261 | 08B5C593215348A500F5476E /* CNMyAnnouncementsTableViewCell.m in Sources */, |
CNLiveScioLive/Pages/Home/抽屉效果/Controller/CNHomeRightViewController.m
| @@ -64,7 +64,7 @@ static NSString *homeRightHeaderFooterView = @"CNHomeRightHeaderFooterView"; | @@ -64,7 +64,7 @@ static NSString *homeRightHeaderFooterView = @"CNHomeRightHeaderFooterView"; | ||
| 64 | 64 | ||
| 65 | #pragma mark - UITableViewDataSource | 65 | #pragma mark - UITableViewDataSource |
| 66 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ | 66 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ |
| 67 | - return 3; | 67 | + return 2; |
| 68 | 68 | ||
| 69 | } | 69 | } |
| 70 | 70 | ||
| @@ -101,7 +101,7 @@ static NSString *homeRightHeaderFooterView = @"CNHomeRightHeaderFooterView"; | @@ -101,7 +101,7 @@ static NSString *homeRightHeaderFooterView = @"CNHomeRightHeaderFooterView"; | ||
| 101 | 101 | ||
| 102 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ | 102 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ |
| 103 | 103 | ||
| 104 | - NSArray *array = @[@"搜索内容", @"栏目列表", @"AR扫描"]; | 104 | + NSArray *array = @[@"搜索内容", @"栏目列表"]; |
| 105 | 105 | ||
| 106 | CNHomeRightHeaderFooterView *sectionHeadView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:homeRightHeaderFooterView]; | 106 | CNHomeRightHeaderFooterView *sectionHeadView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:homeRightHeaderFooterView]; |
| 107 | if(!sectionHeadView){ | 107 | if(!sectionHeadView){ |
CNLiveScioLive/Pages/Live/Controller/VideoPlayBackViewController.m
| @@ -77,13 +77,13 @@ | @@ -77,13 +77,13 @@ | ||
| 77 | progress:^(NSProgress * _Nonnull uploadProgress) {} | 77 | progress:^(NSProgress * _Nonnull uploadProgress) {} |
| 78 | success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { | 78 | success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { |
| 79 | // 请求成功,解析数据 | 79 | // 请求成功,解析数据 |
| 80 | - NSString * jsonString = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; | 80 | + NSString * jsonString = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; |
| 81 | // NSLog(@"jsonString == %@",jsonString); | 81 | // NSLog(@"jsonString == %@",jsonString); |
| 82 | - NSArray *arr = [jsonString objectFromJSONString]; | ||
| 83 | - _dicArticle = [arr objectAtIndex:0]; | 82 | + NSArray *arr = [jsonString objectFromJSONString]; |
| 83 | + self->_dicArticle = [arr objectAtIndex:0]; | ||
| 84 | // NSLog(@"%@", _dicArticle); | 84 | // NSLog(@"%@", _dicArticle); |
| 85 | - [_webView loadHTMLString:[self setHTMLString] baseURL:nil]; | ||
| 86 | - [SVProgressHUD dismiss]; | 85 | + [self->_webView loadHTMLString:[self setHTMLString] baseURL:nil]; |
| 86 | + [SVProgressHUD dismiss]; | ||
| 87 | } | 87 | } |
| 88 | failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { | 88 | failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { |
| 89 | // 请求失败 | 89 | // 请求失败 |
CNLiveScioLive/Pages/My/通知公告/Controller/CNMyAnnouncementsViewController.m
| @@ -27,7 +27,7 @@ static NSString *myAnnouncementsTableViewCell = @"CNMyAnnouncementsTableViewCell | @@ -27,7 +27,7 @@ static NSString *myAnnouncementsTableViewCell = @"CNMyAnnouncementsTableViewCell | ||
| 27 | - (void)loadData{ | 27 | - (void)loadData{ |
| 28 | NSString *url = @"http://app.phonemovie.cnlive.com/gxb/api/cataloglatest"; | 28 | NSString *url = @"http://app.phonemovie.cnlive.com/gxb/api/cataloglatest"; |
| 29 | NSLog(@"%@",url); | 29 | NSLog(@"%@",url); |
| 30 | - NSString *josnParameters = [NSString stringWithFormat:@"{\"plat\":\"i\",\"version\":\"5.0\",\"appid\":\"gxb\",\"categoryId\":\"wz/fbhgg/\",\"page\":\"%ld\",\"pageSize\":\"%@\"}",(long)self.pageNo,@"15"]; | 30 | + NSString *josnParameters = [NSString stringWithFormat:@"{\"plat\":\"i\",\"version\":\"5.0\",\"appid\":\"gxb\",\"categoryId\":\"wz/fbhgg/\",\"page\":\"%ld\",\"pageSize\":\"%@\",\"lang\":\"%@\"}",(long)self.pageNo,@"15", IS_CHINESE?@"cn":@"en"]; |
| 31 | NSLog(@"%@",josnParameters); | 31 | NSLog(@"%@",josnParameters); |
| 32 | NSDictionary *parameters = @{@"params":josnParameters}; | 32 | NSDictionary *parameters = @{@"params":josnParameters}; |
| 33 | 33 |
CNLiveScioLive/Pages/SDK/Html5Utils/Html5Utils.h
| @@ -7,7 +7,6 @@ | @@ -7,7 +7,6 @@ | ||
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | #import <UIKit/UIKit.h> | 9 | #import <UIKit/UIKit.h> |
| 10 | -#import "UIWebView+JavaScript.h" | ||
| 11 | #import "WKWebView+JavaScript.h" | 10 | #import "WKWebView+JavaScript.h" |
| 12 | 11 | ||
| 13 | //! Project version number for Html5Utils. | 12 | //! Project version number for Html5Utils. |
CNLiveScioLive/Pages/SDK/Html5Utils/UIWebView+JavaScript.h deleted
100755 → 0
| 1 | -// | ||
| 2 | -// UIWebView+JavaScript.h | ||
| 3 | -// eCarry | ||
| 4 | -// | ||
| 5 | -// Created by whde on 15/11/10. | ||
| 6 | -// Copyright © 2015年 Joybon. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import <UIKit/UIKit.h> | ||
| 10 | - | ||
| 11 | -@interface UIWebView (JavaScript) | ||
| 12 | -/// 获取某个标签的结点个数 | ||
| 13 | -- (int)nodeCountOfTag:(NSString *)tag; | ||
| 14 | - | ||
| 15 | -/// 获取当前页面URL | ||
| 16 | -- (NSString *)getCurrentURL; | ||
| 17 | - | ||
| 18 | -/// 获取标题 | ||
| 19 | -- (NSString *)getTitle; | ||
| 20 | - | ||
| 21 | -/// 获取文章内容 | ||
| 22 | -- (NSString *)getContent; | ||
| 23 | - | ||
| 24 | -/// 获取图片 | ||
| 25 | -- (NSMutableArray *)getImgs; | ||
| 26 | - | ||
| 27 | -/// 获取当前页面所有链接 | ||
| 28 | -- (NSArray *)getOnClicks; | ||
| 29 | - | ||
| 30 | -/// 改变背景颜色 | ||
| 31 | -- (void)setBackgroundColor:(UIColor *)color; | ||
| 32 | - | ||
| 33 | -/// 为所有图片添加点击事件(网页中有些图片添加无效) | ||
| 34 | -- (void)addClickEventOnImg; | ||
| 35 | - | ||
| 36 | -/// 改变指定标签的字体颜色 | ||
| 37 | -- (void)setFontColor:(UIColor *)color withTag:(NSString *)tagName; | ||
| 38 | - | ||
| 39 | -/// 改变指定标签的字体大小 | ||
| 40 | -- (void)setFontSize:(int)size withTag:(NSString *)tagName; | ||
| 41 | - | ||
| 42 | -/// 设置网页没有拷贝粘贴 | ||
| 43 | -- (void)disableTouchCallout; | ||
| 44 | -@end |
CNLiveScioLive/Pages/SDK/Html5Utils/UIWebView+JavaScript.m deleted
100755 → 0
| 1 | -// | ||
| 2 | -// UIWebView+JavaScript.m | ||
| 3 | -// eCarry | ||
| 4 | -// | ||
| 5 | -// Created by whde on 15/11/10. | ||
| 6 | -// Copyright © 2015年 Joybon. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import "UIWebView+JavaScript.h" | ||
| 10 | -#import "UIColor+Change.h" | ||
| 11 | -#define HTML_STRING_NIL_TO_NONE_IF(x) [UIWebView STRING_NIL_TO_NONE:x] | ||
| 12 | -@implementation UIWebView (JavaScript) | ||
| 13 | -+ (NSString *)STRING_NIL_TO_NONE:(NSString *)x;{ | ||
| 14 | - if (x == nil || ([x isKindOfClass:[NSNull class]]) || ([x isKindOfClass:[NSString class]]&&x.length<=0) || [x isEqual:NULL]){ | ||
| 15 | - return @""; | ||
| 16 | - } else { | ||
| 17 | - return [NSString stringWithFormat:@"%@",x]; | ||
| 18 | - } | ||
| 19 | -} | ||
| 20 | - | ||
| 21 | -/// 获取某个标签的结点个数 | ||
| 22 | -- (int)nodeCountOfTag:(NSString *)tag { | ||
| 23 | - NSString *jsString = [NSString stringWithFormat:@"document.getElementsByTagName('%@').length", tag]; | ||
| 24 | - int len = [[self stringByEvaluatingJavaScriptFromString:jsString] intValue]; | ||
| 25 | - return len; | ||
| 26 | -} | ||
| 27 | - | ||
| 28 | -/// 获取当前页面URL | ||
| 29 | -- (NSString *)getCurrentURL { | ||
| 30 | - return HTML_STRING_NIL_TO_NONE_IF([self stringByEvaluatingJavaScriptFromString:@"document.location.href"]); | ||
| 31 | -} | ||
| 32 | - | ||
| 33 | -/// 获取标题 | ||
| 34 | -- (NSString *)getTitle { | ||
| 35 | - return HTML_STRING_NIL_TO_NONE_IF([self stringByEvaluatingJavaScriptFromString:@"document.title"]); | ||
| 36 | -} | ||
| 37 | - | ||
| 38 | -/// 获取文章内容 | ||
| 39 | -- (NSString *)getContent{ | ||
| 40 | - NSString *result = [self stringByEvaluatingJavaScriptFromString:@"document.documentElement.innerText"]; | ||
| 41 | - if (!result) { | ||
| 42 | - result = [self stringByEvaluatingJavaScriptFromString:@"document.body.innerText"]; | ||
| 43 | - } | ||
| 44 | - result = HTML_STRING_NIL_TO_NONE_IF(result); | ||
| 45 | - return result; | ||
| 46 | -} | ||
| 47 | - | ||
| 48 | -/// 获取所有图片链接 | ||
| 49 | -- (NSMutableArray *)getImgs { | ||
| 50 | - NSMutableArray *arrImgURL = [[NSMutableArray alloc] init]; | ||
| 51 | - int node = [self nodeCountOfTag:@"img"]; | ||
| 52 | - for (int i = 0; i < node; i++) { | ||
| 53 | - NSString *jsString = [NSString stringWithFormat:@"document.getElementsByTagName('img')[%d].src", i]; | ||
| 54 | - NSString *img = [self stringByEvaluatingJavaScriptFromString:jsString]; | ||
| 55 | - [arrImgURL addObject:img]; | ||
| 56 | - } | ||
| 57 | - return arrImgURL; | ||
| 58 | -} | ||
| 59 | - | ||
| 60 | -/// 获取当前页面所有点击链接 | ||
| 61 | -- (NSArray *)getOnClicks { | ||
| 62 | - NSMutableArray *arrOnClicks = [[NSMutableArray alloc] init]; | ||
| 63 | - int node = [self nodeCountOfTag:@"a"]; | ||
| 64 | - for (int i = 0; i < node; i++) { | ||
| 65 | - NSString *jsString = [NSString stringWithFormat:@"document.getElementsByTagName('a')[%d].getAttribute('onclick')", i]; | ||
| 66 | - NSString *clickString = [self stringByEvaluatingJavaScriptFromString:jsString]; | ||
| 67 | - [arrOnClicks addObject:clickString]; | ||
| 68 | - } | ||
| 69 | - return arrOnClicks; | ||
| 70 | -} | ||
| 71 | - | ||
| 72 | -/// 改变背景颜色 | ||
| 73 | -- (void)setBackgroundColor:(UIColor *)color { | ||
| 74 | - NSString * jsString = [NSString stringWithFormat:@"document.body.style.backgroundColor = '%@'",[color webColorString]]; | ||
| 75 | - [self stringByEvaluatingJavaScriptFromString:jsString]; | ||
| 76 | -} | ||
| 77 | - | ||
| 78 | -/// 为所有图片添加点击事件(网页中有些图片添加无效) | ||
| 79 | -- (void)addClickEventOnImg { | ||
| 80 | - int node = [self nodeCountOfTag:@"img"]; | ||
| 81 | - for (int i = 0; i < node; i++) { | ||
| 82 | - //利用重定向获取img.src,为区分,给url添加'img:'前缀 | ||
| 83 | - NSString *jsString = [NSString stringWithFormat: | ||
| 84 | - @"document.getElementsByTagName('img')[%d].onclick = \ | ||
| 85 | - function() { document.location.href = 'img:' + this.src; }",i]; | ||
| 86 | - [self stringByEvaluatingJavaScriptFromString:jsString]; | ||
| 87 | - } | ||
| 88 | -} | ||
| 89 | - | ||
| 90 | -/// 改变指定标签的字体颜色 | ||
| 91 | -- (void)setFontColor:(UIColor *)color withTag:(NSString *)tagName { | ||
| 92 | - NSString *jsString = [NSString stringWithFormat: | ||
| 93 | - @"var nodes = document.getElementsByTagName('%@'); \ | ||
| 94 | - for(var i=0;i<nodes.length;i++){\ | ||
| 95 | - nodes[i].style.color = '%@';}", tagName, [color webColorString]]; | ||
| 96 | - [self stringByEvaluatingJavaScriptFromString:jsString]; | ||
| 97 | -} | ||
| 98 | - | ||
| 99 | -/// 改变指定标签的字体大小 | ||
| 100 | -- (void)setFontSize:(int)size withTag:(NSString *)tagName { | ||
| 101 | - NSString *jsString = [NSString stringWithFormat: | ||
| 102 | - @"var nodes = document.getElementsByTagName('%@'); \ | ||
| 103 | - for(var i=0;i<nodes.length;i++){\ | ||
| 104 | - nodes[i].style.fontSize = '%dpx';}", tagName, size]; | ||
| 105 | - [self stringByEvaluatingJavaScriptFromString:jsString]; | ||
| 106 | -} | ||
| 107 | - | ||
| 108 | -/// 设置网页没有拷贝粘贴 | ||
| 109 | -- (void)disableTouchCallout { | ||
| 110 | - [self stringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitUserSelect='none';"]; | ||
| 111 | - [self stringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitTouchCallout='none';"]; | ||
| 112 | -} | ||
| 113 | - | ||
| 114 | - | ||
| 115 | -@end |
CNLiveScioLive/Pages/SDK/Html5Utils/WKWebView+JavaScript.m
| @@ -23,7 +23,8 @@ | @@ -23,7 +23,8 @@ | ||
| 23 | /// 获取某个标签的结点个数 | 23 | /// 获取某个标签的结点个数 |
| 24 | - (int)nodeCountOfTag:(NSString *)tag { | 24 | - (int)nodeCountOfTag:(NSString *)tag { |
| 25 | __block int len = 0; | 25 | __block int len = 0; |
| 26 | - [self evaluateJavaScript:@"document.getElementsByTagName('%@').length" completionHandler:^(id _Nullable response, NSError * _Nullable error) { | 26 | + NSString *jsString = [NSString stringWithFormat:@"document.getElementsByTagName('%@').length", tag]; |
| 27 | + [self evaluateJavaScript:jsString completionHandler:^(id _Nullable response, NSError * _Nullable error) { | ||
| 27 | NSLog(@"value: %@ error: %@", response, error); | 28 | NSLog(@"value: %@ error: %@", response, error); |
| 28 | len = [response intValue]; | 29 | len = [response intValue]; |
| 29 | }]; | 30 | }]; |
CNLiveScioLive/Pages/Tools/DBAction/DBAction.m
| @@ -130,6 +130,9 @@ static DBAction *instance = nil; | @@ -130,6 +130,9 @@ static DBAction *instance = nil; | ||
| 130 | BOOL res = [db executeUpdate:sql]; | 130 | BOOL res = [db executeUpdate:sql]; |
| 131 | if (!res) { | 131 | if (!res) { |
| 132 | NSLog(@"建表失败"); | 132 | NSLog(@"建表失败"); |
| 133 | + NSString *sql = [NSString stringWithFormat:@"ALTER TABLE %@ ADD %@ INTEGER",@"DATATABLE",@"playType"]; | ||
| 134 | + BOOL result = [db executeUpdate:sql]; | ||
| 135 | + | ||
| 133 | } else { | 136 | } else { |
| 134 | NSLog(@"建表成功"); | 137 | NSLog(@"建表成功"); |
| 135 | } | 138 | } |