举报
测试插入代码高亮 置顶
2020-06-28 00:30:01
2728次阅读
1个评论
/** 标签页 **/
.tagModule {
    width: 100%;
    height: 100%;
    background: #fff;
    right:0;
    margin-bottom: 0;
    border-bottom: none;
    overflow-y:hidden;
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
}
.tagModule .box{
	padding-bottom: 10px;
}
.tagModule .box .tagList{
	margin-top:2px;margin-left: 10px; margin-right: 0px; 
}

//获取Range范围的pre和hide标签
function getRangeTag(range) {
	var ancestor = K(range.commonAncestor());
		
	while (ancestor) {
		if (ancestor.type == 1 && !ancestor.isStyle()) {
			break;
		}
		if(ancestor.name == 'pre' || ancestor.name == 'code' || ancestor.name =='hide'){
			break;
		}
		ancestor = ancestor.parent();
	}
	return ancestor;
}



/**
* 是否为微信浏览器
* @param request
* @return
*/
public static boolean isWeChatBrowser(HttpServletRequest request){
	String userAgent = request.getHeader("user-agent").toLowerCase();
	if(userAgent != null && !"".equals(userAgent.trim()) && userAgent.indexOf("micromessenger")>-1){
		return true;
	}
	return false;
}
收藏 0 0
    test2 白金会员 VIP
    2020-06-28 00:34:51

    /**
     * 文本中的URL转超链接
     * @param text 文本
     * @return
     */
    public static String urlToHyperlink(String text){
    	// url的正则表达式
    	Matcher matcher = pattern.matcher(text);
          
    	String resultText = "";// (临时变量,保存转换后的文本)
    	int lastEnd = 0;// 保存每个链接最后一行的下标
          
    	while(matcher.find()){
    		resultText += text.substring(lastEnd, matcher.start());
        resultText += "<a target=\"_blank\" href=\"" + matcher.group() + "\">" + matcher.group() + "</a>";
        lastEnd = matcher.end();
    	}
    	resultText += text.substring(lastEnd);
    	return resultText;
    }

    • test2 白金会员 VIP
      2020-06-28 00:35:51
       
      哈哈..........
共1条 1

登录 后评论。没有帐号? 注册 一个。

测试会员

VIP
  • 0 回答
  • 0 粉丝
  • 0 关注