PageSourceSearch

https://designdb.com/usr/js/banner.js

js designdb.com collected 2026-10-02 11:41:29 UTC 16,663 bytes, 403 lines download raw bytes

1(function ($) {
2    var rollingParam = {};
3
4    $.fn.rolling = function (rollingDirection, rollingItemWidth, rollingItemHeight, viewingItemCount) {
5        var rollingId = new Date().getTime();
6        var id = this.attr("id");
7        rollingParam[rollingId] = {
8            id: id,
9            rollingIsStarted: false,
10            rollingItemCount: 0,
11            rollingAnimationIndex: 0,
12            rollingItemWidth: 0,
13            rollingItemHeight: 0,
14            viewingItemCount: 0,
15            rollingTime: 0,
16            viewingTime: 0,
17            rollingAnimationFrame: 0,
18            rollingDirection: null,
19            rollingLeft: 0,
20            rollingTop: 0,
21            requestReverse: false,
22            newRollingAnimationFrame: 0
23        };
24
25        var param = rollingParam[rollingId];
26        param.rollingDirection = rollingDirection;
27        param.rollingItemWidth = rollingItemWidth;
28        param.rollingItemHeight = rollingItemHeight;
29
30        if (viewingItemCount == undefined) {
31            param.viewingItemCount = 1;
32        } else {
33            param.viewingItemCount = viewingItemCount;
34        }
35
36        if (param.rollingDirection == "left" ||
37            param.rollingDirection == "right") {
38            this.css("width", param.rollingItemWidth * param.viewingItemCount);
39            this.css("height", param.rollingItemHeight);
40        } else if (param.rollingDirection == "up" ||
41            param.rollingDirection == "down") {
42            this.css("width", param.rollingItemWidth);
43            this.css("height", param.rollingItemHeight * param.viewingItemCount);
44        }
45
46        this.css("position", "relative");
47        this.css("overflow", "hidden");
48        this.attr("rollingId", rollingId);
49
50        this.empty();
51
52        rollingContentDiv = $("<div/>").appendTo(this);
53        rollingContentDiv.attr("id", rollingId);
54        rollingContentDiv.css("position", "absolute");
55        rollingContentDiv.attr("align", "left");
56        rollingContentDiv.css("left", "0");
57        rollingContentDiv.css("top", "0");
58        return this;
59    };
60
61    $.fn.addRollingItem = function (html) {
62        var param = rollingParam[this.attr("rollingId")];
63        var rollingContentDiv = $("#" + this.attr("rollingId"));
64        param.rollingItemCount++;
65        var rollingItem = null;
66
67        if (param.rollingDirection == "up") {
68            rollingItem = $("<div class='item'/>").appendTo(rollingContentDiv);
69        } else if (param.rollingDirection == "right") {
70            rollingItem = $("<div class='item'/>").prependTo(rollingContentDiv);
71            rollingItem.css("float", "left");
72            rollingContentDiv.css("width", param.rollingItemCount * param.rollingItemWidth);
73            rollingContentDiv.css("left", -(param.rollingItemCount - param.viewingItemCount) * param.rollingItemWidth);
74            param.rollingLeft = -(param.rollingItemCount - param.viewingItemCount) * param.rollingItemWidth;
75        } else if (param.rollingDirection == "down") {
76            rollingItem = $("<div class='item'/>").prependTo(rollingContentDiv);
77            param.rollingTop = -(param.rollingItemCount - param.viewingItemCount) * param.rollingItemHeight;
78            rollingContentDiv.css("top", -(param.rollingItemCount - param.viewingItemCount) * param.rollingItemHeight);
79        } else if (param.rollingDirection == "left") {
80            rollingItem = $("<div class='item'/>").appendTo(rollingContentDiv);
81            rollingItem.css("float", "left");
82            rollingContentDiv.css("width", param.rollingItemCount * param.rollingItemWidth);
83        }
84        rollingItem.css("overflow", "hidden");
85        rollingItem.css("width", param.rollingItemWidth);
86        rollingItem.css("height", param.rollingItemHeight);
87        rollingItem.html(html);
88        return this;
89    };
90
91    rollingAnimation = function (id) {
92        var param = rollingParam[id];
93        var rollingContentDiv = $("#" + id);
94        if (rollingContentDiv.size() == 0) {
95            return;
96        }
97        var delayTime = param.rollingTime;
98
99        if (param.rollingIsStarted == false) {
100            setTimeout("rollingAnimation('" + id + "')", delayTime);
101            return;
102        }
103
104        if (param.rollingAnimationIndex == 0) {
105            if (param.newRollingAnimationFrame != param.rollingAnimationFrame) {
106                param.rollingAnimationFrame = param.newRollingAnimationFrame;
107            }
108        }
109
110        var isReverse = false;
111        if (param.requestReverse == true) {
112            isReverse = true;
113            param.requestReverse = false;
114            param.rollingAnimationIndex = param.rollingAnimationFrame - param.rollingAnimationIndex
115
116            if (param.rollingDirection == "left") {
117                param.rollingDirection = "right";
118            } else if (param.rollingDirection == "right") {
119                param.rollingDirection = "left";
120            } else if (param.rollingDirection == "down") {
121                param.rollingDirection = "up";
122            } else if (param.rollingDirection == "up") {
123                param.rollingDirection = "down";
124            }
125            $("#" + param.id).trigger("reverse");
126        } else {
127            if (param.rollingDirection == "up") {
128                param.rollingTop -= param.rollingItemHeight / param.rollingAnimationFrame;
129                if (-param.rollingTop > parseFloat(param.rollingItemHeight) * param.rollingItemCount) {
130                    param.rollingTop = -parseFloat(param.rollingItemHeight) * param.rollingItemCount;
131                }
132                rollingContentDiv.css("top", param.rollingTop);
133            } else if (param.rollingDirection == "right") {
134                param.rollingLeft += param.rollingItemWidth / param.rollingAnimationFrame;
135                if (param.rollingLeft > parseFloat(param.rollingItemWidth)) {
136                    param.rollingLeft = parseFloat(param.rollingItemWidth);
137                }
138                rollingContentDiv.css("left", param.rollingLeft);
139            } else if (param.rollingDirection == "down") {
140                param.rollingTop += param.rollingItemHeight / param.rollingAnimationFrame;
141                if (param.rollingTop > parseFloat(param.rollingItemHeight)) {
142                    param.rollingTop = parseFloat(param.rollingItemHeight);
143                }
144                rollingContentDiv.css("top", param.rollingTop);
145            } else if (param.rollingDirection == "left") {
146                param.rollingLeft -= param.rollingItemWidth / param.rollingAnimationFrame;
147                if (-param.rollingLeft > parseFloat(param.rollingItemWidth) * param.rollingItemCount) {
148                    param.rollingLeft = -parseFloat(param.rollingItemWidth) * param.rollingItemCount;
149                }
150                rollingContentDiv.css("left", param.rollingLeft);
151            }
152            param.rollingAnimationIndex++;
153        }
154
155        if (param.rollingAnimationIndex != 0 && param.rollingAnimationIndex % param.rollingAnimationFrame == 0) {
156            var currentRollingItemIndex = 0;
157            if (param.rollingDirection == "up" || param.rollingDirection == "left") {
158                currentRollingItemIndex = 0;
159            } else if (param.rollingDirection == "right" || param.rollingDirection == "down") {
160                currentRollingItemIndex = param.rollingItemCount - 1;
161            }
162
163            var currentRollingItem = $("div[class='item']:eq(" + currentRollingItemIndex + ")", rollingContentDiv);
164            var rollingItem = null;
165            if (param.rollingDirection == "up") {
166                rollingItem = currentRollingItem.clone(true).appendTo(rollingContentDiv);
167                param.rollingTop += parseFloat(param.rollingItemHeight);
168                param.rollingTop = param.rollingItemHeight * Math.round(param.rollingTop / param.rollingItemHeight);
169                rollingContentDiv.css("top", param.rollingTop);
170            } else if (param.rollingDirection == "right") {
171                rollingItem = currentRollingItem.clone(true).prependTo(rollingContentDiv);
172                param.rollingLeft -= parseFloat(param.rollingItemWidth);
173                param.rollingLeft = param.rollingItemWidth * Math.round(param.rollingLeft / param.rollingItemWidth);
174                $("#debug").html("rollingLeft:" + param.rollingLeft);
175                rollingItem.css("float", "left");
176                rollingContentDiv.css("left", param.rollingLeft);
177            } else if (param.rollingDirection == "down") {
178                rollingItem = currentRollingItem.clone(true).prependTo(rollingContentDiv);
179                param.rollingTop -= parseFloat(param.rollingItemHeight);
180                param.rollingTop = param.rollingItemHeight * Math.round(param.rollingTop / param.rollingItemHeight);
181                rollingContentDiv.css("top", param.rollingTop);
182            } else if (param.rollingDirection == "left") {
183                rollingItem = currentRollingItem.clone(true).appendTo(rollingContentDiv);
184                param.rollingLeft += parseFloat(param.rollingItemWidth);
185                param.rollingLeft = param.rollingItemWidth * Math.round(param.rollingLeft / param.rollingItemWidth);
186                $("#debug").html("rollingLeft:" + param.rollingLeft);
187                rollingItem.css("float", "left");
188                rollingContentDiv.css("left", param.rollingLeft);
189            }
190
191            currentRollingItem.remove();
192
193            if (!isReverse) {
194                delayTime = param.viewingTime;
195            } else {
196                delayTime = 0;
197            }
198
199            var previousRollingItem = $("div[class='item']:eq(" + currentRollingItemIndex + ")", rollingContentDiv);
200            $("#" + param.id).trigger("viewing", [previousRollingItem]);
201            param.rollingAnimationIndex = 0;
202        }
203
204        if (param.rollingAnimationIndex != 0) {
205            var currentRollingItem = $("div[class='item']:eq(0)", rollingContentDiv);
206            $("#" + param.id).trigger("rolling", [currentRollingItem]);
207        }
208        setTimeout("rollingAnimation('" + id + "')", delayTime);
209    }
210
211    $.fn.initRolling = function (rollingTime, viewingTime, rollingAnimationFrame) {
212        var param = rollingParam[this.attr("rollingId")];
213        var rollingContentDiv = $("#" + this.attr("rollingId"));
214        var currentRollingItemIndex = 0;
215
216        if (param.rollingDirection == "up" ||
217            param.rollingDirection == "left") {
218            currentRollingItemIndex = 0;
219        } else if (param.rollingDirection == "right" ||
220            param.rollingDirection == "down") {
221            currentRollingItemIndex = param.rollingItemCount - 1;
222        }
223        var currentRollingItem = $("div[class='item']:eq(" + currentRollingItemIndex + ")", rollingContentDiv);
224        this.trigger("viewing", [currentRollingItem]);
225        param.rollingTime = rollingTime
226        param.viewingTime = viewingTime;
227        param.rollingAnimationFrame = rollingAnimationFrame;
228        param.newRollingAnimationFrame = rollingAnimationFrame;
229    };
230
231    $.fn.startRolling = function (rollingTime, viewingTime, rollingAnimationFrame) {
232        this.initRolling(rollingTime, viewingTime, rollingAnimationFrame);
233        var param = rollingParam[this.attr("rollingId")];
234        if (param.rollingIsStarted == false) {
235            param.rollingIsStarted = true;
236            this.trigger("start");
237            setTimeout("rollingAnimation('" + this.attr("rollingId") + "')", param.viewingTime);
238        }
239        return this;
240    };
241
242    $.fn.readyRolling = function (rollingTime, viewingTime, rollingAnimationFrame) {
243        this.initRolling(rollingTime, viewingTime, rollingAnimationFrame);
244        var param = rollingParam[this.attr("rollingId")];
245        param.rollingIsStarted = false;
246        setTimeout("rollingAnimation('" + this.attr("rollingId") + "')", param.viewingTime);
247        return this;
248    };
249
250    $.fn.stopRolling = function () {
251        this.trigger("stop");
252        rollingParam[this.attr("rollingId")].rollingIsStarted = false;
253        return this;
254    };
255
256    $.fn.resumeRolling = function () {
257        if (rollingParam[this.attr('rollingId')].rollingIsStarted == false) {
258            rollingParam[this.attr('rollingId')].rollingIsStarted = true;
259            this.trigger("start");
260        }
261        return this;
262    };
263
264    $.fn.getRollingTime = function () {
265        return rollingParam[this.attr('rollingId')].rollingTime;
266    };
267
268    $.fn.getViewingTime = function () {
269        return rollingParam[this.attr('rollingId')].viewingTime;
270    };
271
272    $.fn.getRollingAnimationFrame = function () {
273        return rollingParam[this.attr('rollingId')].rollingAnimationFrame;
274    };
275
276    $.fn.getRollingDirection = function () {
277        return rollingParam[this.attr('rollingId')].rollingDirection;
278    };
279
280    $.fn.setRollingTime = function (rollingTime) {
281        rollingParam[this.attr('rollingId')].rollingTime = rollingTime;
282        return this;
283    };
284
285    $.fn.setViewingTime = function (viewingTime) {
286        rollingParam[this.attr('rollingId')].viewingTime = viewingTime;
287        return this;
288    };
289
290    $.fn.setRollingAnimationFrame = function (rollingAnimationFrame) {
291        var oldStep = rollingParam[this.attr('rollingId')].rollingAnimationFrame;
292        var oldIndex = rollingParam[this.attr('rollingId')].rollingAnimationIndex;
293        var multiplier = rollingAnimationFrame / oldStep;
294        rollingParam[this.attr('rollingId')].rollingAnimationFrame = rollingAnimationFrame;
295        rollingParam[this.attr('rollingId')].newRollingAnimationFrame = rollingAnimationFrame;
296        rollingParam[this.attr('rollingId')].rollingAnimationIndex = Math.round(multiplier * oldIndex);
297        return this;
298    };
299
300    $.fn.setRollingAnimationFrameNext = function (rollingAnimationFrame) {
301        rollingParam[this.attr('rollingId')].newRollingAnimationFrame = rollingAnimationFrame;
302        return this;
303    }
304
305    $.fn.getRollingItems = function () {
306        return $("div[class=item]", this);
307    };
308
309    $.fn.getViewingItemCount = function () {
310        return rollingParam[this.attr('rollingId')].viewingItemCount;
311    };
312
313    $.fn.bindViewingEvent = function (rollingEvent) {
314        return this.bind("viewing", rollingEvent);
315    };
316
317    $.fn.unbindViewingEvent = function () {
318        return this.unbind("viewing");
319    };
320
321    $.fn.bindRollingEvent = function (rollingEvent) {
322        return this.bind("rolling", rollingEvent);
323    };
324
325    $.fn.unbindRollingEvent = function () {
326        return this.unbind("rolling");
327    };
328
329    $.fn.bindStartEvent = function (rollingEvent) {
330        return this.bind("start", rollingEvent);
331    };
332
333    $.fn.unbindStartEvent = function () {
334        return this.unbind("start");
335    };
336
337    $.fn.bindStopEvent = function (rollingEvent) {
338        return this.bind("stop", rollingEvent);
339    };
340
341    $.fn.unbindStopEvent = function () {
342        return this.unbind("stop");
343    };
344
345    $.fn.bindReverseEvent = function (rollingEvent) {
346        return this.bind("reverse", rollingEvent);
347    };
348
349    $.fn.unbindReverseEvent = function () {
350        return this.unbind("reverse");
351    };
352
353    $.fn.reverseRolling = function () {
354        rollingParam[this.attr('rollingId')].requestReverse = true;
355        return this;
356    };
357
358})(jQuery);
359
360
361function clickBanner(bannerno,title, url, target){
362	if(url=="null") return;	
363	if(title == "수도권 방역조치 강화"){
364		win = window.open('','수도권 방역조치 강화','height=870,width=620');
365		win.document.open();
366		win.document.write("<div style='overflow:hidden;'><a href='http://www.cdc.go.kr/linkCheck.es?mid=a21111050500' target='blank'><img src = '/images/banner/600_850.jpg'</a></div>");
367		win.document.close();
368		return;
369	}
370	
371	if(title =="req"){
372		viewPic('http://www.kidp.or.kr/usr/upload/banner/20191206_popup.jpg');
373	}else{
374		if(url.indexOf("ztag=") != -1){
375			var urls = url.split("ztag=");
376			url = urls[0] + "ztag=" + urls[1].replace(/&/gi, "%26").replace(/\+/gi, "%2B").replace(/\=/gi, "%3D")
377		}if (typeof gtag === 'function') {
378			gtag('event', 'banner_click', {
379				'banner_id': bannerno,
380				'banner_name': title,
381				'banner_url': url
382			});
383		}
384		$.ajax({ 
385			type: 'post' 
386			, async: true 
387			, url: '/skin/banner/updateClick.html' 
388			, data: "bannerno="+bannerno+"&title="+title+"&url="+url
389			, success: function(data) { 
390				if (data=="false"){
391					alert("오류가 발생하였습니다. 관리자에게 문의하십시오.");
392				}
393				
394				window.open(url, target); 
395				
396			} 
397			, error: function(data, status, err) { 
398				alert('서버와의 통신이 실패했습니다.'); 
399			}
400
401		});
402	}	
403}

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.