1;(function($, window, document, undefined) 2{ 3 4 var defaults = { 5 title : "Layer-Popup" // ë ì´ì´ íì íì´í 6 , width : "500" // ì²ì ì°½ í¬ê¸° 7 , height : "300" // ì²ì ì°½ í¬ê¸° 8 , min_width : "500" // 구í ìë¬ì * ì°¨í, 모ë°ì¼ ì§ìì© 9 , min_height : "300" // 구í ìë¬ì * ì°¨í, 모ë°ì¼ ì§ìì© 10 , max_width : "1400" // í°ì°½ í¬ê¸° 11 , max_height : "600" // í°ì°½ í¬ê¸° 12 , url : "" // URL ì ë ¥ **** íì ì¡°ê±´ 13 , div_target : "" 14 , parameter : {} // íë¼ë¯¸í° ì ë ¥ ì ë°°ì´ë¡ ì ë ¥ 15 , top : "0" // ìì¹ ê° 16 , left : "0" // ìì¹ ê° 17 , returnObj : null // ì°½ì´ ë«íìë ëëìê°ë ê°ì± **** íì ì¡°ê±´ 18 , UnderReset : false // 구í ìë¬ì 19 , animate_open : "0" // ì°½ì´ ì´ë¦´ë ìë(ì ëë©ì´ì í¨ê³¼) 20 , animate_close : "0" // ì°½ì´ ë«íë ìë(ì ëë©ì´ì í¨ê³¼) 21 , animate_reload : "0" // 구í ìë¬ì 22 , animate_move : "slow" // ì°½ ì¬ì´ì¦ ë³ê²½ì ìë ì´ë ë¨, ì´ëì ì ëë©ì´ì í¨ê³¼ 23 , close_button : "<button class='btn-close' type='button'><span>íì¬ì°½ ë«ê¸°</span></button>" 24 , reload_button : "<button class='btn-reload' type='button'><span>ë¤ìì´ê¸°</span></button>" 25 , minsize_button : "<button class='btn-minsize' type='button'><span>ì°½ ìµìí í기</span></button>" 26 , maxsize_button : "<button class='btn-maxsize' type='button'><span>ì°½ ìµëí í기</span></button>" 27 , close_button_yn : true 28 , reload_button_yn : true 29 , minmaxsize_button_yn : true 30 }; 31 32 function Plugin(element, options) 33 { 34 this.content = null; 35 this.el = $(element); 36 this.options = $.extend({}, defaults, options); 37 this.init(); 38 } 39 40 Plugin.prototype = { 41 42 init: function() { 43 var layer = this; 44 45 if(this.isNullOrBlank(layer.options.url)&& this.isNullOrBlank(layer.options.div_target)) { 46 alert("í¸ì¶ URL ëë ëìì´ ììµëë¤."); 47 return false; 48 } 49 50 layer.options.min_width = layer.options.width; 51 layer.options.min_height = layer.options.height; 52 53 layer.drawWindow(); 54 layer.showLayerPopup(); 55 layer.setWindowResizing(); 56 layer.pageLoad(); 57 58 } 59 60 , isNullOrBlank : function(val){ 61 if(val == null || val == "")return true; 62 else return false; 63 } 64 65 , drawWindow : function(){ 66 var layer = this; 67 layer.window = $("<div id='layout-popup-wrap' style='display:none;'></div>"); 68 layer.con_wrap = $("<div id='popup-wrap' tabindex='0'></div>"); 69 layer.con_head = $("<div class='pop-head'></div>"); 70 layer.con_title = $("<h1 class='htit'></h1>"); 71 layer.con_cont = $("<div class='pop-cont'></div>"); 72 73 74 layer.setTitle(layer.options.title); 75 76 layer.con_head.append(layer.con_title); 77 78 layer.con_wrap.append(layer.con_head).append(layer.con_cont).append(layer.win_close_btn); 79 layer.window.append(layer.con_wrap); 80 81 82 83 var btn_cnt = 1; 84 85 // ë«ê¸° ë²í¼ ìì± 86 if(layer.options.close_button_yn){ 87 layer.win_close_btn = $(layer.options.close_button); 88 layer.con_wrap.append(layer.win_close_btn); 89 layer.win_close_btn.bind("click", function(){ 90 layer.closeLayerPopup(); 91 }); 92 layer.win_close_btn.addClass("pop-btn-" + btn_cnt); 93 btn_cnt++; 94 } 95 96 97 // 리ë¡ë ë²í¼ ìì± 98 if(layer.options.reload_button_yn){ 99 layer.win_reload_btn = $(layer.options.reload_button); 100 layer.con_wrap.append(layer.win_reload_btn); 101 layer.win_reload_btn.bind("click", function(){ 102 layer.reload(); 103 }); 104 layer.win_reload_btn.addClass("pop-btn-" + btn_cnt); 105 btn_cnt++; 106 } 107 108 // ì°½í¬í¤ ì¡°ì ë²í¼ ìì± 109 if(layer.options.minmaxsize_button_yn){ 110 layer.win_minsize_btn = $(layer.options.minsize_button); 111 layer.win_maxsize_btn = $(layer.options.maxsize_button); 112 layer.con_wrap.append(layer.win_minsize_btn); 113 layer.con_wrap.append(layer.win_maxsize_btn); 114 layer.win_minsize_btn.bind("click", function(){ 115 $(this).hide(); 116 layer.win_maxsize_btn.show(); 117 layer.options.width = layer.options.min_width; 118 layer.options.height = layer.options.min_height; 119 layer.setWindowResizing(); 120 }); 121 layer.win_maxsize_btn.bind("click", function(){ 122 $(this).hide(); 123 layer.win_minsize_btn.show(); 124 layer.options.width = layer.options.max_width; 125 layer.options.height = layer.options.max_height; 126 layer.setWindowResizing(); 127 }); 128 layer.win_minsize_btn.addClass("pop-btn-" + btn_cnt).hide(); 129 layer.win_maxsize_btn.addClass("pop-btn-" + btn_cnt); 130 btn_cnt++; 131 } 132 133 // ìëì° ì¬ì´ì¦ ë³ê²½ ì´ë²¤í¸ 134 $(window).resize(function() { 135 if(this.resizeTO) { clearTimeout(this.resizeTO); } 136 this.resizeTO = setTimeout(function() { $(this).trigger('resizeEnd'); }, 100); 137 }); 138 $(window).on('resizeEnd', function() { 139 layer.moveLayer(); 140 }); 141 142 $(document.body).append(layer.window); 143 } 144 145 , setWindowResizing : function(){ 146 var layer = this; 147 148 // ì°½í¬ê¸° ì¡°ì 149 // ì°½ ëì´ ì¤ì 150 layer.options.option_height = layer.options.height * 1; 151 layer.options.title_height = layer.con_head.css("height").replace("px", "")* 1; 152 layer.options.cont_height = (1 * layer.con_cont.css("margin-top").replace("px", "")) + (1 * layer.con_cont.css("margin-bottom").replace("px", "")); 153 layer.options.total_height = layer.options.option_height + layer.options.title_height + layer.options.cont_height; 154 155 layer.getPosition(); 156 157 // ì§ì í í¬ê¸°ë³´ë¤ ì°½ í¬ê¸°ê° ììê²½ì° ì²ë¦¬ & 모ë°ì¼ 158 var auto_with = layer.options.width; 159 var auto_height = layer.options.total_height; 160 var auto_cont_height = layer.options.height; 161 if($(window).width() <= layer.options.width) auto_with = $(window).width(); 162 if($(window).height() <= layer.options.total_height){ 163 auto_height = $(window).height(); 164 auto_cont_height = auto_height - (layer.options.title_height + layer.options.cont_height); 165 } 166 167 // ì°½ ìì¹ ì¡°ì 기본 168 layer.con_cont.css("height", auto_cont_height); 169 layer.con_wrap.animate({ 170 "width": auto_with 171 , "height": auto_height 172 , "top": layer.options.top
173 , "left": layer.options.left 174 }, layer.options.animate_open); 175 176 // ë°ëì ì¤í¬ë¡¤ ì¨ê¸°ê¸° 177 $(document.body).css("overflow", "hidden"); 178 } 179 180 , setTitle : function(title){ 181 var layer = this; 182 var title = title || layer.options.title; 183 layer.con_title.html(title); 184 } 185 186 , setContent : function(content){ 187 var layer = this; 188 var inner_content = content || "" ; 189 190 layer.con_cont.html(inner_content); 191 } 192 193 , pageLoad : function(){ 194 var layer = this; 195 196 if(!this.isNullOrBlank(layer.options.div_target)){ 197 var data = $(layer.options.div_target).html(); 198 layer.setContent(data); 199 }else if(!this.isNullOrBlank(layer.options.url)){ 200 $.ajax({ 201 type : "post", 202 url : layer.options.url, 203 data: layer.options.parameter, 204 dataType:"text", 205 success : function(data){ 206 layer.setContent(data); 207 }, 208 error : function(xhr, status, error){ alert("ìì ìíì¤ ì¤ë¥ê° ë°ìíìµëë¤.\në¤ì ìëí´ ì£¼ì¸ì."); } 209 }); 210 } 211 212 } 213 214 , showLayerPopup : function (){ 215 var layer = this; 216 $(document.body).css("overflow", "hidden"); 217 layer.window.show(layer.options.animate_open); 218 219 if(layer.con_cont.find("select, input[type!=hidden]").length > 0){ 220 layer.con_cont.find("select, input[type!=hidden]").first().focus(); 221 }else{ 222 layer.con_wrap.focus(); 223 } 224 225 } 226 227 , closeLayerPopup : function (){ 228 var layer = this; 229 $(document.body).css("overflow","visible"); 230 layer.window.hide(layer.options.animate_close, function(){ 231 $(layer.options.returnObj).focus(); 232 layer.el.removeData("layerPopup"); 233 layer.window.remove(); 234 $(window).off('resizeEnd'); 235 }); 236 } 237 238 , moveLayer : function(){ 239 var layer = this; 240 layer.setWindowResizing(); 241 layer.con_wrap.animate({ "top": layer.options.top, "left": layer.options.left }, layer.options.animate_move); 242 } 243 244 , getPosition : function(){ 245 var layer = this; 246 layer.options.top = Math.max(0, (($(window).height() - layer.options.total_height)/ 2)) + "px"; 247 layer.options.left = Math.max(0, (($(window).width() - layer.options.width)/ 2)) + "px"; 248 } 249 250 , reload : function (new_option){ 251 var layer = this; 252 layer.options = $.extend({}, layer.options, new_option); 253 layer.setContent(); // ì´ê¸°í 254 layer.setTitle(layer.options.title); 255 layer.pageLoad(); 256 layer.setWindowResizing(); 257 } 258 259 }; 260 261 $.fn.layerPopup = function(params, a) { 262 var lists = this, 263 retval = this; 264 265 lists.each(function() 266 { 267 268 var plugin = $(this).data("layerPopup"); 269 270 if(!plugin) { 271 $(this).data("layerPopup", new Plugin(this, params)); 272 $(this).data("layerPopup-id", new Date().getTime()); 273 } else { 274 if(typeof params === 'string' && typeof plugin[params] === 'function' && typeof a === 'undefined'){ 275 retval = plugin[params](); 276 }else if(typeof params === 'string' && typeof plugin[params] === 'function'){ 277 retval = plugin[params](a); 278 } 279 } 280 }); 281 282 return retval || lists; 283 }; 284 285})(window.jQuery || window.Zepto, window, document);
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.