当前位置:网站首页>Data formatting widget
Data formatting widget
2022-07-24 13:38:00 【Amitabha @ Moda】
**
/* legal uri */
**
export function validateURL(textval) {
const urlregex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
return urlregex.test(textval)
}
/** * Get the address of the file relative to the browser
- @param {[type]} file [ File stream ]
- @return {[url]} [ Relative to the browser's secure encrypted address ]
*/
export const getblobUrl = (file) => {
let url = ''
if (window.createObjcectURL !== undefined) {
url = window.createOjcectURL(file)
} else if (window.URL !== undefined) {
url = window.URL.createObjectURL(file)
} else if (window.webkitURL !== undefined) {
url = window.webkitURL.createObjectURL(file)
}
return url
}
/** * Format time
- @param {[type]} time [description]
- @return {[type]} [description]
*/
export const formatDateTimeList = time => {
time = new Date(time)
let _hour = time.getHours()
let _minute = time.getMinutes()
let _second = time.getSeconds()
let _year = time.getFullYear()
let _month = time.getMonth()
let _date = time.getDate()
if (_hour < 10) {
_hour = '0' + _hour
}
if (_minute < 10) {
_minute = '0' + _minute
}
if (_second < 10) {
_second = '0' + _second
}
_month = _month + 1
if (_month < 10) {
_month = '0' + _month
}
if (_date < 10) {
_date = '0' + _date
}
return (
_year +
'-' +
_month +
'-' +
_date
// +
// ' ' +
// _hour +
// ':' +
// _minute +
// ':' +
// _second
)
}
/** * The interception time
- @param {[type]} time [description]
- @return {[type]} [description]
*/
export const getViewTime = time => {
if(time){
return time.split(' ')[0]
}
return ''
}
*Android
function isAndroid() {
return /(?:android)/.test(window.navigator.userAgent.toLowerCase());
}
* Mobile
function isWap() {
return !!window.navigator.userAgent
.toLowerCase()
.match(
/(phone|pad|pod|iphone|ipod|ios|ipad|android|mobile|blackberry|iemobile|mqqbrowser|juc|fennec|wosbrowser|browserng|webos|symbian|windows phone)/i
);
}
*app
function isApp() {
return !!window.navigator.userAgent
.toLowerCase()
.match(
/(csdn)/i
);
}
* Splicing url
// Splicing url
function setParamsList(params, isFirst = true) {
var paramsData = "";
for (var Key in params) {
if (typeof params[Key] != "function") {
paramsData += Key + "=" + (params[Key]||"") + "&";
}
}
paramsData = paramsData.substr(0, paramsData.length - 1);
return `${
isFirst ? "?" : "&"}${
paramsData}`;
}
边栏推荐
- The use of two-dimensional array (including the definition of two-dimensional array, the declaration and initialization of two-dimensional array (dynamic initialization, static initialization), common
- Aike AI frontier promotion (7.24)
- Kunyu(坤舆) 安装 详解
- 户外广告牌不能“想挂就挂”!广州城管部门加强户外广告安全管理
- 通配符(泛域名)SSL证书
- Experience sharing | how to use SaaS for enterprise knowledge management
- Analysis of abnormal problems of embedded SD card
- 网络安全——文件上传白名单绕过
- 深入浅出边缘云 | 2. 架构
- Game thinking 04 summary: a summary of frame, state and physical synchronization (it was too long before, and now it's brief)
猜你喜欢

Aggregation measurement of robot swarm intelligence based on group entropy

Representation and basic application of regular expressions

Win10 log in with Microsoft account and open all programs by default with administrator privileges: 2020-12-14

Network security - Web information collection

网络安全——函数绕过注入

Packaging class (mutual conversion between types)

网络安全——WAR后门部署
![[paper reading] temporary binding for semi-superior learning](/img/59/846d868cccad238267bd984f085218.png)
[paper reading] temporary binding for semi-superior learning

On node embedding

Modern data architecture selection: Data fabric, data mesh
随机推荐
【论文阅读】TEMPORAL ENSEMBLING FOR SEMI-SUPERVISED LEARNING
The scroll bar in unity ugui is not displayed from the top when launching the interface in the game
【论文阅读】Mean teachers are better role models
Aggregation measurement of robot swarm intelligence based on group entropy
网络安全——WAR后门部署
Spelling words~
Group intelligence decision-making in an open environment: concepts, challenges and leading technologies
基于社会媒体数据增强的交通态势感知研究及进展
浅谈Node Embedding
Browser type judgment
How to configure webrtc protocol for low latency playback on easycvr platform v2.5.0 and above?
Overview of multi view learning methods based on canonical correlation analysis
How can flinksql run in perjob mode on yarn? I submit tasks on SqlClient
Interface document evolution atlas, some ancient interface document tools, you may not have used them
AtCoder Beginner Contest 261 F // 树状数组
Notes on Linear Algebra -- lesson 25 -- projection of vectors on axes
On node embedding
Packaging class (mutual conversion between types)
EAS approval process related table
Detailed explanation of odoo JS DoAction