PageSourceSearch

http://www.slowfoodupstate.com/js/pic.js

js slowfoodupstate.com collected 2026-10-05 22:45:42 UTC 2,494 bytes, 68 lines download raw bytes

1//---------- 图片自动比例
2$( function() {
3	$(".PicAuto").each( function() {
4		var BoxWidth = $(this).attr("width"),BoxHeight = $(this).attr("height");
5		var img = new Image(),_this = $(this);
6		img.src = $(this).attr("src");
7		if ( img.complete ) {
8			var RealWidth = img.width,RealHeight = img.height,Padding = 0;
9			if ( RealWidth / RealHeight > BoxWidth / BoxHeight ) {
10				RealHeight = parseInt( BoxWidth / RealWidth * RealHeight );
11				RealWidth = parseInt( BoxWidth );
12				Padding = parseInt( ( BoxHeight - RealHeight ) / 2 );
13				_this.attr("width",RealWidth).attr("height",RealHeight).css("padding",Padding + "px 0");
14			}
15			else {
16				RealWidth = parseInt( BoxHeight / RealHeight * RealWidth );
17				RealHeight = parseInt( BoxHeight );
18				Padding = parseInt( ( BoxWidth - RealWidth ) / 2 );
19				_this.attr("width",RealWidth).attr("height",RealHeight).css("padding","0 " + Padding + "px");
20			}
21		}
22		img.onload = function() {
23			var RealWidth = img.width,RealHeight = img.height,Padding = 0;
24			if ( RealWidth / RealHeight > BoxWidth / BoxHeight ) {
25				RealHeight = parseInt( BoxWidth / RealWidth * RealHeight );
26				RealWidth = parseInt( BoxWidth );
27				Padding = parseInt( ( BoxHeight - RealHeight ) / 2 );
28				_this.attr("width",RealWidth).attr("height",RealHeight).css("padding",Padding + "px 0");
29			}
30			else {
31				RealWidth = parseInt( BoxHeight / RealHeight * RealWidth );
32				RealHeight = parseInt( BoxHeight );
33				Padding = parseInt( ( BoxWidth - RealWidth ) / 2 );
34				_this.attr("width",RealWidth).attr("height",RealHeight).css("padding","0 " + Padding + "px");
35			}
36			return;
37		};
38	} );
39} );
40
41//内页图片自动缩放
42$( function() {
43	$(".PicLoad").hide().each( function() {
44		var img = new Image(),_this = $(this),maxwidth = parseInt( $(this).attr("maxwidth") ),showtime = $(this).attr("showtime");
45		img.src = $(this).attr("src");
46		if ( /^[0-9]+$/.test(showtime) ) {
47			showtime = parseInt(showtime);
48		}
49		if ( img.complete ) {
50			if ( maxwidth > img.width ) {
51				maxwidth = img.width;
52			}
53			$(this).attr("width",maxwidth).show(showtime);
54		}
55		img.onload = function() {
56			if ( maxwidth > this.width ) {
57				maxwidth = this.width;
58			}
59			_this.attr("width",maxwidth).show(showtime);
60			return;
61		};
62	} );
63} );
64document.writeln("<style type=\"text/css\">")
65document.writeln("	<!--")
66document.writeln("		.PicLoad { display:none; }")
67document.writeln("	-->")
68document.writeln("</style>")

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.