env¶
webix.
env
([see official doc])¶webix.env helper.
Please look into the linked official documentation.
External references¶
Code¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | webix.env = {};
// webix.env.transform
// webix.env.transition
(function(){
webix.env.strict = !!window.webix_strict;
webix.env.https = document.location.protocol === "https:";
if (navigator.userAgent.indexOf("Mobile")!=-1 || navigator.userAgent.indexOf("Windows Phone")!=-1)
webix.env.mobile = true;
if (webix.env.mobile || navigator.userAgent.indexOf("iPad")!=-1 || navigator.userAgent.indexOf("Android")!=-1)
webix.env.touch = true;
if (navigator.userAgent.indexOf('Opera')!=-1)
webix.env.isOpera=true;
else{
//very rough detection, but it is enough for current goals
webix.env.isIE=!!document.all || (navigator.userAgent.indexOf("Trident") !== -1);
if (webix.env.isIE){
var version = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (version == 8)
webix.env.isIE8 = true;
}
webix.env.isEdge=(navigator.userAgent.indexOf("Edge")!=-1);
webix.env.isFF=(navigator.userAgent.indexOf("Firefox")!=-1);
webix.env.isWebKit=(navigator.userAgent.indexOf("KHTML")!=-1);
webix.env.isSafari=webix.env.isWebKit && (navigator.userAgent.indexOf('Mac')!=-1);
//maximum height/width for HTML elements in pixels (rough), bigger values will be ignored by browser
if(webix.env.isIE || webix.env.isEdge || webix.env.isFF)
webix.env.maxHTMLElementSize = 10000000;
if(webix.env.isSafari)
webix.env.maxHTMLElementSize = 100000000;
}
if(navigator.userAgent.toLowerCase().indexOf("android")!=-1){
webix.env.isAndroid = true;
if(navigator.userAgent.toLowerCase().indexOf("trident")){
webix.env.isAndroid = false;
webix.env.isIEMobile = true;
}
}
webix.env.transform = false;
webix.env.transition = false;
var found_index = -1;
var js_list = ['', 'webkit', 'Moz', 'O', 'ms'];
var css_list = ['', '-webkit-', '-Moz-', '-o-', '-ms-'];
var d = document.createElement("DIV");
for (var j=0; j < js_list.length; j++) {
var name = js_list[j] ? (js_list[j]+"Transform") : "transform";
if(typeof d.style[name] != 'undefined'){
found_index = j;
break;
}
}
if (found_index > -1){
webix.env.cssPrefix = css_list[found_index];
var jp = webix.env.jsPrefix = js_list[found_index];
webix.env.transform = jp ? jp+"Transform" : "transform";
webix.env.transition = jp ? jp+"Transition" : "transition";
webix.env.transitionDuration = jp ? jp+"TransitionDuration" : "transitionDuration";
d.style[webix.env.transform] = "translate3d(0,0,0)";
webix.env.translate = (d.style[webix.env.transform])?"translate3d":"translate";
webix.env.transitionEnd = ((webix.env.cssPrefix == '-Moz-')?"transitionend":(jp ? jp+"TransitionEnd" : "transitionend"));
}
webix.env.pointerevents = (!webix.env.isIE ||(new RegExp("Trident/.*rv:11")).exec(navigator.userAgent) !== null);
})();
|