/** * @file common/js/xe.min.js * @author NHN (developers@xpressengine.com) * @brief XE Common JavaScript **/ (function(a){function b(){return function(){var e=this;a.isArray(this._plugins)&&(this._plugins=[]);this._messages?this._messages={}:this._binded_fn={};a.each(this,function(h,c){if(!a.isFunction(c)||!/^API_([A-Z0-9_]+)$/.test(h))return!0;var b=RegExp.$1,d=function(a,c){return e[h](a,c)};e._messages?e._messages[b]=[d]:e._binded_fn[b]=d});a.isFunction(this.init)&&this.init.apply(this,arguments)}}var d,c,g=[];d={_plugins:[],_messages:{},getPlugin:function(e){e=e.toLowerCase();return a.isArray(this._plugins[e])? this._plugins[e]:[]},registerPlugin:function(e){var h=this,c=e.getName().toLowerCase();if(0<=a.inArray(e,this._plugins))return!1;this._plugins.push(e);a.isArray(this._plugins[c])||(this._plugins[c]=[]);this._plugins[c].push(e);a.each(e._binded_fn,function(a,e){h.registerHandler(a,e)});e.oApp=this;a.isFunction(e.activate)&&e.activate();return!0},registerHandler:function(e,h){var c=this._messages;e=e.toUpperCase();a.isArray(c[e])||(c[e]=[]);c[e].push(h)},cast:function(a,h){return this._cast(this,a, h||[])},broadcast:function(a,h,c){this.parent&&this.parent._broadcast&&this.parent._broadcast(a,h,c)},_cast:function(e,h,c){var b,d=this._messages;h=h.toUpperCase();if(!d["BEFORE_"+h]&&!this["API_BEFORE_"+h]||this._cast(e,"BEFORE_"+h,c)){var g=[];if(a.isArray(d[h]))for(b=0;bg.length&&(g=g[0]);(d["AFTER_"+h]||this["API_AFTER_"+h])&&this._cast(e,"AFTER_"+h,c);return/^(?:AFTER|BEFORE)_/.test(h)?a.isArray(g)?0>a.inArray(!1,g):"undefined"==typeof g?!0:!!g:g}}};c= {oApp:null,cast:function(a,c){if(this.oApp&&this.oApp._cast)return this.oApp._cast(this,a,c||[])},broadcast:function(a,c){this.oApp&&this.oApp.broadcast&&this.oApp.broadcast(this,mag,c||[])}};window.xe=a.extend(d,{getName:function(){return"Core"},createApp:function(e,c){var g=b();a.extend(g.prototype,d,c);g.prototype.getName=function(){return e};return g},createPlugin:function(e,h){var d=b();a.extend(d.prototype,c,h);d.prototype.getName=function(){return e};return d},getApps:function(){return a.makeArray(g)}, getApp:function(a){a=(a||"").toLowerCase();return"undefined"!=typeof g[a]?g[a]:null},registerApp:function(e){var c=e.getName().toLowerCase();g.push(e);a.isArray(g[c])||(g[c]=[]);g[c].push(e);e.parent=this;a.isFunction(e.activate)&&e.activate()},unregisterApp:function(e){var c=e.getName().toLowerCase(),b=a.inArray(e,g);0<=b&&(g=g.splice(b,1));a.isArray(g[c])&&(b=a.inArray(e,g[c]),0<=b&&(g[c]=g[c].splice(b,1)));a.isFunction(e.deactivate)&&e.deactivate()},broadcast:function(a,c){this._broadcast(this, a,c)},_broadcast:function(a,c,b){for(var d=0;de.length)e=Array(e);if(e.length)for(var h=0;h"+l+" "}}this.loaded_popup_menus[c]=b}b&&(c=a("#popup_menu_area").html("
    "+b+"
"),b=g.page_y,g=g.page_x,c.outerHeight()+b>a(window).height()+a(window).scrollTop()&&(b=a(window).height()- c.outerHeight()+a(window).scrollTop()),c.outerWidth()+g>a(window).width()+a(window).scrollLeft()&&(g=a(window).width()-c.outerWidth()+a(window).scrollLeft()),c.css({top:b,left:g}).show().focus())}}})(jQuery); jQuery(function(a){a.browser.msie&&a("select").each(function(a,b){for(var e=!1,h=[],d=0;d';else if(/\.flv$/i.test(a)||/\.mov$/i.test(a)||/\.moov$/i.test(a)||/\.m4v$/i.test(a))e='';else if(/\.swf/i.test(a)){var e="undefined"!=typeof enforce_ssl&&enforce_ssl?"https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0":"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0",e='',e=e+(''),h;for(h in c)"undefined"!=c[h]&&""!=c[h]&&(e+='');e+=''}else{if(jQuery.browser.mozilla||jQuery.browser.opera)g=c.autostart&&"false"!=c.autostart?"1":"0";e='.popup"),d,c,g,e;e=a.css({overflow:"scroll"}).offset();d=a.width(10).height(1E4).get(0).scrollWidth+2*e.left;c=a.height(10).width(1E4).get(0).scrollHeight+2*e.top;800>d&&(d=800+2*e.left);g=b.width();b=b.height();d!=g&&window.resizeBy(d-g,0);c!=b&&window.resizeBy(0,c-b);a.width(d-2*e.left).css({overflow:"",height:""})} function doCallModuleAction(a,b,d){exec_xml(a,b,{target_srl:d,cur_mid:current_mid,mid:current_mid},completeCallModuleAction)}function completeCallModuleAction(a,b){"success"!=a.message&&alert(a.message);location.reload()}function completeMessage(a){alert(a.message);location.reload()}function doChangeLangType(a){"string"==typeof a?setLangType(a):setLangType(a.options[a.selectedIndex].value);location.href=location.href.setQuery("l","")} function setLangType(a){var b=new Date;b.setTime(b.getTime()+6048E8);setCookie("lang_type",a,b,"/")} function doDocumentPreview(a){for(;"FORM"!=a.nodeName;)a=a.parentNode;if("FORM"==a.nodeName){a=a.getAttribute("editor_sequence");a=editorGetContent(a);window.open("","previewDocument","toolbars=no,width=700px;height=800px,scrollbars=yes,resizable=yes");var b=jQuery("#previewDocument");b.length?b=b[0]:(jQuery('
').appendTo(document.body),b= jQuery("#previewDocument")[0]);b&&(b.content.value=a,b.submit())}} function doDocumentSave(a){var b=a.form.getAttribute("editor_sequence"),d=editorRelKeys[b].content.value;if("undefined"!=typeof b&&b&&"undefined"!=typeof editorRelKeys&&"function"==typeof editorGetContent){var c=editorGetContent(b);editorRelKeys[b].content.value=c}var g={},c=jQuery(a.form).serializeArray();jQuery.each(c,function(a,b){var c=jQuery.trim(b.value);if(!c)return!0;/\[\]$/.test(b.name)&&(b.name=b.name.replace(/\[\]$/,""));g[b.name]=g[b.name]?g[b.name]+("|@|"+c):b.value});exec_xml("document", "procDocumentTempSave",g,completeDocumentSave,["error","message","document_srl"],g,a.form);editorRelKeys[b].content.value=d;return!1}function completeDocumentSave(a){jQuery("input[name=document_srl]").eq(0).val(a.document_srl);alert(a.message)}var objForSavedDoc=null;function doDocumentLoad(a){objForSavedDoc=a.form;popopen(request_uri.setQuery("module","document").setQuery("act","dispTempSavedList"))} function doDocumentSelect(a){opener&&opener.objForSavedDoc&&(opener.location.href=opener.current_url.setQuery("document_srl",a).setQuery("act","dispBoardWrite"));window.close()}function viewSkinInfo(a,b){popopen("./?module=module&act=dispModuleSkinInfo&selected_module="+a+"&skin="+b,"SkinInfo")}var addedDocument=[];function doAddDocumentCart(a){addedDocument[addedDocument.length]=a.value;setTimeout(function(){callAddDocumentCart(addedDocument.length)},100)} function callAddDocumentCart(a){1>addedDocument.length||a!=addedDocument.length||(a=[],a.srls=addedDocument.join(","),exec_xml("document","procDocumentAddCart",a,null),addedDocument=[])} function transRGB2Hex(a){if(!a)return a;if(-1a.toLowerCase().indexOf("rgb"))return a;a=a.replace(/^rgb\(/i,"").replace(/\)$/,"");value_list=a.split(",");a="";for(var b=0;b>2,d=(d&3)<<4|c>>4,h=(c&15)<<2|g>>6,n=g&63,isNaN(c)?h=n=64:isNaN(g)&&(n=64),b=b+this._keyStr.charAt(e)+this._keyStr.charAt(d)+this._keyStr.charAt(h)+this._keyStr.charAt(n);return b},decode:function(a){var b="",d,c,g,e,h,n=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");n< a.length;)d=this._keyStr.indexOf(a.charAt(n++)),c=this._keyStr.indexOf(a.charAt(n++)),e=this._keyStr.indexOf(a.charAt(n++)),h=this._keyStr.indexOf(a.charAt(n++)),d=d<<2|c>>4,c=(c&15)<<4|e>>2,g=(e&3)<<6|h,b+=String.fromCharCode(d),64!=e&&(b+=String.fromCharCode(c)),64!=h&&(b+=String.fromCharCode(g));return b=Base64._utf8_decode(b)},_utf8_encode:function(a){a=a.replace(/\r\n/g,"\n");for(var b="",d=0;dc?b+=String.fromCharCode(c):(127c?b+=String.fromCharCode(c>> 6|192):(b+=String.fromCharCode(c>>12|224),b+=String.fromCharCode(c>>6&63|128)),b+=String.fromCharCode(c&63|128))}return b},_utf8_decode:function(a){for(var b="",d=0,c=c1=c2=0;dc?(b+=String.fromCharCode(c),d++):191c?(c2=a.charCodeAt(d+1),b+=String.fromCharCode((c&31)<<6|c2&63),d+=2):(c2=a.charCodeAt(d+1),c3=a.charCodeAt(d+2),b+=String.fromCharCode((c&15)<<12|(c2&63)<<6|c3&63),d+=3);return b}}; if("undefined"==typeof resizeImageContents)var resizeImageContents=function(){};if("undefined"==typeof activateOptionDisabled)var activateOptionDisabled=function(){};objectExtend=jQuery.extend;function toggleDisplay(a){jQuery("#"+a).toggle()}function svc_folder_open(a){jQuery("#_folder_open_"+a).hide();jQuery("#_folder_close_"+a).show();jQuery("#_folder_"+a).show()}function svc_folder_close(a){jQuery("#_folder_open_"+a).show();jQuery("#_folder_close_"+a).hide();jQuery("#_folder_"+a).hide()} function open_calendar(a,b,d){"undefined"==typeof b&&(b="");var c="./common/tpl/calendar.php?";a&&(c+="fo_id="+a);b&&(c+="&day_str="+b);d&&(c+="&callback_func="+d);popopen(c,"Calendar")}var loaded_popup_menus=XE.loaded_popup_menus;function createPopupMenu(){}function chkPopupMenu(){}function displayPopupMenu(a,b,d){XE.displayPopupMenu(a,b,d)}function GetObjLeft(a){return jQuery(a).offset().left}function GetObjTop(a){return jQuery(a).offset().top} function replaceOuterHTML(a,b){jQuery(a).replaceWith(b)}function getOuterHTML(a){return jQuery(a).html().trim()}function setCookie(a,b,d,c){a=a+"="+escape(b)+(d?"; expires="+d.toGMTString():"")+"; path="+(c?c:"/");document.cookie=a}function getCookie(a){if(a=document.cookie.match(RegExp(a+"=(.*?)(?:;|$)")))return unescape(a[1])}function is_def(a){return"undefined"!=typeof a}function ucfirst(a){return a.charAt(0).toUpperCase()+a.slice(1)}function get_by_id(a){return document.getElementById(a)} jQuery(function(a){a(document).click(function(b){var d=a("#popup_menu_area");d.length||(d=a('