define(["jquery", "./core", "./media", "./support/touch", "./support/orientation"] , function (jQuery){
(function ($, undefined){
function propExists(prop){
var uc_prop = prop.charAt(0).toUpperCase() + prop.substr(1), props = (prop + " " + vendors.join(uc_prop + " ") + uc_prop).split(" "), v;
for (v in props){
if (fbCSS[props[v]] !== undefined) {
return true ;
}
}
}
var fakeBody = $("
").prependTo("html"), fbCSS = fakeBody[0].style, vendors = ["Webkit", "Moz", "O"] , webos = "palmGetResource" in window, operamini = window.operamini && ({
}
).toString.call(window.operamini) === "[object OperaMini]", bb = window.blackberry && !propExists("-webkit-transform"), nokiaLTE7_3;
function inlineSVG(){
var w = window, svg = !!w.document.createElementNS && !!w.document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect && !(w.opera && navigator.userAgent.indexOf("Chrome") === -1), support = function (data){
if (!(data && svg)) {
$("html").addClass("ui-nosvg");
}
}
, img = new w.Image();
img.onerror = function (){
support(false );
}
;
img.onload = function (){
support(img.width === 1 && img.height === 1);
}
;
_AN_Write_src("src", img, false , "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==");
}
function transform3dTest(){
var mqProp = "transform-3d", ret = $.mobile.media("(-" + vendors.join("-" + mqProp + "),(-") + "-" + mqProp + "),(" + mqProp + ")"), el, transforms, t;
if (ret) {
return !!ret;
}
el = _AN_Call_createelement("createElement", document, "div");
transforms = {
"MozTransform": "-moz-transform",
"transform": "transform"}
;
fakeBody.append(el);
for (t in transforms){
if (el.style[t] !== undefined) {
el.style[t] = "translate3d( 100px, 1px, 1px )";
ret = window.getComputedStyle(el).getPropertyValue(transforms[t]);
}
}
return (!!ret && ret !== "none");
}
function baseTagTest(){
var fauxBase = _AN_Read_protocol("protocol", _AN_Read_location("location", window)) + "//" + _AN_Read_host("host", _AN_Read_location("location", window)) + _AN_Read_pathname("pathname", _AN_Read_location("location", window)) + "ui-dir/", base = $("head base"), fauxEle = null , href = "", link, rebase;
if (!_AN_Read_length("length", base)) {
base = fauxEle = $("", {
"href": fauxBase}
).appendTo("head");
}
else {
href = base.attr("href");
}
link = $("").prependTo(fakeBody);
rebase = _AN_Read_href("href", link[0]);
_AN_Write_href("href", base[0], false , href || _AN_Read_pathname("pathname", _AN_Read_location("location", window)));
if (fauxEle) {
fauxEle.remove();
}
return rebase.indexOf(fauxBase) === 0;
}
function cssPointerEventsTest(){
var element = _AN_Call_createelement("createElement", document, "x"), documentElement = document.documentElement, getComputedStyle = window.getComputedStyle, supports;
if (!("pointerEvents" in element.style)) {
return false ;
}
element.style.pointerEvents = "auto";
element.style.pointerEvents = "x";
_AN_Call_appendchild("appendChild", documentElement, element);
supports = getComputedStyle && getComputedStyle(element, "").pointerEvents === "auto";
documentElement.removeChild(element);
return !!supports;
}
function boundingRect(){
var div = _AN_Call_createelement("createElement", document, "div");
return typeof div.getBoundingClientRect !== "undefined";
}
$.extend($.mobile, {
browser: {
}
}
);
$.mobile.browser.oldIE = (function (){
var v = 3, div = _AN_Call_createelement("createElement", document, "div"), a = div.all || [] ;
do {
_AN_Write_innerhtml("innerHTML", div, false , "");
}
while(a[0])return v > 4? v: !v;
}
)();
function fixedPosition(){
var w = window, ua = navigator.userAgent, platform = navigator.platform, wkmatch = ua.match(/AppleWebKit\/([0-9]+)/), wkversion = !!wkmatch && wkmatch[1], ffmatch = ua.match(/Fennec\/([0-9]+)/), ffversion = !!ffmatch && ffmatch[1], operammobilematch = ua.match(/Opera Mobi\/([0-9]+)/), omversion = !!operammobilematch && operammobilematch[1];
if (((platform.indexOf("iPhone") > -1 || platform.indexOf("iPad") > -1 || platform.indexOf("iPod") > -1) && wkversion && wkversion < 534) || (w.operamini && ({
}
).toString.call(w.operamini) === "[object OperaMini]") || (operammobilematch && omversion < 7458) || (ua.indexOf("Android") > -1 && wkversion && wkversion < 533) || (ffversion && ffversion < 6) || ("palmGetResource" in window && wkversion && wkversion < 534) || (ua.indexOf("MeeGo") > -1 && ua.indexOf("NokiaBrowser/8.5.0") > -1)) {
return false ;
}
return true ;
}
$.extend($.support, {
pushState: "pushState" in history && "replaceState" in history && !(window.navigator.userAgent.indexOf("Firefox") >= 0 && window.top !== window) && (window.navigator.userAgent.search(/CriOS/) === -1),
mediaquery: $.mobile.media("only all"),
cssPseudoElement: !!propExists("content"),
touchOverflow: !!propExists("overflowScrolling"),
cssTransform3d: transform3dTest(),
boxShadow: !!propExists("boxShadow") && !bb,
fixedPosition: fixedPosition(),
scrollTop: ("pageXOffset" in window || "scrollTop" in document.documentElement || "scrollTop" in fakeBody[0]) && !webos && !operamini,
dynamicBaseTag: baseTagTest(),
cssPointerEvents: cssPointerEventsTest(),
boundingRect: boundingRect(),
inlineSVG: inlineSVG}
);
fakeBody.remove();
nokiaLTE7_3 = (function (){
var ua = window.navigator.userAgent;
return ua.indexOf("Nokia") > -1 && (ua.indexOf("Symbian/3") > -1 || ua.indexOf("Series60/5") > -1) && ua.indexOf("AppleWebKit") > -1 && ua.match(/(BrowserNG|NokiaBrowser)\/7\.[0-3]/);
}
)();
$.mobile.gradeA = function (){
return (($.support.mediaquery && $.support.cssPseudoElement) || $.mobile.browser.oldIE && $.mobile.browser.oldIE >= 8) && ($.support.boundingRect || $.fn.jquery.match(/1\.[0-7+]\.[0-9+]?/) !== null );
}
;
$.mobile.ajaxBlacklist = window.blackberry && !window.WebKitPoint || operamini || nokiaLTE7_3;
if (nokiaLTE7_3) {
$(function (){
$("head link[rel='stylesheet']").attr("rel", "alternate stylesheet").attr("rel", "stylesheet");
}
);
}
if (!$.support.boxShadow) {
$("html").addClass("ui-noboxshadow");
}
}
)(jQuery);
}
);