一些通用函数
export function parseTime(time, cFormat) { if (arguments.length === 0) { return null; } const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'; let date; if (typeof time === 'object') { date = time; } else { if (typeof time === 'string' && /^[0-9]+$/.test(time)) { time = parseInt(time); } if (typeof time === 'number' && time.toString().length === 10) { time = time * 1000; } date = new Date(time); } const formatObj = { y: date.getFullYear(), m: date.getMonth() + 1, d: date.getDate(), h: date.getHours(), i: date.getMinutes(), s: date.getSeconds(), a: date.getDay() }; const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { let value = formatObj[key]; // Note: getDay() returns 0 on Sunday if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value]; } if (result.length > 0 && value < 10) { value = '0' + value; } return value || 0; }); return time_str; } /** * @param {number} time * @param {string} option * @returns {string} */ export function formatTime(time, option) { if (('' + time).length === 10) { time = parseInt(time) * 1000; } else { time = +time; } const d = new Date(time); const now = Date.now(); const diff = (now - d) / 1000; if (diff < 30) { return '刚刚'; } else if (diff < 3600) { // less 1 hour return Math.ceil(diff / 60) + '分钟前'; } else if (diff < 3600 * 24) { return Math.ceil(diff / 3600) + '小时前'; } else if (diff < 3600 * 24 * 2) { return '1天前'; } if (option) { return parseTime(time, option); } else { return ( d.getMonth() + 1 + '月' + d.getDate() + '日' + d.getHours() + '时' + d.getMinutes() + '分' ); } } /** * @param {string} url * @returns {Object} */ export function param2Obj(url) { const search = url.split('?')[1]; if (!search) { return {}; } return JSON.parse( '{"' + decodeURIComponent(search) .replace(/"/g, '\\"') .replace(/&/g, '","') .replace(/=/g, '":"') .replace(/\+/g, ' ') + '"}' ); } export function getUrlParams(url, key) { const arr = url.split('?'); const newArr = arr[1].split('&'); for (var i = 0; i < newArr.length; i++) { let temp = newArr[i].split('='); if (temp[0] === key) { let search = temp[1]; return search; } } } export function changeParams(obj) { var ary = []; for (var p in obj) if (obj.hasOwnProperty(p) && obj[p]) { ary.push(encodeURIComponent(p) + '=' + encodeURIComponent(obj[p])); } return ary.join('&'); }
//获取当前时间,格式YYYY-MM-DD function getNowFormatDate() { var date = new Date(); var seperator1 = "-"; var year = date.getFullYear(); var month = date.getMonth() + 1; var strDate = date.getDate(); if (month >= 1 && month <= 9) { month = "0" + month; } if (strDate >= 0 && strDate <= 9) { strDate = "0" + strDate; } var currentdate = year + seperator1 + month + seperator1 + strDate; return currentdate; } /** * * @param {String,Object} date 时间戳或对象 * @param {String} fmt 时间格式如 yyyy-MM-dd */ function formatDate(date, fmt = 'yyyy-MM-dd') { if (typeof (date) === 'number') { date = new Date(date) } var o = { "M+": date.getMonth() + 1, //月份 "d+": date.getDate(), //日 "h+": date.getHours(), //小时 "m+": date.getMinutes(), //分 "s+": date.getSeconds(), //秒 "q+": Math.floor((date.getMonth() + 3) / 3), //季度 "S": date.getMilliseconds() //毫秒 } if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length)) for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))) return fmt } function debounce(func, wait, immediate) { let timeout, args, context, timestamp, result const later = function () { // 据上一次触发时间间隔 const last = +new Date() - timestamp // 上次被包装函数被调用时间间隔last小于设定时间间隔wait if (last < wait && last > 0) { timeout = setTimeout(later, wait - last) } else { timeout = null // 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用 if (!immediate) { result = func.apply(context, args) if (!timeout) context = args = null } } } return function (...args) { context = this timestamp = +new Date() const callNow = immediate && !timeout // 如果延时不存在,重新设定延时 if (!timeout) timeout = setTimeout(later, wait) if (callNow) { result = func.apply(context, args) context = args = null } return result } } function getScale(pxDate) { let htmlFontSize = document.documentElement.style.fontSize htmlFontSize = htmlFontSize.slice(0, htmlFontSize.length - 2) let scale = htmlFontSize / 192 return (pxDate / htmlFontSize) * scale + 'rem' // return pxDate + '%' } function getSPx() { let htmlFontSize = document.documentElement.style.fontSize htmlFontSize = htmlFontSize.slice(0, htmlFontSize.length - 2) let scale = htmlFontSize / 192 return scale // return pxDate + '%' } //将图片转换为Base64 --2019-8-21更新,加注释 //url 图片链接或者是blob对象 //callback 回调函数 function getImgToBase64(url, callback) { var canvas = document.createElement('canvas'); var ctx = canvas.getContext('2d'); var img = new Image;//通过构造函数来创建的 img 实例,在赋予 src 值后就会立刻下载图片,相比 createElement() 创建 <img> 省去了 append(),也就避免了文档冗余和污染 img.crossOrigin = 'Anonymous'; //要先确保图片完整获取到,这是个异步事件 img.onload = function () { canvas.height = img.height;//确保canvas的尺寸和图片一样 canvas.width = img.width; ctx.drawImage(img, 0, 0);//将图片绘制到canvas中 var dataURL = canvas.toDataURL('image/png');//转换图片为dataURL,传第二个参数可压缩图片,前提是图片格式jpeg或者webp格式的 callback(dataURL);//调用回调函数 canvas = null; }; img.src = url; } //将base64转换为文件对象 function dataURLtoFile(dataurl, filename) { var arr = dataurl.split(','); var mime = arr[0].match(/:(.*?);/)[1]; var bstr = atob(arr[1]); var n = bstr.length; var u8arr = new Uint8Array(n); while (n--) { u8arr[n] = bstr.charCodeAt(n); } //转换成file对象 return new File([u8arr], filename, {type: mime}); //转换成成blob对象 //return new Blob([u8arr],{type:mime}); } //将图片转换为base64,再将base64转换成file对象 // getImgToBase64('images/ruoshui.png', function (data) { // var myFile = dataURLtoFile(data, 'testimgtestimgtestimg'); // console.log(myFile); // }); //防范存储型 XSS 攻击的策略就是不相信一切用户提交的信息,比如说用户的评论、发表的文章等等。对于这些信息一律进行字符串转义,主要是引号、尖括号、斜杠 function escape(str) { str = str.replace(/&/g, '&') str = str.replace(/</g, '<') str = str.replace(/>/g, '>') str = str.replace(/"/g, '&quto;') str = str.replace(/'/g, ''') str = str.replace(/`/g, '`') str = str.replace(/\//g, '/') return str } function styleJson() { let styleJson = [ { "featureType": "land", "elementType": "geometry", "stylers": { "visibility": "on", "color": "#091220ff" } }, { "featureType": "water", "elementType": "geometry", "stylers": { "visibility": "on", "color": "#113549ff" } }, { "featureType": "green", "elementType": "geometry", "stylers": { "visibility": "on", "color": "#0e1b30ff" } }, { "featureType": "building", "elementType": "geometry", "stylers": { "visibility": "on" } }, { "featureType": "building", "elementType": "geometry.fill", "stylers": { "color": "#113549ff" } }, { "featureType": "building", "elementType": "geometry.stroke", "stylers": { "color": "#dadada00" } }, { "featureType": "subwaystation", "elementType": "geometry", "stylers": { "visibility": "on", "color": "#113549B2" } }, { "featureType": "education", "elementType": "geometry", "stylers": { "visibility": "on", "color": "#12223dff" } }, { "featureType": "medical", "elementType": "geometry", "stylers": { "visibility": "on", "color": "#12223dff" } }, { "featureType": "scenicspots", "elementType": "geometry", "stylers": { "visibility": "on", "color": "#12223dff" } }, { "featureType": "highway", "elementType": "geometry", "stylers": { "visibility": "on", "weight": "4" } }, { "featureType": "highway", "elementType": "geometry.fill", "stylers": { "color": "#12223dff" } }, { "featureType": "highway", "elementType": "geometry.stroke", "stylers": { "color": "#fed66900" } }, { "featureType": "highway", "elementType": "labels", "stylers": { "visibility": "on" } }, { "featureType": "highway", "elementType": "labels.text.fill", "stylers": { "color": "#12223dff" } }, { "featureType": "highway", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "highway", "elementType": "labels.icon", "stylers": { "visibility": "on" } }, { "featureType": "arterial", "elementType": "geometry", "stylers": { "visibility": "on", "weight": "2" } }, { "featureType": "arterial", "elementType": "geometry.fill", "stylers": { "color": "#12223dff" } }, { "featureType": "arterial", "elementType": "geometry.stroke", "stylers": { "color": "#ffeebb00" } }, { "featureType": "arterial", "elementType": "labels", "stylers": { "visibility": "on" } }, { "featureType": "arterial", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "arterial", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "local", "elementType": "geometry", "stylers": { "visibility": "on", "weight": "1" } }, { "featureType": "local", "elementType": "geometry.fill", "stylers": { "color": "#12223dff" } }, { "featureType": "local", "elementType": "geometry.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "local", "elementType": "labels", "stylers": { "visibility": "on" } }, { "featureType": "local", "elementType": "labels.text.fill", "stylers": { "color": "#979c9aff" } }, { "featureType": "local", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffffff" } }, { "featureType": "railway", "elementType": "geometry", "stylers": { "visibility": "off", "weight": "1" } }, { "featureType": "railway", "elementType": "geometry.fill", "stylers": { "color": "#123c52ff" } }, { "featureType": "railway", "elementType": "geometry.stroke", "stylers": { "color": "#12223dff" } }, { "featureType": "subway", "elementType": "geometry", "stylers": { "visibility": "off", "weight": "1" } }, { "featureType": "subway", "elementType": "geometry.fill", "stylers": { "color": "#d8d8d8ff" } }, { "featureType": "subway", "elementType": "geometry.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "subway", "elementType": "labels", "stylers": { "visibility": "on" } }, { "featureType": "subway", "elementType": "labels.text.fill", "stylers": { "color": "#979c9aff" } }, { "featureType": "subway", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffffff" } }, { "featureType": "continent", "elementType": "labels", "stylers": { "visibility": "on" } }, { "featureType": "continent", "elementType": "labels.icon", "stylers": { "visibility": "on" } }, { "featureType": "continent", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "continent", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "city", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "city", "elementType": "labels", "stylers": { "visibility": "on" } }, { "featureType": "city", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "city", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "town", "elementType": "labels.icon", "stylers": { "visibility": "on" } }, { "featureType": "town", "elementType": "labels", "stylers": { "visibility": "off" } }, { "featureType": "town", "elementType": "labels.text.fill", "stylers": { "color": "#454d50ff" } }, { "featureType": "town", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffffff" } }, { "featureType": "road", "elementType": "geometry.fill", "stylers": { "color": "#12223dff" } }, { "featureType": "poilabel", "elementType": "labels", "stylers": { "visibility": "on" } }, { "featureType": "districtlabel", "elementType": "labels", "stylers": { "visibility": "off" } }, { "featureType": "road", "elementType": "geometry", "stylers": { "visibility": "on" } }, { "featureType": "road", "elementType": "labels", "stylers": { "visibility": "off" } }, { "featureType": "road", "elementType": "geometry.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "district", "elementType": "labels", "stylers": { "visibility": "on" } }, { "featureType": "poilabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "poilabel", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "poilabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "manmade", "elementType": "geometry", "stylers": { "color": "#12223dff" } }, { "featureType": "districtlabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffffff" } }, { "featureType": "entertainment", "elementType": "geometry", "stylers": { "color": "#12223dff" } }, { "featureType": "shopping", "elementType": "geometry", "stylers": { "color": "#12223dff" } }, { "featureType": "highway", "stylers": { "level": "6", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "highway", "stylers": { "level": "7", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "highway", "stylers": { "level": "8", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "highway", "stylers": { "level": "9", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "highway", "stylers": { "level": "10", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "highway", "elementType": "geometry", "stylers": { "visibility": "off", "level": "6", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "highway", "elementType": "geometry", "stylers": { "visibility": "off", "level": "7", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "highway", "elementType": "geometry", "stylers": { "visibility": "off", "level": "8", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "highway", "elementType": "geometry", "stylers": { "visibility": "off", "level": "9", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "highway", "elementType": "geometry", "stylers": { "visibility": "off", "level": "10", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "highway", "elementType": "labels", "stylers": { "visibility": "off", "level": "6", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "highway", "elementType": "labels", "stylers": { "visibility": "off", "level": "7", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "highway", "elementType": "labels", "stylers": { "visibility": "off", "level": "8", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "highway", "elementType": "labels", "stylers": { "visibility": "off", "level": "9", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "highway", "elementType": "labels", "stylers": { "visibility": "off", "level": "10", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "nationalway", "stylers": { "level": "6", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "nationalway", "stylers": { "level": "7", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "nationalway", "stylers": { "level": "8", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "nationalway", "stylers": { "level": "9", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "nationalway", "stylers": { "level": "10", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "nationalway", "elementType": "geometry", "stylers": { "visibility": "off", "level": "6", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "nationalway", "elementType": "geometry", "stylers": { "visibility": "off", "level": "7", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "nationalway", "elementType": "geometry", "stylers": { "visibility": "off", "level": "8", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "nationalway", "elementType": "geometry", "stylers": { "visibility": "off", "level": "9", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "nationalway", "elementType": "geometry", "stylers": { "visibility": "off", "level": "10", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "nationalway", "elementType": "labels", "stylers": { "visibility": "off", "level": "6", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "nationalway", "elementType": "labels", "stylers": { "visibility": "off", "level": "7", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "nationalway", "elementType": "labels", "stylers": { "visibility": "off", "level": "8", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "nationalway", "elementType": "labels", "stylers": { "visibility": "off", "level": "9", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "nationalway", "elementType": "labels", "stylers": { "visibility": "off", "level": "10", "curZoomRegionId": "0", "curZoomRegion": "6-10" } }, { "featureType": "provincialway", "stylers": { "level": "8", "curZoomRegionId": "0", "curZoomRegion": "8-10" } }, { "featureType": "provincialway", "stylers": { "level": "9", "curZoomRegionId": "0", "curZoomRegion": "8-10" } }, { "featureType": "provincialway", "stylers": { "level": "10", "curZoomRegionId": "0", "curZoomRegion": "8-10" } }, { "featureType": "provincialway", "elementType": "geometry", "stylers": { "visibility": "off", "level": "8", "curZoomRegionId": "0", "curZoomRegion": "8-10" } }, { "featureType": "provincialway", "elementType": "geometry", "stylers": { "visibility": "off", "level": "9", "curZoomRegionId": "0", "curZoomRegion": "8-10" } }, { "featureType": "provincialway", "elementType": "geometry", "stylers": { "visibility": "off", "level": "10", "curZoomRegionId": "0", "curZoomRegion": "8-10" } }, { "featureType": "provincialway", "elementType": "labels", "stylers": { "visibility": "off", "level": "8", "curZoomRegionId": "0", "curZoomRegion": "8-10" } }, { "featureType": "provincialway", "elementType": "labels", "stylers": { "visibility": "off", "level": "9", "curZoomRegionId": "0", "curZoomRegion": "8-10" } }, { "featureType": "provincialway", "elementType": "labels", "stylers": { "visibility": "off", "level": "10", "curZoomRegionId": "0", "curZoomRegion": "8-10" } }, { "featureType": "cityhighway", "stylers": { "level": "6", "curZoomRegionId": "0", "curZoomRegion": "6-9" } }, { "featureType": "cityhighway", "stylers": { "level": "7", "curZoomRegionId": "0", "curZoomRegion": "6-9" } }, { "featureType": "cityhighway", "stylers": { "level": "8", "curZoomRegionId": "0", "curZoomRegion": "6-9" } }, { "featureType": "cityhighway", "stylers": { "level": "9", "curZoomRegionId": "0", "curZoomRegion": "6-9" } }, { "featureType": "cityhighway", "elementType": "geometry", "stylers": { "visibility": "off", "level": "6", "curZoomRegionId": "0", "curZoomRegion": "6-9" } }, { "featureType": "cityhighway", "elementType": "geometry", "stylers": { "visibility": "off", "level": "7", "curZoomRegionId": "0", "curZoomRegion": "6-9" } }, { "featureType": "cityhighway", "elementType": "geometry", "stylers": { "visibility": "off", "level": "8", "curZoomRegionId": "0", "curZoomRegion": "6-9" } }, { "featureType": "cityhighway", "elementType": "geometry", "stylers": { "visibility": "off", "level": "9", "curZoomRegionId": "0", "curZoomRegion": "6-9" } }, { "featureType": "cityhighway", "elementType": "labels", "stylers": { "visibility": "off", "level": "6", "curZoomRegionId": "0", "curZoomRegion": "6-9" } }, { "featureType": "cityhighway", "elementType": "labels", "stylers": { "visibility": "off", "level": "7", "curZoomRegionId": "0", "curZoomRegion": "6-9" } }, { "featureType": "cityhighway", "elementType": "labels", "stylers": { "visibility": "off", "level": "8", "curZoomRegionId": "0", "curZoomRegion": "6-9" } }, { "featureType": "cityhighway", "elementType": "labels", "stylers": { "visibility": "off", "level": "9", "curZoomRegionId": "0", "curZoomRegion": "6-9" } }, { "featureType": "subwaylabel", "elementType": "labels", "stylers": { "visibility": "off" } }, { "featureType": "subwaylabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "tertiarywaysign", "elementType": "labels", "stylers": { "visibility": "off" } }, { "featureType": "tertiarywaysign", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "provincialwaysign", "elementType": "labels", "stylers": { "visibility": "off" } }, { "featureType": "provincialwaysign", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "nationalwaysign", "elementType": "labels", "stylers": { "visibility": "off" } }, { "featureType": "nationalwaysign", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "highwaysign", "elementType": "labels", "stylers": { "visibility": "off" } }, { "featureType": "highwaysign", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "village", "elementType": "labels", "stylers": { "visibility": "off" } }, { "featureType": "district", "elementType": "labels.text", "stylers": { "fontsize": "20" } }, { "featureType": "district", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "district", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "country", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "country", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "water", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "water", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "cityhighway", "elementType": "geometry.fill", "stylers": { "color": "#12223dff" } }, { "featureType": "cityhighway", "elementType": "geometry.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "tertiaryway", "elementType": "geometry.fill", "stylers": { "color": "#12223dff" } }, { "featureType": "tertiaryway", "elementType": "geometry.stroke", "stylers": { "color": "#ffffff10" } }, { "featureType": "provincialway", "elementType": "geometry.fill", "stylers": { "color": "#12223dff" } }, { "featureType": "provincialway", "elementType": "geometry.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "nationalway", "elementType": "geometry.fill", "stylers": { "color": "#12223dff" } }, { "featureType": "nationalway", "elementType": "geometry.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "highway", "elementType": "labels.text", "stylers": { "fontsize": "20" } }, { "featureType": "nationalway", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "nationalway", "elementType": "labels.text.fill", "stylers": { "color": "#12223dff" } }, { "featureType": "nationalway", "elementType": "labels.text", "stylers": { "fontsize": "20" } }, { "featureType": "provincialway", "elementType": "labels.text.fill", "stylers": { "color": "#12223dff" } }, { "featureType": "provincialway", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "provincialway", "elementType": "labels.text", "stylers": { "fontsize": "20" } }, { "featureType": "cityhighway", "elementType": "labels.text.fill", "stylers": { "color": "#12223dff" } }, { "featureType": "cityhighway", "elementType": "labels.text", "stylers": { "fontsize": "20" } }, { "featureType": "cityhighway", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "estate", "elementType": "geometry", "stylers": { "color": "#12223dff" } }, { "featureType": "tertiaryway", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "tertiaryway", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "fourlevelway", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "fourlevelway", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "scenicspotsway", "elementType": "geometry.fill", "stylers": { "color": "#12223dff" } }, { "featureType": "scenicspotsway", "elementType": "geometry.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "universityway", "elementType": "geometry.fill", "stylers": { "color": "#12223dff" } }, { "featureType": "universityway", "elementType": "geometry.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "vacationway", "elementType": "geometry.fill", "stylers": { "color": "#12223dff" } }, { "featureType": "vacationway", "elementType": "geometry.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "fourlevelway", "elementType": "geometry", "stylers": { "visibility": "on" } }, { "featureType": "fourlevelway", "elementType": "geometry.fill", "stylers": { "color": "#12223dff" } }, { "featureType": "fourlevelway", "elementType": "geometry.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "transportationlabel", "elementType": "labels", "stylers": { "visibility": "on" } }, { "featureType": "transportationlabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "transportationlabel", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "transportationlabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "educationlabel", "elementType": "labels", "stylers": { "visibility": "on" } }, { "featureType": "educationlabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "educationlabel", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "educationlabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "transportation", "elementType": "geometry", "stylers": { "color": "#113549ff" } }, { "featureType": "airportlabel", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "airportlabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "scenicspotslabel", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "scenicspotslabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "medicallabel", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "medicallabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "medicallabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "scenicspotslabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "airportlabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "entertainmentlabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "entertainmentlabel", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "entertainmentlabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "estatelabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "estatelabel", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "estatelabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "businesstowerlabel", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "businesstowerlabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "businesstowerlabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "companylabel", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "companylabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "companylabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "governmentlabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "governmentlabel", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "governmentlabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "restaurantlabel", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "restaurantlabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "restaurantlabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "hotellabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "hotellabel", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "hotellabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "shoppinglabel", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "shoppinglabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "shoppinglabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "lifeservicelabel", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "lifeservicelabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "lifeservicelabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "carservicelabel", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "carservicelabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "carservicelabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "financelabel", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "financelabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "financelabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "otherlabel", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "otherlabel", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "otherlabel", "elementType": "labels.icon", "stylers": { "visibility": "off" } }, { "featureType": "manmade", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "manmade", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "transportation", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "transportation", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "education", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "education", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "medical", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "medical", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }, { "featureType": "scenicspots", "elementType": "labels.text.fill", "stylers": { "color": "#2dc4bbff" } }, { "featureType": "scenicspots", "elementType": "labels.text.stroke", "stylers": { "color": "#ffffff00" } }]; return styleJson } module.exports = { formatDate, debounce, getScale, getSPx, styleJson, escape, getImgToBase64, }