leaflet开源地图库源码 浏览器&移动设备判断(browser.js)备份
<script>
var isIe = !-[1,];
// alert('ie9 之前'+isIe);
var ie = 'ActiveXObject' in window;
//alert('sadsd'+ie);
var ie2 = !!('ActiveXObject' in window);
//alert('22222'+ie2);
var ie3= !!window.ActiveXObject || !!("ActiveXObject" in window); //!!window['ActiveXObject'] 这个括号多了3个字符
// alert(ie3); var doc = document.documentElement;
console.log(doc.style+'查看支持的属性');
;(function () { var ua = navigator.userAgent.toLowerCase(),//var ua = navigator.userAgent.toLowerCase(); //window.navigator.userAgent,使用浏览器的UA判断,这里全部转为小写。如下图,在chrome中的判断。
doc = document.documentElement, ie = 'ActiveXObject' in window, webkit = ua.indexOf('webkit') !== -1, // ///retina屏幕
phantomjs = ua.indexOf('phantom') !== -1,
android23 = ua.search('android [23]') !== -1, ////是否是移动端android的2.3以上版本
chrome = ua.indexOf('chrome') !== -1, mobile = typeof orientation !== 'undefined',
msPointer = navigator.msPointerEnabled && navigator.msMaxTouchPoints && !window.PointerEvent,
pointer = (window.PointerEvent && navigator.pointerEnabled && navigator.maxTouchPoints) || msPointer, ie3d = ie && ('transition' in doc.style),
webkit3d = ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()) && !android23,
gecko3d = 'MozPerspective' in doc.style,
opera3d = 'OTransition' in doc.style; ///retina屏幕
var retina = 'devicePixelRatio' in window && window.devicePixelRatio > 1; if (!retina && 'matchMedia' in window) {
var matches = window.matchMedia('(min-resolution:144dpi)');
retina = matches && matches.matches;
} ///触摸设备的验证:
var touch = !window.L_NO_TOUCH && !phantomjs && (pointer || 'ontouchstart' in window ||
(window.DocumentTouch && document instanceof window.DocumentTouch)); L.Browser = {
ie: ie,
ielt9: ie && !document.addEventListener,
webkit: webkit,
gecko: (ua.indexOf('gecko') !== -1) && !webkit && !window.opera && !ie,
android: ua.indexOf('android') !== -1,
android23: android23,
chrome: chrome,
safari: !chrome && ua.indexOf('safari') !== -1, ie3d: ie3d,
webkit3d: webkit3d,
gecko3d: gecko3d,
opera3d: opera3d,
any3d: !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d || opera3d) && !phantomjs, mobile: mobile,
mobileWebkit: mobile && webkit,
mobileWebkit3d: mobile && webkit3d,
mobileOpera: mobile && window.opera, touch: !!touch, //!! 快速转布尔值
msPointer: !!msPointer,
pointer: !!pointer, retina: !!retina
}; }());
</script>
源码清晰完善;备份不错;
http://www.cnblogs.com/vczero/p/leaflet_3.html 参考地址
leaflet开源地图库源码 浏览器&移动设备判断(browser.js)备份的更多相关文章
- 【原】Android热更新开源项目Tinker源码解析系列之三:so热更新
本系列将从以下三个方面对Tinker进行源码解析: Android热更新开源项目Tinker源码解析系列之一:Dex热更新 Android热更新开源项目Tinker源码解析系列之二:资源文件热更新 A ...
- 【原】Android热更新开源项目Tinker源码解析系列之一:Dex热更新
[原]Android热更新开源项目Tinker源码解析系列之一:Dex热更新 Tinker是微信的第一个开源项目,主要用于安卓应用bug的热修复和功能的迭代. Tinker github地址:http ...
- 【原】Android热更新开源项目Tinker源码解析系列之二:资源文件热更新
上一篇文章介绍了Dex文件的热更新流程,本文将会分析Tinker中对资源文件的热更新流程. 同Dex,资源文件的热更新同样包括三个部分:资源补丁生成,资源补丁合成及资源补丁加载. 本系列将从以下三个方 ...
- android 在线升级借助开源中国App源码
android 在线升级借助开源中国App源码 http://www.cnblogs.com/luomingui/p/3949429.html android 在线升级借助开源中国App源码分析如下: ...
- 【安卓网络请求开源框架Volley源码解析系列】定制自己的Request请求及Volley框架源码剖析
通过前面的学习我们已经掌握了Volley的基本用法,没看过的建议大家先去阅读我的博文[安卓网络请求开源框架Volley源码解析系列]初识Volley及其基本用法.如StringRequest用来请求一 ...
- Android 7.0 Gallery图库源码分析3 - 数据加载及显示流程
前面分析Gallery启动流程时,说了传给DataManager的data的key是AlbumSetPage.KEY_MEDIA_PATH,value值,是”/combo/{/local/all,/p ...
- 开源项目Telegram源码 Telegram for Android Source
背景介绍 Telegram 是一款跨平台的即时通信软件,它的客户端是自由及开放源代码软件.用户可以相互交换加密与自毁消息,发送照片.影片等所有类型文件.官方提供手机版.桌面版和网页版等多种平台客户端. ...
- Python优秀开源项目Rich源码解析
这篇文章对优秀的开源项目Rich的源码进行解析,OMG,盘他.为什么建议阅读源码,有两个原因,第一,单纯学语言很难在实践中灵活应用,通过阅读源码可以看到每个知识点的运用场景,印象会更深,以后写代码的时 ...
- 开源MyBatisGenerator组件源码分析
开源MyBatisGenerator组件源码分析 看源码前,先了解Generator能做什么? MyBatisGenerator是用来生成mybatis的Mapper接口和xml文件的工具,提供多种启 ...
随机推荐
- 【从翻译mos文章】在OGG (Oracle GoldenGate) 正在使用SCHEMATRANDATA如果,需要额外的db patch
在OGG (Oracle GoldenGate) 正在使用SCHEMATRANDATA如果.需要额外的db patch 参考原始: Patches needed to support SCHEMATR ...
- UVA 1513 - Movie collection(树状数组)
UVA 1513 - Movie collection option=com_onlinejudge&Itemid=8&page=show_problem&category=5 ...
- 王立平--include在Android应用
它包括一个布局和布局 1.在layout确定activity_other.xml布局 2.代码中的包括例如以下: <LinearLayout xmlns:android="http:/ ...
- Spring系列
Spring系列之访问数据库 阅读目录 一.概述 二.JDBC API的最佳实践 三.Spring对ORM的集成 回到顶部 一.概述 Spring的数据访问层是以统一的数据访问异常层体系为核心,结 ...
- Android DrawerLayout 抽屉
Android DrawerLayout 抽屉 DrawerLayout 在supportV4 Lib在.类似的开源slidemenu如,DrawerLayout父类ViewGroup,自定义组件基本 ...
- log(n)在第一时间,以确定该阵列i小号码
简介参考算法9.2 int partition(int *a,int p,int r){ int x=a[r]; int i=p-1; for(int j=p;j<=r-1;j++){ if(a ...
- git 仓库
从 Git 删除文件 rm test.txt git rm test.txt 加入远程仓库 $ git remote origin $ git remote add pb git://github.c ...
- T-SQL基础(2) - 单表查询
开窗函数over select orderid, custid, val, SUM(val) over() as totalvalue, SUM(val) over(partition by cust ...
- Recall(检出率)和 Precision(准确性)
这两个方面是模式识别和信息检索使用措施值. 浅显易懂的理解,用以下的图片和公式最好只是. 那么 - 召回率R:用检索到相关文档数作为分子.全部相关文档总数作为分母.即R = A / ( A + C ) ...
- CodeForces 22D Segments 排序水问题
主题链接:点击打开链接 升序右键点.采取正确的点 删边暴力 #include <cstdio> #include <cstring> #include <algorith ...