Comments (5)
HTML 实体符号挺多的,靠 replace 无法从根本解决问题,在最新的 v1.4.0 更新中引入了 htmr 进行转义,已解决这个问题;
谢谢二位提出的 issue!
from uptime-status.
貌似把 uptimerobot.js 的 monitor.friendly_name 内容替换一下就可以了(Chrome 84 可以,其它浏览器没试)
let name = monitor.friendly_name.replace(/'/gi, "'");
name = name.replace(/(/gi, "(");
name = name.replace(/)/gi, ")");
name = name.replace(/=/gi, "=");
name = name.replace(/[/gi, "[");
name = name.replace(/]/gi, "]");
name = name.replace(/"/gi, '"');
name = name.replace(/</gi, "<");
name = name.replace(/>/gi, ">");
apps.push({
id: monitor.id,
name: name,
url: monitor.url,
status: status,
average: average,
daily: daily,
total: total,
});
// 烂代码,大佬勿喷
from uptime-status.
我觉得封装成函数更好一些
function convert(str){
str = str.replace(/(\\u)(\w{1,4})/gi, function($0){
return (String.fromCharCode(parseInt((escape($0).replace(/(%5Cu)(\w{1,4})/g,"$2")),16)));
}).replace(/(&#x)(\w{1,4});/gi, function($0){
return String.fromCharCode(parseInt(escape($0).replace(/(%26%23x)(\w{1,4})(%3B)/g,"$2"),16));
}).replace(/(&#)(\d{1,6});/gi, function($0){
return String.fromCharCode(parseInt(escape($0).replace(/(%26%23)(\d{1,6})(%3B)/g,"$2")));
});
return str;
}
方便调用
from uptime-status.
HTML 实体符号挺多的,靠 replace 无法从根本解决问题,在最新的 v1.4.0 更新中引入了 htmr 进行转义,已解决这个问题;
谢谢二位提出的 issue!
@yb 另外,我稍改了一下页面样式,适配了我所用的主题,页面链接:https://renbaoshuo.github.io/status/ ,且页面下方已经注明版权,请问可以吗?
from uptime-status.
@yb 另外,我稍改了一下页面样式,适配了我所用的主题,页面链接:https://renbaoshuo.github.io/status/ ,且页面下方已经注明版权,请问可以吗?
of course,欢迎使用
from uptime-status.
Related Issues (20)
- 跨域报错 HOT 3
- PC浏览器访问不显示数据 HOT 9
- 教程能否写清楚一点 HOT 1
- 更新到最新版,也更新了API KEY,但是打开界面一直在转圈 HOT 1
- 显示空白页面
- ㅤ HOT 1
- 跨域失效了 HOT 1
- 我配置了页面却是白色的 HOT 3
- cloudfare反代错误
- 有办法隐藏部分网址吗? HOT 2
- 如何重新打包檔案?
- 更新变慢了 HOT 3
- 速度问题
- CORS 连接404了
- [BUG]: getMonitor 返回 204 状态码 HOT 1
- 希望能够提供Webhook功能 HOT 1
- 请问怎么改网站的样式? HOT 1
- 获取 不到具体状态了
- Reverse days status
- 什么时候支持时间轴从左到右
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uptime-status.