/** * smartPop.js(?) 지우고 다시짰습니다... * SEED 3.0 페이지와 CSS에 의존성이 높습니다. * 다른곳에서는 쓰지마세요.. 안돌아가요 ㅋㅋ */ if( typeof Object.create !== 'function' ){ Object.create = function( obj ){ function F(){} F.prototype = obj; return new F(); }; } ;(function( window, document, $, undefined ){ var Modal = { init : function( options ){ var self = this; self.url = ( typeof options === 'string' ) ? options : options.url; self.options = $.extend( {}, $.SeedModal.options, ( typeof options === 'string' ) ? {} : options ); // 전체박스 self.SeedModalEl = $('
',{'id' : 'SeedModal', 'class' : 'seed-hide'}).append(''); // 아이프레임 박스 self.SeedIframeBoxEl = $('').addClass('iframe-box seed-hide').click(false); // 아이프레임 헤더 self.SeedIframeHeader = $('').addClass('iframe-header'); // 아이프레임 self.SeedIframeEl = $('').attr({id : 'SeedIframe', frameBorder: 0, scrolling: 'no', height : 'auto' }); self.isScrollVisible = false; this.display().done(function(){ self.load(); self.SeedModalEl.find('.rolling').fadeOut(function(){ $(this).remove(); }); if( typeof self.options.callback === 'function' ){ self.options.callback(); return; } }); // refresh event self.SeedIframeEl.load(function(){ self.calcHeight(); }); return this; }, load : function(){ var self = this; this.SeedIframeBoxEl.addClass('seed-open'); $('body, html').addClass('scroll-hidden'); $(window).on('resize.calcHeight', function(){ self.calcHeight(); }).resize(); this.tabResize(); }, close : function(){ var self = this; var modal = this.SeedModalEl.add( this.SeedIframeBoxEl ) .removeClass('seed-open') .one('transitionend webkittransitionend otransitionend mstransitionend', function(){ callback(); }); if( !$.support.transition ){ setTimeout(function(){ callback(); }, 400); } ; function callback(){ $('body, html').removeClass('scroll-hidden'); self.tabResize(); modal.remove(); $(window).off('resize.calcHeight'); } }, fetch : function(){ return this.SeedIframeEl.attr({ src : this.url }); }, display : function(){ var deferred = $.Deferred(); var self = this; $('body') .append( this.SeedModalEl.click(function(){ if( self.options.close ){ self.close(); } }) .append( this.SeedIframeBoxEl .append( this.SeedIframeHeader .append( $(''+ this.options.title +'') ) .append( (function(){ if( !self.options.close ){ return ''; } return $('').click(function(){ self.close.call( self ); }); }()) ) ) .append( this.fetch().load(function(){ setTimeout(function(){ deferred.resolve() }, 250); }) ) ) ) ; setTimeout(function(){ self.SeedModalEl.addClass('seed-open'); }, 25); return deferred.promise(); }, tabResize : function(){ if( window.tabResize && typeof window.tabResize === 'function' ){ window.tabResize(); } }, calcHeight : function(){ this.SeedIframeEl[0].height = 0; var the_height= this.SeedIframeEl[0].contentWindow. document.body.scrollHeight + 50; this.SeedIframeEl[0].height= the_height; } } $.SeedModal = function( options ){ var modal = Object.create( Modal ); modal.init( options ); } $.SeedModal.options = { url : 'http://www.global-it.kr/season2/index.do', title : 'SEED 3.0', callback : undefined, close : true } }( window, document, $ ));