1/*! viewportSize | Author: Tyson Matanich, 2013 | License: MIT */ 2(function (window) { 3 4 window.viewportSize = {}; 5 6 window.viewportSize.getHeight = function () { 7 return getSize("Height"); 8 }; 9 10 window.viewportSize.getWidth = function () { 11 return getSize("Width"); 12 }; 13 14 var getSize = function (Name) { 15 var size; 16 var name = Name.toLowerCase(); 17 var document = window.document; 18 var documentElement = document.documentElement; 19 if (window["inner" + Name] === undefined) { 20 // IE6 & IE7 don't have window.innerWidth or innerHeight 21 size = documentElement["client" + Name]; 22 } 23 else if (window["inner" + Name] != documentElement["client" + Name]) { 24 // WebKit doesn't include scrollbars while calculating viewport size so we have to get fancy 25 26 // Insert markup to test if a media query will match document.doumentElement["client" + Name] 27 var bodyElement = document.createElement("body"); 28 bodyElement.id = "vpw-test-b"; 29 bodyElement.style.cssText = "overflow:scroll"; 30 var divElement = document.createElement("div"); 31 divElement.id = "vpw-test-d"; 32 divElement.style.cssText = "position:absolute;top:-1000px"; 33 // Getting specific on the CSS selector so it won't get overridden easily 34 divElement.innerHTML = "<style>@media(" + name + ":" + documentElement["client" + Name] + "px){body#vpw-test-b div#vpw-test-d{" + name + ":7px!important}}</style>"; 35 bodyElement.appendChild(divElement); 36 documentElement.insertBefore(bodyElement, document.head); 37 38 if (divElement["offset" + Name] == 7) { 39 // Media query matches document.documentElement["client" + Name] 40 size = documentElement["client" + Name]; 41 } 42 else { 43 // Media query didn't match, use window["inner" + Name] 44 size = window["inner" + Name]; 45 } 46 // Cleanup 47 documentElement.removeChild(bodyElement); 48 } 49 else { 50 // Default to use window["inner" + Name] 51 size = window["inner" + Name]; 52 } 53 return size; 54 }; 55 56})(this);
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.