Advertisement
Guest User

stupid ym

a guest
Sep 16th, 2014
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     if(self.cleanedHTML == NO){
  2.         NSLog(@"OASView: Cleaning HTML");
  3.         NSString *tmpHtml = [webView stringByEvaluatingJavaScriptFromString:
  4.                           @"document.body.innerHTML"];
  5.         NSString *html = [NSString stringWithFormat:@"<html><head></head><style>*{margin:0px;padding:0px;background-color:#000000;}</style>%@", tmpHtml];
  6.         if([[SettingsHelper sharedSettingsHelper] objectForKey:@"ymList"] != nil && self.type == OASAdList){
  7.             html = [NSString stringWithFormat:@"<html><head></head><style>*{margin:0px;padding:0px;background-color:#FFFFFF;}</style><div style='height:45px;overflow:hidden;'>%@</div>", tmpHtml];
  8.             html = [NSString stringWithFormat:@"%@%@", html, [[SettingsHelper sharedSettingsHelper] objectForKey:@"ymList"]];
  9.         }
  10.         self.loaded = YES;
  11.         self.cleanedHTML = YES;
  12.         [webView stringByEvaluatingJavaScriptFromString:@"document.body.style.margin = 0; document.body.style.padding = 0;"];
  13.         [webView loadHTMLString:html baseURL:[NSURL URLWithString:[[SettingsHelper sharedSettingsHelper] objectForKey:@"BASEURL"]]];
  14.         CGRect fr = webView.frame;
  15.         if(self.type == OASAdList){
  16.             fr.origin.x = 0;
  17.             fr.origin.y = 0;
  18.         }else if(self.type == OASAdInterstitial){
  19.             fr.origin.x = 10;
  20.             fr.origin.y = 80;
  21.             UILabel *loadingLabel = [[UILabel alloc] initWithFrame:CGRectMake(125, -50, 300, 20)];
  22.             loadingLabel.text = @"Loading...";
  23.             [loadingLabel setBackgroundColor:[UIColor clearColor]];
  24.             [webView addSubview:loadingLabel];
  25.             [loadingLabel release];
  26.             UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
  27.             [indicator setFrame:CGRectMake(100, -50, 20, 20)];
  28.             [indicator startAnimating];
  29.             [webView addSubview:indicator];
  30.             [indicator release];
  31.         }else if(self.type == OASAdInterstitialSlideshow){
  32.             CGRect screenRect = [[UIScreen mainScreen] bounds];
  33.             CGFloat screenHeight = screenRect.size.height;
  34.             fr.origin.x = 0;
  35.             fr.origin.y = (screenHeight-480)/2; // Center ad on both sized screens
  36.         }else{
  37.            // NSLog(@"Html: %@", html);
  38.         }
  39.         webView.frame = fr;      
  40.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement