1 Star 8 Fork 2

sinriv / ids.js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Zlib

ids.js表意文字渲染工具

本工具可将表意文字描述符“⿰⿱⿲⿳⿴⿵⿶⿷⿸⿹⿺⿻”渲染为真实的汉字(说简单点,就是用来在网页上显示自己造的汉字的)

使用方法

先加载ids.js和ids.css两个文件,然后用decodeIDS(str)将str解析为汉字
也可以使用下面的代码,将[ids][/ids]标签中的内容解析为汉字

    str = str.replace(/\[ids\]([^\[]*)\[\/ids\]/g, function(res){
      try{
        var str = res.replace("[ids]","");
        str = str.replace("[/ids]","");
        var ch = decodeIDS(str);
        return "<div style='display: inline-block;position:relative;'>"+ch+"</div>";
      }catch(e){
        console.log(e);
      }
      return "无法解析";
    });

效果

img
实际效果(翻到页尾)
修改自ids_renderer

zlib License (C) 2020 cgoxopx This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution.

简介

表意文字描述符渲染工具 展开 收起
JavaScript 等 2 种语言
Zlib
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/sinriv/ids.js.git
git@gitee.com:sinriv/ids.js.git
sinriv
ids.js
ids.js
master

搜索帮助