$(document).ready(function(){$(document).on('focusin',function(e){if($(e.target).closest(".mce-window, .moxman-window").length){e.stopImmediatePropagation();}});var orgHtml=$.fn.html;$.fn.html=$.extend(function(){if($(this).find('.mce-tinymce').length){glexa.clearMCE();} try{return orgHtml.apply(this,arguments);}catch(e){console.log(e);}},orgHtml);});$(function(){});var glexa=glexa||{ERROR_MSG_UNKNOWN:'An error has occurred.',ERROR_MSG_SERVER_ERROR:'A server error has occurred.',DEFAULT_MSG_DONE:'Process has been successfully completed.',isLoading:false,loadingCount:0,loadingOverlay:null,currentModalZIndex:9999,dispModalCount:0,modalCbFuncs:[],postCallback:null,completeCallback:null,timerAccess:undefined,arInput:0,arInputDefault:0,loading:function(isRemove){isRemove=isRemove?true:false;if(isRemove){glexa.loadingCount--;if(glexa.loadingCount>0){return;}}else{glexa.loadingCount++;} if(isRemove){if(glexa.loadingOverlay!=null){glexa.loadingOverlay.remove();} glexa.loadingOverlay=null}else if(glexa.loadingOverlay==null){try{glexa.loadingOverlay=getBusyOverlay("viewport",{color:'black',opacity:0.1,text:'loading',style:'text-decoration:blink;font-weight:bold;font-size:12px;color:white;z-index:9999'},{color:'#666',size:100,type:'c'});}catch(e){}}},ajax:function(options,callback){var action=options.action?options.action:null;var params=options.params?options.params:{};var hasFile=options.hasFile?options.hasFile:false;var method=options.method?options.method:null;var element=options.element?options.element:null;var isAppend=options.isAppend?true:false;var beforeSend=options.beforeSend?options.beforeSend:function(){};var onSuccess=options.onSuccess?options.onSuccess:function(res){};var onError=options.onError?options.onError:function(res){};var onComplete=options.onComplete?options.onComplete:function(res){};var withoutLoading=options.withoutLoading?options.withoutLoading:false;var isSuccess=false;if(action){if(typeof params==='string'){params+='&action='+action;}else{params.action=action;}} var ajaxOptions={type:(method?method:window.loadmethod?window.loadmethod:'post'),url:window.urlbase,data:params,cache:false,timeout:0,beforeSend:function(){if(!withoutLoading){glexa.loading();} beforeSend();},success:function(res){isSuccess=true;var json=null;try{json=$.parseJSON(res);}catch(e){if(res){json={success:true,html:res};}else{json={success:false};}} if(json.success){if(json.message){$('.div-message,.modal-body').prepend('
'+json.message+'
');if(json.fade){setTimeout(function(){$('.div-alert-success').fadeOut('slow',function(){$('.div-alert-success').remove();});},5000);}} if(element&&json.html){if(isAppend){$(element).append(json.html);}else{$(element).html(json.html);}} onSuccess(json);}else{if(json.error){if(element&&$(element).parents('.modal-dialog').length>0){$(element).parents('.modal-dialog').find('.modal-body .div-alert-error').remove();$(element).parents('.modal-dialog').find('.modal-body').prepend('
'+json.error+'
');}else{$('.div-message .div-alert-error').remove();$('.div-message').first().prepend('
'+json.error+'
');} if(json.fade){setTimeout(function(){$('.div-alert-error').fadeOut('slow',function(){$('.div-alert-error').remove();});},5000);} $('#div-common-remote-modal').animate({scrollTop:0},100,'swing');} if(json.data&&json.data.elements){} if(onError){onError(json);}}},complete:function(res){if(!isSuccess){} if(!withoutLoading){glexa.loading(true);} if(onComplete){onComplete();}},statusCode:{403:function(){glexa.openCommonAlertModal({body:glexa.ERROR_MSG_SERVER_ERROR});},205:function(){window.location.reload();}},error:function(){$('.div-offline').show();}};if(hasFile){ajaxOptions['processData']=false;ajaxOptions['contentType']=false;} return $.ajax(ajaxOptions).done(function(){if(typeof callback=='function')callback();});},ajaxForm:function(options){var form=options.form?options.form:null;var hasFile=options.hasFile?options.hasFile:false;var element=options.element?options.element:null;var method=options.method?options.method:null;var beforeSend=options.beforeSend?options.beforeSend:function(){};var onSuccess=options.onSuccess?options.onSuccess:function(res){};var onError=options.onError?options.onError:function(res){};var onComplete=options.onComplete?options.onComplete:function(res){};var withoutLoading=options.withoutLoading?options.withoutLoading:false;if(hasFile){glexa.ajax({params:new FormData($(form).get(0)),method:method,element:element,beforeSend:beforeSend,hasFile:true,onSuccess:onSuccess,onError:onError,onComplete:onComplete,});}else{glexa.ajax({params:$(form).serialize(),method:method,element:element,beforeSend:beforeSend,onSuccess:onSuccess,onError:onError,onComplete:onComplete,});}},openCommonModal:function(options){if(!options)options={};var modal=options.modal?options.modal:null;var cbFunc=options.cbFunc?options.cbFunc:null;var onOk=options.onOk?options.onOk:function(){glexa.closeCommonModal({modal:modal});};var onOpened=options.onOpened?options.onOpened:false;var keyboard=(options.keyboard!=null)?options.keyboard:true;$('#btn-common-alert-modal-ok').off().on('click',onOk);glexa.modalCbFuncs.push(cbFunc);$(modal).css({zIndex:glexa.currentModalZIndex}).modal({backdrop:'static',show:true,keyboard:keyboard});if(onOpened){onOpened($(modal));} glexa.currentModalZIndex++;glexa.dispModalCount++;$(modal).on('hidden.bs.modal',function(){glexa.dispModalCount--;if(glexa.dispModalCount>0){$('body').addClass('modal-open');}else{glexa.dispModalCount=0;$('body').removeClass('modal-open');$(document).off('keypress');} $('.timepicker').timepicker('hideWidget');$(modal).off('hidden.bs.modal');});},closeCommonModal:function(options){if(!options)options={};var modal=options.modal?options.modal:null;cbFunc=glexa.modalCbFuncs.pop();if(cbFunc){cbFunc();} glexa.currentModalZIndex--;$(modal).modal('hide');if($(modal).length>1){$(modal+':last-child').remove();}},alert:function(body,title){glexa.openCommonAlertModal({title:title,body:body});},openCommonAlertModal:function(options){if(!options)options={};var title=options.title?options.title:'';var body=options.body?options.body:'';var btnOkName=options.btnOkName?options.btnOkName:'OK';var onOk=options.onOk?options.onOk:'';var keyboard=(options.keyboard!=null)?options.keyboard:true;if(title){$('#div-common-alert-modal').attr('aria-labelledby',title);$('#div-common-alert-modal .modal-title').html(title);$('#div-common-alert-modal .modal-header').show();}else{$('#div-common-alert-modal .modal-header').hide();} $('#div-common-alert-modal .modal-body').html(body);glexa.openCommonModal({modal:'#div-common-alert-modal',onOpened:function(modal){$(document).off('keypress').on('keypress',function(e){if(e.keyCode==13){glexa.closeCommonAlertModal();}});},onOk:onOk,keyboard:keyboard});},closeCommonAlertModal:function(options){if(!options)options={};glexa.closeCommonModal({modal:'#div-common-alert-modal'});},confirm:function(body,onYes,title,onNo){glexa.openCommonConfirmModal({title:title,body:body,onYes:onYes,onNo:onNo});},openCommonConfirmModal:function(options){if(!options)options={};var modal=options.modal?options.modal:'#div-common-confirm-modal';var title=options.title?options.title:' ';var body=options.body?options.body:'';var btnYesName=options.btnYesName?options.btnYesName:false;var btnNoName=options.btnNoName?options.btnNoName:false;var onYes=options.onYes?function(e){if(options.onYes(e)!==false){glexa.closeCommonConfirmModal();}}:function(){glexa.closeCommonConfirmModal();};var onNo=options.onNo?function(e){if(options.onNo(e)!==false){glexa.closeCommonConfirmModal();}}:function(){glexa.closeCommonConfirmModal();};$(modal).attr('aria-labelledby',title);$(modal+' .modal-title').html(title);$(modal+' .modal-body').html(body);if(btnYesName){$(modal+' .btn-common-confirm-modal-yes').html(btnYesName)} if(btnNoName){$(modal+' .btn-common-confirm-modal-no').html(btnNoName);} $(modal+' .btn-common-confirm-modal-yes').off().on('click',onYes);$(modal+' .btn-common-confirm-modal-no').off().on('click',onNo) glexa.openCommonModal({modal:modal,onOpened:function(object){}});},closeCommonConfirmModal:function(options){if(!options)options={};$('#div-common-confirm-modal .btn-common-confirm-modal-yes').off();$('#div-common-confirm-modal .btn-common-confirm-modal-no').off();glexa.closeCommonModal({modal:'#div-common-confirm-modal'});},openRemoteModal:function(options){var action=options.action?options.action:'';var params=options.params?options.params:{};var disableEnterKey=options.disableEnterKey?options.disableEnterKey:false;var cbFunc=options.cbFunc?options.cbFunc:null;var onErrorMsg=options.onErrorMsg?options.onErrorMsg:glexa.ERROR_MSG_UNKNOWN;var method=options.method?options.method:'get';glexa.ajax({action:action,params:params,method:method,element:'#div-common-remote-modal',onSuccess:function(res){glexa.openCommonModal({modal:'#div-common-remote-modal',cbFunc:cbFunc,onOpened:function(){if(!disableEnterKey){$(document).off('keypress').on('keypress',function(e){if(e.keyCode==13){if(e.target.nodeName!='TEXTAREA'){e.preventDefault();$('#btn-common-alert-modal-send').trigger('click');}}});}}});var $modal=$('#div-remote-modal'+' > div:last-child');$modal.on('hidden.bs.modal',function(){glexa.closeRemoteModal({modal:$modal});})},onError:function(res){var errMsg=res.error;if(errMsg){onErrorMsg=errMsg;} glexa.openCommonAlertModal({body:onErrorMsg,onOk:function(){glexa.closeCommonAlertModal();glexa.closeCommonConfirmModal();}});}});},closeRemoteModal:function(options){if(!options)options={};var modal=options.modal?options.modal:'#div-common-remote-modal';glexa.closeCommonModal({modal:modal});},updateRemoteModal:function(options){var modal=options.modal?options.modal:'';var action=options.action?options.action:'';var params=options.params?options.params:{};var cbFunc=options.cbFunc?options.cbFunc:null;glexa.ajax({action:action,params:params,onSuccess:function(res){if(res&&res.html){$(modal).html($(res.html).html());} if(cbFunc){cbFunc();}}});},inlineEditor:function(options){var prevValue;if(typeof options=='string'){if(options=='destroy'){$(element).off();$(viewElement).off();} return;} var options=options||{};var onSuccess=options.onSuccess?options.onSuccess:false;var element=options.element?options.element:'.x-inline-edit';var viewElement=options.viewElement?options.viewElement:'span';$(element).find('input,textarea').hide();$(element).css('cursor','pointer');$(element).on('click',function(e){$(this).find(viewElement).hide();$(this).find('input,textarea').show();$(this).find('input,textarea').focus();prevValue=$(this).find('input,textarea').val();});$(element).find('input,textarea').off('blur keypress').on('blur keypress',function(e){if(e.type=='keypress'&&e.which==13||e.type=='blur'){if(onSuccess){if(prevValue!=$(this).val()){onSuccess($(this));}} $(this).parent().find(viewElement).html($(this).val()).show();$(this).hide();}});},openField:function(options){var options=options||{};var isSave=options.isSave?options.isSave:true;var isOpen=options.isOpen?options.isOpen:false;var element=options.element?options.element:'.x-openclose';var titleElement=options.titleElement?options.titleElement:'.x-openclose-title';var viewElement=options.viewElement?options.viewElement:'div';$(element).each(function(){var id=$(this).attr('id');if(id&&isSave){isOpen=localStorage.getItem(element+'-'+id)=='1'?true:false;} if(isOpen){if($(this).children(titleElement).find('.fas').length==0){$(this).children(titleElement).html(' '+$(this).children('.x-openclose-title').html());}}else{$(this).children(viewElement).hide();if($(this).children(titleElement).find('.fas').length==0){$(this).children(titleElement).html(' '+$(this).children('.x-openclose-title').html());}} $(this).children(titleElement).css('cursor','pointer');$(this).children(titleElement).off().on('click',function(e){e.preventDefault();if($(this).next(viewElement).isVisible()){$(this).next(viewElement).slideUp('fast');$(this).children('.fas').removeClass('fa-minus-circle').addClass('fa-plus-circle');if(id&&isSave){localStorage.setItem(element+'-'+id,0);}}else{$(this).next(viewElement).slideDown('fast');$(this).children('.fas').removeClass('fa-plus-circle').addClass('fa-minus-circle');if(id&&isSave){localStorage.setItem(element+'-'+id,1);}}});});},setMCE:function(options){var options=options||{};var selector=options.selector?options.selector:'.mce';var plugin=options.plugin?options.plugin:'';var noneMenu=options.none_menu?options.none_menu:false;var extended=options.extended?options.extended:'';var customInit=options.modify_init?options.modify_init:false;var readonly=options.readonly?options.readonly:0;if(!$('.mce-tinymce').get(0)){glexa.clearMCE();} tinymce.init({mode:"exact",selector:selector,content_css:window.urlbase+"common/css/glexa_mce.css",language:lang,menubar:false,convert_urls:false,toolbar:plugin+(noneMenu?'':'fontsizeselect | bold italic underline forecolor backcolor | strikethrough alignleft aligncenter alignright alignjustify | charmap table | undo redo link unlink | cleanup fullscreen code | leaui_formula'),readonly:readonly,theme_advanced_buttons1:'',theme_advanced_buttons2:'',theme_advanced_buttons3:'',theme_advanced_buttons4:'',theme_advanced_toolbar_location:'top',theme_advanced_toolbar_align:'left',theme_advanced_statusbar_location:'bottom',theme_advanced_resizing:true,extended_valid_elements:extended+'a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style],iframe[src|width|height|name|align],i/em,ruby,rb,rp,rt',plugins:'glexaquizfill,table,contextmenu,fullscreen,noneditable,tabfocus,visualchars,textcolor,wordcount,anchor,link,charmap,code,leaui_formula,paste',forced_root_block:false,accessibility_focus:false,preformatted:true,remove_linebreaks:true,resize:true,paste_retain_style_properties:'all',setup:function(editor){editor.on('change',function(){tinymce.triggerSave();});if(customInit){editor.on('init',function(args){if(typeof customInit=='function'){customInit();}});}}});},clearMCE:function(){try{tinymce.remove();}catch(e){}},setDatepicker:function(options){var datepickerOptions={showAnim:'slideDown',dateFormat:'yy-mm-dd'} if(options){for(var i in options){datepickerOptions[i]=options[i];}} $('.timepicker, .datepicker').on('focus',function(){$('.timepicker').timepicker('hideWidget');});$.datepicker.setDefaults($.extend($.datepicker.regional['ja']));$('.datepicker').removeClass('hasDatepicker').datepicker(datepickerOptions);$('.timepicker').timepicker({defaultTime:false,showMeridian:false,minuteStep:5});$('.bootstrap-timepicker-widget').css('z-index',99999);},setToggleCheckbox:function(options){var options=options||{};var onSuccess=options.onSuccess?options.onSuccess:false;var isForce=options.isForce?options.isForce:false;var triggerClass=options.triggerClass?options.triggerClass:'.x-checks';$(triggerClass).css('cursor','pointer');$(triggerClass).off().on('click',function(e){e.preventDefault();var checked=true;if($(this).attr('target_class')){if($($(this).attr('target_class')).filter(':checked').length==$($(this).attr('target_class')).length){checked=false;} $($(this).attr('target_class')).each(function(){if(!$(this).attr('disabled')||isForce){$(this).prop('checked',checked);}});}else{if($(this).closest('table').find('input[type=checkbox]:checked').length==$(this).closest('table').find('input[type=checkbox]').length){checked=false;} $(this).closest('table').find('input[type=checkbox]').each(function(){if(!$(this).attr('disabled')||isForce){$(this).prop('checked',checked);}});} if(onSuccess){onSuccess();}});},getCheckedIds:function(chkboxName){var ret=[];$('input[name="'+chkboxName+'"]:checked').each(function(){ret.push($(this).val());});return ret;},convertNumeric:function(src){var src=src.replace(/\D/g,'');return src.replace(/(\W)/g,function($0){return String.fromCharCode($0.charCodeAt(0)-65248);});},setSort:function(options){var options=options||{};var axis=options.axis?options.axis:false;var element=options.element?options.element:'.x-sort';var attributes=options.attributes?options.attributes:'sortable_ids';var onSuccess=options.onSuccess?options.onSuccess:false;var handle=options.handle?options.handle:false;var placeholder=options.placeholder?options.placeholder:'ui-state-highlight';var connectWith=options.connectWith?options.connectWith:false;var helper=options.helper?options.helper:function(e,ui){ui.children().each(function(){$(this).width($(this).width());});return ui;};$(element).each(function(){$(this).sortable({helper:helper,axis:axis,placeholder:placeholder,connectWith:connectWith,handle:handle,update:function(ev,ui){if(onSuccess){onSuccess($(this).sortable('toArray',{attribute:attributes}));}else{var callback=eval($(this).attr('callback'));if(callback){callback($(this).sortable('toArray',{attribute:attributes}));}}}}).disableSelection();});if(handle){$(handle).css('cursor','move');}else{$(element).css('cursor','move');}},destroySort:function(options){var options=options||{};var element=options.element?options.element:'x-sort';try{$(element).sortable('destroy').css('cursor','');}catch(e){}},setDrag:function(options){var options=options||{};var dragElement=options.dragElement?options.dragElement:'.x-drag';var dropElement=options.dropElement?options.dropElement:'.x-drop';var selectElement=options.selectElement?options.selectElement:'.x-select';var hiddens=options.hiddens?options.hiddens:'header,.btn,.panel';var hoverClass=options.hoverClass?options.hoverClass:'drop-hover';var onDropped=options.onDropped?options.onDropped:false;var helper=options.helper?options.helper:'clone';$(dragElement).draggable({helper:helper,revert:true,revertDuration:0,cursor:'move',opacity:0.9,start:function(){if(hiddens){$(hiddens).each(function(){if(!$(this).find(dropElement).length&&!$(this).find(dragElement).length){$(this).animate({'opacity':0.5},200);}});}},stop:function(){if(hiddens){$(hiddens).animate({'opacity':1},200);}}}).css('cursor','move');$(dropElement).droppable({hoverClass:hoverClass,tolerance:'pointer',drop:function(event,ui){if(onDropped){onDropped(event,ui);}}});},setDrop:function(options){var options=options||{};var dropElement=options.dropElement?options.dropElement:'.x-drop';var hoverClass=options.hoverClass?options.hoverClass:'drop-hover';var onDropped=options.onDropped?options.onDropped:false;var helper=options.helper?options.helper:'clone';$(dropElement).droppable({hoverClass:hoverClass,tolerance:'pointer',drop:function(event,ui){if(onDropped){onDropped(event,ui);}}});},destroyDrag:function(options){var options=options||{};var dragElement=options.dragElement?options.dragElement:'.x-drag';var dropElement=options.dropElement?options.dropElement:'.x-drop';try{$(dragElement).draggable('destroy').css('cursor','');$(dropElement).droppable('destroy');}catch(e){}},googleMaps:[],setMap:function(options) {var options=options||{};var address=options.address?options.address:'';var map=options.map?options.map:false;var isImage=options.image?options.image:false;var onEmpty=options.onEmpty?options.onEmpty:false;var onError=options.onError?options.onError:false;var key=options.key?options.key:'';if(!address||!map){if(onEmpty){onEmpty();} return false;} map.children().remove();if(!address.trim()){if(onEmpty){onEmpty();} return;}else{var geocoder=new google.maps.Geocoder();var request={address:address};geocoder.geocode(request,function(results,status){if(status==google.maps.GeocoderStatus.OK){for(var i in results){if(results[i].geometry){if(isImage){var latlng=results[i].geometry.location.lat()+','+results[i].geometry.location.lng();}else{var latlng=results[i].geometry.location;} if(isImage){var options={center:latlng,maptype:google.maps.MapTypeId.ROADMAP,zoom:16,size:'640x360',format:'png',markers:latlng,key:key};map.html($('').attr('src','http://maps.google.com/maps/api/staticmap?'+$.param(options)));}else{var options={backgroundColor:'#ffffff',center:latlng,disableDoubleClickZoom:true,navigationControl:true,noClear:false,scaleControl:true,scrollwheel:false,mapTypeId:google.maps.MapTypeId.ROADMAP,zoom:16};var googleMap=new google.maps.Map(map[0],options);var markerOptions={position:latlng,map:googleMap};var marker=new google.maps.Marker(markerOptions);} map.width('100%').height(360);}}}else{switch(status){case google.maps.GeocoderStatus.ERROR:case google.maps.GeocoderStatus.INVALID_REQUEST:case google.maps.GeocoderStatus.OVER_QUERY_LIMIT:case google.maps.GeocoderStatus.REQUEST_DENIED:case google.maps.GeocoderStatus.UNKNOWN_ERROR:case google.maps.GeocoderStatus.ZERO_RESULTS:default:if(onError){onError();} break;}}});}},toggleExam:function(isExam,src){if(!isExam||window.sessionStorage.getItem('exam_fullscreen')){this.exitExam(src);return true;}else{if(isExam){this.startExam(src);return true;}else{window.sessionStorage.removeItem('exam_fullscreen');return false;}}},startExam:function(src){console.log('exam start');window.sessionStorage.setItem('exam_fullscreen',true);$('body').fullscreen();if(src){$('body').html($('').attr('src',src).css('width','100%').css('height','100%').css('border','solid 20px #ccc'));} $(document).on('fscreenchange',function(e,state,elem){if(!$.fullscreen.isFullScreen()){window.glexa._exitFullScreen(window.urlbase+'class');}});return true;},exitExam:function(src){console.log('exam exit');parent.glexa._exitFullScreen(src);return true;},_exitFullScreen:function(src){console.log('exam close');$(document).off('fscreenchange');if($.fullscreen.isFullScreen()){$.fullscreen.exit();} window.sessionStorage.removeItem('exam_fullscreen') if(src){window.parent.location.href=src;}},putSWF:function(options,flashvars){var options=options||{};var flashvars=flashvars;var src=options.src?options.src:false;var params=options.params?options.params:{menu:"false",scale:"exactFit",allowFullscreen:"true",allowScriptAccess:"always",bgcolor:"#000000",wmode:"transparent"} var element=options.element?options.element:false;var attributes=options.attributes?options.attributes:{};var width=options.width?options.width:'auto';var height=options.height?options.height:'auto';if(!src||!element){return false;} swfobject.embedSWF(src,element,width,height,flashversion,'expressInstall.swf',flashvars,params,attributes);},openWindow:function(src,w,h,name){if(w==undefined){w=750;} if(h==undefined){h=500;} if(name==undefined){name='common window';} var win=window.open(src,name,'width='+w+',height='+h+',status=no,toolbar=no,scrollbars=yes,resizable=yes,location=no,menubar=no');win.focus();},putSoundSwf:function(filename,memberId,element,pitch,noneautoplay,w,h,fileUrl){if(w==undefined){w=136;} if(h==undefined){h=24;} var html,url;var autoplay='autoplay';if(noneautoplay){autoplay='';} $('#'+element).html('');if(pitch){this.putPitchLink(filename,memberId,element);}},putPitchLink:function(filename,memberId,element){},putSwfPlayer:function(filename,memberId,questionInstanceId,element,isAutoPlay,preWord,pitch){if(isAutoPlay==undefined){isAutoPlay=true;} if(preWord==undefined){preWord='';} this.putSoundSwf(filename,memberId,element,undefined,isAutoPlay,198,24);$('#'+element).html(preWord+$('#'+element).html());if(pitch){this.putPitchLink(filename,memberId,element);}},setMailMember:function(memberId,number,name){if(this.members){for(var i=0;i ul').tabs();});},timetableChange:function(){$(document).ready(function(){if($('#mycarousel').length>0&&$.fn.jcarousel){$('#mycarousel').jcarousel();}});},resizeWindow:function() {if(this.examWindow){try{this.examWindow.moveTo(0,0);this.examWindow.resizeTo(window.screen.availWidth,window.screen.availHeight);}catch(e){} setTimeout(this.resizeWindow.on(this),500);}},setAudioObject:function(audioSpanTagId,url){$objAudio=$("