工具类 util.img
/**
* @description transform emotion image url between code
* @author x.radish
* @param {String} html the html contents
* @return {String}
*/ transformImg:function (html) {
var imgReg = /<img\s+data-type=['|"]emotion['|"]\s+src\s*=\s*['|"]([^\s'"]+).*?\/?>/g;
var codeReg = /\[:(\d{1,3}):\]/g;
if (imgReg.test(html)) {
html = html.replace(imgReg, function (match, capture) {
var temp = capture.split("/");
return "[:" + temp[temp.length - 1].split(".")[0] + ":]";
});
} else {
html = html.replace(codeReg, function (match, capture) {
return "<img data-type='emotion' src='emotion/" + capture + ".gif' />";
});
}
return html;
}
工具类 util.img的更多相关文章
- 小米开源文件管理器MiCodeFileExplorer-源码研究(3)-使用最多的工具类Util
Util.java,使用最广泛~代码中很多地方,都写了注释说明~基本不需要怎么解释了~ package net.micode.fileexplorer.util; import java.io.Fil ...
- Springboot在工具类(Util)中使用@Autowired注入Service
1. 使用@Component注解标记工具类MailUtil: 2. 使用@Autowired注入我们需要的bean: 3. 在工具类中编写init()函数,并使用@PostConstruct注解标记 ...
- 32.Node.js中的常用工具类util
转自:http://www.runoob.com/nodejs/nodejs-module-system.html util是一个Node.js核心模块,提供常用函数的集合,用于弥补JavaScrip ...
- Spring中提供的集合工具类util CollectionUtils
转自:https://blog.csdn.net/fangwenzheng88/article/details/78457850 CollectionUtils类 /* * Copyright 200 ...
- 图片处理工具类 util
PathUtil package util; public class PathUtil { private static String seperator = System.getProperty( ...
- Java工具类(util) 之01- 数学运算工具(精确运算)
数学运算工具(精确运算) /** * * @author maple * */ public abstract class AmountUtil { private AmountUtil() { } ...
- 工具类Util类的注释书写规范
package com.paic.pacz.core.salesmanage.util; import java.util.List; import org.apache.commons.beanut ...
- 工具类 util.Date 日期类
/** * @description format the time * @author xf.radish * @param {String} format The format your want ...
- 工具类 Util.Browser
/** * @description get the param form browser * @author xf.radish * @param {String} key the param yo ...
随机推荐
- Unity 解决 An asset is marked with HideFlags.DontSave but is included in the build 问题。
问题是:不能使用Unity使用的默认的字体.想要显示中文直接去下载一个字体.没必要使用默认的字体
- 基于Java 的增量与完全备份小工具
前段时间,因为各种原因,自己动手写了一个小的备份工具,用了一个星期,想想把它的设计思路放上来,当是笔记吧. 需求场景:这个工具起初的目的是为了解决朋友公司对其网络的限制(不可以用任何同步软件,git, ...
- PEiD 0.95 全插件中文绿色版
软件名称: PEiD 0.95 软件语言: 简体中文 授权方式: 免费软件 运行环境: Win8 / Win7 / Vista / WinXP 软件大小: 4.4MB 图片预览: 软件简介: PEiD ...
- Docker 总结
版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[+] Docker总结 简单介绍 1 Docker 架构 安装和环境配置 1 mac 11 brew安装 11 dmg文件安装 1 ...
- 找轮转后的有序数组中第K小的数
我们可以通过二分查找法,在log(n)的时间内找到最小数的在数组中的位置,然后通过偏移来快速定位任意第K个数. 此处假设数组中没有相同的数,原排列顺序是递增排列. 在轮转后的有序数组中查找最小数的算法 ...
- Python--三元运算与lambda表达式
三元运算: if 1 ==1: name = 'Tim' else: name = 'SB' 利用三元运算来完成上述4句语句任务: name = 'Tim' if 1==1 else 'SB' lam ...
- directive(指令里的)的compile,pre-link,post-link,link,transclude
The nitty-gritty of compile and link functions inside AngularJS directives The nitty-gritty of comp ...
- js 对象类型 (对象的属性 ,对象的方法) this 关键字
$(function () { var observation = { init: function () { this.render();//断点:this bind :function() che ...
- 基于UDP协议的网络编程
UDP协议是一种不可靠的网络协议,它在通信实例的两端各建立一个Socket,但这两个Socket之间并没有虚拟链路,这两个Socket只是发送.接收数据报的对象. Java使用DatagramSock ...
- mybatis配置sql超时时间
mybatis如果不配置,默认超时时间是不做限制的.当系统慢sql很多时,势必会增加数据库压力,系统性能及稳定性降低.所以有必要要设置sql超时设置,下面配置超时时间是5分钟. 第一步:全局配置如下 ...