1.     /**
         * @description transform emotion image url between code
         * @author x.radish
         * @param {String} html the html contents
         * @return {String}
         */
  2.  
  3.     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的更多相关文章

  1. 小米开源文件管理器MiCodeFileExplorer-源码研究(3)-使用最多的工具类Util

    Util.java,使用最广泛~代码中很多地方,都写了注释说明~基本不需要怎么解释了~ package net.micode.fileexplorer.util; import java.io.Fil ...

  2. Springboot在工具类(Util)中使用@Autowired注入Service

    1. 使用@Component注解标记工具类MailUtil: 2. 使用@Autowired注入我们需要的bean: 3. 在工具类中编写init()函数,并使用@PostConstruct注解标记 ...

  3. 32.Node.js中的常用工具类util

    转自:http://www.runoob.com/nodejs/nodejs-module-system.html util是一个Node.js核心模块,提供常用函数的集合,用于弥补JavaScrip ...

  4. Spring中提供的集合工具类util CollectionUtils

    转自:https://blog.csdn.net/fangwenzheng88/article/details/78457850 CollectionUtils类 /* * Copyright 200 ...

  5. 图片处理工具类 util

    PathUtil package util; public class PathUtil { private static String seperator = System.getProperty( ...

  6. Java工具类(util) 之01- 数学运算工具(精确运算)

    数学运算工具(精确运算) /** * * @author maple * */ public abstract class AmountUtil { private AmountUtil() { } ...

  7. 工具类Util类的注释书写规范

    package com.paic.pacz.core.salesmanage.util; import java.util.List; import org.apache.commons.beanut ...

  8. 工具类 util.Date 日期类

    /** * @description format the time * @author xf.radish * @param {String} format The format your want ...

  9. 工具类 Util.Browser

    /** * @description get the param form browser * @author xf.radish * @param {String} key the param yo ...

随机推荐

  1. mysql给表添加外键并查询

    CREATE TABLE `heart` ( `heart_ID` ) NOT NULL AUTO_INCREMENT, `heart_name` ) CHARACTER SET utf8 NOT N ...

  2. 关于The requested PHP extension ext-pdo_sqlite * is missing from your system. Install or enable PHP's pdo_sqlite extension.的解决

    $ php composer.phar install Loading composer repositories with package information Installing depend ...

  3. gmic全球移动互联网大会 全球九站已开启!

    由长城会主办的全球移动互联网大会( 简称GMIC)已成长为世界范围内最具影响力的辐射并连结东西半球的移动互联网商务平台,是最大规模的移动互联网行业盛会. 2017gmic全球移动互联网大会北京站将于2 ...

  4. SVN 版本控制工具

    1,安装完服务端VisualSVN Server和客户端TortoiseSVN 后,随便在一个文件夹下,右键,会看到有SVN checkout 选项,这个选项只有在第一次在仓库下下载的时候会用到: 1 ...

  5. CSS display:inline-block的元素特点:

    将对象呈递为内联对象,但是对象的内容作为块对象呈递.旁边的内联对象会被呈递在同一行内,允许空格. 在CSS中,块级对象元素会单独占一行显示,多个block元素会各自新起一行,并且可以设置width,h ...

  6. 12.04 css小测div+css...

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  7. redhat 安装配置samba实现win共享linux主机目录

    [转]http://blog.chinaunix.net/uid-26642180-id-3135941.html redhat 安装配置samba实现win共享linux主机目录 2012-03-1 ...

  8. jsp中获取json字符串,并解析

    <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title> ...

  9. Java实现二叉树先序,中序,后序遍历

    以下是我要解析的一个二叉树的模型形状 接下来废话不多直接上代码 一种是用递归的方法,另一种是用堆栈的方法: 首先创建一棵树: public class Node { private int data; ...

  10. mybatis xml的无效判空

    <insert id="insert"> <if test="xxxMappingEntityList != null and xxxMappingEn ...