diff --git a/modules/admin/tpl/js/admin.js b/modules/admin/tpl/js/admin.js index 83dd8e045..0397322c7 100644 --- a/modules/admin/tpl/js/admin.js +++ b/modules/admin/tpl/js/admin.js @@ -34,16 +34,20 @@ jQuery(function($){ return false; }); // Tab Navigation - $('.x .x_tabbable').each(function(){ - var $this = $(this); - $this.find('>.x_nav-tabs>li>a').each(function(index){ - $(this).attr('data-index', index+1); + $.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); + }); }); - $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_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); $this.parent('li').addClass('x_active').siblings().removeClass('x_active'); @@ -1022,6 +1026,9 @@ $('.filebox') var $g11n_search = $g11n_get.find('#lang_search'); // search section var is_create_changed = false; + // tabbable + $g11n_get.find('.x_tabbable').xeTabbable(); + // check create change $g11n_create.find('.editMode textarea').change(function(){ is_create_changed = true; diff --git a/modules/admin/tpl/js/admin.min.js b/modules/admin/tpl/js/admin.min.js index 83dd8e045..68987fbe8 100644 --- a/modules/admin/tpl/js/admin.min.js +++ b/modules/admin/tpl/js/admin.min.js @@ -1,1323 +1,45 @@ -/* NHN (developers@xpressengine.com) */ -jQuery(function($){ -// iSO mobile device toolbar remove - window.scrollTo(0,0); -// Skip to content - $('.x .skipNav>a').click(function(){ - $($(this).attr('href')).attr('tabindex','0').css('outline','0').focus(); - }); -// TARGET toggle - $(document.body).on('click', '.x [data-toggle]', function(){ - var $this = $(this); - var $target = $($this.attr('data-toggle')); - var focusable = 'a,input,button,textarea,select'; - $target.toggle(); - if($target.is(':visible') && !$target.find(focusable).length){ - $target.attr('tabindex','0').not(':disabled').focus(); - } else if($target.is(':visible') && $target.find(focusable).length) { - $target.find(focusable).not(':disabled').eq(0).focus(); - } else { - $this.focus(); - } - return false; - }); -// TARGET show - $(document.body).on('click', '.x [data-show]', function(){ - $($(this).attr('data-show')).show().attr('tabindex','0').focus(); - return false; - }); -// TARGET hide - $(document.body).on('click', '.x [data-hide]', function(){ - var $this = $(this); - $($this.attr('data-hide')).hide(); - $this.focus(); - return false; - }); -// Tab Navigation - $('.x .x_tabbable').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(); - $(document.body).on('click', '.x .x_nav-tabs>li>a[href*="#"]', function(){ - var $this = $(this); - $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().removeClass('x_active').hide(); - return false; - }); -// GNB - var $xBody = $('.x>.body'); - var $xContent = $xBody.children('#content.content'); - var $xGnb = $xBody.find('>.gnb'); - var $xGnb_li = $xGnb.find('>ul>li'); - // Add icon - $xGnb_li.find('a').prepend(''); - // Active Submenu Copy - $xGnb_li.find('>ul>li.active_').clone().addClass('active').prependTo('#gnbNav'); - // GNB Hover toggle - function reflow(){ // Chrome browser rendering bug fix - $xContent.width('99.99%'); - setTimeout(function(){ - $xContent.removeAttr('style'); - if($xGnb.height() > $xContent.height()){ - $xContent.height($xGnb.height()); - } - }, 100); - } - // GNB Click toggle - $xGnb_li.find('ul').prev('a') - .bind('click focus', function(){ - var $this = $(this); - $this.parent('li').addClass('open').siblings('li').removeClass('open'); - $xBody.removeClass('wide'); - reflow(); - return false; - }); - // GNB Mobile Toggle - $xGnb.find('>a[href="#gnbNav"]').click(function(){ - $(this).parent('.gnb').toggleClass('open'); - $xBody.toggleClass('wide'); - reflow(); - return false; - }); - // GNB Close - $xGnb - .prepend(''); - $('.x .section>h1>.snToggle').click(function(){ - var $this = $(this); - var $section = $this.closest('.section'); - if(!$section.hasClass('collapse')){ - $section.addClass('collapse').children('h1:first').siblings().hide(); - $this.removeClass('x_icon-chevron-up').addClass('x_icon-chevron-down'); - } else { - $section.removeClass('collapse').children('h1:first').siblings().show(); - $this.removeClass('x_icon-chevron-down').addClass('x_icon-chevron-up'); - } - }); -// 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 Rule Style - $('.x i').each(function(){ - var $this = $(this); - if($this.text() == '|'){ - $this.addClass('vr'); - } - }); -}); -// Modal Window -jQuery(function($){ - -var ESC = 27; -$.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; - - $modal = $( $this.attr('href') ); - 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('
').append($modal); // append background - $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 modal window - $modal = $( $this.attr('href') ); - - // 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().end() - .prev('.x_modal-backdrop').show(); - }) - .bind('close.mw', function(){ - var $this = $(this), before_event, $modal, duration; - - // before event trigger - before_event = $.Event('before-close.mw'); - $this.trigger(before_event); - - // is event canceled? - if(before_event.isDefaultPrevented()) return false; - - // get modal window - $modal = $( $this.attr('href') ); - - // 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) - .prev('.x_modal-backdrop').hide(); - $this.focus(); - }); - $('div.x_modal').addClass('x').hide(); -}; -$('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); - $('