工具类 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 ...
随机推荐
- 9款.net反编译的必备神器
编辑来给大家盘点下.net的反编译工具: 1.Reflector Reflector是最为流行的.Net反编译工具.Reflector是由微软员工Lutz Roeder编写的免费程序.Reflecto ...
- ASP.NET用户控件操作ASPX页面
定义一个不含数据的事件处理方法 用户控件 public event EventHandler Click; protected void Button1_Click(object sender, Ev ...
- Python基础知识学习_Day4
一.函数 1.1函数特性 减少重复代码 使程序可扩展 使程序变得容易维护 1.2函数定义和使用 def 函数名(参数): ...... 函数体 ...... 返回值 函数定义主要特点如下: def:表 ...
- Silverlight 中MatrixTransform和其他Transform的数值转换
对各种transform的讲解已经很多了,但是有时MatrixTransform和其他transform变换效果之间需要转换时,变换量的转换又如何呢?下面的类就完成了Matrix和其他transfor ...
- mysql无法输入中文
#查看系统的环境变量 echo $LANG zh_CN.UTF-8 vim /etc/sysconfig/i18n 1 LANG="en_US.UTF-8"2 SYSFONT=&q ...
- sql convert() 函数
convert: 时间格式转换为其他时间格式的函数 CONVERT ( data_type [ ( length ) ] , expression [ , style ] ) data_type: ...
- JAVA内容回顾(二)——面向对象(OOP)
1.类与对象 类:类指的是同种对象的抽象,看不见摸不着的.包含有属性与方法. 对象:是类的具体实现,看的见摸得着的东西. 类是对象的抽象,对象是类的具体实现. 2.访问修饰符 public:在项目的任 ...
- CachedRowSet的用法
String sql="select item_code from xt_dictionary_item where type_id='32' and parent_itemid='0' o ...
- Applet签名
applet签名 1.生成密匙库 keytool -genkey -keystore mytest.store -alias mytest -validity 365 -keystore 密匙库 -a ...
- MVC创建
[1]创建ASP.NET_MVC应用程序 1>新建项目>web>Visual Studio 2012>ASP.NET MVC4 Web应用程序 2>填写名称,位置 ...