/* NAVER (developers@xpressengine.com) */ // core update check jQuery(function($) { var core_update = $('.core_update'); if (!core_update.size()) { return; } var version_decode = function(str) { var version_number = 0; var extra_strings = ''; var parts = str.split(/[\.-]/); $.each(parts, function(i, part) { if (part.match(/^[0-9]+$/)) { version_number += parseInt(part, 10) * Math.pow(1000, 3 - i); } else { extra_strings = extra_strings + part; } }); return String(version_number) + (extra_strings === '' ? 'z' : extra_strings); }; var current_version = version_decode(core_update.data('current-version')); $.ajax({ url: 'https://api.rhymix.org/version.json', dataType: 'json', cache: true, success: function(data) { var latest_version = version_decode(data.latest); if (latest_version > current_version) { var version_replace = core_update.find('p').first(); version_replace.html(version_replace.html().replace('$VERSION', data.latest)); core_update.show(); } } }); }); // install module function doInstallModule(module) { var params = []; params.module_name = module; exec_json('install.procInstallAdminInstall', params, completeInstallModule); } // upgrade module function doUpdateModule(module) { var params = []; params.module_name = module; exec_json('install.procInstallAdminUpdate', params, completeInstallModule); } function completeInstallModule(ret_obj) { alert(ret_obj.message); location.reload(); } jQuery(function($){ // iSO mobile device toolbar remove window.scrollTo(0,0); // TARGET toggle $(document.body).on('click', '.x [data-toggle]', function(){ var $this = $(this); if($this.is('a') && $this.attr('href') != $this.attr('data-toggle')){ var target = $this.attr('href'); $this.attr('data-toggle', target); } var $target = $($this.attr('data-toggle')); var focusable = 'a,input,button,textarea,select'; $target.toggle(); if($target.is(':visible') && !$target.find(focusable).length){ $target.not(':disabled').attr('tabindex','0').focus(); } else if($target.is(':visible') && $target.find(focusable).length) { $target.not(':disabled').find(focusable).eq(0).focus(); } else { $this.focus(); } return false; }); // TARGET show $(document.body).on('click', '.x [data-show]', function(){ var $this = $(this); if($this.is('a') && $this.attr('href') != $this.attr('data-show')){ var target = $this.attr('href'); $this.attr('data-show', target); } $($this.attr('data-show')).show().attr('tabindex','0').focus(); return false; }); // TARGET hide $(document.body).on('click', '.x [data-hide]', function(){ var $this = $(this); if($this.is('a') && $this.attr('href') != $this.attr('data-hide')){ var target = $this.attr('href'); $this.attr('data-hide', target); } $($this.attr('data-hide')).hide(); $this.focus(); return false; }); // Tab Navigation $.fn.xeTabbable = function(){ $(this).each(function(){ var $this = $(this); $this.find('>.x_nav-tabs>li>a').each(function(index){ $(this).attr('data-index', index+1); }); $this.find('>.x_tab-content>.x_tab-pane').each(function(index){ $(this).attr('data-index', index+1); }); }); $('.x .x_tab-content>.x_tab-pane:not(".x_active")').hide(); }; $('.x .x_tabbable').xeTabbable(); $(document.body).on('click', '.x .x_nav-tabs>li>a[href^="#"]', function(){ var $this = $(this); if($this.parent('li').hasClass('x_disabled')){ return false; } $this.parent('li').addClass('x_active').siblings().removeClass('x_active'); $this.closest('.x_nav-tabs').next('.x_tab-content').find('>.x_tab-pane').eq($this.attr('data-index')-1).addClass('x_active').show().siblings('.x_tab-pane').removeClass('x_active').hide(); $this.parents('.x_tabbable').trigger('tab_change', [parseInt($this.attr('data-index'))-1, $this]); return false; }); // #content reflow function reflow(){ // Browser bug fix & resize height var $xBody = $('.x>.body'); var $xGnb = $xBody.find('>.gnb'); var $xContent = $xBody.children('#content.content'); setTimeout(function(){ $xContent.removeAttr('style'); if($xGnb.height() > $xContent.height()){ $xContent.height($xGnb.height()); } }, 100); } // GNB $.fn.gnb = function(){ var $xBody = $('.x>.body'); var $xGnb = $xBody.find('>.gnb'); var $xGnb_li = $xGnb.find('>ul>li:not(.active_clone)'); // Add icon $xGnb_li.find('>a').prepend(''); $xGnb_li.find('>ul').prev('a').append(''); // Active Submenu Copy $xGnb_li.each(function(index){ $(this).attr('data-index', index+1); }); // GNB Click toggle $xGnb_li.find('>a').click(function(){ var $this = $(this); var $parent = $(this).parent('li'); var hasOpen = $parent.hasClass('open'); var hasActive = $parent.hasClass('active'); var hasList = $parent.find('>ul').length >= 1; var hasWide = $xBody.hasClass('wide'); function openGNB(){ $xBody.removeClass('wide'); reflow(); } if(!hasOpen && !hasActive && hasList){ // Down to open $parent.addClass('open').find('>ul').slideDown(100); openGNB(); XE.cookie.set('__xe_admin_gnb_tx_' + $this.data('href'), 'open', { expires: 365 }); return false; } else if(hasOpen && !hasActive && hasList && !hasWide){ // Up to close $parent.removeClass('open').find('>ul').slideUp(100); openGNB(); XE.cookie.remove('__xe_admin_gnb_tx_' + $this.data('href')); return false; } else if(hasWide && !hasList || hasActive || hasWide && hasOpen){ // Right to open openGNB(); return false; } }); // GNB Mobile Toggle $("a.mobile_menu_open").click(function(){ $xGnb.toggleClass('open'); if($(this).parent('.gnb').hasClass('open')){ XE.cookie.set('__xe_admin_gnb_status', 'open', { expires: 365 }); }else{ XE.cookie.remove('__xe_admin_gnb_status'); } return false; }); $xGnb.find('>a[href="#gnbNav"]').click(function(){ $xGnb.toggleClass('open'); $xBody.toggleClass('wide'); if($(window).width() <= 980 && !$xGnb.hasClass('open')){ $('#gnbNav').removeClass('ex'); } reflow(); // remember status if($(this).parent('.gnb').hasClass('open')){ XE.cookie.set('__xe_admin_gnb_status', 'open', { expires: 365 }); }else{ XE.cookie.remove('__xe_admin_gnb_status'); } return false; }); // Expert Menu Toggle $xGnb.find('.exMenu>button').click(function(){ $('#gnbNav').toggleClass('ex'); reflow(); // remember status if($('#gnbNav').hasClass('ex')){ XE.cookie.set('__xe_admin_gnb_ex_status', 'open', { expires: 365 }); }else{ XE.cookie.remove('__xe_admin_gnb_ex_status'); } }); // re-create cookie var gnb_status = getCookie('__xe_admin_gnb_status'); if(gnb_status){ XE.cookie.set('__xe_admin_gnb_status', gnb_status, { expires: 365 }); } var gnb_ex_status = getCookie('__xe_admin_gnb_ex_status'); if(gnb_ex_status){ XE.cookie.set('__xe_admin_gnb_xe_status', gnb_ex_status, { expires: 365 }); } if(typeof __xe_admin_gnb_txs != 'undefined'){ for(var i in __xe_admin_gnb_txs){ var item = __xe_admin_gnb_txs[i]; var status = getCookie(item); if (status === 'open') { XE.cookie.set(item, status, { expires: 365 }); } } } }; $('.gnb').gnb(); // Default Language Selection $('.x #lang') .mouseleave(function(){ $(this).hide(); }) .focusout(function(){ var $this = $(this); setTimeout(function(){ if(!$this.find('a:focus').length){ $this.mouseleave(); } }, 500); }); // Check All $('.x th :checkbox') .change(function() { var $this = $(this), name = $this.data('name'); $this.closest('table') .find(':checkbox') .filter(function(){ var $this = $(this); return !$this.prop('disabled') && (($this.attr('name') == name) || ($this.data('name') == name)); }) .prop('checked', $this.prop('checked')) .end() .end() .trigger('update.checkbox', [name, this.checked]); }); // Pagination $(document.body).on('click', '.x .x_pagination .x_disabled, .x .x_pagination .x_active', function(){ return false; }); // Section Toggle if($('.x .section').length > 1){ var $section_heading = $('.x .section').find('>h1:first'); $section_heading.each(function(){ var $this = $(this); if($this.next().length){ $this.append(''); } }); $('.x .section.collapsed>h1>.snToggle').removeClass('x_icon-chevron-up').addClass('x_icon-chevron-down'); $section_heading.click(function(){ var $this = $(this); var $btnToggle = $(this).find('>.snToggle'); var $section = $this.closest('.section'); if(!$section.hasClass('collapsed')){ $section.addClass('collapsed'); $btnToggle.removeClass('x_icon-chevron-up').addClass('x_icon-chevron-down'); } else { $section.removeClass('collapsed'); $btnToggle.removeClass('x_icon-chevron-down').addClass('x_icon-chevron-up'); } reflow(); }); } // Alert Closer var $xAlert = $('.x .x_alert'); $xAlert.prepend(''); $xAlert.children('.x_close').click(function(){ $(this).parent('.x_alert').hide(); }); // Desabled Buttons $('.x .x_btn').click(function(){ if($(this).hasClass('x_disabled')){ return false; } }); // Vertical Divider $.fn.vr = function(){ this.each(function(){ var $this = $(this); if($this.text() == '|'){ $this.addClass('vr').filter(':first-child, :last-child').remove(); } }); }; $('.x i').vr(); // label[for] + input[id]/textarea[id]/select[id] creator $.fn.labelMaker = function(){ this.each(function(index){ index = index + 1; var $this = $(this); var input = 'input, textarea, select'; var check = ':radio, :checkbox'; var id = '[id]'; var value = 'i' + index; if($this.next(input).filter(id).not(check).length){ // next input, textarea, select id true $this.attr('for', $this.next().attr('id')); } else if ($this.next(input).not(id).not(check).length) { // next input, textarea, select id false $this.attr('for', value).next().attr('id', value); } else if ($this.prev(check).filter(id).length) { // prev :radio :checkbox id true $this.attr('for', $this.prev().attr('id')); } else if ($this.prev(check).not(id).length) { // prev :radio :checkbox id false $this.attr('for', value).prev().attr('id', value); } else if ($this.children(input).filter(id).length) { // children id true $this.attr('for', $this.children(input).filter(id).eq(0).attr('id')); } else if ($this.children(input).not(id).length) { // children id false $this.attr('for', value).children(input).not(id).eq(0).attr('id', value); } }); }; $('label:not([for])').labelMaker(); // :radio, :checkbox checked class $.fn.checkToggle = function(){ function check(){ setTimeout(function(){ $(':checked').parent('label').addClass('checked'); $(':not(":checked")').parent('label').removeClass('checked'); },0); } this.change(check); check(); }; $(':radio, :checkbox').checkToggle(); // File input .overlap style $.fn.fileTypeOverlap = function(){ this.each(function(){ var $this = $(this); $this.wrap('').before($this.attr('title')); }); }; $('input[type="file"].overlap').fileTypeOverlap(); // Table Col Span $.fn.tableSpan = function(){ this.each(function(){ var $this = $(this); var thNum = $this.find('>thead>tr:eq(0)>th').length; var $tdTarget = $this.find('>tbody>tr:eq(0)>td:only-child'); if(thNum != $tdTarget.attr('colspan')){ $tdTarget.attr('colspan', thNum).css('text-align','center'); } }); }; $('table').tableSpan(); }); // Modal Window jQuery(function($){ var ESC = 27; var xeModalStack = []; var xeModalInitailZIndex = 1040; // modal backdrop var $xeModalBackdrop = $('
').appendTo('body').hide(); $.fn.xeModalWindow = function(){ this .not('.xe-modal-window') .addClass('xe-modal-window') .each(function(){ $( $(this).attr('href') ).addClass('x').hide(); }) .click(function(){ var $this = $(this), $modal, $btnClose, disabled; // get and initialize modal window $modal = $( $this.attr('href') ); if($modal.data('state') == 'showing') { $this.trigger('close.mw'); } else { $this.trigger('open.mw'); } return false; }) .bind('open.mw', function(){ var $this = $(this), $modal, $btnClose, disabled, before_event, duration; // get modal window $modal = $( $this.attr('href') ); // if stack top is this modal, ignore if(xeModalStack.length && xeModalStack[xeModalStack.length - 1].get(0) == $modal.get(0)){ return; } if(!$modal.parent('body').length) { $btnClose = $(''); $btnClose.click(function(){ $modal.data('anchor').trigger('close.mw'); }); $modal.find('[data-hide]').click(function(){ $modal.data('anchor').trigger('close.mw'); }); $('body').append($modal); $modal.prepend($btnClose); // prepend close button } // set the related anchor $modal.data('anchor', $this); // before event trigger before_event = $.Event('before-open.mw'); $this.trigger(before_event); // is event canceled? if(before_event.isDefaultPrevented()) return false; // get duration duration = $this.data('duration') || 'fast'; // set state : showing $modal.data('state', 'showing'); // after event trigger function after(){ $this.trigger('after-open.mw'); } $(document).bind('keydown.mw', function(event){ if(event.which == ESC) { $this.trigger('close.mw'); return false; } }); $modal .fadeIn(duration, after) .find('button.x_close:first').focus(); $('body').css('overflow','hidden'); // push to stack xeModalStack.push($modal); // show backdrop and adjust z-index var zIndex = xeModalInitailZIndex + ((xeModalStack.length - 1) * 2); $xeModalBackdrop.css('z-index', zIndex).show(); var xeModalBackdropHeight = $xeModalBackdrop.height(); var modalBodyHeight = xeModalBackdropHeight; modalBodyHeight -= $modal.find('.x_modal-header:visible').height(); modalBodyHeight -= $modal.find('.x_modal-footer:visible').height(); modalBodyHeight -= 150; $modal.find('.x_modal-body').css('height', modalBodyHeight); $modal.css('z-index', zIndex + 1); }) .bind('close.mw', function(){ var $this = $(this), before_event, $modal, duration; // get modal window $modal = $( $this.attr('href') ); // if stack top is not this modal, ignore if(xeModalStack.length && xeModalStack[xeModalStack.length - 1].get(0) != $modal.get(0)){ return; } // before event trigger before_event = $.Event('before-close.mw'); $this.trigger(before_event); // is event canceled? if(before_event.isDefaultPrevented()) return false; // get duration duration = $this.data('duration') || 'fast'; // set state : hiding $modal.data('state', 'hiding'); // after event trigger function after(){ $this.trigger('after-close.mw'); } $modal.fadeOut(duration, after); $('body').css('overflow','auto'); $this.focus(); // pop from stack xeModalStack.pop(); // hide backdrop and adjust z-index var zIndex = xeModalInitailZIndex + ((xeModalStack.length - 1) * 2); if(xeModalStack.length){ $xeModalBackdrop.css('z-index', zIndex); }else{ $xeModalBackdrop.hide(); } }); $('div.x_modal').addClass('x'); }; $('a.modalAnchor').xeModalWindow(); }); // Content Toggler jQuery(function($){ var dont_close_this_time = false; var ESC = 27; $.fn.xeContentToggler = function(){ this .not('.xe-content-toggler') .addClass('xe-content-toggler') .each(function(){ var $anchor = $(this); $layer = $($anchor.attr('href')); $layer.hide() .not('.xe-toggling-content') .addClass('xe-toggling-content') .mousedown(function(event){ dont_close_this_time = true; }) .focusout(function(event){ setTimeout(function(){ if(!dont_close_this_time && !$layer.find(':focus').length && $layer.data('state') == 'showing') $anchor.trigger('close.tc'); dont_close_this_time = false; }, 1); }); }) .click(function(){ var $this = $(this), $layer; // get content container $layer = $( $this.attr('href') ); // set anchor object $layer.data('anchor', $this); if($layer.data('state') == 'showing') { $this.trigger('close.tc'); } else { $this.trigger('open.tc'); } return false; }) .bind('open.tc', function(){ var $this = $(this), $layer, effect, duration; // get content container $layer = $( $this.attr('href') ); // get effeect effect = $this.data('effect'); // get duration duration = $this.data('duration') || 'fast'; // set state : showing $layer.data('state', 'showing'); // before event trigger $this.trigger('before-open.tc'); dont_close_this_time = false; // When mouse button is down or when ESC key is pressed close this layer $(document) .unbind('mousedown.tc keydown.tc') .bind('mousedown.tc keydown.tc', function(event){ if(event) { if(event.type == 'keydown' && event.which != ESC) return true; if(event.type == 'mousedown') { var $t = $(event.target); if($t.is('html,.tgAnchor,.tgContent') || $layer.has($t).length) return true; } } $this.trigger('close.tc'); return false; } ); // triggering after function trigger_after(){ $this.trigger('after-open.tc'); } switch(effect) { case 'slide': $layer.slideDown(duration, trigger_after); break; case 'slide-h': var w = $layer.css({'overflow-x':'',width:''}).width(); $layer .show() .css({'overflow-x':'hidden',width:'0px'}) .animate({width:w}, duration, function(){ $layer.css({'overflow-x':'',width:''}); trigger_after(); }); break; case 'fade': $layer.fadeIn(duration, trigger_after); break; default: $layer.show(); $this.trigger('after-open.tc'); } }) .bind('close.tc', function(){ var $this = $(this), $layer, effect, duration; // unbind document's event handlers $(document).unbind('mousedown.tc keydown.tc'); // get content container $layer = $( $this.attr('href') ); // get effeect effect = $this.data('effect'); // get duration duration = $this.data('duration') || 'fast'; // set state : hiding $layer.data('state', 'hiding'); // before event trigger $this.trigger('before-close.tc'); // triggering after function trigger_after(){ $this.trigger('after-close.tc'); } // close this layer switch(effect) { case 'slide': $layer.slideUp(duration, trigger_after); break; case 'slide-h': $layer.animate({width:0}, duration, function(){ $layer.hide(); trigger_after(); }); break; case 'fade': $layer.fadeOut(duration, trigger_after); break; default: $layer.hide(); $this.trigger('after-close.tc'); } }); return this; }; $('a.tgAnchor').xeContentToggler(); }); // Module finder jQuery(function($){ $.fn.xeModuleFinder = function(){ this .not('.xe-module-finder') .addClass('xe-module-finder') .find('a.tgAnchor.findsite') .bind('before-open.tc', function(){ var $this, $ul, val; $this = $(this); $ul = $($this.attr('href')).find('>ul'); val = $this.prev('input:text').val(); function on_complete(data) { var $li, list = data.site_list, i, c; $ul.empty(); $this.closest('.modulefinder').find('.moduleList,.moduleIdList').attr('disabled','disabled'); if(data.error || !$.isArray(list)) { $this.trigger('close.tc'); return; } for(i=0,c=list.length; i < c; i++) { $li = $('').appendTo($ul); $('').text(list[i].domain).data('site_srl', list[i].site_srl).appendTo($li); } } $.exec_json('admin.getSiteAllList', {domain:val}, on_complete); }) .end() .find('.tgContent.suggestion') .delegate('button','click',function(){ var $this, $finder; $this = $(this); $finder = $this.closest('.modulefinder'); function on_complete(data) { var $mod_select, list = data.module_list, x; if(data.error || !list) return; $mod_select = $finder.find('.moduleList').data('module_list', list).removeAttr('disabled').empty(); for(x in list) { if(!list.hasOwnProperty(x)) continue; $('').attr('value', x).text(list[x].title).appendTo($mod_select); } $mod_select.prop('selectedIndex', 0).change().focus(); if(!$mod_select.is(':visible')) { $mod_select .slideDown(100, function(){ $finder.find('.moduleIdList:not(:visible)').slideDown(100).trigger('show'); }) .trigger('show'); } } $finder.find('a.tgAnchor.findsite').trigger('close.tc'); $.exec_json('module.procModuleAdminGetList', {site_srl:$this.data('site_srl')}, on_complete); }) .end() .find('.moduleList,.moduleIdList').hide().end() .find('.moduleList') .change(function(){ var $this, $mid_select, val, list; $this = $(this); val = $this.val(); list = $this.data('module_list'); if(!list[val]) return; list = list[val].list; $mid_select = $this.closest('.modulefinder').find('.moduleIdList').removeAttr('disabled').empty(); for(var x in list) { if(!list.hasOwnProperty(x)) continue; $('').attr('value', list[x].module_srl).text(list[x].browser_title).appendTo($mid_select); } $mid_select.prop('selectedIndex', 0).change(); }); return this; }; $('.modulefinder').xeModuleFinder(); }); // Module Search : A New Version Of Module Finder jQuery(function($){ var tmpCount = 0; _xeModuleSearch = function(){ var t = this; var $t = $(this); var is_multiple = $t.data('multiple'); if(!is_multiple) is_multiple = ''; var id = '__module_searcher_' + tmpCount; tmpCount++; // add html $.exec_json('module.getModuleAdminModuleSearcherHtml', {'id': id, 'is_multiple': is_multiple}, function(data){ if(!data || !data.html) return; $t.after(data.html).addClass('tgAnchor').attr('href', '#' + id).xeContentToggler(); var $moduleWindow = $t.next(".moduleWindow"); var $siteListDiv = $moduleWindow.find('.siteList'); var $moduleListDiv = $moduleWindow.find('.moduleList'); var $instanceListDiv = $moduleWindow.find('.instanceList'); var $siteList = $siteListDiv.find('>ul'); var $moduleList = $moduleListDiv.find('>ul'); var $instanceList = $instanceListDiv.find('>select'); var $siteFinder = $moduleWindow.find('input.siteFinder'); var aSiteListData; var MAX_LIST_HEIGHT = 280; function setListSize($UL, nHeight){ var nWidth, $div; $UL.find('li div').width(''); $UL.css('height', 'auto'); $UL.css('overflow-y', ''); if($UL.height() > nHeight){ $div = $UL.find('li div'); $div.width($div.width()-20+'px'); $UL.css('height', nHeight+'px'); $UL.css('overflow-y', 'auto'); } } function setSiteList(sFilter){ var sDomain; var rxFilter = new RegExp(sFilter, "ig"); var list = aSiteListData; var replaceHighlight = function(sKeyword){ return ''+sKeyword+''; }; $siteList.empty(); for(i=0,c=list.length; i < c; i++) { sDomain = list[i].domain; if(sFilter){ if(!sDomain.match(rxFilter)) continue; sDomain = sDomain.replace(rxFilter, replaceHighlight); } $li = $('').appendTo($siteList); $('').attr('href', '#').html( sDomain ).data('site_srl', list[i].site_srl).appendTo($li); } setListSize($siteList, MAX_LIST_HEIGHT - $siteFinder.parent("div").height()); if(list.length == 1){ $siteList.find('a').trigger('click'); } } $siteFinder.keyup(function(){ setSiteList($siteFinder.val()); }); if(typeof console == 'undefined'){ /* jshint -W020 */ console={log:function(){}}; } $t .not('.xe-module-search') .addClass('xe-module-search') .parent() .find('.moduleTrigger') .bind('before-open.tc', function(){ var $this; $this = $(this); function on_complete(data) { var $li, list = data.site_list, i, c; if(data.error || !$.isArray(list)) { $this.trigger('close.tc'); return; } aSiteListData = list; setSiteList($siteFinder.val()); $siteFinder.focus(); } $siteList.empty(); $instanceList.empty(); $moduleListDiv.hide(); $instanceListDiv.hide(); $.exec_json('admin.getSiteAllList', {domain:""}, on_complete); }); $moduleWindow .find('.siteList>ul') .delegate('a','click',function(oEvent){ var $this, $finder; $this = $(this); $finder = $this.closest('.moduleSearch'); function on_complete(data) { var list = data.module_list, x; if(data.error || !list) return; for(x in list) { if(!list.hasOwnProperty(x)) continue; $li = $('').appendTo($moduleList); $('').attr('href', '#').html( list[x].title ).data('moduleInstanceList', list[x].list).appendTo($li); } $moduleWindow.find('.moduleList').show(); setListSize($moduleList, MAX_LIST_HEIGHT); $siteList.find('li').removeClass('x_active'); $this.parent('li').addClass('x_active'); } $moduleList.empty(); $instanceListDiv.hide(); $.exec_json('module.procModuleAdminGetList', {site_srl:$this.data('site_srl')}, on_complete); oEvent.preventDefault(); }) .end() .find('.moduleList>ul') .delegate('a', 'click', function(oEvent){ var $this, $mid_select, val, list; $this = $(this); list = $this.data('moduleInstanceList'); if(!list) return; t.sSelectedModuleType = $this.text(); $instanceList.empty(); for(var x in list) { if(!list.hasOwnProperty(x)) continue; $li = $('').html(list[x].browser_title + ' (' + list[x].mid + ')').appendTo($instanceList).val(list[x].module_srl).data('mid', list[x].mid) .data('module_srl', list[x].module_srl).data('layout_srl', list[x].layout_srl).data('browser_title', list[x].browser_title); } $instanceListDiv.show(); setListSize($instanceList, MAX_LIST_HEIGHT); $moduleList.find('li').removeClass('x_active'); $this.parent('li').addClass('x_active'); oEvent.preventDefault(); }) .end() .find('.moduleSearch_ok').click(function(oEvent){ var aSelected = []; $instanceList.find('option:selected').each(function(){ aSelected.push({ 'type' : t.sSelectedModuleType, 'module_srl' : $(this).data('module_srl'), 'layout_srl' : $(this).data('layout_srl'), 'browser_title' : $(this).data('browser_title'), 'mid' : $(this).data('mid') }); }); $t.trigger('moduleSelect', [aSelected]); $('.moduleTrigger').trigger('close.tc'); oEvent.preventDefault(); }); }); return this; }; $.fn.xeModuleSearch = function(){ $(this).each(_xeModuleSearch); }; //$('.moduleTrigger').xeModuleSearch(); // Add html for .module_search $.fn.xeModuleSearchHtml = function(){ var tmpCount = 0; $(this).each(function(){ var $this = $(this); var id = $this.attr('id'); if(!id) id = '__module_search_' + tmpCount; tmpCount++; // add html var $btn = $('' + xe.lang.cmd_find + ''); var $displayInput = $(''); $this.after($btn).after(' ').after($displayInput).hide(); $btn.xeModuleSearch(); // on selected module $btn.bind('moduleSelect', function(e, selected){ $displayInput.val(selected[0].browser_title + ' (' + selected[0].mid + ')'); $this.val(selected[0].module_srl); }); // get module info if($this.val()){ $.exec_json('module.getModuleAdminModuleInfo', {'search_module_srl': $this.val()}, function(data){ if(!data || !data.module_info) return; $displayInput.val(data.module_info.browser_title + ' (' + data.module_info.mid + ')'); }); } }); return this; }; }); jQuery(function($){ var _hide = $.fn.hide; $.fn.hide = function(speed, easing, callback, htOpt) { $(this).trigger('hide', [htOpt]); $(this).find('.active').removeClass('active'); var sId = $(this).attr("id"); if($(this).hasClass("col")){ $(this).next().hide(speed, easing, callback, htOpt); if(sId){ $(this).parent().find('a[href="#'+sId+'"]').parent('li.active').removeClass('active'); } } return _hide.apply(this, arguments); }; var _show = $.fn.show; $.fn.show = function(speed, easing, callback, htOpt) { $(this).trigger('show', [htOpt]); if($(this).hasClass("col")){ $(this).next().hide(speed, easing, callback, htOpt); var $container = $(this).parent(); setTimeout(function(){ $container.scrollTo($container.width(), 0, {duration: 0 } ); }, 0); //scrollToRight(); } var rst = _show.apply(this, arguments); var $this = $(this); // elem. display not yet... using setTimeout... setTimeout(function(){$this.trigger('after-show', [htOpt]); }, 0); return rst; }; }); jQuery(function($){ $.xeMsgBox = { htOptions : {} }; //xe.lang.cmd_cancel = "{$lang->cmd_cancel}"; //xe.lang.cmd_confirm = "{$lang->cmd_confirm}"; var $msgBox = $.xeMsgBox.$msgBox = $("").addClass("x_modal _common x").hide().css('z-index', 9999); $msgBox.html('