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