PageSourceSearch

https://www.dongjian.cc/static/js/jext/org/viewport.js?t=1791178790

js dongjian.cc collected 2026-10-05 05:40:17 UTC 1,730 bytes, 45 lines download raw bytes

1
2/********************屏幕自适应**********************/
3var viewport = {
4	init: function(width) {
5		var thi = this;
6		thi.width = width;
7		$(window).on('orientationchange resize', function(e) {
8			thi.set();
9		});
10		thi.set();
11	},
12	set: function() {
13		var thi = this;
14		$('meta[name="viewport"]').remove();
15		if(thi.orient()){
16			var phoneWidth = parseInt(window.screen.height);
17		}else{
18			var phoneWidth = parseInt(window.screen.width);
19		}
20		var phoneScale = phoneWidth / thi.width;
21		var userAgent = navigator.userAgent;
22		var index = userAgent.indexOf('Android');
23		if (index >= 0) {
24			var androidVersion = parseFloat(userAgent.slice(index+8));
25			if (androidVersion > 2.3) {
26				$('head:eq(0)').append('<meta name="viewport" content="width='+thi.width+', initial-scale='+phoneScale+', minimum-scale='+phoneScale+', maximum-scale='+phoneScale+',user-scalable=no, target-densitydpi=device-dpi">');
27			} else {
28				$('head:eq(0)').append('<meta name="viewport" content="width='+thi.width+', target-densitydpi=device-dpi">');
29			}
30		} else {
31			$('head:eq(0)').append('<meta name="viewport" content="width='+thi.width+', initial-scale='+phoneScale+', minimum-scale='+phoneScale+', maximum-scale='+phoneScale+',user-scalable=no, target-densitydpi=device-dpi">');
32		}
33		// $('html').css({margin:'auto', width:thi.width});
34	},
35	orient: function() {
36		if (window.orientation == 90 || window.orientation == -90) {
37			return 1;
38		} else if (window.orientation == 0 || window.orientation == 180) {
39			return 0;
40		}
41	}
42};
43VIEWPORTWIDTH=typeof(VIEWPORTWIDTH)=='undefined'?750:(VIEWPORTWIDTH||750);
44viewport.init(VIEWPORTWIDTH);
45/********************屏幕自适应**********************/

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.