```javascript
/**
* Filename: LoggerSaveManager.java
* Description:
* Copyright: Copyright (c)2015
* Company: SENRSL
* @author: senRsl senRsl@163.com
* @version: 1.0
* Create at: 2015年7月28日 下午4:17:11
*
* Modification History:
* Date Author Version Description
* ------------------------------------------------------------------
* 2015年7月28日 senRsl 1.0 1.0 Version
*/
package dc.common.log;
import java.util.HashMap;
import java.util.Map;
import android.content.Context;
/**
*
* @author senrsl
*
*/
public class LoggerSaveManager {
private static Map<String,LoggerSave> map = new HashMap<String, LoggerSave>();
protected static boolean isSave = false;
public static LoggerSave get(){
return get(null);
}
public static LoggerSave get(String name){
if(null == name || "".equals(name))return map.get(0);
return map.get(name);
}
public static int start(Context ctx){
isSave = true;
return create(ctx);
}
public static int start(Context ctx,String logPath,String logName){
isSave = true;
return create(ctx, logPath, logName);
}
public static int create(Context ctx){
return create(ctx, null, null);
}
public static int create(Context ctx,String logPath,String logName){
if(map.containsKey(logName))return map.size();
LoggerSave ls = new LoggerSave(ctx, logPath, logName);
map.put(logName, ls);
return map.size();
}
public static void save(String str){
save(null, str);
}
public static void save(String name,String str){
try {
map.get(name).save(str);
} catch (Exception e) {
e.printStackTrace();
}
}
private static LoggerSaveCat lsc;
public static void startCat(Context ctx){
startCat(ctx, null, null);
}
public static void startCat(Context ctx,String logPath,String logName){
try {
if(null == lsc)lsc = new LoggerSaveCat(ctx, logPath, logName);
lsc.start();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void stopCat(){
if(null != lsc)lsc.stop();
}
}
```
转:
/** * Filename: LoggerSaveManager.java * Description: * Copyright: Copyright (c)2015 * Company: SENRSL * @author: senRsl senRsl@163.com * @version: 1.0 * Create at: 2015年7月28日 下午4:17:11 * * Modification History: * Date Author Version Description * ------------------------------------------------------------------ * 2015年7月28日 senRsl 1.0 1.0 Version */ package dc.common.log; import java.util.HashMap; import java.util.Map; import android.content.Context; /** * * @author senrsl * */ public class LoggerSaveManager { private static Map<String,LoggerSave> map = new HashMap<String, LoggerSave>(); protected static boolean isSave = false; public static LoggerSave get(){ return get(null); } public static LoggerSave get(String name){ if(null == name || "".equals(name))return map.get(0); return map.get(name); } public static int start(Context ctx){ isSave = true; return create(ctx); } public static int start(Context ctx,String logPath,String logName){ isSave = true; return create(ctx, logPath, logName); } public static int create(Context ctx){ return create(ctx, null, null); } public static int create(Context ctx,String logPath,String logName){ if(map.containsKey(logName))return map.size(); LoggerSave ls = new LoggerSave(ctx, logPath, logName); map.put(logName, ls); return map.size(); } public static void save(String str){ save(null, str); } public static void save(String name,String str){ try { map.get(name).save(str); } catch (Exception e) { e.printStackTrace(); } } private static LoggerSaveCat lsc; public static void startCat(Context ctx){ startCat(ctx, null, null); } public static void startCat(Context ctx,String logPath,String logName){ try { if(null == lsc)lsc = new LoggerSaveCat(ctx, logPath, logName); lsc.start(); } catch (Exception e) { e.printStackTrace(); } } public static void stopCat(){ if(null != lsc)lsc.stop(); } }
2016年09月02日18:16:21
这个需要把\t\n\r这种换行换成<br/>,不然会被过滤掉造成所有代码都在一行,得改源码
改blogspot模板的pre标签样式,发现是在发布的时候blogspot把\n之类的标签给过滤掉了
尝试加js代码
- <script type='text/javascript'>
- img_thumb_width = 180; // Image Thumbnail Width
- img_thumb_height = 180; // Image Thumbnail Height
- summary_noimg = 500; // Length of Summary Text if no image is Used
- summary_img = 400; // Length of Summary Text if post has Image Thumbnail
- </script>
- <script type='text/javascript'>
- //<![CDATA[
- function removeHtmlTag(strx,chop){
- chop = (chop < strx.length-1) ? chop : strx.length-2;
- while(strx.charAt(chop-1)!=' ' && strx.indexOf(' ',chop)!=-1) chop++;
- strx = strx.substring(0,chop-1);
- return strx+'...';
- }
- function createSummaryAndThumb(pID){
- var div = document.getElementById(pID);
- var imgtag = "";
- var img = div.getElementsByTagName("img");
- var summ = summary_noimg;
- if(img.length>=1) {
- imgtag = '<span style="overflow:hidden; border: none; margin:0 15px 10px 0; float:left; max-height:'+img_thumb_height+'px;width:auto;"><img src="'+img[0].src+'" width="'+img_thumb_width+'px" height="auto"/></span>';
- summ = summary_img;
- }
- var summary = imgtag + '<div>' + removeHtmlTag(div.innerHTML,summ) + '</div>';
- div.innerHTML = summary;
- }
- //]]>
- </script>
2016年09月06日17:56:35修改
亲测此方式无用
应该是在用邮件发过来的时候,被blogspot给过滤掉了。。。。
--
senRsl
2016年09月06日17:53:59
2016年09月06日17:53:59
没有评论 :
发表评论