1// JavaScript Document 2var activeIndex=0; 3 4$(document).ready(function($) { 5 6 //Scroll to top 7 $("#back-top").hide(); 8 $(window).scroll(function () { 9 if ($(this).scrollTop() > 800) { 10 $('#back-top').fadeIn(); 11 } else { 12 $('#back-top').fadeOut(); 13 } 14 }); 15 $('#back-top').click(function () { 16 $('body,html').animate({ 17 scrollTop: 0 }, 600); 18 }); 19 20 21 // News and Events 22 var rankInterval; 23 jQuery(function($){ 24 //Logo Slider 25 var slwidth=90; 26 var sliderLength=parseInt(jQuery('.newsEvents ul li').length); 27 $('.newsEvents ul').width((sliderLength*slwidth)); 28 29 window.rankInterval=setInterval("rankSlide('nex')",3000); 30 31 //onmouseover of arrows 32 $('.newsEvents ul li').mouseover(function(){ clearInterval(window.rankInterval); }).mouseleave(function(){ window.rankInterval=setInterval("rankSlide('nex')",3000); }); 33 34 //onclick of prev 35 $('.c4-prev').click(function(){ 36 rankSlide('prev'); 37 }); 38 39 //onclick of next 40 $('.c4-next').click(function(){ 41 rankSlide('nex'); 42 }); 43 }); 44 45 46 //menu-focus 47 var url = document.URL; 48 var page = url.split('/').pop(); 49 $(".menu > ul > li > a").each(function(){ 50 if(page == 'index.php' || page == ''){ 51 $( "#header" ).animate({ 52 opacity: 1, 53 top: "0" 54 },'slow'); 55 $(".menu > ul > li > a").each(function() { 56 // checks if its the same on the address bar 57 var anchorText = $(this).text(); 58 if(anchorText == 'Home') { 59 $(this).addClass("menu-focus"); 60 } 61 }); 62 } 63 else if(url == (this.href)){ 64 $(this).addClass("menu-focus"); 65 $(this).css('color','#FFF'); 66 } 67 else{ 68 var r_page = page.split('?'); 69 r_page.pop(); 70 r_page = r_page.pop(); 71 if(r_page == 'products.php' || r_page == 'weight-products.php' || r_page == 'pressure-products.php'){ 72 $(".menu a").each(function() { 73 // checks if its the same on the address bar 74 var anchorText = $(this).text(); 75 if(anchorText == 'PRODUCTS') { 76 $(this).addClass("menu-focus"); 77 $(this).css('color','#FFF'); 78 } 79 }); 80 } 81 } 82 }); 83 84 // Gallery Tab 85 $('.gallery-head ul li').eq(0).addClass('active-gallery'); 86 $('.photo-container').eq(0).show(); 87 $('.gallery-head ul li').click(function(){ 88 var index = $(this).index(); 89 $('.photo-container').eq(index).show(); 90 $('.photo-container').not(':eq('+index+')').hide(); 91 $('.gallery-head ul li').eq(index).addClass('active-gallery'); 92 $('.gallery-head ul li').not(':eq('+index+')').removeClass('active-gallery'); 93 if(index == 1){ 94 $('.gallery-subhead').css('display','none'); 95 } 96 else{ 97 $('.gallery-subhead').css('display','block'); 98 } 99 }); 100 101 // Facilities Tab 102 $('.ftab-head ul li').click(function(){ 103 var index = $(this).index(); 104 $('.div-tab').not(':eq('+index+')').hide(); 105 $('.div-tab').eq(index).show(); 106 $('.ftab-head ul li').eq(index).addClass('facility-active'); 107 $('.ftab-head ul li').not(':eq('+index+')').removeClass('facility-active'); 108 }); 109 110 //animation 111 $('#header').css({'display':'block','opacity':'1','top':'0'}); 112 113 $('.ayurveda_img').animate({ 114 left:"-8" , 115 opacity:1 116 },'10000'); 117 118 $('.main_top').animate({ 119 opacity:1 120 },'5000'); 121 122// $(window).scroll(function(){ 123// if($('body').scrollTop() === 1000) 124// { 125// $('footer').animate({ 126// opacity:1, 127// top:0 128// },'slow'); 129// } 130// }); 131 132 133 134 /* banner code */ 135 $('img').fadeIn(); 136 var imglen=$('#banner img').length; 137 var loadImg=0; 138 var slideInt; 139 140 $(window).load(function() { 141 142 $('#banner div').eq(0).animate({opacity:1},200); 143 slideInt=setInterval("slideInterval()",5000); 144 }); 145 146 $('.slide-control').mouseover(function(){ clearInterval(slideInt) }).mouseout(function(){ slideInt=setInterval("slideInterval()",5000); }); 147 148 $('.slide-arrow span').click(function(){ 149 var clname=$(this).attr('class'); 150 var currIndex=0; 151 if(clname=='arrow-left') 152 { 153 currIndex=$('#banner div.active').index(); 154 currIndex--; 155 if(currIndex<0) 156 activeIndex=imglen-1; 157 else 158 activeIndex=currIndex; 159 } 160 else 161 { 162 currIndex=$('#banner div.active').index(); 163 currIndex++; 164 if(currIndex>(imglen-1)) 165 activeIndex=0; 166 else 167 activeIndex=currIndex; 168 } 169 slideShow(); 170 }); 171 172 /* banner code ends */ 173 174 175 }); 176 177 178function slideInterval() 179{ 180 var imglen=$('#banner div').length; 181 var currIndex=$('#banner div.active').index(); 182 if(activeIndex<imglen-1) 183 { 184 activeIndex=currIndex+1; 185 } 186 else 187 { 188 activeIndex=0; 189 } 190 191 slideShow(); 192 193} 194 195function slideShow() 196{ 197 var currAct=$('#banner div.active').index(); 198 199 $('#banner div').eq(currAct).removeClass('active').css('z-index',0); 200 201 $('.slide-control ul li').removeClass('active'); 202 $('.slide-control ul li').eq(activeIndex).addClass('active'); 203 204 205 $('#banner div').eq(activeIndex).addClass('active').css({'opacity':0,'z-index':5}).animate({opacity:1},400,function(){ 206 $('#banner div').eq(currAct).css('opacity','0').removeClass('active'); 207 208 }); 209 210} 211 212// slider 213var rankslideWidth=0; 214 function rankSlide(direction){ 215 216 var ulWidth=jQuery('.newsEvents ul').width(); 217 var liWidth=80; 218 219 if(direction=='nex') 220 { 221 rankslideWidth+=liWidth; 222 } 223 else 224 { 225 rankslideWidth-=liWidth; 226 if(rankslideWidth <= 0){ 227 rankslideWidth = 0; 228 } 229 } 230 231 232 if(rankslideWidth<ulWidth-180) 233 { 234 jQuery('.newsEvents ul').animate({top:'-'+rankslideWidth+'px'},400); 235 } 236 else 237 { 238 jQuery('.newsEvents ul').animate({top:0+'px'},400); 239 rankslideWidth=0; 240 } 241 242 } 243 244/*! 245 * Modernizr v2.6.1 246 * www.modernizr.com 247 * 248 * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton 249 * Available under the BSD and MIT licenses: www.modernizr.com/license/ 250 */ 251 252/* 253 * Modernizr tests which native CSS3 and HTML5 features are available in 254 * the current UA and makes the results available to you in two ways: 255 * as properties on a global Modernizr object, and as classes on the 256 * <html> element. This information allows you to progressively enhance 257 * your pages with a granular level of control over the experience. 258 * 259 * Modernizr has an optional (not included) conditional resource loader 260 * called Modernizr.load(), based on Yepnope.js (yepnopejs.com). 261 * To get a build that includes Modernizr.load(), as well as choosing 262 * which tests to include, go to www.modernizr.com/download/ 263 * 264 * Authors Faruk Ates, Paul Irish, Alex Sexton 265 * Contributors Ryan Seddon, Ben Alman 266 */ 267 268window.Modernizr = (function( window, document, undefined ) { 269 270 var version = '2.6.1', 271 272 Modernizr = {}, 273 274 /*>>cssclasses*/ 275 // option for enabling the HTML classes to be added 276 enableClasses = true, 277 /*>>cssclasses*/ 278 279 docElement = document.documentElement, 280 281 /** 282 * Create our "modernizr" element that we do most feature tests on. 283 */ 284 mod = 'modernizr', 285 modElem = document.createElement(mod), 286 mStyle = modElem.style, 287 288 /** 289 * Create the input element for various Web Forms feature tests. 290 */ 291 inputElem /*>>inputelem*/ = document.createElement('input') /*>>inputelem*/ , 292 293 /*>>smile*/ 294 smile = ':)', 295 /*>>smile*/ 296 297 toString = {}.toString, 298 299 // TODO :: make the prefixes more granular 300 /*>>prefixes*/ 301 // List of property values to set for css tests. See ticket #21 302 prefixes = ' -webkit- -moz- -o- -ms- '.split(' '), 303 /*>>prefixes*/ 304 305 /*>>domprefixes*/ 306 // Following spec is to expose vendor-specific style properties as: 307 // elem.style.WebkitBorderRadius 308 // and the following would be incorrect: 309 // elem.style.webkitBorderRadius 310 311 // Webkit ghosts their properties in lowercase but Opera & Moz do not. 312 // Microsoft uses a lowercase `ms` instead of the correct `Ms` in IE8+ 313 // erik.eae.net/archives/2008/03/10/21.48.10/ 314 315 // More here: github.com/Modernizr/Modernizr/issues/issue/21 316 omPrefixes = 'Webkit Moz O ms', 317 318 cssomPrefixes = omPrefixes.split(' '), 319 320 domPrefixes = omPrefixes.toLowerCase().split(' '), 321 /*>>domprefixes*/ 322 323 /*>>ns*/ 324 ns = {'svg': 'http://www.w3.org/2000/svg'}, 325 /*>>ns*/ 326 327 tests = {}, 328 inputs = {}, 329 attrs = {}, 330 331 classes = [], 332 333 slice = classes.slice, 334 335 featureName, // used in testing loop 336 337 338 /*>>
338teststyles*/ 339 // Inject element with style element and some CSS rules 340 injectElementWithStyles = function( rule, callback, nodes, testnames ) { 341 342 var style, ret, node, 343 div = document.createElement('div'), 344 // After page load injecting a fake body doesn't work so check if body exists 345 body = document.body, 346 // IE6 and 7 won't return offsetWidth or offsetHeight unless it's in the body element, so we fake it. 347 fakeBody = body ? body : document.createElement('body'); 348 349 if ( parseInt(nodes, 10) ) { 350 // In order not to give false positives we create a node for each test 351 // This also allows the method to scale for unspecified uses 352 while ( nodes-- ) { 353 node = document.createElement('div'); 354 node.id = testnames ? testnames[nodes] : mod + (nodes + 1); 355 div.appendChild(node); 356 } 357 } 358 359 // <style> elements in IE6-9 are considered 'NoScope' elements and therefore will be removed 360 // when injected with innerHTML. To get around this you need to prepend the 'NoScope' element 361 // with a 'scoped' element, in our case the soft-hyphen entity as it won't mess with our measurements. 362 // msdn.microsoft.com/en-us/library/ms533897%28VS.85%29.aspx 363 // Documents served as xml will throw if using ­ so use xml friendly encoded version. See issue #277 364 style = ['­','<style id="s', mod, '">', rule, '</style>'].join(''); 365 div.id = mod; 366 // IE6 will false positive on some tests due to the style element inside the test div somehow interfering offsetHeight, so insert it into body or fakebody. 367 // Opera will act all quirky when injecting elements in documentElement when page is served as xml, needs fakebody too. #270 368 (body ? div : fakeBody).innerHTML += style; 369 fakeBody.appendChild(div); 370 if ( !body ) { 371 //avoid crashing IE8, if background image is used 372 fakeBody.style.background = ""; 373 docElement.appendChild(fakeBody); 374 } 375 376 ret = callback(div, rule); 377 // If this is done after page load we don't want to remove the body so check if body exists 378 !body ? fakeBody.parentNode.removeChild(fakeBody) : div.parentNode.removeChild(div); 379 380 return !!ret; 381 382 }, 383 /*>>teststyles*/ 384 385 /*>>mq*/ 386 // adapted from matchMedia polyfill 387 // by Scott Jehl and Paul Irish 388 // gist.github.com/786768 389 testMediaQuery = function( mq ) { 390 391 var matchMedia = window.matchMedia || window.msMatchMedia; 392 if ( matchMedia ) { 393 return matchMedia(mq).matches
vendor: 14,824 bytes, lines 393-842
393; 394 } 395 396 var bool; 397 398 injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) { 399 bool = (window.getComputedStyle ? 400 getComputedStyle(node, null) : 401 node.currentStyle)['position'] == 'absolute'; 402 }); 403 404 return bool; 405 406 }, 407 /*>>mq*/ 408 409 410 /*>>hasevent*/ 411 // 412 // isEventSupported determines if a given element supports the given event 413 // kangax.github.com/iseventsupported/ 414 // 415 // The following results are known incorrects: 416 // Modernizr.hasEvent("webkitTransitionEnd", elem) // false negative 417 // Modernizr.hasEvent("textInput") // in Webkit. github.com/Modernizr/Modernizr/issues/333 418 // ... 419 isEventSupported = (function() { 420 421 var TAGNAMES = { 422 'select': 'input', 'change': 'input', 423 'submit': 'form', 'reset': 'form', 424 'error': 'img', 'load': 'img', 'abort': 'img' 425 }; 426 427 function isEventSupported( eventName, element ) { 428 429 element = element || document.createElement(TAGNAMES[eventName] || 'div'); 430 eventName = 'on' + eventName; 431 432 // When using `setAttribute`, IE skips "unload", WebKit skips "unload" and "resize", whereas `in` "catches" those 433 var isSupported = eventName in element; 434 435 if ( !isSupported ) { 436 // If it has no `setAttribute` (i.e. doesn't implement Node interface), try generic element 437 if ( !element.setAttribute ) { 438 element = document.createElement('div'); 439 } 440 if ( element.setAttribute && element.removeAttribute ) { 441 element.setAttribute(eventName, ''); 442 isSupported = is(element[eventName], 'function'); 443 444 // If property was created, "remove it" (by setting value to `undefined`) 445 if ( !is(element[eventName], 'undefined') ) { 446 element[eventName] = undefined; 447 } 448 element.removeAttribute(eventName); 449 } 450 } 451 452 element = null; 453 return isSupported; 454 } 455 return isEventSupported; 456 })(), 457 /*>>hasevent*/ 458 459 // TODO :: Add flag for hasownprop ? didn't last time 460 461 // hasOwnProperty shim by kangax needed for Safari 2.0 support 462 _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp; 463 464 if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) { 465 hasOwnProp = function (object, property) { 466 return _hasOwnProperty.call(object, property); 467 }; 468 } 469 else { 470 hasOwnProp = function (object, property) { /* yes, this can give false positives/negatives, but most of the time we don't care about those */ 471 return ((property in object) && is(object.constructor.prototype[property], 'undefined')); 472 }; 473 } 474 475 // Adapted from ES5-shim https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js 476 // es5.github.com/#x15.3.4.5 477 478 if (!Function.prototype.bind) { 479 Function.prototype.bind = function bind(that) { 480 481 var target = this; 482 483 if (typeof target != "function") { 484 throw new TypeError(); 485 } 486 487 var args = slice.call(arguments, 1), 488 bound = function () { 489 490 if (this instanceof bound) { 491 492 var F = function(){}; 493 F.prototype = target.prototype; 494 var self = new F(); 495 496 var result = target.apply( 497 self, 498 args.concat(slice.call(arguments)) 499 ); 500 if (Object(result) === result) { 501 return result; 502 } 503 return self; 504 505 } else { 506 507 return target.apply( 508 that, 509 args.concat(slice.call(arguments)) 510 ); 511 512 } 513 514 }; 515 516 return bound; 517 }; 518 } 519 520 /** 521 * setCss applies given styles to the Modernizr DOM node. 522 */ 523 function setCss( str ) { 524 mStyle.cssText = str; 525 } 526 527 /** 528 * setCssAll extrapolates all vendor-specific css strings. 529 */ 530 function setCssAll( str1, str2 ) { 531 return setCss(prefixes.join(str1 + ';') + ( str2 || '' )); 532 } 533 534 /** 535 * is returns a boolean for if typeof obj is exactly type. 536 */ 537 function is( obj, type ) { 538 return typeof obj === type; 539 } 540 541 /** 542 * contains returns a boolean for if substr is found within str. 543 */ 544 function contains( str, substr ) { 545 return !!~('' + str).indexOf(substr); 546 } 547 548 /*>>testprop*/ 549 550 // testProps is a generic CSS / DOM property test. 551 552 // In testing support for a given CSS property, it's legit to test: 553 // `elem.style[styleName] !== undefined` 554 // If the property is supported it will return an empty string, 555 // if unsupported it will return undefined. 556 557 // We'll take advantage of this quick test and skip setting a style 558 // on our modernizr element, but instead just testing undefined vs 559 // empty string. 560 561 // Because the testing of the CSS property names (with "-", as 562 // opposed to the camelCase DOM properties) is non-portable and 563 // non-standard but works in WebKit and IE (but not Gecko or Opera), 564 // we explicitly reject properties with dashes so that authors 565 // developing in WebKit or IE first don't end up with 566 // browser-specific content by accident. 567 568 function testProps( props, prefixed ) { 569 for ( var i in props ) { 570 var prop = props[i]; 571 if ( !contains(prop, "-") && mStyle[prop] !== undefined ) { 572 return prefixed == 'pfx' ? prop : true; 573 } 574 } 575 return false; 576 } 577 /*>>testprop*/ 578 579 // TODO :: add testDOMProps 580 /** 581 * testDOMProps is a generic DOM property test; if a browser supports 582 * a certain property, it won't return undefined for it. 583 */ 584 function testDOMProps( props, obj, elem ) { 585 for ( var i in props ) { 586 var item = obj[props[i]]; 587 if ( item !== undefined) { 588 589 // return the property name as a string 590 if (elem === false) return props[i]; 591 592 // let's bind a function 593 if (is(item, 'function')){ 594 // default to autobind unless override 595 return item.bind(elem || obj); 596 } 597 598 // return the unbound function or obj or value 599 return item; 600 } 601 } 602 return false; 603 } 604 605 /*>>testallprops*/ 606 /** 607 * testPropsAll tests a list of DOM properties we want to check against. 608 * We specify literally ALL possible (known and/or likely) properties on 609 * the element including the non-vendor prefixed one, for forward- 610 * compatibility. 611 */ 612 function testPropsAll( prop, prefixed, elem ) { 613 614 var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), 615 props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' '); 616 617 // did they call .prefixed('boxSizing') or are we just testing a prop? 618 if(is(prefixed, "string") || is(prefixed, "undefined")) { 619 return testProps(props, prefixed); 620 621 // otherwise, they called .prefixed('requestAnimationFrame', window[, elem]) 622 } else { 623 props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' '); 624 return testDOMProps(props, prefixed, elem); 625 } 626 } 627 /*>>testallprops*/ 628 629 630 /** 631 * Tests 632 * ----- 633 */ 634 635 // The *new* flexbox 636 // dev.w3.org/csswg/css3-flexbox 637 638 tests['flexbox'] = function() { 639 return testPropsAll('flexWrap'); 640 }; 641 642 // The *old* flexbox 643 // www.w3.org/TR/2009/WD-css3-flexbox-20090723/ 644 645 tests['flexboxlegacy'] = function() { 646 return testPropsAll('boxDirection'); 647 }; 648 649 // On the S60 and BB Storm, getContext exists, but always returns undefined 650 // so we actually have to call getContext() to verify 651 // github.com/Modernizr/Modernizr/issues/issue/97/ 652 653 tests['canvas'] = function() { 654 var elem = document.createElement('canvas'); 655 return !!(elem.getContext && elem.getContext('2d')); 656 }; 657 658 tests['canvastext'] = function() { 659 return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function')); 660 }; 661 662 // webk.it/70117 is tracking a legit WebGL feature detect proposal 663 664 // We do a soft detect which may false positive in order to avoid 665 // an expensive context creation: bugzil.la/732441 666 667 tests['webgl'] = function() { 668 return !!window.WebGLRenderingContext; 669 }; 670 671 /* 672 * The Modernizr.touch test only indicates if the browser supports 673 * touch events, which does not necessarily reflect a touchscreen 674 * device, as evidenced by tablets running Windows 7 or, alas, 675 * the Palm Pre / WebOS (touch) phones. 676 * 677 * Additionally, Chrome (desktop) used to lie about its support on this, 678 * but that has since been rectified: crbug.com/36415 679 * 680 * We also test for Firefox 4 Multitouch Support. 681 * 682 * For more info, see: modernizr.github.com/Modernizr/touch.html 683 */ 684 685 tests['touch'] = function() { 686 var bool; 687 688 if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) { 689 bool = true; 690 } else { 691 injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) { 692 bool = node.offsetTop === 9; 693 }); 694 } 695 696 return bool; 697 }; 698 699 700 // geolocation is often considered a trivial feature detect... 701 // Turns out, it's quite tricky to get right: 702 // 703 // Using !!navigator.geolocation does two things we don't want. It: 704 // 1. Leaks memory in IE9: github.com/Modernizr/Modernizr/issues/513 705 // 2. Disables page caching in WebKit: webk.it/43956 706 // 707 // Meanwhile, in Firefox < 8, an about:config setting could expose 708 // a false positive that would throw an exception: bugzil.la/688158 709 710 tests['geolocation'] = function() { 711 return 'geolocation' in navigator; 712 }; 713 714 715 tests['postmessage'] = function() { 716 return !!window.postMessage; 717 }; 718 719 720 // Chrome incognito mode used to throw an exception when using openDatabase 721 // It doesn't anymore. 722 tests['websqldatabase'] = function() { 723 return !!window.openDatabase; 724 }; 725 726 // Vendors had inconsistent prefixing with the experimental Indexed DB: 727 // - Webkit's implementation is accessible through webkitIndexedDB 728 // - Firefox shipped moz_indexedDB before FF4b9, but since then has been mozIndexedDB 729 // For speed, we don't test the legacy (and beta-only) indexedDB 730 tests['indexedDB'] = function() { 731 return !!testPropsAll("indexedDB", window); 732 }; 733 734 // documentMode logic from YUI to filter out IE8 Compat Mode 735 // which false positives. 736 tests['hashchange'] = function() { 737 return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7); 738 }; 739 740 // Per 1.6: 741 // This used to be Modernizr.historymanagement but the longer 742 // name has been deprecated in favor of a shorter and property-matching one. 743 // The old API is still available in 1.6, but as of 2.0 will throw a warning, 744 // and in the first release thereafter disappear entirely. 745 tests['history'] = function() { 746 return !!(window.history && history.pushState); 747 }; 748 749 tests['draganddrop'] = function() { 750 var div = document.createElement('div'); 751 return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div); 752 }; 753 754 // FF3.6 was EOL'ed on 4/24/12, but the ESR version of FF10 755 // will be supported until FF19 (2/12/13), at which time, ESR becomes FF17. 756 // FF10 still uses prefixes, so check for it until then. 757 // for more ESR info, see: mozilla.org/en-US/firefox/organizations/faq/ 758 tests['websockets'] = function() { 759 return 'WebSocket' in window || 'MozWebSocket' in window; 760 }; 761 762 763 // css-tricks.com/rgba-browser-support/ 764 tests['rgba'] = function() { 765 // Set an rgba() color and check the returned value 766 767 setCss('background-color:rgba(150,255,150,.5)'); 768 769 return contains(mStyle.backgroundColor, 'rgba'); 770 }; 771 772 tests['hsla'] = function() { 773 // Same as rgba(), in fact, browsers re-map hsla() to rgba() internally, 774 // except IE9 who retains it as hsla 775 776 setCss('background-color:hsla(120,40%,100%,.5)'); 777 778 return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla'); 779 }; 780 781 tests['multiplebgs'] = function() { 782 // Setting multiple images AND a color on the background shorthand property 783 // and then querying the style.background property value for the number of 784 // occurrences of "url(" is a reliable method for detecting ACTUAL support for this! 785 786 setCss('background:url(https://),url(https://),red url(https://)'); 787 788 // If the UA supports multiple backgrounds, there should be three occurrences 789 // of the string "url(" in the return value for elemStyle.background 790 791 return (/(url\s*\(.*?){3}/).test(mStyle.background); 792 }; 793 794 795 796 // this will false positive in Opera Mini 797 // github.com/Modernizr/Modernizr/issues/396 798 799 tests['backgroundsize'] = function() { 800 return testPropsAll('backgroundSize'); 801 }; 802 803 tests['borderimage'] = function() { 804 return testPropsAll('borderImage'); 805 }; 806 807 808 // Super comprehensive table about all the unique implementations of 809 // border-radius: muddledramblings.com/table-of-css3-border-radius-compliance 810 811 tests['borderradius'] = function() { 812 return testPropsAll('borderRadius'); 813 }; 814 815 // WebOS unfortunately false positives on this test. 816 tests['boxshadow'] = function() { 817 return testPropsAll('boxShadow'); 818 }; 819 820 // FF3.0 will false positive on this test 821 tests['textshadow'] = function() { 822 return document.createElement('div').style.textShadow === ''; 823 }; 824 825 826 tests['opacity'] = function() { 827 // Browsers that actually have CSS Opacity implemented have done so 828 // according to spec, which means their return values are within the 829 // range of [0.0,1.0] - including the leading zero. 830 831 setCssAll('opacity:.55'); 832 833 // The non-literal . in this regex is intentional: 834 // German Chrome returns this value as 0,55 835 // github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632 836 return (/^0.55$/).test(mStyle.opacity); 837 }; 838 839 840 // Note, Android < 4 will pass this test, but can only animate 841 // a single property at a time 842 //
vendor: 23,138 bytes, lines 842-1450
842daneden.me/2011/12/putting-up-with-androids-bullshit/ 843 tests['cssanimations'] = function() { 844 return testPropsAll('animationName'); 845 }; 846 847 848 tests['csscolumns'] = function() { 849 return testPropsAll('columnCount'); 850 }; 851 852 853 tests['cssgradients'] = function() { 854 /** 855 * For CSS Gradients syntax, please see: 856 * webkit.org/blog/175/introducing-css-gradients/ 857 * developer.mozilla.org/en/CSS/-moz-linear-gradient 858 * developer.mozilla.org/en/CSS/-moz-radial-gradient 859 * dev.w3.org/csswg/css3-images/#gradients- 860 */ 861 862 var str1 = 'background-image:', 863 str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));', 864 str3 = 'linear-gradient(left top,#9f9, white);'; 865 866 setCss( 867 // legacy webkit syntax (FIXME: remove when syntax not in use anymore) 868 (str1 + '-webkit- '.split(' ').join(str2 + str1) + 869 // standard syntax // trailing 'background-image:' 870 prefixes.join(str3 + str1)).slice(0, -str1.length) 871 ); 872 873 return contains(mStyle.backgroundImage, 'gradient'); 874 }; 875 876 877 tests['cssreflections'] = function() { 878 return testPropsAll('boxReflect'); 879 }; 880 881 882 tests['csstransforms'] = function() { 883 return !!testPropsAll('transform'); 884 }; 885 886 887 tests['csstransforms3d'] = function() { 888 889 var ret = !!testPropsAll('perspective'); 890 891 // Webkit's 3D transforms are passed off to the browser's own graphics renderer. 892 // It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in 893 // some conditions. As a result, Webkit typically recognizes the syntax but 894 // will sometimes throw a false positive, thus we must do a more thorough check: 895 if ( ret && 'webkitPerspective' in docElement.style ) { 896 897 // Webkit allows this media query to succeed only if the feature is enabled. 898 // `@media (transform-3d),(-webkit-transform-3d){ ... }` 899 injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) { 900 ret = node.offsetLeft === 9 && node.offsetHeight === 3; 901 }); 902 } 903 return ret; 904 }; 905 906 907 tests['csstransitions'] = function() { 908 return testPropsAll('transition'); 909 }; 910 911 912 /*>>fontface*/ 913 // @font-face detection routine by Diego Perini 914 // javascript.nwbox.com/CSSSupport/ 915 916 // false positives: 917 // WebOS github.com/Modernizr/Modernizr/issues/342 918 // WP7 github.com/Modernizr/Modernizr/issues/538 919 tests['fontface'] = function() { 920 var bool; 921 922 injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) { 923 var style = document.getElementById('smodernizr'), 924 sheet = style.sheet || style.styleSheet, 925 cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : ''; 926 927 bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0; 928 }); 929 930 return bool; 931 }; 932 /*>>fontface*/ 933 934 // CSS generated content detection 935 tests['generatedcontent'] = function() { 936 var bool; 937 938 injectElementWithStyles(['#modernizr:after{content:"',smile,'";visibility:hidden}'].join(''), function( node ) { 939 bool = node.offsetHeight >= 1; 940 }); 941 942 return bool; 943 }; 944 945 946 947 // These tests evaluate support of the video/audio elements, as well as 948 // testing what types of content they support. 949 // 950 // We're using the Boolean constructor here, so that we can extend the value 951 // e.g. Modernizr.video // true 952 // Modernizr.video.ogg // 'probably' 953 // 954 // Codec values from : github.com/NielsLeenheer/html5test/blob/9106a8/index.html#L845 955 // thx to NielsLeenheer and zcorpan 956 957 // Note: in some older browsers, "no" was a return value instead of empty string. 958 // It was live in FF3.5.0 and 3.5.1, but fixed in 3.5.2 959 // It was also live in Safari 4.0.0 - 4.0.4, but fixed in 4.0.5 960 961 tests['video'] = function() { 962 var elem = document.createElement('video'), 963 bool = false; 964 965 // IE9 Running on Windows Server SKU can cause an exception to be thrown, bug #224 966 try { 967 if ( bool = !!elem.canPlayType ) { 968 bool = new Boolean(bool); 969 bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,''); 970 971 // Without QuickTime, this value will be `undefined`. github.com/Modernizr/Modernizr/issues/546 972 bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,''); 973 974 bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,''); 975 } 976 977 } catch(e) { } 978 979 return bool; 980 }; 981 982 tests['audio'] = function() { 983 var elem = document.createElement('audio'), 984 bool = false; 985 986 try { 987 if ( bool = !!elem.canPlayType ) { 988 bool = new Boolean(bool); 989 bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,''); 990 bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,''); 991 992 // Mimetypes accepted: 993 // developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements 994 // bit.ly/iphoneoscodecs 995 bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,''); 996 bool.m4a = ( elem.canPlayType('audio/x-m4a;') || 997 elem.canPlayType('audio/aac;')) .replace(/^no$/,''); 998 } 999 } catch(e) { } 1000 1001 return bool; 1002 }; 1003 1004 1005 // In FF4, if disabled, window.localStorage should === null. 1006 1007 // Normally, we could not test that directly and need to do a 1008 // `('localStorage' in window) && ` test first because otherwise Firefox will 1009 // throw bugzil.la/365772 if cookies are disabled 1010 1011 // Also in iOS5 Private Browsing mode, attempting to use localStorage.setItem 1012 // will throw the exception: 1013 // QUOTA_EXCEEDED_ERRROR DOM Exception 22. 1014 // Peculiarly, getItem and removeItem calls do not throw. 1015 1016 // Because we are forced to try/catch this, we'll go aggressive. 1017 1018 // Just FWIW: IE8 Compat mode supports these features completely: 1019 // www.quirksmode.org/dom/html5.html 1020 // But IE8 doesn't support either with local files 1021 1022 tests['localstorage'] = function() { 1023 try { 1024 localStorage.setItem(mod, mod); 1025 localStorage.removeItem(mod); 1026 return true; 1027 } catch(e) { 1028 return false; 1029 } 1030 }; 1031 1032 tests['sessionstorage'] = function() { 1033 try { 1034 sessionStorage.setItem(mod, mod); 1035 sessionStorage.removeItem(mod); 1036 return true; 1037 } catch(e) { 1038 return false; 1039 } 1040 }; 1041 1042 1043 tests['webworkers'] = function() { 1044 return !!window.Worker; 1045 }; 1046 1047 1048 tests['applicationcache'] = function() { 1049 return !!window.applicationCache; 1050 }; 1051 1052 1053 // Thanks to Erik Dahlstrom 1054 tests['svg'] = function() { 1055 return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect; 1056 }; 1057 1058 // specifically for SVG inline in HTML, not within XHTML 1059 // test page: paulirish.com/demo/inline-svg 1060 tests['inlinesvg'] = function() { 1061 var div = document.createElement('div'); 1062 div.innerHTML = '<svg/>'; 1063 return (div.firstChild && div.firstChild.namespaceURI) == ns.svg; 1064 }; 1065 1066 // SVG SMIL animation 1067 tests['smil'] = function() { 1068 return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate'))); 1069 }; 1070 1071 // This test is only for clip paths in SVG proper, not clip paths on HTML content 1072 // demo: srufaculty.sru.edu/david.dailey/svg/newstuff/clipPath4.svg 1073 1074 // However read the comments to dig into applying SVG clippaths to HTML content here: 1075 // github.com/Modernizr/Modernizr/issues/213#issuecomment-1149491 1076 tests['svgclippaths'] = function() { 1077 return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath'))); 1078 }; 1079 1080 /*>>webforms*/ 1081 // input features and input types go directly onto the ret object, bypassing the tests loop. 1082 // Hold this guy to execute in a moment. 1083 function webforms() { 1084 /*>>input*/ 1085 // Run through HTML5's new input attributes to see if the UA understands any. 1086 // We're using f which is the <input> element created early on 1087 // Mike Taylr has created a comprehensive resource for testing these attributes 1088 // when applied to all input types: 1089 // miketaylr.com/code/input-type-attr.html 1090 // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary 1091 1092 // Only input placeholder is tested while textarea's placeholder is not. 1093 // Currently Safari 4 and Opera 11 have support only for the input placeholder 1094 // Both tests are available in feature-detects/forms-placeholder.js 1095 Modernizr['input'] = (function( props ) { 1096 for ( var i = 0, len = props.length; i < len; i++ ) { 1097 attrs[ props[i] ] = !!(props[i] in inputElem); 1098 } 1099 if (attrs.list){ 1100 // safari false positive's on datalist: webk.it/74252 1101 // see also github.com/Modernizr/Modernizr/issues/146 1102 attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement); 1103 } 1104 return attrs; 1105 })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' ')); 1106 /*>>input*/ 1107 1108 /*>>inputtypes*/ 1109 // Run through HTML5's new input types to see if the UA understands any. 1110 // This is put behind the tests runloop because it doesn't return a 1111 // true/false like all the other tests; instead, it returns an object 1112 // containing each input type with its corresponding true/false value 1113 1114 // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/ 1115 Modernizr['inputtypes'] = (function(props) { 1116 1117 for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) { 1118 1119 inputElem.setAttribute('type', inputElemType = props[i]); 1120 bool = inputElem.type !== 'text'; 1121 1122 // We first check to see if the type we give it sticks.. 1123 // If the type does, we feed it a textual value, which shouldn't be valid. 1124 // If the value doesn't stick, we know there's input sanitization which infers a custom UI 1125 if ( bool ) { 1126 1127 inputElem.value = smile; 1128 inputElem.style.cssText = 'position:absolute;visibility:hidden;'; 1129 1130 if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) { 1131 1132 docElement.appendChild(inputElem); 1133 defaultView = document.defaultView; 1134 1135 // Safari 2-4 allows the smiley as a value, despite making a slider 1136 bool = defaultView.getComputedStyle && 1137 defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' && 1138 // Mobile android web browser has false positive, so must 1139 // check the height to see if the widget is actually there. 1140 (inputElem.offsetHeight !== 0); 1141 1142 docElement.removeChild(inputElem); 1143 1144 } else if ( /^(search|tel)$/.test(inputElemType) ){ 1145 // Spec doesn't define any special parsing or detectable UI 1146 // behaviors so we pass these through as true 1147 1148 // Interestingly, opera fails the earlier test, so it doesn't 1149 // even make it here. 1150 1151 } else if ( /^(url|email)$/.test(inputElemType) ) { 1152 // Real url and email support comes with prebaked validation. 1153 bool = inputElem.checkValidity && inputElem.checkValidity() === false; 1154 1155 } else { 1156 // If the upgraded input compontent rejects the :) text, we got a winner 1157 bool = inputElem.value != smile; 1158 } 1159 } 1160 1161 inputs[ props[i] ] = !!bool; 1162 } 1163 return inputs; 1164 })('search tel url email datetime date month week time datetime-local number range color'.split(' ')); 1165 /*>>inputtypes*/ 1166 } 1167 /*>>webforms*/ 1168 1169 1170 // End of test definitions 1171 // ----------------------- 1172 1173 1174 1175 // Run through all tests and detect their support in the current UA. 1176 // todo: hypothetically we could be doing an array of tests and use a basic loop here. 1177 for ( var feature in tests ) { 1178 if ( hasOwnProp(tests, feature) ) { 1179 // run the test, throw the return value into the Modernizr, 1180 // then based on that boolean, define an appropriate className 1181 // and push it into an array of classes we'll join later. 1182 featureName = feature.toLowerCase(); 1183 Modernizr[featureName] = tests[feature](); 1184 1185 classes.push((Modernizr[featureName] ? '' : 'no-') + featureName); 1186 } 1187 } 1188 1189 /*>>webforms*/ 1190 // input tests need to run. 1191 Modernizr.input || webforms(); 1192 /*>>webforms*/ 1193 1194 1195 /** 1196 * addTest allows the user to define their own feature tests 1197 * the result will be added onto the Modernizr object, 1198 * as well as an appropriate className set on the html element 1199 * 1200 * @param feature - String naming the feature 1201 * @param test - Function returning true if feature is supported, false if not 1202 */ 1203 Modernizr.addTest = function ( feature, test ) { 1204 if ( typeof feature == 'object' ) { 1205 for ( var key in feature ) { 1206 if ( hasOwnProp( feature, key ) ) { 1207 Modernizr.addTest( key, feature[ key ] ); 1208 } 1209 } 1210 } else { 1211 1212 feature = feature.toLowerCase(); 1213 1214 if ( Modernizr[feature] !== undefined ) { 1215 // we're going to quit if you're trying to overwrite an existing test 1216 // if we were to allow it, we'd do this: 1217 // var re = new RegExp("\\b(no-)?" + feature + "\\b"); 1218 // docElement.className = docElement.className.replace( re, '' ); 1219 // but, no rly, stuff 'em. 1220 return Modernizr; 1221 } 1222 1223 test = typeof test == 'function' ? test() : test; 1224 1225 if (enableClasses) { 1226 docElement.className += ' ' + (test ? '' : 'no-') + feature; 1227 } 1228 Modernizr[feature] = test; 1229 1230 } 1231 1232 return Modernizr; // allow chaining. 1233 }; 1234 1235 1236 // Reset modElem.cssText to nothing to reduce memory footprint. 1237 setCss(''); 1238 modElem = inputElem = null; 1239 1240 /*>>shiv*/ 1241 /*! HTML5 Shiv v3.6 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed */ 1242 ;(function(window, document) { 1243 /*jshint evil:true */ 1244 /** Preset options */ 1245 var options = window.html5 || {}; 1246 1247 /** Used to skip problem elements */ 1248 var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; 1249 1250 /** Not all elements can be cloned in IE (this list can be shortend) **/ 1251 var saveClones = /^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i; 1252 1253 /** Detect whether the browser supports default html5 styles */ 1254 var supportsHtml5Styles; 1255 1256 /** Name of the expando, to work with multiple documents or to re-shiv one document */ 1257 var expando = '_html5shiv'; 1258 1259 /** The id for the the documents expando */ 1260 var expanID = 0; 1261 1262 /** Cached data for each document */ 1263 var expandoData = {}; 1264 1265 /** Detect whether the browser supports unknown elements */ 1266 var supportsUnknownElements; 1267 1268 (function() { 1269 try { 1270 var a = document.createElement('a'); 1271 a.innerHTML = '<xyz></xyz>'; 1272 //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles 1273 supportsHtml5Styles = ('hidden' in a); 1274 1275 supportsUnknownElements = a.childNodes.length == 1 || (function() { 1276 // assign a false positive if unable to shiv 1277 (document.createElement)('a'); 1278 var frag = document.createDocumentFragment(); 1279 return ( 1280 typeof frag.cloneNode == 'undefined' || 1281 typeof frag.createDocumentFragment == 'undefined' || 1282 typeof frag.createElement == 'undefined' 1283 ); 1284 }()); 1285 } catch(e) { 1286 supportsHtml5Styles = true; 1287 supportsUnknownElements = true; 1288 } 1289 1290 }()); 1291 1292 /*--------------------------------------------------------------------------*/ 1293 1294 /** 1295 * Creates a style sheet with the given CSS text and adds it to the document. 1296 * @private 1297 * @param {Document} ownerDocument The document. 1298 * @param {String} cssText The CSS text. 1299 * @returns {StyleSheet} The style element. 1300 */ 1301 function addStyleSheet(ownerDocument, cssText) { 1302 var p = ownerDocument.createElement('p'), 1303 parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; 1304 1305 p.innerHTML = 'x<style>' + cssText + '</style>'; 1306 return parent.insertBefore(p.lastChild, parent.firstChild); 1307 } 1308 1309 /** 1310 * Returns the value of `html5.elements` as an array. 1311 * @private 1312 * @returns {Array} An array of shived element node names. 1313 */ 1314 function getElements() { 1315 var elements = html5.elements; 1316 return typeof elements == 'string' ? elements.split(' ') : elements; 1317 } 1318 1319 /** 1320 * Returns the data associated to the given document 1321 * @private 1322 * @param {Document} ownerDocument The document. 1323 * @returns {Object} An object of data. 1324 */ 1325 function getExpandoData(ownerDocument) { 1326 var data = expandoData[ownerDocument[expando]]; 1327 if (!data) { 1328 data = {}; 1329 expanID++; 1330 ownerDocument[expando] = expanID; 1331 expandoData[expanID] = data; 1332 } 1333 return data; 1334 } 1335 1336 /** 1337 * returns a shived element for the given nodeName and document 1338 * @memberOf html5 1339 * @param {String} nodeName name of the element 1340 * @param {Document} ownerDocument The context document. 1341 * @returns {Object} The shived element. 1342 */ 1343 function createElement(nodeName, ownerDocument, data){ 1344 if (!ownerDocument) { 1345 ownerDocument = document; 1346 } 1347 if(supportsUnknownElements){ 1348 return ownerDocument.createElement(nodeName); 1349 } 1350 if (!data) { 1351 data = getExpandoData(ownerDocument); 1352 } 1353 var node; 1354 1355 if (data.cache[nodeName]) { 1356 node = data.cache[nodeName].cloneNode(); 1357 } else if (saveClones.test(nodeName)) { 1358 node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); 1359 } else { 1360 node = data.createElem(nodeName); 1361 } 1362 1363 // Avoid adding some elements to fragments in IE < 9 because 1364 // * Attributes like `name` or `type` cannot be set/changed once an element 1365 // is inserted into a document/fragment 1366 // * Link elements with `src` attributes that are inaccessible, as with 1367 // a 403 response, will cause the tab/window to crash 1368 // * Script elements appended to fragments will execute when their `src` 1369 // or `text` property is set 1370 return node.canHaveChildren && !reSkip.test(nodeName) ? data.frag.appendChild(node) : node; 1371 } 1372 1373 /** 1374 * returns a shived DocumentFragment for the given document 1375 * @memberOf html5 1376 * @param {Document} ownerDocument The context document. 1377 * @returns {Object} The shived DocumentFragment. 1378 */ 1379 function createDocumentFragment(ownerDocument, data){ 1380 if (!ownerDocument) { 1381 ownerDocument = document; 1382 } 1383 if(supportsUnknownElements){ 1384 return ownerDocument.createDocumentFragment(); 1385 } 1386 data = data || getExpandoData(ownerDocument); 1387 var clone = data.frag.cloneNode(), 1388 i = 0, 1389 elems = getElements(), 1390 l = elems.length; 1391 for(;i<l;i++){ 1392 clone.createElement(elems[i]); 1393 } 1394 return clone; 1395 } 1396 1397 /** 1398 * Shivs the `createElement` and `createDocumentFragment` methods of the document. 1399 * @private 1400 * @param {Document|DocumentFragment} ownerDocument The document. 1401 * @param {Object} data of the document. 1402 */ 1403 function shivMethods(ownerDocument, data) { 1404 if (!data.cache) { 1405 data.cache = {}; 1406 data.createElem = ownerDocument.createElement; 1407 data.createFrag = ownerDocument.createDocumentFragment; 1408 data.frag = data.createFrag(); 1409 } 1410 1411 1412 ownerDocument.createElement = function(nodeName) { 1413 //abort shiv 1414 if (!html5.shivMethods) { 1415 return data.createElem(nodeName); 1416 } 1417 return createElement(nodeName, ownerDocument, data); 1418 }; 1419 1420 ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' + 1421 'var n=f.cloneNode(),c=n.createElement;' + 1422 'h.shivMethods&&(' + 1423 // unroll the `createElement` calls 1424 getElements().join().replace(/\w+/g, function(nodeName) { 1425 data.createElem(nodeName); 1426 data.frag.createElement(nodeName); 1427 return 'c("' + nodeName + '")'; 1428 }) + 1429 ');return n}' 1430 )(html5, data.frag); 1431 } 1432 1433 /*--------------------------------------------------------------------------*/ 1434 1435 /** 1436 * Shivs the given document. 1437 * @memberOf html5 1438 * @param {Document} ownerDocument The document to shiv. 1439 * @returns {Document} The shived document. 1440 */ 1441 function shivDocument(ownerDocument) { 1442 if (!ownerDocument) { 1443 ownerDocument = document; 1444 } 1445 var data = getExpandoData(ownerDocument); 1446 1447 if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) { 1448 data.hasCSS = !!addStyleSheet(ownerDocument, 1449 // corrects block display not defined in IE6/7/8/9 1450 'article,aside,figcaption,figure,footer,header,hgroup,nav,section{dis
1450play:block}' + 1451 // adds styling not present in IE6/7/8/9 1452 'mark{background:#FF0;color:#000}' 1453 ); 1454 } 1455 if (!supportsUnknownElements) { 1456 shivMethods(ownerDocument, data); 1457 } 1458 return ownerDocument; 1459 } 1460 1461 /*--------------------------------------------------------------------------*/ 1462 1463 /** 1464 * The `html5` object is exposed so that more elements can be shived and 1465 * existing shiving can be detected on iframes. 1466 * @type Object 1467 * @example 1468 * 1469 * // options can be changed before the script is included 1470 * html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false }; 1471 */ 1472 var html5 = { 1473 1474 /** 1475 * An array or space separated string of node names of the elements to shiv. 1476 * @memberOf html5 1477 * @type Array|String 1478 */ 1479 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video', 1480 1481 /** 1482 * A flag to indicate that the HTML5 style sheet should be inserted. 1483 * @memberOf html5 1484 * @type Boolean 1485 */ 1486 'shivCSS': (options.shivCSS !== false), 1487 1488 /** 1489 * Is equal to true if a browser supports creating unknown/HTML5 elements 1490 * @memberOf html5 1491 * @type boolean 1492 */ 1493 'supportsUnknownElements': supportsUnknownElements, 1494 1495 /** 1496 * A flag to indicate that the document's `createElement` and `createDocumentFragment` 1497 * methods should be overwritten. 1498 * @memberOf html5 1499 * @type Boolean 1500 */ 1501 'shivMethods': (options.shivMethods !== false), 1502 1503 /** 1504 * A string to describe the type of `html5` object ("default" or "default print"). 1505 * @memberOf html5
1506 * @type String 1507 */ 1508 'type': 'default', 1509 1510 // shivs the document according to the specified `html5` object options 1511 'shivDocument': shivDocument, 1512 1513 //creates a shived element 1514 createElement: createElement, 1515 1516 //creates a shived documentFragment 1517 createDocumentFragment: createDocumentFragment 1518 }; 1519 1520 /*--------------------------------------------------------------------------*/ 1521 1522 // expose html5 1523 window.html5 = html5; 1524 1525 // shiv the document 1526 shivDocument(document); 1527 1528 }(this, document)); 1529 /*>>shiv*/ 1530 1531 // Assign private properties to the return object with prefix 1532 Modernizr._version = version; 1533 1534 // expose these for the plugin API. Look in the source for how to join() them against your input 1535 /*>>prefixes*/ 1536 Modernizr._prefixes = prefixes; 1537 /*>>prefixes*/ 1538 /*>>domprefixes*/ 1539 Modernizr._domPrefixes = domPrefixes; 1540 Modernizr._cssomPrefixes = cssomPrefixes; 1541 /*>>domprefixes*/ 1542 1543 /*>>mq*/ 1544 // Modernizr.mq tests a given media query, live against the current state of the window 1545 // A few important notes: 1546 // * If a browser does not support media queries at all (eg. oldIE) the mq() will always return false 1547 // * A max-width or orientation query will be evaluated against the current state, which may change later. 1548 // * You must specify values. Eg. If you are testing support for the min-width media query use: 1549 // Modernizr.mq('(min-width:0)') 1550 // usage: 1551 // Modernizr.mq('only screen and (max-width:768)') 1552 Modernizr.mq = testMediaQuery; 1553 /*>>mq*/ 1554 1555 /*>>hasevent*/ 1556 // Modernizr.hasEvent() detects support for a given event, with an optional element to test on 1557 // Modernizr.hasEvent('gesturestart', elem) 1558 Modernizr.hasEvent = isEventSupported; 1559 /*>>hasevent*/ 1560 1561 /*>>testprop*/ 1562 // Modernizr.testProp() investigates whether a given style property is recognized 1563 // Note that the property names must be provided in the camelCase variant. 1564 // Modernizr.testProp('pointerEvents') 1565 Modernizr.testProp = function(prop){ 1566 return testProps([prop]); 1567 }; 1568 /*>>testprop*/ 1569 1570 /*>>testallprops*/ 1571 // Modernizr.testAllProps() investigates whether a given style property, 1572 // or any of its vendor-prefixed variants, is recognized 1573 // Note that the property names must be provided in the camelCase variant. 1574 // Modernizr.testAllProps('boxSizing') 1575 Modernizr.testAllProps = testPropsAll; 1576 /*>>testallprops*/ 1577 1578 1579 /*>>teststyles*/ 1580 // Modernizr.testStyles() allows you to add custom styles to the document and test an element afterwards 1581 // Modernizr.testStyles('#modernizr { position:absolute }', function(elem, rule){ ... }) 1582 Modernizr.testStyles = injectElementWithStyles; 1583 /*>>teststyles*/ 1584 1585 1586 /*>>prefixed*/ 1587 // Modernizr.prefixed() returns the prefixed or nonprefixed property name variant of your input 1588 // Modernizr.prefixed('boxSizing') // 'MozBoxSizing' 1589 1590 // Properties must be passed as dom-style camelcase, rather than `box-sizing` hypentated style. 1591 // Return values will also be the camelCase variant, if you need to translate that to hypenated style use: 1592 // 1593 // str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-'); 1594 1595 // If you're trying to ascertain which transition end event to bind to, you might do something like... 1596 // 1597 // var transEndEventNames = { 1598 // 'WebkitTransition' : 'webkitTransitionEnd', 1599 // 'MozTransition' : 'transitionend', 1600 // 'OTransition' : 'oTransitionEnd', 1601 // 'msTransition' : 'MSTransitionEnd', 1602 // 'transition' : 'transitionend' 1603 // }, 1604 // transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ]; 1605 1606 Modernizr.prefixed = function(prop, obj, elem){ 1607 if(!obj) { 1608 return testPropsAll(prop, 'pfx'); 1609 } else { 1610 // Testing DOM property e.g. Modernizr.prefixed('requestAnimationFrame', window) // 'mozRequestAnimationFrame' 1611 return testPropsAll(prop, obj, elem); 1612 } 1613 }; 1614 /*>>prefixed*/ 1615 1616 1617 /*>>cssclasses*/ 1618 // Remove "no-js" class from <html> element, if it exists: 1619 docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') + 1620 1621 // Add the new classes to the <html> element. 1622 (enableClasses ? ' js ' + classes.join(' ') : ''); 1623 /*>>cssclasses*/ 1624 1625 return Modernizr; 1626 1627})(this, this.document);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.