/**
     * @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. zabbix 布署实践【5 使用邮箱SMTP SSL推送告警邮件】

    由于传统的邮件推送脚本使用smtp 25端口,在各大邮箱提供商已不适用,已经向SSL过渡,这里以QQ邮箱为例,使用SSL 465端口 登录zabbix-server 进入 cd /usr/lib/za ...

  2. CodeForces 709A Juicer

    简单题. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #inclu ...

  3. 超实用 JS 代码段笔记(一)

    序1:30段简单代码段(有删减) 1 . 区分 IE 和 非 IE 浏览器 if(!+[1,]){ console.log('ie浏览器'); }else{ console.log('非ie浏览器') ...

  4. js实现多行文本超出一定字数显示省略号功能

    最近项目中遇到了一个关于超出一定字数用省略号显示的问题,其实这种形式很常见,公司简介.产品介绍啊里面都可能会用到,一行文字显示省略号很容易,多行就得想点办法了.在经过查阅.整理之后,我也算是实现了这个 ...

  5. 使用ajax和history.pushState无刷新改变页面URL(转)

    表现 如果你使用chrome或者firefox等浏览器访问本博客.github.com.plus.google.com等网站时,细心的你会发现页面之间的点击是通过ajax异步请求的,同时页面的URL发 ...

  6. vscode: Visual Studio Code 常用快捷键

    vscode: Visual Studio Code 常用快捷键 主命令框 F1 或 Ctrl+Shift+P: 打开命令面板.在打开的输入框内,可以输入任何命令,例如: 按一下 Backspace ...

  7. web前端-雅虎34条规则优化

    1.尽量减少HTTP请求次数      终端用户响应的时间中,有80%用于下载各项内容.这部分时间包括下载页面中的图像.样式表.脚本.Flash等.通过减少页面中的元素可以减少HTTP请求的次数.这是 ...

  8. maven package:Max maven Unsupported major.minor version 51.0

    编译maven项目时报错:Max maven Unsupported major.minor version 51.0 major.minor version 51.0 对应的是JDK1.7 majo ...

  9. IIS优化服务器性能导致QuartZ任务未运行

    问题: IIS 为优化服务器性能,会自动对它认为休眠的应用程序进行资源回收,资源回收将会导致网站应用程序关闭. 解决方案: 1.  设置闲置超时为0,固定回收时间间隔为0,即IIS不主动回收闲置进程 ...

  10. NIO 入门

    新的输入/输出 (NIO) 库是在 JDK 1.4 中引入的.NIO 弥补了原来的 I/O 的不足,它在标准 Java 代码中提供了高速的.面向块的 I/O.通过定义包含数据的类,以及通过以块的形式处 ...