工具类 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 ...
随机推荐
- The APR based Apache Tomcat Native library tomcat启动错误
The APR based Apache Tomcat Native library which allows optimal performance in production environmen ...
- 【转】Jmeter(三)-简单的HTTP请求(非录制)
首先建立一个线程组(Thread Group),为什么所有的请求都要加入线程组这个组件呢?不加不行吗?答案当然是不行的.因为jmeter的所有任务都必须由线程处理,所有任务都必须在线程组下面创建. 选 ...
- Java 彩色图转灰度图
1. 方法1 BufferedImage grayImage = new BufferedImage(width, height, colorImage.TYPE_BYTE_GRAY); Graphi ...
- mysql中datetime和timestamp的区别
原文地址:http://database.51cto.com/art/200905/124240.htm 相同 显示 TIMESTAMP列的显示格式与DATETIME列相同.换句话说,显示宽度固定在1 ...
- Zeppelin使用Spark的yarn-client模式
Zeppelin版本0.6.2 1. Export SPARK_HOME In conf/zeppelin-env.sh, export SPARK_HOME environment variable ...
- delphi变量作用域
完全摘自网络(一件飘雪),供参考: 很多初学者对delphi单元的变量和函数访问权限不理解,在此我举例说明,希望初学者看此文后能茅塞顿开. delphi单元的变量和函数访问权限问题如下两个单元描述: ...
- iOS项目导航栏返回按钮
最近iOS项目中要求导航栏的返回按钮只保留那个箭头,去掉后边的文字,在网上查了一些资料,最简单且没有副作用的方法就是 [[UIBarButtonItem appearance] setBackButt ...
- 关于PHPAPI ZEND_API TSRM_API宏的定义
在PHP源码中,我们可以见到诸如PHPAPI ZEND_API TSRM_API等xxx_API(当然还有其他格式的)这样的宏 关于它们的定义都是类似于 #if defined(__GNUC__) & ...
- gem install bundler
http://stackoverflow.com/questions/7483515/rake-aborted-no-such-file-to-load-bundler-setup-rails-3-1 ...
- ThreadLocal 与 static 变量
ThreadLocal是为解决多线程程序的并发问题而提出的,可以称之为线程局部变量.与一般的变量的区别在于,生命周期是在线程范围内的.static变量是的生命周期与类的使用周期相同,即只要类存在,那么 ...