工具类 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 ...
随机推荐
- quagga源码分析--通用库thread
quagga是开源路由器软件,提供的用户界面与思科,华为的路由器的人机接口几乎一致,非常有学习价值,尤其是开源的协议代码,简直亮瞎了我的小眼睛. quagga的介绍,我就不赘述了,有兴趣的可以找度娘或 ...
- java模拟数据库缓存
实现缓存一些数据到本地,避免重复查询数据库,对数据库造成压力,代码如下: package threadLock; import java.util.HashMap; import java.util. ...
- 《Intel汇编第5版》 汇编调用子过程
一.Call和Ret指令 二.在子过程中需要自己保存可能会修改掉的寄存器值,这里可以使用USES伪指令来生成 三.一个数组求和的汇编例子 TITLE Call a Proc Demo INCLUDE ...
- Vrui 增加自定义事件
#include <Vrui/Application.h> #include <GL/GLObject.h> #include <Vrui/Vrui.h> #inc ...
- 初始化git
git config --global user.name "Firstname Lastname" git config --global user.email "yo ...
- 前端环境安装(node.js+npm+grunt+bower)
前端开发环境安装(本教程不带开发工具的安装教程,只是环境安装) 本人机器环境win7 64位. 一.node.js安装 进入官网下载node.js文件,http://www.nodejs.org/ 2 ...
- epoll完整例子
#include <deque> #include <map> #include <vector> #include <pthread.h> #incl ...
- HttpGet和HttpPost的区别
HttpGet和HttpPost的区别总结就是下面这样: Get一般用于从服务器取数据,而且不改变原来的内容: Post一般用于向服务器传递数据,这需要改变服务器的内容. 从安全性上考虑,Get的安全 ...
- TOMcat9 免安装版的配置
在这里默认大家都安装了jdk并且配置了java的环境,网上教程很多. 在tomcat官网(http://tomcat.apache.org/download-90.cgi)上下载和自己系统匹配的安装包 ...
- C++类与static
到目前为止,我们设计的类中所有的成员变量和成员函数都是属于对象的,如我们在前面定义的book类,利用book类声明两个对象Alice和Harry,这两个对象均拥有各自的price和title成员变量, ...