PageSourceSearch

http://www.seewah.com/art-deco-london/bower_components/overthrow/src/overthrow-detect.js

js seewah.com collected 2026-10-02 11:24:31 UTC 4,211 bytes, 93 lines download raw bytes

1/*! Overthrow. An overflow:auto polyfill for responsive design. (c) 2012: Scott Jehl, Filament Group, Inc. http://filamentgroup.github.com/Overthrow/license.txt */
2(function( w, undefined ){
3	
4	var doc = w.document,
5		docElem = doc.documentElement,
6		enabledClassName = "overthrow-enabled",
7
8		// Touch events are used in the polyfill, and thus are a prerequisite
9		canBeFilledWithPoly = "ontouchmove" in doc,
10		
11		// The following attempts to determine whether the browser has native overflow support
12		// so we can enable it but not polyfill
13		nativeOverflow = 
14			// Features-first. iOS5 overflow scrolling property check - no UA needed here. thanks Apple :)
15			"WebkitOverflowScrolling" in docElem.style ||
16			// Test the windows scrolling property as well
17			"msOverflowStyle" in docElem.style ||
18			// Touch events aren't supported and screen width is greater than X
19			// ...basically, this is a loose "desktop browser" check. 
20			// It may wrongly opt-in very large tablets with no touch support.
21			( !canBeFilledWithPoly && w.screen.width > 800 ) ||
22			// Hang on to your hats.
23			// Whitelist some popular, overflow-supporting mobile browsers for now and the future
24			// These browsers are known to get overlow support right, but give us no way of detecting it.
25			(function(){
26				var ua = w.navigator.userAgent,
27					// Webkit crosses platforms, and the browsers on our list run at least version 534
28					webkit = ua.match( /AppleWebKit\/([0-9]+)/ ),
29					wkversion = webkit && webkit[1],
30					wkLte534 = webkit && wkversion >= 534;
31					
32				return (
33					/* Android 3+ with webkit gte 534
34					~: Mozilla/5.0 (Linux; U; Android 3.0; en-us; Xoom Build/HRI39) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13 */
35					ua.match( /Android ([0-9]+)/ ) && RegExp.$1 >= 3 && wkLte534 ||
36					/* Blackberry 7+ with webkit gte 534
37					~: Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0 Mobile Safari/534.11+ */
38					ua.match( / Version\/([0-9]+)/ ) && RegExp.$1 >= 0 && w.blackberry && wkLte534 ||
39					/* Blackberry Playbook with webkit gte 534
40					~: Mozilla/5.0 (PlayBook; U; RIM Tablet OS 1.0.0; en-US) AppleWebKit/534.8+ (KHTML, like Gecko) Version/0.0.1 Safari/534.8+ */   
41					ua.indexOf( "PlayBook" ) > -1 && wkLte534 && !ua.indexOf( "Android 2" ) === -1 ||
42					/* Firefox Mobile (Fennec) 4 and up
43					~: Mozilla/5.0 (Mobile; rv:15.0) Gecko/15.0 Firefox/15.0 */
44					ua.match(/Firefox\/([0-9]+)/) && RegExp.$1 >= 4 ||
45					/* WebOS 3 and up (TouchPad too)
46					~: Mozilla/5.0 (hp-tablet; Linux; hpwOS/3.0.0; U; en-US) AppleWebKit/534.6 (KHTML, like Gecko) wOSBrowser/233.48 Safari/534.6 TouchPad/1.0 */
47					ua.match( /wOSBrowser\/([0-9]+)/ ) && RegExp.$1 >= 233 && wkLte534 ||
48					/* Nokia Browser N8
49					~: Mozilla/5.0 (Symbian/3; Series60/5.2 NokiaN8-00/012.002; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/533.4 (KHTML, like Gecko) NokiaBrowser/7.3.0 Mobile Safari/533.4 3gpp-gba 
50					~: Note: the N9 doesn't have native overflow with one-finger touch. wtf */
51					ua.match( /NokiaBrowser\/([0-9\.]+)/ ) && parseFloat(RegExp.$1) === 7.3 && webkit && wkversion >= 533
52				);
53			})();
54
55	// Expose overthrow API
56	w.overthrow = {};
57
58	w.overthrow.enabledClassName = enabledClassName;
59
60	w.overthrow.addClass = function(){
61		if( docElem.className.indexOf( w.overthrow.enabledClassName ) === -1 ){
62			docElem.className += " " + w.overthrow.enabledClassName;
63		}
64	};
65
66	w.overthrow.removeClass = function(){
67		docElem.className = docElem.className.replace( w.overthrow.enabledClassName, "" );
68	};
69
70	// Enable and potentially polyfill overflow
71	w.overthrow.set = function(){
72			
73		// If nativeOverflow or at least the element canBeFilledWithPoly, add a class to cue CSS that assumes overflow scrolling will work (setting height on elements and such)
74		if( nativeOverflow ){
75			w.overthrow.addClass();
76		}
77
78	};
79
80	// expose polyfillable 
81	w.overthrow.canBeFilledWithPoly = canBeFilledWithPoly;
82
83	// Destroy everything later. If you want to.
84	w.overthrow.forget = function(){
85
86		w.overthrow.removeClass();
87		
88	};
89		
90	// Expose overthrow API
91	w.overthrow.support = nativeOverflow ? "native" : "none";
92		
93})( 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.