Commit 9f44a471 by lee

u

parent ea19ed6d
...@@ -93,8 +93,8 @@ ...@@ -93,8 +93,8 @@
if(product && product.htmlDescription.length){ if(product && product.htmlDescription.length){
// self.lbDetail.text = product.htmlDescription; // self.lbDetail.text = product.htmlDescription;
// NSString *html = [NSString stringWithFormat:@"%@<script type='text/javascript'>window.webkit.messageHandlers.handle.postMessage(document.body.clientHeight)</scriot>",product.htmlDescription]; // NSString *html = [NSString stringWithFormat:@"%@<script type='text/javascript'>window.webkit.messageHandlers.handle.postMessage(document.body.clientHeight)</scriot>",product.htmlDescription];
NSString *css = [NSString stringWithFormat:@"p{font-size:12px; }img{width:100%%;}*{padding:0;margin:0;max-width:%f}",UI_SCREEN_WIDTH]; NSString *css = [NSString stringWithFormat:@"p:empty{margin: 0 20px;}p{font-size:12px; }img{width:100%%;}*{padding:0;margin:0;max-width:%f}",UI_SCREEN_WIDTH];
NSString *html = [[NSString stringWithFormat:@"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0 user-scalable=yes\" /><div id=\"container\">%@<div><script type=\"text/javascript\">function update() {window.webkit.messageHandlers.handle.postMessage({height:document.body.scrollHeight})} function timer(){ setTimeout(timer,1000); update()} function delay() { setTimeout(update,1000) } window.onload = update</script><style type=\"text/css\">%@</style>",product.htmlDescription,css] stringByReplacingOccurrencesOfString:@"src=\"//cdn.shopify.com" withString:@"src=\"https://o42yton8r.qnssl.com"]; NSString *html = [[NSString stringWithFormat:@"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0 user-scalable=yes\" /><div id=\"container\">%@<div><script type=\"text/javascript\">function update() {window.webkit.messageHandlers.handle.postMessage({height:document.body.scrollHeight})} function timer(){ setTimeout(timer,1000); update()} function delay() { setTimeout(update,1000) } window.onload = update;for(var e of document.getElementsByTagName('p')) { if(e.getElementsByTagName('img').length==0) e.style.setProperty('margin','0 20px') }</script><style type=\"text/css\">%@</style>",product.htmlDescription,css] stringByReplacingOccurrencesOfString:@"src=\"//cdn.shopify.com" withString:@"src=\"https://o42yton8r.qnssl.com"];
[self.webView loadHTMLString:html baseURL:nil]; [self.webView loadHTMLString:html baseURL:nil];
}else{ }else{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment