/** * @class * Æ˾÷À» È£ÃâÀ» ÆíÇÏ°í ·¹À̾î Æ˾÷ È£Ãâ°ú ÀÏ¹Ý Æ˾÷ È£ÃâÀ» °°ÀÌ »ç¿ëÇϵµ·Ï Çϱâ À§ÇÏ¿© ¸¸µë * * @example * È£Ãâ type : layer ÀԷ½à ·¹À̾î È£Ãâ, 'browser' ÀÏ¹Ý Æ˾÷â, ±âº» browser * var opts = {'url' : 'index.html', 'width' : '600px', 'height' : '500px', 'left': '100px' , 'top' : '300px', 'type' : 'layer' }; * $.popup(opts); * * $('.layerpopup').popup(opts); */ (function($){ $.fn.popup = function(options) { var popup,popup_options; var $this = $(this); var opts = $.extend({},$.fn.popup.defaults, options); if(opts.center) { opts.top = $(window).height()/2- opts.height.replace('px','')/2; opts.left = $(window).width()/2 - opts.width.replace('px','')/2; } //popup options , layer , borwser if( opts.type == 'browser' ) { popup_options = "width=" + opts.width + ",height=" + opts.height; popup_options += ",left=" + opts.left + ",top=" + opts.top; popup_options += ",scrollbars=" + opts.scrollbars + ",toolbar=" + opts.toolbar + ",menubars=" + opts.menubars; popup_options += ",locationbar=" + opts.locationbar + ",statusbar=" + opts.statusbar; popup_options += ",resizable=" + opts.resizable ; popup_options += ",titlebar=" + opts.titlebar; if(opts.etc_option != '') popup_options += "," + opts.etc_option; } else { var len = $('.' +opts.name).length; if(len > 1 ){ $('.' +opts.name).show(); return; } popup = $("
").css({ 'display' : 'none', 'position': 'absolute' , 'z-index' : '1000' , 'width' : opts.width, 'height' : opts.height, 'left' : opts.left, 'top' : opts.top }); //titleBar var titleBar = $("
"); var title = $("
" + opts.title + "
").css({'float':'left','padding-left' : '5px', 'padding-top' : '3px'}); var closeBtn = $("
").css({'float':'right','padding-right' : '5px', 'padding-top' : '3px'}); var popIframe = $(""); var bottom = $(""); //titleBar.append(title).append(closeBtn); //titleBar.append("
"); //popup.append(titleBar); popup.append(popIframe); popup.append(bottom); $("body").prepend(popup); //popupTitle $('.titleBar').css({ 'cursor' : 'move', 'width' : opts.width , 'height' : '25px','background': '#FBFAFA none repeat scroll 0 0','border' : '1px solid #FBFAFA', 'color' : '#000000' }); popup.draggable(); $('.layer_close').click(function(){ //parent.optRemove(); popup.remove(); }).css({ 'color' : '#ffffff' , 'font-size' : '14px' , 'line-height' : '14px', 'font-weight' : '700' , 'text-decoration':'none' }); if(opts.bottom_display) { bottom.css({ 'width' : '100%', 'background-color' : '#7f7f7f', 'color' : 'white' , 'height' : '24px' , 'padding-top' : '5px', 'font-size' : '12px' }); var bottom_msgArea = $("
 
"); bottom_msgArea.css({ 'float' : 'left', 'padding-left' : '5px' }); var bottom_btnArea = $("
"); bottom_btnArea.css({ 'float' : 'right', 'padding-right' : '10px', 'padding-top' : '7px' }); bottom.append(bottom_msgArea).append(bottom_btnArea); $("#bottom_close").click(function(e){ //parent.optRemove(); popup.remove(); }); $("#chkPopupCookie").click(function(e){ setCookie(opts.id , "done" , this.value); //parent.optRemove(); popup.remove(); }); function setCookie(name, value, expiredays) { var todayDate = new Date(); todayDate.setDate(todayDate.getDate() + expiredays); document.cookie = name + "=" + escape(value) + "; path=/; domain=.yoons.com; expires=" + todayDate.toGMTString() + ";" } /* function setCookie( name, value, expires ) { var date = new Date(); date.setTime(date.getTime() + (expires * 24 * 60 * 60 * 1000)); document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + date.toUTCString() + ";" } */ } } var methods = { 'open' : function() { if( opts.type == 'browser' ) { popup = window.open(opts.url,opts.id,popup_options); if(!popup) { //opts.message // alert('POPUP BLOCK IS OPEN PLEASE.'); return false; }else { popup.focus(); } } else { popup.show(); } }, 'close' : function() { if( opts.type == 'browser' ) { popup.close(); } else { //parent.optRemove(); popup.remove(); } }, 'getPopup' : function() { return pupup; } } // Click Event . if( $this.length > 0 ) { $this.css('cursor','pointer'); $this.click(function(e){ methods.open(); e.preventDefault(); }); } else { methods.open(); } return methods; } $.fn.popup.defaults = { 'url' : 'index.html' , 'type' : 'browser' , 'name' : 'popup' , 'width' : '300px' , 'height' : '300px' , 'scrollbars' : 'no' , 'toolbar' : 'no' , 'menubars' : 'no' , 'locationbar' : 'no' , 'statusbar' : 'no' , 'resizable' : 'no' , 'titlebar' : 'no' , 'left' : '0px' , 'top' : '0px' , 'Message' : 'Æ˾÷Â÷´ÜÀ» ÇØÁ¦ÇØÁÖ¼¼¿ä.' , 'title' : 'Æ˾÷ ' , 'center' : false , 'bottom_display' : true , 'bottom_value' : 1 , 'bottom_message' : ' window ' }; $.extend({ popup : function (options) { return $.fn.popup(options); } }); })(jQuery);