PageSourceSearch

https://www.korg.com/global/js/top.js

js korg.com collected 2026-09-24 08:37:51 UTC 3,474 bytes, 137 lines download raw bytes

1$(window).load(function(){
2	var UA = navigator.userAgent.toLowerCase();
3	var isMobile = function(){return /(iphone|ipod|ipad|android|blackberry|windows ce|palm|symbian)/i.test(navigator.userAgent);};
4	isMobile = isMobile();
5	legacyIE = (UA.indexOf("msie 8.") != -1 || UA.indexOf("msie 7.") != -1 || UA.indexOf("msie 9.") != -1);
6
7	var $top_contents = $("#top_contents");
8	var topObj = [];
9
10	init();
11
12	function init(){
13		topObjSec = $top_contents.find("div");
14		a = 0;
15		for (_i = 0, _len = topObjSec.length; _i < _len; _i++) {
16			obj = topObjSec[_i];
17			if ($(obj).attr("class") === "noise_over") continue;
18			topObj[a] = $(obj);
19			a++;
20		}
21		$win.on("resize",onResizeFunc);
22		$win.on("scroll",onScrollFunc);
23		onResizeFunc();
24		onScrollFunc();
25	}
26
27	function onScrollFunc(){
28		sctop = $win.scrollTop();
29
30		len = topObj.length - 1;
31		cnt = 0;
32		while(cnt < len){
33			pos = parseInt(topObj[cnt].css("top"));
34			if(pos - WH < sctop){
35				//img = topObj[cnt].find("img");
36				img = topObj[cnt].find("img").eq(0);
37				src = $(img).attr("act-src");
38				$(img).attr("src",src);
39				var imgs = topObj[cnt].find("img");
40				if(imgs.length > 1){
41				var img2 = imgs.eq(1);
42					if($(img2).attr("act-src")){
43						src = $(img2).attr("act-src");
44						$(img2).attr("src",src);
45					}
46				}
47				if(legacyIE){
48					topObj[cnt].animate({"opacity":"1"},300);
49				}else{
50					topObj[cnt].css("opacity","1");
51				}
52			}
53			cnt++;
54		}
55	}
56	function onResizeFunc(){
57		top_w = $top_contents.width()
58		//WW = $win.width();
59		WW = window.innerWidth ? window.innerWidth: $win.width();
60		WH = $win.height();
61
62		if(isMobile){
63			if(top_w < 481) c = 1;
64			else if(top_w < 1001) c = 2;
65			else if( top_w < 1401) c = 3;
66			else c = 4;
67		}else{
68			if(WW <= 1000) c = 2;
69			else if( WW <= 1400) c = 3;
70			else c = 4;
71		}
72
73		len = topObj.length - 1;
74		h1 = ((top_w / c)*3/4) | 0;
75		if(h1 === 0) return;
76		block = [];
77		cnt = 0;
78		while(cnt < len){
79			type = topObj[cnt].attr("class").replace(' top-img-content', '')
80			if(type === "block1_1"){
81				w = 1;
82				h = 1;
83			}else if(type === "block2_1"){
84				w = 2;
85				h = 1;
86			}else if(type === "block1_2"){
87				w = 1;
88				h = 2;
89			}else if(type === "block2_2"){
90				w = 2;
91				h = 2;
92			}else if(type === "block3_2"){
93				w = 3;
94				h = 2;
95			}
96			py = 0;
97			flg = false;
98			while(!flg && py < 999){
99				px = 0;
100				if(!block[py]) block[py] = [];
101				while(px < c && ((px + w) <= c || c === 2 && w === 3) && !flg){
102					flg = true;
103					if(block[py][px] === 1) flg = false;
104					if(w > 1 && (block[py][px+1] === 1 || px + 1 > c)) flg = false;
105					if(w > 2 && (block[py][px+2] === 1 || px + 2 > c)) flg = false;
106					if(h === 2){
107						if(!block[py+1]) block[py+1] = [];
108						else{
109							if(block[py+1][px] === 1) flg = false;
110							if(w > 1 && block[py+1][px+1] === 1) flg = false;
111							if(w > 2 && block[py+1][px+2] === 1) flg = false;
112						}
113					}
114					if(!flg) px++;
115				}
116				if(flg){
117					block[py][px] = 1;
118					if(w > 1) block[py][px+1] = 1;
119					if(w > 2) block[py][px+2] = 1;
120					if(h ===2){
121						block[py+1][px] = 1;
122						if(w > 1) block[py+1][px+1] = 1;
123						if(w > 2) block[py+1][px+2] = 1;
124					}
125				}
126
127				topObj[cnt].css({"left":(px / c * 100)+"%","top": (h1*py)+"px","height":(h1*h | 0)+"px","z-index":999-cnt});
128
129				py++
130			}
131			cnt++
132		}
133
134		$top_contents.height(h1*block.length);
135	}
136
137});

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.