PageSourceSearch

https://e-inspot.com/lib/js/default.js

js e-inspot.com collected 2026-09-24 13:38:41 UTC 20,193 bytes, 685 lines download raw bytes

1var winH = $(window).height()||window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;
2$(document).on('click','.btn-top', function(e){
3	e.preventDefault();
4	$('body, html').animate({scrollTop:0}, 450);
5});
6//block
7function addBlock() {
8	$('body').append('<div class="block"></div>');
9	$('.block').fadeIn(300);
10	$('.block').on('click', function(){
11		$('.block').fadeOut(100).empty().remove();
12		$('.popup-wrap').hide();
13	});
14}
15function deleteBlock(){
16	$('.block').fadeOut(300);
17	$('.block').empty().remove();
18}
19//popup
20function openPopup(id){
21	addBlock();
22	$('#'+id).show();
23}
24function closePopup(id){
25	deleteBlock();
26	$('#'+id).hide();
27}
28/* radio, checkbox custom style */
29function setupLabel() {
30	if ($('.check input').length) {
31		$('.check').each(function(){
32			$(this).removeClass('c-on');
33		});
34		$('.check input:checked').each(function(){
35			$(this).parent('label').addClass('c-on');
36		});
37	};
38	if ($('.radio input').length) {
39		$('.radio').each(function(){
40			$(this).next('.radio-txt').removeClass('radio-txt-on');
41			$(this).removeClass('r-on');
42		});
43		$('.radio input:checked').each(function(){
44			$(this).parent('label').addClass('r-on');
45
46			$(this).parent('label').next('.radio-txt').addClass('radio-txt-on');
47		});
48	};
49};
50
51var _veiwportH;
52$(document).ready(function(){
53	$("body").on("click",".check, .radio",function(e){
54		setupLabel();
55	});
56	setupLabel();
57	//
58	// _veiwportH = getViewport().h;
59	//
60	// $(window).load(function(e){
61	// 	transformVH();
62	// });
63	// var _resizeTimer;
64	// $(window).resize(function(e){
65	// 	console.log("리사이즈");
66	// 	clearTimeout(_resizeTimer);
67	// 	_resizeTimer = setTimeout(function(){transformVH();},500);
68	// });
69
70});
71/** viewPort 가져오기 **/
72getViewport = function () {
73    var m = document.compatMode == 'CSS1Compat';
74    return {
75        l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
76        t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
77        w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
78        h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
79    };
80};
81/**
82 * vh 단위 변환
83 * @class transform-vh
84 * @param data : 변환할 vh 값
85 * @return
86 */
87// function transformVH(){
88// 	if ($('.transform-vh').length > 0) {
89// 		console.log("transformVH");
90// 		$(this).css({'height':_veiwportH});
91// 	}
92// }
93// (function( $, window ){
94//
95//   var $win = $(window)
96//       , _css = $.fn.css;
97//
98//   function viewportToPixel( val ) {
99//     var percent = val.match(/\d+/)[0] / 100,
100//       unit = val.match(/[vwh]+/)[0];
101//     return (unit == 'vh' ? $win.height() : $win.width()) * percent + 'px';
102//   }
103//
104//   function parseProps( props ) {
105//     var p, prop;
106//     for ( p in props ) {
107//       prop = props[ p ];
108//       if ( /[vwh]$/.test( prop ) ) {
109//         props[ p ] = viewportToPixel( prop );
110//       }
111//     }
112//     return props;
113//   }
114//
115//   $.fn.css = function( props ) {
116//     var self = this,
117//         update = function() {
118//           return _css.call( self, parseProps( $.extend( {}, props ) ) );
119//         };
120//     $win.resize( update );
121//     return update();
122//   };
123//
124// }( jQuery, window ));
125
126/** IE 버전체크 **/
127function get_version_of_IE() {
128    var word;
129    var version = "N/A";
130    var agent = navigator.userAgent.toLowerCase();
131    var name = navigator.appName;
132
133    // IE old version ( IE 10 or Lower )
134    if (name == "Microsoft Internet Explorer") word = "msie ";
135    else {
136        // IE 11
137        if (agent.search("trident") > -1) word = "trident/.*rv:";
138        // Microsoft Edge
139        else if (agent.search("edge/") > -1) word = "edge/";
140    }
141    var reg = new RegExp(word + "([0-9]{1,})(\\.{0,}[0-9]{0,1})");
142    if (reg.exec(agent) !== null) version = RegExp.$1 + RegExp.$2;
143    return version;
144}
145/**
146 * PC 인지 모바일인지 판단하기
147 * return true : pc
148 * return false : mobile
149 *
150 */
151var isPc = (function() {
152	var filter = "win16|win32|win64|macintel|mac";
153	var isPc = true;
154	if(navigator.platform){
155		if(filter.indexOf(navigator.platform.toLowerCase())<0){
156			return false;
157		}else{
158			return true;
159		}
160	}
161});
162/* selectbox */
163jQuery.fn.extend({
164	selectbox: function(options) {
165		return this.each(function() {
166			new jQuery.SelectBox(this, options);
167		});
168	}
169});
170
171/* pawel maziarz: work around for ie logging */
172if (!window.console) {
173	var console = {
174		log: function(msg) {
175	 	}
176	}
177}
178
179$(document).ready(function() {
180	//$('select').selectbox();
181});
182jQuery.SelectBox = function(selectobj, options) {
183
184	var opt = options || {};
185	opt.inputType = opt.inputType || "input";
186	opt.inputClass = opt.inputClass || "selectbox";
187	opt.containerClass = opt.containerClass || "selectbox-wrapper";
188	opt.hoverClass = opt.hoverClass || "current";
189	opt.currentClass = opt.currentClass || "selected";
190	opt.groupClass = opt.groupClass || "groupname"; //css class for group
191	//opt.maxHeight = opt.maxHeight || 200; // max height of dropdown list
192	opt.loopnoStep = opt.loopnoStep || false; // to remove the step in list moves loop
193	opt.onChangeCallback = opt.onChangeCallback || false;
194	opt.onChangeParams = opt.onChangeParams || false;
195	opt.debug = opt.debug || false;
196	opt.selectColor = opt.selectColor || "#000"; //css class for group
197
198	var elm_id = selectobj.id;
199	var active = 0;
200	var inFocus = false;
201	var hasfocus = 0;
202	var hasfocusContainer = -1;
203	//jquery object for select element
204	var $select = jQuery(selectobj);
205	// jquery container object
206	var $container = setupContainer(opt);
207	//jquery input object
208	var $input = setupInput(opt);
209	// hide select and append newly created elements
210	$select.hide().before($input).before($container);
211	var defaultColor = $input.css('color');
212	init();
213
214	$input
215	.click(function(){
216		if (!inFocus) {
217			$container.toggle();
218		}
219	})
220	.focus(function(){
221		if( hasfocus > 0 && hasfocusContainer > 0){
222			hasfocusContainer = -1;
223			setTimeout(function(){ $input.blur(); }, 300);
224		}
225		else if ($container.not(':visible')) {
226			inFocus = true;
227			$container.show();
228		}
229	})
230	.keydown(function(event) {
231		switch(event.keyCode) {
232			case 38: // up
233				event.preventDefault();
234				moveSelect(-1);
235				break;
236			case 40: // down
237				event.preventDefault();
238				moveSelect(1);
239				break;
240			case 9:  // tab
241				hideMe();
242				break;
243			case 13: // return
244				event.preventDefault(); // seems not working in mac !
245				$('li.'+opt.hoverClass).trigger('click');
246				break;
247			case 27: //escape
248			  hideMe();
249			  break;
250		}
251	})
252	.blur(function(e) {
253		if ($container.is(':visible') && hasfocusContainer > 0 ) {
254			$input.focus();
255		} else {
256			hasfocusContainer = -1;
257			hideMe();
258		}
259	});
260
261	$container.on({
262		mouseenter : function(){
263			hasfocusContainer = 1;
264		},
265		mouseleave : function(){
266			hasfocusContainer = -1;
267		}
268	});
269
270	function hideMe() {
271		hasfocus = 0;
272		$container.hide();
273	}
274
275	function init() {
276		$container.append(getSelectOptions($input.attr('id'))).hide();
277		//var width = $input.css('width');
278		//var width = $input.outerWidth()-2;
279		var width = $input.outerWidth()-2;
280		if($container.height() > opt.maxHeight){
281			//$container.width(parseInt(width)+parseInt($input.css('paddingRight'))+parseInt($input.css('paddingLeft')));
282			$container.width(width);
283			$container.height(opt.maxHeight);
284		} else $container.width(width);
285	}
286
287	function setupContainer(options) {
288		var container = document.createElement("div");
289		$container = jQuery(container);
290		$container.attr('id', elm_id+'_container');
291		$container.addClass(options.containerClass);
292			$container.css('display', 'none');
293		return $container;
294	}
295
296	function setupInput(options) {
297		if(opt.inputType == "span"){
298			var input = document.createElement("span");
299			var $input = jQuery(input);
300			$input.attr("id", elm_id+"_input");
301			$input.addClass(options.inputClass);
302			$input.attr("tabIndex", $select.attr("tabindex"));
303		} else {
304			var input = document.createElement("input");
305			var $input = jQuery(input);
306			$input.attr("id", elm_id+"_input");
307			$input.attr("type", "text");
308			$input.addClass(options.inputClass);
309			$input.attr("autocomplete", "off");
310			$input.attr("readonly", "readonly");
311			$input.attr("tabIndex", $select.attr("tabindex")); // "I" capital is important for ie
312			$input.css("width", $select.parent().outerWidth()-2);
313			//$input.css("width", $select.outerWidth()-2);
314			}
315		return $input;
316	}
317
318	function moveSelect(step) {
319		var lis = jQuery("li", $container);
320		if (!lis || lis.length == 0) return false;
321		// find the first non-group (first option)
322		firstchoice = 0;
323		while($(lis[firstchoice]).hasClass(opt.groupClass)) firstchoice++;
324		active += step;
325			// if we are on a group step one more time
326			if($(lis[active]).hasClass(opt.groupClass)) active += step;
327		//loop through list from the first possible option
328		if (active < firstchoice) {
329			(opt.loopnoStep ? active = lis.size()-1 : active = lis.size() );
330		} else if (opt.loopnoStep && active > lis.size()-1) {
331			active = firstchoice;
332		} else if (active > lis.size()) {
333			active = firstchoice;
334		}
335			scroll(lis, active);
336		lis.removeClass(opt.hoverClass);
337
338		jQuery(lis[active]).addClass(opt.hoverClass);
339	}
340
341	function scroll(list, active) {
342			var el = jQuery(list[active]).get(0);
343			var list = $container.get(0);
344
345		if (el.offsetTop + el.offsetHeight > list.scrollTop + list.clientHeight) {
346			list.scrollTop = el.offsetTop + el.offsetHeight - list.clientHeight;
347		} else if(el.offsetTop < list.scrollTop) {
348			list.scrollTop = el.offsetTop;
349		}
350	}
351
352	function setCurrent() {
353		var li = jQuery("li."+opt.currentClass, $container).get(0);
354		var ar = (''+li.id).split('_');
355		var el = ar[ar.length-1];
356		if (opt.onChangeCallback){
357				$select.get(0).selectedIndex = $('li', $container).index(li);
358				opt.onChangeParams = { selectedVal : $select.val() };
359			opt.onChangeCallback(opt.onChangeParams);
360		} else {
361			$select.val(el);
362			$select.change();
363		}
364		//console.log($select.get(0).selectedIndex);
365		if($select.get(0).selectedIndex!=0)$input.css('color',opt.selectColor);
366		else $input.css('color',defaultColor)
367		if(opt.inputType == 'span') $input.html($(li).text());
368		else $input.val($(li).text());
369		return true;
370	}
371
372	// select value
373	function getCurrentSelected() {
374		return $select.val();
375	}
376
377	// input value
378	function getCurrentValue() {
379		return $input.val();
380	}
381
382	function getSelectOptions(parentid) {
383		var select_options = new Array();
384		var ul = document.createElement('ul');
385		select_options = $select.children('option');
386		if(select_options.length == 0) {
387			var select_optgroups = new Array();
388			select_optgroups = $select.children('optgroup');
389			for(x=0;x<select_optgroups.length;x++){
390				select_options = $("#"+select_optgroups[x].id).children('option');
391				var li = document.createElement('li');
392				li.setAttribute('id', parentid + '_' + $(this).val());
393				li.innerHTML = $("#"+select_optgroups[x].id).attr('label');
394				li.className = opt.groupClass;
395				ul.appendChild(li);
396				select_options.each(function() {
397					var li = document.createElement('li');
398					li.setAttribute('id', parentid + '_' + $(this).val());
399					li.innerHTML = $(this).html();
400					if ($(this).is(':selected')) {
401						$input.html($(this).html());
402						$(li).addClass(opt.currentClass);
403					}
404					ul.appendChild(li);
405					$(li)
406					.mouseover(function(event) {
407						hasfocus = 1;
408						if (opt.debug) console.log('over on : '+this.id);
409						jQuery(event.target, $container).addClass(opt.hoverClass);
410					})
411					.mouseout(function(event) {
412						hasfocus = -1;
413						if (opt.debug) console.log('out on : '+this.id);
414						jQuery(event.target, $container).removeClass(opt.hoverClass);
415					})
416					.click(function(event) {
417						var fl = $('li.'+opt.hoverClass, $container).get(0);
418						if (opt.debug) console.log('click on :'+this.id);
419						$('li.'+opt.currentClass, $container).removeClass(opt.currentClass);
420						$(this).addClass(opt.currentClass);
421						setCurrent();
422						$select.get(0).blur();
423						hideMe();
424					});
425				});
426			}
427		} else select_options.each(function() {
428			var li = document.createElement('li');
429			li.setAttribute('id', parentid + '_' + $(this).val());
430			li.innerHTML = $(this).html();
431			if ($(this).is(':selected')) {
432				$input.val($(this).text());
433				$(li).addClass(opt.currentClass);
434			}
435			ul.appendChild(li);
436			$(li)
437			.mouseover(function(event) {
438				hasfocus = 1;
439				if (opt.debug) console.log('over on : '+this.id);
440				jQuery(event.target, $container).addClass(opt.hoverClass);
441			})
442			.mouseout(function(event) {
443				hasfocus = -1;
444				if (opt.debug) console.log('out on : '+this.id);
445				jQuery(event.target, $container).removeClass(opt.hoverClass);
446			})
447			.click(function(event) {
448			  	var fl = $('li.'+opt.hoverClass, $container).get(0);
449				if (opt.debug) console.log('click on :'+this.id);
450				$('li.'+opt.currentClass, $container).removeClass(opt.currentClass);
451				$(this).addClass(opt.currentClass);
452				setCurrent();
453				$select.get(0).blur();
454				hideMe();
455			});
456		});
457		return ul;
458	}
459};
460// select 삭제  function
461function selClear(selId){
462	$(selId+"_input").remove();
463	$(selId + '_container').remove();
464}
465//font Control
466function fontPlus(){
467	$('*').each(function(){
468		var _fontSize = parseInt($(this).css('font-size'))*1.1;
469		//console.log(_fontSize);
470		$(this).css({'font-size':_fontSize+"px"});
471	});
472}
473function fontMinus(){
474	$('*').each(function(){
475		var _fontSize = parseInt($(this).css('font-size'))/1.1;
476		//console.log(_fontSize);
477		$(this).css({'font-size':_fontSize+"px"});
478	});
479}
480/**
481* 중앙정렬 위치
482* @param containerSize : 컨테이너의 크기
483* @param targetSize : 컨테이너에 들어 있는 오브젝트의 크기
484* @return
485*/
486function getCenterAlignPos( containerSize, targetSize ) {
487  var pos = ( containerSize - targetSize ) / 2;
488  return pos;
489}
490
491/**
492 * 해당 포인트를 기준으로 중간에 걸칠경우
493 * @param centerPos : 기준선
494 * @param targetSize : 오브젝트의 크기
495 * @return
496 *
497 */
498function getCenterPos( centerPos, targetSize ) {
499  var pos = centerPos - ( targetSize / 2 );
500  return pos;
501}
502
503/**
504 * 랜덤값 간단하게 뽑아오기
505 * @param min : 가장 적은값
506 * @param max  : 가장 높은값
507 * @return
508 *
509 */
510function getRandom( min, max ){
511	return Math.floor(Math.random()*(max-min))+min;
512}
513
514/**
515 * 이미지모션 오버 아웃 버튼
516 */
517$.fn.animationButton = function( imgPath, imgType, imgNum ){
518  return new AnimationButtonClass( this, imgPath, imgType, imgNum );
519}
520AnimationButtonClass = function( _selector, _imgPath, _imgType, _imgNum ){
521  this.aniBtnthis = _selector;
522  this.aniBtnTimer;
523  this.aniBtnCount=0;
524  this.aniBtnTotalImages=_imgNum;
525  var _this = this;
526
527  for(var i=0;i<_imgNum;i++){
528    $(_selector).append("<img src ='"+_imgPath+i+_imgType+"' />");
529  }
530  $(_selector).find("img").css({"position":"absolute", "display":"none"});
531  $(_selector).find("img").eq(0).show();
532
533  this.aniBtnthis.hover(function() {
534	if(_this.aniBtnTimer) { clearInterval(_this.aniBtnTimer); }
535	_this.aniBtnTimer = setInterval(function(){_this.nextFrame();},50);
536  },function() {
537	if(_this.aniBtnTimer) { clearInterval(_this.aniBtnTimer); }
538	_this.aniBtnTimer = setInterval(function(){_this.prevFrame();},50);
539  });
540
541}
542AnimationButtonClass.prototype = {
543  nextFrame: function() {
544    this.aniBtnCount++;
545	if(this.aniBtnCount>this.aniBtnTotalImages-1){
546	  this.aniBtnCount = this.aniBtnTotalImages-1;
547	  clearInterval(this.aniBtnTimer);
548	}
549	$(this.aniBtnthis).find("img").hide();
550	$(this.aniBtnthis).find("img").eq(this.aniBtnCount).css("display","block");
551  },
552  prevFrame: function() {
553    this.aniBtnCount--;
554	if(this.aniBtnCount < 0){
555	  this.aniBtnCount = 0;
556	  clearInterval(this.aniBtnTimer);
557	}
558	$(this.aniBtnthis).find("img").hide();
559	$(this.aniBtnthis).find("img").eq(this.aniBtnCount).css("display","block");
560  }
561
562}
563
564
565
566
567/*
568 * Pass a function to whenReady() and it will be invoked (as a method of the
569 * document) when the document is parsed and ready for manipulation. Registered
570 * functions are triggered by the first DOMContentLoaded, readystatechange, or
571 * load event that occurs. Once the document is ready and all functions have
572 * been invoked, any functions passed to whenReady() will be invoked
573 * immediately.
574 */
575var whenReady = (function() { // This function returns the whenReady() function
576    var funcs = [];    // The functions to run when we get an event
577    var ready = false; // Switches to true when the handler is triggered
578
579    // The event handler invoked when the document becomes ready
580    function handler(e) {
581        // If we've already run once, just return
582        if (ready) return;
583
584        // If this was a readystatechange event where the state changed to
585        // something other than "complete", then we're not ready yet
586        if (e.type === "readystatechange" && document.readyState !== "complete")
587            return;
588
589        // Run all registered functions.
590        // Note that we look up funcs.length each time, in case calling
591        // one of these functions causes more functions to be registered.
592        for(var i = 0; i < funcs.length; i++)
593            funcs[i].call(document);
594
595        // Now set the ready flag to true and forget the functions
596        ready = true;
597        funcs = null;
598    }
599
600    // Register the handler for any event we might receive
601    if (document.addEventListener) {
602        document.addEventListener("DOMContentLoaded", handler, false);
603        document.addEventListener("readystatechange", handler, false);
604        window.addEventListener("load", handler, false);
605    }
606    else if (document.attachEvent) {
607        document.attachEvent("onreadystatechange", handler);
608        window.attachEvent("onload", handler);
609    }
610
611    // Return the whenReady function
612    return function whenReady(f) {
613        if (ready) f.call(document); // If already ready, just run it
614        else funcs.push(f);          // Otherwise, queue it for later.
615    }
616}());
617
618
619// Register the function f to run when the document finishes loading.
620// If the document has already loaded, run it asynchronously ASAP.
621function onLoad(f) {
622    if (onLoad.loaded)                  // If document is already loaded
623        window.setTimeout(f, 0);        // Queue f to be run as soon as possible
624    else if (window.addEventListener)   // Standard event registration method
625        window.addEventListener("load", f, false);
626    else if (window.attachEvent)        // IE8 and earlier use this instead
627        window.attachEvent("onload", f);
628}
629
630// ======================= imagesLoaded Plugin ===============================
631/*!
632 * jQuery imagesLoaded plugin v1.1.0
633 * http://github.com/desandro/imagesloaded
634 *
635 * MIT License. by Paul Irish et al.
636 */
637
638// $('#my-container').imagesLoaded(myFunction)
639// or
640// $('img').imagesLoaded(myFunction)
641
642// execute a callback when all images have loaded.
643// needed because .load() doesn't work on cached images
644
645// callback function gets image collection as argument
646//  `this` is the container
647
648$.fn.imagesLoaded = function( callback ) {
649  var $this = this,
650      $images = $this.find('img').add( $this.filter('img') ),
651      len = $images.length,
652      blank = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==',
653      loaded = [];
654
655  function triggerCallback() {
656    callback.call( $this, $images );
657  }
658
659  function imgLoaded( event ) {
660    var img = event.target;
661    if ( img.src !== blank && $.inArray( img, loaded ) === -1 ){
662      loaded.push( img );
663      if ( --len <= 0 ){
664        setTimeout( triggerCallback );
665        $images.unbind( '.imagesLoaded', imgLoaded );
666      }
667    }
668  }
669
670  // if no images, trigger immediately
671  if ( !len ) {
672    triggerCallback();
673  }
674
675  $images.bind( 'load.imagesLoaded error.imagesLoaded',  imgLoaded ).each( function() {
676    // cached images don't fire load sometimes, so we reset src.
677    var src = this.src;
678    // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
679    // data uri bypasses webkit log warning (thx doug jones)
680    this.src = blank;
681    this.src = src;
682  });
683
684  return $this;
685};

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.