摘要:
['contextmenu', 'selectstart', 'copy'].forEach(function(ev){ document.addEventListener(ev, function(event){ return event.returnValue = false })}); 阅读全文
摘要:
document.addEventListener('keydown', function(event){ return !( 112 == event.keyCode || //F1 123 == event.keyCode || //F12 event.ctrlKey && 82 == even 阅读全文
摘要:
window.onload = function(){ setTimeout(function(){ let t = performance.timing console.log('DNS查询耗时 :' + (t.domainLookupEnd - t.domainLookupStart).toFi 阅读全文
摘要:
toFullScreen:全屏 function toFullScreen(){ let elem = document.body; elem.webkitRequestFullScreen ? elem.webkitRequestFullScreen() : elem.mozRequestFull 阅读全文
摘要:
function downloadFile(filename, data){ let DownloadLink = document.createElement('a'); if ( DownloadLink ){ document.body.appendChild(DownloadLink); D 阅读全文
摘要:
function GetUrlParam(){ let url = document.location.toString(); let arrObj = url.split("?"); let params = Object.create(null) if (arrObj.length > 1){ 阅读全文
摘要:
function getPropByPath(obj, path, strict) { let tempObj = obj; path = path.replace(/\[(\w+)\]/g, '.$1'); //将[0]转化为.0 path = path.replace(/^\./, ''); / 阅读全文
摘要:
function dateFormater(formater, t){ let date = t ? new Date(t) : new Date(), Y = date.getFullYear() + '', M = date.getMonth() + 1, D = date.getDate(), 阅读全文
摘要:
function unique(arr){ if(!isArrayLink(arr)){ //不是类数组对象 return arr } let result = [] let objarr = [] let obj = Object.create(null) arr.forEach(item => 阅读全文
摘要:
function isPCBroswer() { let e = navigator.userAgent.toLowerCase() , t = "ipad" == e.match(/ipad/i) , i = "iphone" == e.match(/iphone/i) , r = "midp" 阅读全文
摘要:
function getExplorerInfo() { let t = navigator.userAgent.toLowerCase(); return 0 <= t.indexOf("msie") ? { //ie < 11 type: "IE", version: Number(t.matc 阅读全文
摘要:
//运行环境是浏览器let inBrowser = typeof window !== 'undefined';//运行环境是微信let inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;let wee 阅读全文
摘要:
这里列出了原始类型,时间、正则、错误、数组、对象的克隆规则,其他的可自行补充 function clone(value, deep){ if(isPrimitive(value)){ return value } if (isArrayLike(value)) { //是类数组 value = Ar 阅读全文
摘要:
Object.assign = Object.assign || function(){ if(arguments.length == 0) throw new TypeError('Cannot convert undefined or null to object'); let target = 阅读全文
摘要:
function getRawType(value) { return Object.prototype.toString.call(value).slice(8, -1)}//getoRawType([]) ==> Array 阅读全文
摘要:
function isObjectLike(value) { return value != null && typeof value == 'object';} 阅读全文
摘要:
function isObject(value) { let type = typeof value; return value != null && (type == 'object' || type == 'function');} 阅读全文
摘要:
function isPrimitive(value) { return isStatic(value) || typeof value 'symbol} 阅读全文
摘要:
function isStatic(value) { return( typeof value 'string' || typeof value 'number' || typeof value 'boolean' || typeof value 'undefined' || value null 阅读全文