/**
     * @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的更多相关文章

  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. Java中不定参的使用规则

    Java中有时候会使用到不定参数,它的使用规则有2项: 一个方法中只能使用一个不定参数. 不定参数必须是方法中最后一个参数. 不定参数在传入的过程中会行成一个数组传入,如果不会放在最后一个,虚拟机无法 ...

  2. CodeForces 676D Theseus and labyrinth

    最短路. $dis[i][j][k]$记录到点$(i,j)$,门的状态为$k$时的最短路.转移的时候有$8$种方案,即直接走向周围四个点,或者进行旋转.比较烦的是判断两个相邻的点在状态$k$下是否连通 ...

  3. openstack私有云布署实践【11.2 计算nova - compute节点配置(办公网环境)】

    这里我只使用compute1节点配置为示例,其它节点的配置基本是一样的,只是声明的管理IP不同而已   计算节点 # yum install openstack-nova-compute sysfsu ...

  4. Xsser

    来源:https://www.cqhacker.cn/post-174.html   XSSer使用说明 =============================================== ...

  5. IOS常遇问题个人收藏网址指南

    代码适配Masonry使用的详细介绍: http://blog.csdn.net/majiakun1/article/details/51160339 Masonry使用注意篇: http://www ...

  6. C#第十天

    1.c#中的访问修饰符 public :公开的公共的 private:私有的,只能在当前类的内部访问 protected:受保护的,只能在当前类的内部以及该类的子类中访问. internal:只能在当 ...

  7. layer1.8UI

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...

  8. wcf测试工具

    WCF测试工具-WcfStorm WCF测试工具-WcfStorm  http://www.wcfstorm.com/wcf/home.aspx WcfStorm is a dead-simple, ...

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

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

  10. python demo整理

    1 变量作用域 #!/usr/bin/python # coding=utf-8 name = "whole global name" class Person: name = & ...