1// Add Page Visibility API support to old browsers by focus/blur hack. 2// 3// Include this script _before_ Visibility.js. 4// 5// Note, that this hack doesnât correctly emulate Page Visibility API: 6// when user change focus from browser to another window (browser and your 7// page may stay visible), this hack will decide, that you page is hidden. 8// 9// For Firefox 5â9 it will be better to use MozVisibility hack without 10// this issue. See <https://github.com/private-face/mozvisibility>. 11;(function (document) { 12 if (document.visibilityState || document.webkitVisibilityState) { 13 return; 14 } 15 16 document.hidden = false; 17 document.visibilityState = 'visible'; 18 19 var event = null 20 var i = 0 21 var fireEvent = function () { 22 if (document.createEvent) { 23 if (!event) { 24 event = document.createEvent('HTMLEvents'); 25 event.initEvent('visibilitychange', true, true); 26 } 27 document.dispatchEvent(event); 28 } else { 29 if (typeof (Visibility) == 'object') { 30 Visibility._change.call(Visibility, {}); 31 } 32 } 33 } 34 35 var onFocus = function () { 36 document.hidden = false; 37 document.visibilityState = 'visible'; 38 fireEvent(); 39 }; 40 var onBlur = function () { 41 document.hidden = true; 42 document.visibilityState = 'hidden'; 43 fireEvent(); 44 } 45 46 if (document.addEventListener) { 47 window.addEventListener('focus', onFocus, true); 48 window.addEventListener('blur', onBlur, true); 49 } else { 50 document.attachEvent('onfocusin', onFocus); 51 document.attachEvent('onfocusout', onBlur); 52 } 53})(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.