// JavaScript Document /* Remember to encode */ /* https://javascriptobfuscator.com/Javascript-Obfuscator.aspx */ var isDOM = (getRef ? true : false); var isIE4 = ((document.all && !isDOM) ? true : false); var isNS4 = (document.layers ? true : false); var local_url = (header_path ? header_path : window.location.protocol + '//' + window.location.host + '/'); var root_local_url = (root_header_path ? root_header_path : window.location.protocol + '//' + window.location.host + '/'); var popUpWin = 0; var stringStorage = ''; var scripts = document.getElementsByTagName('script'); var myScript = scripts[ scripts.length - 1 ]; var queryString = myScript.src.replace(/^[^\?]+\??/, ''); var global_js_params = parseQuery(queryString); var isMobileWesite = isMobileWebsiteBoo(); var mm_still, mm_still_close, mm_close_still; var mm_date, mm_init_time; var clock_check_timeout_post; var paypal_img, paypal_img_dis, unionpay_img, unionpay_img_dis, alipay_img, alipay_img_dis; var count_down_clock, count_down_clock_is_pause; var add_question_selection = 0; function isMobileWebsiteBoo() { var check = false; //pattern: ismobile = "/iphone|ipod|android|blackberry|opera|mini|windows\sce|palm|smartphone|iemobile/i"; //pattern: istablet = "/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i"; //if((navigator.userAgent||navigator.vendor||window.opera).toLowerCase().match(/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i)){ //alert('istablet'); if((navigator.userAgent || navigator.vendor || window.opera).toLowerCase().match(/iphone|ipod|android|blackberry|opera|mini|windows\sce|palm|smartphone|iemobile/i)) { return true; } return check; } function parseQuery(query) { var Params = new Object(); if(!query) return Params; // return empty object var Pairs = query.split(/[;&]/); for(var i = 0; i < Pairs.length; i++) { var KeyVal = Pairs[ i ].split('='); if(!KeyVal || KeyVal.length != 2) continue; var key = unescape(KeyVal[ 0 ]); var val = unescape(KeyVal[ 1 ]); val = val.replace(/\+/g, ' '); Params[ key ] = val; } return Params; } function getRef(id) { if(isDOM) return document.getElementById(id); if(isIE4) return document.all[ id ]; if(isNS4) return document.layers[ id ]; } function MM_swapImgRestore() { //v3.0 var i, x, a = document.MM_sr; for(i = 0; a && i < a.length && (x = a[ i ]) && x.oSrc; i++) x.src = x.oSrc; } function MM_jumpMenu(targ, selObj, restore) { //v3.0 eval(targ + '.location=\'' + selObj.options[ selObj.selectedIndex ].value + '\''); if(restore) selObj.selectedIndex = 0; } function MM_preloadImages() { //v3.0 var d = document; if(d.images) { if(!d.MM_p) d.MM_p = new Array(); var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for(i = 0; i < a.length; i++) { if(a[ i ].indexOf('#') != 0) { d.MM_p[ j ] = new Image; d.MM_p[ j++ ].src = a[ i ]; } } } } function MM_findObj(n, d) { //v4.01 var p, i, x; if(!d) d = document; if((p = n.indexOf('?')) > 0 && parent.frames.length) { d = parent.frames[ n.substring(p + 1) ].document; n = n.substring(0, p); } if(!(x = d[ n ]) && d.all) x = d.all[ n ]; for(i = 0; !x && i < d.forms.length; i++) x = d.forms[ i ][ n ]; for(i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[ i ].document); if(!x && d.getElementById) x = d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for(i = 0; i < (a.length - 2); i += 3) { if((x = MM_findObj(a[ i ])) != null) { document.MM_sr[ j++ ] = x; if(!x.oSrc) x.oSrc = x.src; x.src = a[ i + 2 ]; } } } function commaSeparateNumber(val) { while(/(\d+)(\d{3})/.test(val.toString())) { val = val.toString().replace(/(\d+)(\d{3})/, '$1' + ',' + '$2'); } return val; } function validateURL(url) { if(/^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/|www\.)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/.test(url)) { return true; } return false; } function validateEmail(address) { if(/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(address)) { return true; } return false; } function format_number(text) { return text.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,'); }; function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } function wordCount(str) { var matches = str.match(/[\u00ff-\uffff]|\S+/g); return matches ? matches.length : 0; } // ---------------------------------------- jquery init ------------------------------------------------ // ----- iPhone Switch ------------------------------------------------------------ jQuery.fn.iphoneSwitch = function(template_no, start_state, switched_on_callback, switched_off_callback, options) { var state = start_state == 'on' ? start_state : 'off'; var settings; switch(template_no) { default: settings = { mouse_over: 'pointer', mouse_out: 'default', switch_on_container_path: local_url + 'lib/img/ajax-switch/iphone_switch_container_on.png', switch_off_container_path: local_url + 'lib/img/ajax-switch/iphone_switch_container_off.png', switch_path: local_url + 'lib/img/ajax-switch/iphone_switch.png', switch_width: 86, switch_height: 27, switch_off_width: -60 }; break; case 2: settings = { mouse_over: 'pointer', mouse_out: 'default', switch_on_container_path: local_url + 'lib/img/ajax-switch/iphone_switch_gender_container_on.png', switch_off_container_path: local_url + 'lib/img/ajax-switch/iphone_switch_gender_container_off.png', switch_path: local_url + 'lib/img/ajax-switch/iphone_switch_gender.png', switch_width: 148, switch_height: 44, switch_off_width: -109 }; break; } if(options) { jQuery.extend(settings, options); } return this.each(function() { var container; var image; container = jQuery('
'); image = jQuery(''); jQuery(this).html(jQuery(container).html(jQuery(image))); jQuery(this).mouseover(function() { jQuery(this).css('cursor', settings.mouse_over); }); jQuery(this).mouseout(function() { jQuery(this).css('background', settings.mouse_out); }); jQuery(this).click(function() { if(state == 'on') { jQuery(this).find('.iphone_switch').animate({ backgroundPosition: settings.switch_off_width }, 'fast', function() { jQuery(this).attr('src', settings.switch_off_container_path); switched_off_callback(); }); state = 'off'; } else { jQuery(this).find('.iphone_switch').animate({ backgroundPosition: 0 }, 'fast', function() { switched_on_callback(); }); jQuery(this).find('.iphone_switch').attr('src', settings.switch_on_container_path); state = 'on'; } }); // jQuery(this).click }); //#39BEAA }; // ----- END ------------- iPhone Switch ---------------------- // ----- Jquery Function ------------------------------------------------------------ var counts = {}; var ddmenuitem = 0; var ajax_getJSON = null; /* switch(Number(global_js_params.lang)){ default: case 1: // ENGLISH break; case 2: // T.CHINESE break; case 3: // S.CHINESE break; } */ // ----- Header functions ------------------------------------------------------------ function init_preload_images() { } function header_open_mm(id) { // close old layer if(ddmenuitem) ddmenuitem.hide(); ddmenuitem = $('#' + id); ddmenuitem.show(); } function header_close_mm() { if(ddmenuitem) { ddmenuitem.hide(); } } function init_header_mm_event() { return false; if($('#mobile_mm').length) { $('#mobile_mm').click(function(e) { if(Number($('#mobile_mm').attr('title')) == 0) { //$('#mobile_mm img').stop().attr("src", local_url+"lib/img/header/header_mobile_mm_still_close.gif"); $('#mobile_mm img').stop().attr('src', mm_still_close.src); $('#mobile_mm').attr('title', '1'); $('#headerContent_mobile').stop().animate({ height: (250 + ((!$('#header_process_container').length ? 100 : 0)) + ($('.header_mm_org').length ? $('.header_mm_org').height() : 0)) + 'px' }, 400, 'easeOutBack'); } else { //$('#mobile_mm img').stop().attr("src", local_url+"lib/img/header/header_mobile_mm_close_still.gif"); $('#mobile_mm img').stop().attr('src', mm_close_still.src); $('#mobile_mm').attr('title', '0'); $('#headerContent_mobile').stop().animate({ height: '84px' }, 200); } }); } } // ================================================================================== // ------------------------------------ INITIAL ------------------------------------- // ================================================================================== // --------------------------- Index Page ------------------------------------- function init_index_page() { // } // ----- END --------------- Index Page ------------------------------------- // ================================================================================== // ---- END --------------------------- INITIAL ------------------------------------- // ================================================================================== var headerIsAnimate; $(document).ready(function() { init_preload_images(); init_index_page(); init_header_mm_event(); $(document).click(function(e) { // }); $(document).scroll(function(e) { return; if($('#headerBg').length) { var scroll_position = $(window).scrollTop(); if(scroll_position > $('#headerBg').height()) { if($('#header').position().top != $('#headerBg').height() * -1 && !headerIsAnimate) { headerIsAnimate = true; $('#header').stop().animate({ top: '-' + $('#headerBg').height() }, 'fast', function() { // completed headerIsAnimate = false; if($('#headerContent_mobile').is(':visible')) { if(Number($('#mobile_mm').attr('title')) == 1) { $('#mobile_mm img').stop().attr('src', mm_still.src); $('#mobile_mm').attr('title', '0'); $('#headerContent_mobile').stop().delay(10).animate({ height: '84px' }, 'fast'); } } }); } } else { // if($('#headerBg').length){ if($('#header').position().top != 0 && !headerIsAnimate) { headerIsAnimate = true; $('#header').stop().animate({ top: 0 }, 'fast', function() { // completed headerIsAnimate = false; }); } } //alert(scroll_position); } // if($('#headerBg').length){ }); $(window).on('orientationchange', function(event) { // }); }); var refHeight = function() { $('.layoutBlockHeight').each(function() { if($(this).closest('.cccApp').length) return; var obj = $(this).parent().find('.layoutRefHeight').filter(':visible'); var targetHeight = $(obj).height(); if($(this).hasClass('layoutBlockLineHeight')) { $(this).css('line-height', targetHeight + 'px'); $(this).css('padding-top', $(obj).css('padding-top')); $(this).css('padding-bottom', $(obj).css('padding-bottom')); } $(this).height(targetHeight); }); if($('.footer-menu-nav').hasClass('notSticky')) { var contentsHeight = $('.footer-menu-nav').outerHeight() + $('.menu-nav').outerHeight() + $('.mainContainer').outerHeight(); if(contentsHeight > $(window).height()) { $('.footer-padding').height('auto'); } else { $('.footer-padding').height($(window).height() - contentsHeight); } } $('.mainContainer').not('.notSticky').height($(window).height() - $('.menu-nav').outerHeight() - $('.footer-menu-nav').outerHeight()); $('.mainContainerHeight').not('.notSticky').height($(window).height() - $('.menu-nav').outerHeight() - $('.footer-menu-nav').outerHeight()); $('.changeBg').click(function() { $(this).closest('.imagesContainer').find('.changeBg').removeClass('active'); $(this).addClass('active'); $('.overLayBg').backstretch($(this).attr('data-image'), { duration: 3000, fade: 0 }); }); $('.stickToBottom').each(function() { $(this).css('margin-top', $(this).parent().height() - $(this).outerHeight() + 'px'); }); $(document).trigger('refHeightLoaded'); }; var scrollTimer = null; $(window).resize(function() { if(scrollTimer) { clearTimeout(scrollTimer); // clear any previous pending timer } scrollTimer = setTimeout(refHeight, 10); // set new timer }); $(document).bind('langLoaded', refHeight); $(document).bind('load', refHeight); $('html').addClass('frontEnd'); function acUpdate() { loadPopupForm(lang('Change Password'), local_url + '?acupdate=true', 'acupdate'); } function forgotEmail() { loadPopupForm(lang('Forgot Email / Activation Login Email'), root_local_url + '?forgot_email=true', 'forgot_email'); } function forgotPassword() { loadPopupForm(lang('Forgot Password'), root_local_url + '?forgot_password=true', 'forgot_password'); } function addSubAccount(callback, user_id, closeCallback) { loadPopupForm(lang('Add Sub-Account'), root_local_url + '?add_sub_account=true&user_id=' + user_id, root_local_url + '|add_sub_account', false, 'modal-lg', callback, closeCallback, true); } function editSubAccount(callback, user_id, closeCallback) { loadPopupForm(lang('Edit Sub-Account'), root_local_url + '?edit_sub_account=true&uid=' + user_id, root_local_url + '|add_sub_account', user_id, 'modal-lg', callback, closeCallback, true); } function deleteSubAccount(callback, uid, closeCallback) { var isSuccess = false; BootstrapDialog.confirm(1, 'info', 'Delete Sub-Account', 'Do your delete this account?', true, true, { 'callback': function(result, dialog) { if(result) { //console.log(award_uid); // loadingdiv //dialog.close(); cms.loadingDiv(dialog.$modalDialog); $.ajax({ type: 'POST', headers: { 'X-Cccms-Key-Secret': $('#h').val() }, data: { h: $('#h').val() }, dataType: 'json', url: local_url + 'lib/ajax/add_sub_account/remove/?uid=' + uid, success: function(data) { if(data[ 'status' ] == 1) { isSuccess = true; dialog.close(); } else { cms.removeLoadingDiv(dialog.$modalDialog); } } }); } else { console.log('false'); } } }, [ { label: lang('Confirm'), cssClass: 'btn-warning', action: function(dialog) { typeof dialog.getData('callback') === 'function' && dialog.getData('callback')(true, dialog); } }, { label: lang('Close'), cssClass: 'btn-default', action: function(dialog) { typeof dialog.getData('callback') === 'function' && dialog.getData('callback')(false); dialog.close(); } } ], function(dialog) { //console.log('1'); }, function(dialog) { //console.log('2'); }, function(dialog) { // console.log('3'); }, function(dialog) { if(closeCallback && isSuccess) closeCallback(); // console.log('4'); }, false); //loadPopupForm(lang('Confirm Award'),root_local_url+"?confirm_award=true&entry_uid="+entry_uid,"confirm_award",entry_uid,"modal-lg",callback); } $(document).ready(function() { $('.hoverBtn').hover(function() { pngHover(this, 1); }, function() { pngHover(this, 2); }); }); function pngHover(obj, action) { if(action == 1) { $(obj).attr('src', function(i, src) { return src.replace('.png', '_.png'); }); } else { $(obj).attr('src', function(i, src) { return src.replace('_.png', '.png'); }); } } function checkIE() { var ua = window.navigator.userAgent; var msie = ua.indexOf('MSIE'); if(msie > 0 || ua.match(/Trident.*rv\:9\./)) { return true; } else { return false; } } function initResizeObj() { $.each($('[data-resize]'), function() { if(checkIE()) { $(this).removeClass('backstretched'); } var maxHeight = false; var minHeight = false; if($(this).attr('data-max-height')) { maxHeight = $(this).attr('data-max-height'); } if($(this).attr('data-min-height')) { minHeight = $(this).attr('data-min-height'); } resizeObj($(this), $(this).attr('data-width'), $(this).attr('data-height'), false, false, maxHeight, true, minHeight); }); } function resizeObj(obj, width, height, callback, beforeCallback, maxHeight, init, minHeight) { var $this = obj; if(maxHeight && $(obj).width() * height / width >= maxHeight) { $(obj).height(maxHeight); } else if(minHeight && $(obj).width() * height / width <= minHeight) { $(obj).height(minHeight); } else { // console.log($(obj).width()*height/width,$(obj).width()); $(obj).height($(obj).width() * height / width); } if($($this).attr('data-margin-top')) { var extra = 0; if($($this).attr('data-margin-target')) { if($($this).attr('data-margin-top-extra')) { extra = parseInt($($this).attr('data-margin-top-extra')); } var target = $($this).closest($($this).attr('data-margin-target')); $(target).css('margin-top', $(target).height() * $($this).attr('data-margin-top') + extra); } else { if($($this).attr('data-margin-top-extra')) { extra = parseInt($($this).attr('data-margin-top-extra')); } $($this).css('margin-top', $($this).height() * $($this).attr('data-margin-top') + extra); } } if(beforeCallback) beforeCallback(); if(!init) { $(window).resize(function() { if(maxHeight && $(obj).width() * height / width >= maxHeight) { $(obj).height(maxHeight); } else if(minHeight && $(obj).width() * height / width <= minHeight) { $(obj).height(minHeight); } else { // console.log($(obj).width()*height/width,$(obj).width()); $(obj).height($(obj).width() * height / width); } if($($this).attr('data-margin-top')) { var extra = 0; if($($this).attr('data-margin-target')) { if($($this).attr('data-margin-top-extra')) { extra = parseInt($($this).attr('data-margin-top-extra')); } var target = $($this).closest($($this).attr('data-margin-target')); $(target).css('margin-top', $(target).height() * $($this).attr('data-margin-top') + extra); } else { if($($this).attr('data-margin-top-extra')) { extra = parseInt($($this).attr('data-margin-top-extra')); } $($this).css('margin-top', $($this).height() * $($this).attr('data-margin-top') + extra); } } if(callback) callback(); }); } if(callback) callback(); } function scrollToTop() { $('html, body').animate({ scrollTop: 0 }, 800); } function scrollToObj(obj, plus, minus, speed) { if(!plus) plus = 0; if(!minus) minus = 0; if(!speed) speed = 800; $('html, body').animate({ scrollTop: $(obj).offset().top + plus - minus }, speed); } function checkLargestObjHeight(obj) { var height = 0; $.each($(obj), function() { if($(this).height() > height) { height = $(this).height(); } }); return height; } function getUrlParameter(sParam) { var sPageURL = decodeURIComponent(window.location.search.substring(1)), sURLVariables = sPageURL.split('&'), sParameterName, i; for(i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[ i ].split('='); if(sParameterName[ 0 ] === sParam) { return sParameterName[ 1 ] === undefined ? true : sParameterName[ 1 ]; } } } function winnerDetailPopup(key, k) { if(currentLang == 1) { var langKey = '_en'; } else { var langKey = '_tc'; } var dialog = new BootstrapDialog({ size: BootstrapDialog.SIZE_WIDE, closable: true, message: function(dialogRef) { var $title; var $message = '
'; $message += '

'; $title = 'award' + langKey; $message += winnerDetailData[ key ].list[ k ][ $title ]; $message += '

'; $message += '

'; $title = 'company' + langKey; $message += winnerDetailData[ key ].list[ k ][ $title ]; $message += '

'; $message += '

'; $title = 'project' + langKey; $message += winnerDetailData[ key ].list[ k ][ $title ]; $message += '

'; $title = 'desc' + langKey; if(winnerDetailData[ key ].list[ k ][ $title ]) { $message += '

'; $message += winnerDetailData[ key ].list[ k ][ $title ]; $message += '

'; } // carousel start var carouselHtml = ''; $message += carouselHtml; $message += '
'; return $message; }, buttons: [{ label: 'Close', action: function(dialogRef) { dialogRef.close(); } }], cssClass: 'winner-detail-dialog', width: '100%' }); dialog.realize(); // dialog.setClosable(true); dialog.getModalHeader().hide(); dialog.getModalBody().css('background-color', '#fff'); dialog.getModalBody().css('color', '#000'); dialog.open(); setTimeout(() => { $('.winner-detail-dialog .winner-detail-carousel').owlCarousel({ loop: true, margin: 10, nav: true, responsive: { 0: { items: 1 } }, autoHeight: true, navText: ['
', '
'] }); }, 200); } var isCCCMS = false;var isUCP = false;/* CSS Browser Selector v0.4.0 (Nov 02, 2010) Rafael Lima (http://rafael.adm.br) http://rafael.adm.br/css_browser_selector License: http://creativecommons.org/licenses/by/2.5/ Contributors: http://rafael.adm.br/css_browser_selector#contributors */ function css_browser_selector(u) { var ua = u.toLowerCase(), is = function(t) { return ua.indexOf(t) > -1 }, g = 'gecko', w = 'webkit', s = 'safari', o = 'opera', m = 'mobile', h = document.documentElement, b = [ (!(/opera|webtv|firefox/i.test(ua)) && /trident|msie/i.test(ua) && /(msie\s|rv\:)(\d+)/.test(ua)) ? ('ie ie' + RegExp.$2) : is('firefox/2') ? g + ' ff2' : is('firefox/3.5') ? g + ' ff3 ff3_5' : is('firefox/3.6') ? g + ' ff3 ff3_6' : is('firefox/3') ? g + ' ff3' : is('gecko/') ? g : is('opera') ? o + (/version\/(\d+)/.test(ua) ? ' ' + o + RegExp.$1 : (/opera(\s|\/)(\d+)/.test(ua) ? ' ' + o + RegExp.$2 : '')) : is('konqueror') ? 'konqueror' : is('blackberry') ? m + ' blackberry' : is('android') ? m + ' android' : is('chrome') ? w + ' chrome' : is('iron') ? w + ' iron' : is('applewebkit/') ? w + ' ' + s + (/version\/(\d+)/.test(ua) ? ' ' + s + RegExp.$1 : '') : is('mozilla/') ? g : '', is('j2me') ? m + ' j2me' : is('iphone') ? m + ' iphone' : is('ipod') ? m + ' ipod' : is('ipad') ? m + ' ipad' : is('mac') ? 'mac' : is('darwin') ? 'mac' : is('webtv') ? 'webtv' : is('win') ? 'win' + (is('windows nt 6.0') ? ' vista' : '') : is('freebsd') ? 'freebsd' : (is('x11') || is('linux')) ? 'linux' : '', 'js' ]; if(document.documentMode || /Edge/.test(navigator.userAgent)) { b.push("edge") } c = b.join(' '); h.className += ' ' + c; return c; }; css_browser_selector(navigator.userAgent); (function($) { $.belowthefold = function(element, settings) { var fold = $(window).height() + $(window).scrollTop(); return fold <= $(element).offset().top - settings.threshold; }; $.abovethetop = function(element, settings) { var top = $(window).scrollTop(); return top >= $(element).offset().top + $(element).height() - settings.threshold; }; $.rightofscreen = function(element, settings) { var fold = $(window).width() + $(window).scrollLeft(); return fold <= $(element).offset().left - settings.threshold; }; $.leftofscreen = function(element, settings) { var left = $(window).scrollLeft(); return left >= $(element).offset().left + $(element).width() - settings.threshold; }; $.inviewport = function(element, settings) { return !$.rightofscreen(element, settings) && !$.leftofscreen(element, settings) && !$.belowthefold(element, settings) && !$.abovethetop(element, settings); }; $.extend($.expr[ ':' ], { "below-the-fold": function(a, i, m) { return $.belowthefold(a, { threshold: 0 }); }, "above-the-top": function(a, i, m) { return $.abovethetop(a, { threshold: 0 }); }, "left-of-screen": function(a, i, m) { return $.leftofscreen(a, { threshold: 0 }); }, "right-of-screen": function(a, i, m) { return $.rightofscreen(a, { threshold: 0 }); }, "in-viewport": function(a, i, m) { return $.inviewport(a, { threshold: 0 }); } }); })(jQuery); function loadPopupForm(title, formURL, cccFormAPI, uid, addClass, callback, oncloseCallback, disableCenter, disableCloseBtn) { var thisApp; cms.loadingDiv($("body")); var div = $('
'); div.load(formURL, function() { cms.removeLoadingDiv($("body")); BootstrapDialog.confirm(1, 'info', title, '', true, true, { 'callback': function(result) { if(result) { } else { $('form.mainForm').find('input[type="submit"]').prop('disabled', false); } } }, (disableCloseBtn ? [] : [ { label: lang('Close'), cssClass: 'btn-default', action: function(dialog) { typeof dialog.getData('callback') === 'function' && dialog.getData('callback')(false); dialog.close(); } } ]), function(dialog) { dialog.$modalBody.append(div); if(addClass) $(dialog.$modalDialog).addClass(addClass); }, function(dialog) { thisApp = cms.cccApp.init(cccFormAPI, $(dialog.$modalDialog).find(".cccApp"), (uid ? uid : false), false, function(thisApp) { if(callback) callback(thisApp, dialog) }, function() { if(canDebug()) console.log('onDestory App'); dialog.close(); }); formSelect(thisApp); }, function(dialog) { if(canDebug()) console.log('onhide'); }, function(dialog) { if(canDebug()) console.log('onhidden'); if(oncloseCallback) oncloseCallback(thisApp); }, disableCenter, true); }); } function rawurldecode(str) { return decodeURIComponent((str + '') .replace(/%(?![\da-f]{2})/gi, function() { return '%25'; })); } function rawurlencode(str) { str = (str + '') .toString(); return encodeURIComponent(str) .replace(/!/g, '%21') .replace(/'/g, '%27') .replace(/\(/g, '%28') .replace(/\)/g, '%29') .replace(/\*/g, '%2A'); } function canDebug() { return false; } var randomIDs = []; var cms = { cccApp: {}, functionControl: function(func) { var setting = { swipe: true }; if(setting[ func ]) { return setting[ func ]; } else { return false; } }, ready: function() { }, init: function() { }, translate: function(id, cmsPath) { console.log('Translate', id, cmsPath); if(!cmsPath) cmsPath = root_header_path loadPopupForm('Translate', cmsPath + 'cccframework/cccApp/getApp/?app=translate', cmsPath + '|cccms/ucp/api/ucp-v1/translate', id, false, function(thisApp, dialog) { thisApp.onSave = function() { dialog.close(); }; }, false, false, true); }, siteSettingContent: function(client, settingSwitch, field, id, cmsPath) { console.log('settingContent', client, settingSwitch, field, cmsPath); if(!cmsPath) cmsPath = root_header_path loadPopupForm('Site Setting Content', cmsPath + 'cccframework/cccApp/getSiteSettingApp/?field=' + field + '&client=' + client + '&setting_switch=' + settingSwitch, cmsPath + '|cccms/ucp/api/ucp-v1/site-setting', id, "modal-lg", function(thisApp, dialog) { thisApp.onSave = function() { //dialog.close(); }; }, false, false, true); }, inArray: function(needle, haystack) { var length = haystack.length; for(var i = 0; i < length; i++) { if(haystack[ i ] == needle) return true; } return false; }, loadScript: function(url, callback) { var head = document.getElementsByTagName('head')[ 0 ]; var script = document.createElement('script'); script.type = 'text/javascript'; if(url) { script.src = url; } if(callback && typeof (callback) === 'function') { script.onreadystatechange = callback; script.onload = callback; } head.appendChild(script); }, makeID: function() { if(!text) { var text = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for(var i = 0; i < 5; i++) { text += possible.charAt(Math.floor(Math.random() * possible.length)); } if(cms.in_array(text, randomIDs)) return cms.makeID(); } cms.regID(text); return text; }, regID: function(id) { randomIDs.push(id); }, shuffle: function(array) { var currentIndex = array.length, temporaryValue, randomIndex; while(0 !== currentIndex) { randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; temporaryValue = array[ currentIndex ]; array[ currentIndex ] = array[ randomIndex ]; array[ randomIndex ] = temporaryValue; } return array; }, getCookie: function(cname) { var name = ('isCCCMS' in window && window.isCCCMS ? 'cccms_' : '') + cname + "="; var ca = document.cookie.split(';'); for(var i = 0; i < ca.length; i++) { var c = ca[ i ]; while(c.charAt(0) == ' ') c = c.substring(1); if(c.indexOf(name) != -1) return c.substring(name.length, c.length); } return ""; }, setCookie: function(cname, cvalue, exdays, path) { var d = new Date(); exdays = (exdays === false ? 1 : exdays); d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000); var expires = "expires=" + d.toGMTString(); path = "path=" + (path != '' && path != undefined ? path : '/'); document.cookie = ('isCCCMS' in window && window.isCCCMS ? 'cccms_' : '') + cname + "=" + cvalue + "; " + expires + "; " + path; }, funnySubmitButton: function(obj) { document.write(''); }, loadingDiv: function(target, addLoading, setting) { if($(target).length > 1) { $(target).each(function() { cms.loadingDiv(this, addLoading, setting); }); return false; } var LoadingDivID = cms.makeID(); if(!setting) setting = { loading: {}, background: {} }; if(!setting[ 'loading' ]) setting[ 'loading' ] = {}; if(!setting[ 'background' ]) setting[ 'background' ] = {}; if($("html,body").hasClass("hasSelectable")) { $('html,body').selectable("disable"); } var loading; if(!addLoading) { loading = $(''); } else { loading = $("
"); } $.each(setting[ 'loading' ], function(k, v) { if(loading) $(loading).css(k, v); }); var background = $("
"); var final = $("
").css({ position: ($(target).is("body") ? "fixed" : "absolute"), 'z-index': '65535', height: $(target).height(), width: $(target).width() }).append(background).append(loading); var thisCallBack = function() { $(background).css({ position: ($(target).is("body") ? "fixed" : "absolute"), opacity: (addLoading ? '0' : '0.5'), background: '#ffffff', height: $(target).outerHeight(), width: $(target).outerWidth() }).mousemove(function(e) { e.preventDefault(); return false; }).mousedown(function(e) { e.preventDefault(); return false; }); $.each(setting[ 'background' ], function(k, v) { if(background) $(background).css(k, v); }); $.each([ 'border-top-left-radius', 'border-top-right-radius', 'border-bottom-right-radius', 'border-bottom-left-radius', '-webkit-border-radius', '-webkit-border-top-left-radius', '-webkit-border-top-right-radius', '-webkit-border-bottom-right-radius', '-webkit-border-bottom-left-radius', '-moz-border-radius', '-moz-border-radius-topleft', '-moz-border-radius-topright', '-moz-border-radius-bottomright', '-moz-border-radius-bottomleft' ], function(k, keyword) { if($(target).css(keyword)) $(background).css(keyword, $(target).css(keyword)); }); $.each({ "padding-top": 'margin-top', "padding-left": 'margin-left' }, function(keyword, value) { if($(target).css(keyword)) $(background).css(value, '-' + $(target).css(keyword)); }); }; thisCallBack(); final.attr("LoadingDivID", LoadingDivID); var subCallBack = function() { if(!$(final).is(":visible")) { $(window).unbind("resize." + LoadingDivID); $(document).unbind("LoadingDivResize." + LoadingDivID); return false; } $(final).css({ position: 'absolute', 'z-index': '65535', height: $(target).height(), width: $(target).width() }); thisCallBack(); }; $(window).bind("resize." + LoadingDivID, function() { subCallBack(); }); $(document).bind("LoadingDivResize." + LoadingDivID, function() { subCallBack(); }); cms.removeLoadingDiv(target); $(target).prepend(final); if($(target).is("body")) $("body").css("overflow", "hidden"); return { 'setText': function(text) { console.log($(target).children(".LoadingDiv").find(".statusGif")); $(target).children(".LoadingDiv").find(".statusGif").html("" + text + ""); } }; }, removeLoadingDiv: function(target) { if($(target).is("body")) $("body").css("overflow", ""); if($(target).length > 1) { $(target).each(function() { cms.removeLoadingDiv(this); }); return false; } if($("html").hasClass("hasSelectable")) { $('html,body').selectable("enable"); } if(target.attr) var LoadingDivID = target.attr("LoadingDivID"); if(LoadingDivID) { $(window).unbind("resize." + LoadingDivID); $(document).unbind("LoadingDivResize." + LoadingDivID); } $(target).children(".LoadingDiv").remove(); }, simpleHrefValue: function(obj, title) { var $obj = $(obj); var value = obj.href; value = value.replace("javascript:void('", '').replace("');", ''); BootstrapDialog.show({ 'title': title, 'message': '
' + value + '
' }); }, simpleConfirm: function(type, message, callback) { var btnColorType = 'default'; switch(type) { case 'alert' : btnColorType = 'danger'; break; default : btnColorType = type; break; } BootstrapDialog.confirm(false, type, false, lang(message), false, false, callback, [ { label: lang('cancel'), cssClass: 'btn-default', action: function(dialog) { typeof dialog.getData('callback') === 'function' && dialog.getData('callback')(false); dialog.close(); } }, { label: lang('enter'), cssClass: 'btn-' + btnColorType, action: function(dialog) { typeof dialog.getData('callback') === 'function' && dialog.getData('callback')(true); dialog.close(); } } ] ) }, simpleAjax: function(ajaxOptions, doneCallBack, failCallBack) { $.ajax(ajaxOptions).done(function(data, textStatus, jqXHR) { if(doneCallBack && typeof (doneCallBack) == 'function') { doneCallBack(data, textStatus, jqXHR); } }).fail(function(data, textStatus, jqXHR) { if(failCallBack && typeof (failCallBack) == 'function') { failCallBack(data, textStatus, jqXHR); } else { console.warn(data, textStatus, jqXHR); } }); }, windowFocus: function($windowFocusFunc, $windowBlurFunc, $tabFocusFunc, $tabBlurFunc) { //Main visibility API function //Use visibility API to check if current tab is active or not var vis = (function() { var stateKey, eventKey, keys = { hidden: "visibilitychange", webkitHidden: "webkitvisibilitychange", mozHidden: "mozvisibilitychange", msHidden: "msvisibilitychange" }; for(stateKey in keys) { if(stateKey in document) { if(keys[ stateKey ]) { eventKey = keys[ stateKey ]; break; } } } return function(c) { if(c) { document.addEventListener(eventKey, c); } else { return !document[ stateKey ]; } } })(); //Check if current tab is active or not vis(function() { if(vis()) { // tween resume() code goes here if($tabFocusFunc && typeof ($tabFocusFunc) !== 'undefined') { $tabFocusFunc(); } } else { // tween pause() code goes here if($tabBlurFunc && typeof ($tabBlurFunc) !== 'undefined') { $tabBlurFunc(); } } }); //Check if browser window has focus var notIE = (document.documentMode === undefined), isChromium = window.chrome; if(notIE && !isChromium) { // checks for Firefox and other NON IE Chrome versions $(window).on("focusin", function() { // tween resume() code goes here if($windowFocusFunc && typeof ($windowFocusFunc) !== 'undefined') { $windowFocusFunc(); } }).on("focusout", function() { // tween pause() code goes here if($windowBlurFunc && typeof ($windowBlurFunc) !== 'undefined') { $windowBlurFunc(); } }); } else { // checks for IE and Chromium versions if(window.addEventListener) { // bind focus event window.addEventListener("focus", function(event) { // tween resume() code goes here if($windowFocusFunc && typeof ($windowFocusFunc) !== 'undefined') { $windowFocusFunc(); } }, false); // bind blur event window.addEventListener("blur", function(event) { // tween pause() code goes here if($windowBlurFunc && typeof ($windowBlurFunc) !== 'undefined') { $windowBlurFunc(); } }, false); } else { // bind focus event window.attachEvent("focus", function(event) { // tween resume() code goes here if($windowFocusFunc && typeof ($windowFocusFunc) !== 'undefined') { $windowFocusFunc(); } }); // bind focus event window.attachEvent("blur", function(event) { // tween pause() code goes here if($windowBlurFunc && typeof ($windowBlurFunc) !== 'undefined') { $windowBlurFunc(); } }); } } }, /*Like PHP Function*/ in_array: function(needle, haystack) { var length = haystack.length; for(var i = 0; i < length; i++) { if(haystack[ i ] == needle) return true; } return false; }, urlencode: function(str) { str = (str + '').toString(); return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+'); }, http_build_query: function(formdata, numeric_prefix, arg_separator) { var value, key, tmp = []; var _http_build_query_helper = function(key, val, arg_separator) { var k, tmp = []; if(val === true) { val = "1"; } else if(val === false) { val = "0"; } if(val !== null && typeof (val) === "object") { for(k in val) { if(val[ k ] !== null) { tmp.push(_http_build_query_helper(key + "[" + k + "]", val[ k ], arg_separator)); } } return tmp.join(arg_separator); } else if(typeof (val) !== "function") { return cms.urlencode(key) + "=" + cms.urlencode(val); } else if(typeof (val) == "function") { return ''; } else { throw new Error('There was an error processing for http_build_query().'); } }; if(!arg_separator) { arg_separator = "&"; } for(key in formdata) { value = formdata[ key ]; if(numeric_prefix && !isNaN(key)) { key = String(numeric_prefix) + key; } tmp.push(_http_build_query_helper(key, value, arg_separator)); } return tmp.join(arg_separator); } /*Like PHP Function*/ }; var tempData = {}; tempData[ 'lang' ] = {}; function lang(code, langID, codecheck) { var span = false; var start_span, end_span; if(!code) return ''; code = code; if((new RegExp("^span:.*")).test(code)) { span = true; code = code.replace('span:', ''); } if(!langID) langID = tempData[ 'currentLangID' ]; if(span) { //font-size:'+$('body').css('font-size')+';line-height:'+$('body').css('line-height')+'; start_span = ''; end_span = ''; } else { start_span = ''; end_span = ''; } var errorCode = start_span + (codecheck ? '400' : code) + end_span; if(tempData[ 'lang' ]) { if(langID in tempData[ 'lang' ] && typeof tempData[ 'lang' ][ langID ] !== 'undefined') { var $breakSpace = false; if('breakspace' in tempData[ 'lang' ][ langID ]) $breakSpace = tempData[ 'lang' ][ langID ][ 'breakspace' ]; if(code in tempData[ 'lang' ][ langID ]) { return start_span + tempData[ 'lang' ][ langID ][ code ] + end_span; } else { return code; // var final = code; // if(code.match(/(_|-|:)/g)){ // var langItems = code.split(":"); // if($.isArray(langItems)){ // $.each(langItems ,function(k,subLangItems){ // var word = ''; // if(subLangItems in tempData['lang'][langID]){ // word = tempData['lang'][langID][subLangItems]; // var reg = new RegExp(word,"g"); // final = subLangItems.replace(reg,final); // } else { // subLangItems = subLangItems.split("_"); // var fullString = []; // if($.isArray(subLangItems)) $.each(subLangItems ,function(ik,$subItems){ // var word; // if($subItems in tempData['lang'][langID]){ // word = tempData['lang'][langID][$subItems]; // var reg = new RegExp(word,"g"); // fullString.push(word); // } else { // fullString.push($subItems); // } // }); // final = fullString.join("_"); // } // }); // } // if(!$breakSpace) { // final = final.replace(/(_|-)/g,""); // } // if($breakSpace) { // final = final.replace(/(_|-)/g," "); // } // return final; // } else { // return errorCode; // } } } else { return code; } } else { return errorCode; } } function LoadLangPackage(langID, callback, update) { $(document).trigger('reloadLayout'); var mainHandler = function() { if(!tempData[ 'lang' ]) tempData[ 'lang' ] = {}; if(!langID && clang > 0) { langID = clang; } else { if(!(langID >= 0) || langID == null) { langID = 2; } } var obj; var handler = function() { if(tempData[ 'oldLangID' ] != tempData[ 'currentLangID' ]) { obj = $('.langPack'); } else { obj = $('.langPack:not(.langEcho)'); obj = $('.langPack'); } $(obj).each(function() { var $this = $(this); if($this.hasClass('langSpan')) { $this.css({ 'width': 'auto', 'height': 'auto', 'display': '', 'position': 'relative', 'float': 'none', 'padding': '0px', 'margin': '0px', 'top': '0px', 'left': '0px', 'font-size': $('body').css('font-size'), 'line-height': $('body').css('line-height') }); } var rawlangCode = $this.attr('lang'); if(rawlangCode) { if((new RegExp("^attr:.*")).test(rawlangCode)) { rawlangCode = rawlangCode.replace('attr:', ''); rawlangCode = rawlangCode.split(":"); if(rawlangCode.length > 1) { $this.attr(rawlangCode[ 0 ], lang(rawlangCode[ 1 ])); } } else { if(tempData[ 'oldLangID' ] != tempData[ 'currentLangID' ]) { rawlangCode = rawlangCode.replace('pp:', '').replace('ap:', '').replace('ib:', '').replace('ia:', ''); $this.contents().filter(function() { return this.nodeType == 3 }).each(function() { if(this.textContent) { this.textContent = this.textContent.replace(lang(rawlangCode, tempData[ 'oldLangID' ]), lang(rawlangCode, tempData[ 'currentLangID' ])); } else { location.reload(); } }); } else { if(!($this.hasClass('langEcho'))) { if((new RegExp("^pp:.*")).test(rawlangCode)) { if(!((new RegExp("^" + lang(rawlangCode.replace('pp:', '')) + ".*")).test($this.html()))) { $this.prepend(lang(rawlangCode.replace('pp:', ''))); } } else if((new RegExp("^ap:.*")).test(rawlangCode)) { if(!((new RegExp(".*" + lang(rawlangCode.replace('ap:', '')) + "$")).test($this.html()))) { $this.append(lang(rawlangCode.replace('ap:', ''))); } } else if((new RegExp("^ib:.*")).test(rawlangCode)) { $this.insertBefore(lang(rawlangCode.replace('ib:', ''))); } else if((new RegExp("^ia:.*")).test(rawlangCode)) { $this.insertAfter(lang(rawlangCode.replace('ia:', ''))); } else { $this.text(lang(rawlangCode)); } $this.addClass('langEcho'); } } } } }); if(tempData[ 'oldLangID' ] != tempData[ 'currentLangID' ]) { tempData[ 'oldLangID' ] = tempData[ 'currentLangID' ]; } if(callback && typeof (callback) === "function") { callback.call(); } cms.setCookie('lang', tempData[ 'currentLangID' ], 10); clang = tempData[ 'currentLangID' ]; $(document).trigger('langPackLoaded'); }; if(langID > 0) { if(langID in tempData[ 'lang' ]) { tempData[ 'currentLangID' ] = langID; if(!(tempData[ 'oldLangID' ] >= 0)) tempData[ 'oldLangID' ] = langID; handler(); } else { if('isExportMode' in window || 'skipAjaxLang' in window) { if(callback && typeof (callback) === "function") { callback.call(); } $(document).trigger('langPackLoaded'); } else { $.ajax({ url: root_header_path + 'lib/ajax/lang/get/', data: { lang: langID }, type: 'GET', dataType: "json", error: function(data) { tempData[ 'lang' ][ langID ] = data.lang; tempData[ 'currentLangID' ] = langID; if(!(tempData[ 'oldLangID' ] >= 0)) tempData[ 'oldLangID' ] = langID; handler(); }, success: function(data) { tempData[ 'lang' ][ langID ] = data.lang; tempData[ 'currentLangID' ] = langID; if(!(tempData[ 'oldLangID' ] >= 0)) tempData[ 'oldLangID' ] = langID; handler(); } }); } } } else { handler(); } }; if(update && langID > 0 && (tempData[ 'oldLangID' ] != tempData[ 'currentLangID' ])) { mainHandler(); } else { mainHandler(); } } $(window).load(function() { if(!clang) clang = 1; LoadLangPackage(clang, function() { $(document).trigger("langLoaded"); $("body").addClass("langLoaded"); }); }); var pad = function(n, width, z) { z = z || '0'; n = n + ''; return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n; }; function htmlEntities(str) { return String(str).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); } var waitForFinalEvent = (function() { var timers = {}; return function(callback, ms, uniqueId) { if(!uniqueId) { uniqueId = "Don't call this twice without a uniqueId"; } if(timers[ uniqueId ]) { clearTimeout(timers[ uniqueId ]); } timers[ uniqueId ] = setTimeout(callback, ms); }; })(); $.fn.extend({ animateCss: function(animationName) { var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend'; $(this).addClass('animated ' + animationName).one(animationEnd, function() { $(this).removeClass('animated ' + animationName); }); } }); $(document).ready(function() { $("[data-animation]").each(function() { var thisData = ($(this).attr('data-animation')).split(","); var $this = this; switch(thisData[ 1 ]) { case 'hover': $($this).hover(function() { $(this).animateCss(thisData[ 0 ]); }); break; case 'hover-long': $($this).hover(function() { switch(thisData[ 0 ]) { case 'scale': if($(this).attr("data-animation-target")) { $(this).find($(this).attr("data-animation-target")).addClass("hoverScale"); $(this).find($(this).attr("data-animation-target")).addClass("hoverScaled"); } else { $(this).addClass("hoverScale"); $(this).addClass("hoverScaled"); } break; default: $($this).hover(function() { $(this).animateCss(thisData[ 0 ]); }); break; } }, function() { switch(thisData[ 0 ]) { case 'scale': if($(this).attr("data-animation-target")) { var $target = $(this).find($(this).attr("data-animation-target")); $($target).removeClass("hoverScale"); setTimeout(function() { if(!$($target).hasClass("hoverScale")) { $($target).removeClass("hoverScaled"); } }, 500); } else { $(this).removeClass("hoverScale"); setTimeout(function() { if(!$($this).hasClass("hoverScale")) { $($this).removeClass("hoverScaled"); } }, 500); } break; default: break; } }); break; } }); }); var getPercentage = function(orgValue, str) { var s = "%"; if(str.indexOf(s) > -1) { return orgValue * (parseInt(str.replace("%", "")) / 100); } else { return parseInt(str.replace("%", "")); } }; var positionObj = function(thisObj) { var obj = $(thisObj); if(obj.hasClass("reset-animate-me")) { console.log('reset-animate-me'); $($this).css({ '-webkit-transform': 'scale(' + ratio + ')', '-moz-transform': 'scale(' + ratio + ')', '-ms-transform': 'scale(' + ratio + ')', '-o-transform': 'scale(' + ratio + ')', 'transform': 'scale(' + ratio + ')' }); obj.css({ 'top': '0px', 'left': '0px', 'margin-left': '0px', 'margin-top': '0px' }); return; } var $this = obj; var baseWidth = $(obj).attr('data-base-scale-width'); var refObj = $(obj).attr(' data-base-scale-min="0.9" data-base-scale-obj-ref'); var minRatio = $(obj).attr('data-base-scale-min'); var maxRatio = $(obj).attr('data-base-scale-max'); var targetObj = $(obj).parent(); if(refObj) { targetObj = $(refObj); } var ratio = $(targetObj).width() / baseWidth; if(minRatio) if(ratio < minRatio) ratio = minRatio; if(maxRatio) if(ratio > maxRatio) ratio = maxRatio; $($this).css({ '-webkit-transform': 'scale(' + ratio + ')', '-moz-transform': 'scale(' + ratio + ')', '-ms-transform': 'scale(' + ratio + ')', '-o-transform': 'scale(' + ratio + ')', 'transform': 'scale(' + ratio + ')' }); var targetX = obj.attr('data-center-x'); var targetY = obj.attr('data-center-y'); if($(window).width() < 1200) { var mdY = obj.attr('data-center-y-md'); if(mdY) targetY = mdY; var mdX = obj.attr('data-center-x-md'); if(mdX) targetX = mdX; } if($(window).width() < 992) { var smY = obj.attr('data-center-y-sm'); if(smY) targetY = smY; var smX = obj.attr('data-center-x-sm'); if(smX) targetX = smX; } if($(window).width() < 768) { var xsY = obj.attr('data-center-y-xs'); if(xsY) targetY = xsY; var xsX = obj.attr('data-center-x-xs'); if(xsX) targetX = xsX; } if(targetY == "bottom" || targetY == "top") { var thisWidth = obj.width(); var thisHeight = obj.height(); var css = { left: (targetX ? getPercentage(targetObj.width(), targetX) : "0px"), 'margin-left': '-' + (targetX ? thisWidth / 2 : 0) + 'px', 'margin-top': '0px' }; if(targetY == "bottom") { css[ 'bottom' ] = "0"; } if(targetY == "top") { css[ 'top' ] = "0"; } } else { var thisWidth = obj.width(); var thisHeight = obj.height(); var css = { left: (targetX ? getPercentage(targetObj.width(), targetX) : "0px"), top: getPercentage(targetObj.height(), targetY), 'margin-left': '-' + (targetX ? thisWidth / 2 : 0) + 'px', 'margin-top': '-' + (targetY ? thisHeight / 2 : 0) + 'px' }; } obj.css(css); }; var animateMe = function() { $(".animate-me,.reset-animate-me").each(function() { var $this = this; positionObj($this); if(!$($this).attr('id')) $($this).attr('id', cms.makeID()); $(window).resize(function() { waitForFinalEvent(function() { positionObj($this); setTimeout(function() { positionObj($this); }, 500); }, 200, "id-" + $($this).attr('id')) }); }); $("[data-refHeight]").each(function() { var $this = this; var obj = $($this).attr('data-refHeight'); var thisHeight = "auto"; if($(obj).length) { thisHeight = $(obj).first().outerHeight(); } $($this).height(thisHeight); }); $("[data-flex-col]").each(function() { var totalCol = 0; $(this).parent().children("[data-flex-col]").each(function() { var thisCol = parseInt($(this).attr('data-flex-col')); if(thisCol) totalCol += thisCol }); var othersHeight = 0; $(this).parent().children().not("[data-flex-col]").not(".LoadingDiv").filter(function() { var position = $(this).css('position'); return position !== 'absolute'; }).each(function() { othersHeight += $(this).outerHeight(); }); var thisHeight = ($(this).parent().height() - othersHeight) / totalCol * parseInt($(this).attr('data-flex-col')); $(this).height(thisHeight); }); $("[data-flex-row]").each(function() { var totalCol = 0; $(this).parent().children("[data-flex-row]").each(function() { var thisCol = parseInt($(this).attr('data-flex-row')); if(thisCol) totalCol += thisCol }); var othersWidth = 0; $(this).parent().children().not("[data-flex-row]").not(".LoadingDiv").filter(function() { var position = $(this).css('position'); return position !== 'absolute'; }).each(function() { othersWidth += $(this).outerWidth(); }); var thisWidth = ($(this).parent().width() - othersWidth) / totalCol * parseInt($(this).attr('data-flex-row')); $(this).width(thisWidth); }); }; var initBackstretchImage = function() { $("[data-backstretchImage]").each(function() { var imagePath = $(this).attr('data-backstretchImage'); if(imagePath) $(this).resizeOrInitBackstretch(imagePath); }); $("[data-xs-class],[data-sm-class],[data-md-class],[data-lg-class]").each(function() { var dataXS = $(this).attr('data-xs-class'); var dataSM = $(this).attr('data-sm-class'); var dataMD = $(this).attr('data-md-class'); var dataLG = $(this).attr('data-lg-class'); $(this).removeClass(dataXS); $(this).removeClass(dataSM); $(this).removeClass(dataMD); $(this).removeClass(dataLG); $(this).addClass(dataXS); if($(window).width() >= 768) { $(this).removeClass(dataXS); $(this).addClass(dataSM); } if($(window).width() >= 992) { $(this).removeClass(dataXS); $(this).removeClass(dataSM); $(this).addClass(dataMD); } if($(window).width() >= 1200) { $(this).removeClass(dataXS); $(this).removeClass(dataSM); $(this).removeClass(dataMD); $(this).addClass(dataLG); } }); }; $(document).bind("refHeightLoaded.positionObj", function() { $(document).unbind("refHeightLoaded.positionObj"); animateMe(); var callback = function() { initBackstretchImage(); }; callback(); $(window).resize(function() { callback(); setTimeout(callback, 500); }); }); $(window).load(function() { if(!('noReFontSize' in window)) { var f = cms.getCookie('font-size'); if(f) { $('a[rel=' + f + ']') .addClass('fontSizeActive') .siblings() .removeClass('fontSizeActive'); $.switchFontSize(f); // 20131126 added } } $('.fontSizeM, .fontSizeL, .fontSizeEx') .attr('href', 'javascript:void(0)') .click(function(e) { $('.fontSizeM, .fontSizeL, .fontSizeEx').removeClass("fontSizeActive"); $.switchFontSize($(this).attr('rel')); $(this) .addClass('fontSizeActive') .siblings() .removeClass('fontSizeActive'); }); if($(".scrollToObj").length) { $('html, body').stop(true).animate({ scrollTop: $(".scrollToObj").offset().top }, 500); } }); var fontChangeCall = false; $.switchFontSize = function(fz) { // console.log(fz); // 20131126: remove all font class // $(".mainContainer *").each(function () { // var $this = this; // if (!$($this).attr('data-org-font-size')) { // $($this).attr('data-org-font-size', $(this).css('font-size')); // } // }); // var runCallback = function () { // $(".mainContainer *").each(function () { // var $this = this; // if (!$($this).attr('data-org-font-size')) { // $($this).attr('data-org-font-size', $($this).css('font-size')); // } // var newFontSize = $($this).attr('data-org-font-size'); // switch (fz) { // case 'font-size-largest': // newFontSize = (parseInt(newFontSize.replace('px', '')) + 2) + 'px'; // $($this).get(0).style.setProperty('font-size', newFontSize, 'important'); // break; // case 'font-size-larger': // newFontSize = (parseInt(newFontSize.replace('px', '')) + 1) + 'px'; // $($this).get(0).style.setProperty('font-size', newFontSize, 'important'); // break; // default: // $($this).get(0).style.setProperty('font-size', newFontSize, 'important'); // break; // } // }); // // }; // runCallback(); if(fontChangeCall) clearInterval(fontChangeCall); if(fz == "font-size-largest" || fz == "font-size-larger") { fontChangeCall = setInterval(runCallback, 200); } cms.setCookie('font-size', fz); if('refHeight' in window) refHeight(); }; var isCtrl = false; var isShift = false; var adminLoginOpen = false; function initAdminMode() { if("FRONTEND_IS_ADMIN" in window && !FRONTEND_IS_ADMIN) { $(document).keyup(function(e) { if(e.which == 17) { isCtrl = false; } if(e.which == 16) { isShift = false; } }); $(document).keydown(function(e) { if(e.which == 17) { isCtrl = true; } if(e.which == 16) { isShift = true; } //ctrl + shift + a if(e.which == 65 && isCtrl && isShift && adminLoginOpen === false) { adminLoginOpen = true; console.log("Admin mode open"); cmsPath = root_header_path; loadPopupForm('Admin Login', cmsPath + 'cccframework/cccApp/getApp/?app=front-login&client_id=' + CLIENT_ID, cmsPath + '|cccms/ucp/api/ucp-v1/login/front', "", "modal-lg", function(thisApp, dialog) { thisApp.onSave = function(data) { if(data[ "status" ] == "1") { cms.loadingDiv("body"); $.ajax({ url: root_header_path + 'cccframework/admin-mode/', data: { token: data[ "data" ][ "token" ], user_id: data[ "data" ][ "user_id" ], }, type: 'GET', dataType: "json", error: function(data) { cms.removeLoadingDiv("body"); }, success: function(data) { cms.removeLoadingDiv("body"); location.reload(); } }); dialog.close(); } }; }, function() { adminLoginOpen = false; }, false, true); } }); } } function frontAdminLogout() { cms.loadingDiv("body"); $.ajax({ url: root_header_path + 'cccframework/admin-mode/logout/', data: {}, type: 'GET', dataType: "json", error: function(data) { cms.removeLoadingDiv("body"); }, success: function(data) { location.reload(); cms.removeLoadingDiv("body"); } }); } function enableTranslateMode(value) { cms.loadingDiv("body"); $.ajax({ url: root_header_path + 'cccframework/admin-mode/translate/', data: { mode: value }, type: 'GET', dataType: "json", error: function(data) { cms.removeLoadingDiv("body"); }, success: function(data) { location.reload(); cms.removeLoadingDiv("body"); } }); } function enableSiteSetting(value) { cms.loadingDiv("body"); $.ajax({ url: root_header_path + 'cccframework/admin-mode/site-setting/', data: { mode: value }, type: 'GET', dataType: "json", error: function(data) { cms.removeLoadingDiv("body"); }, success: function(data) { location.reload(); cms.removeLoadingDiv("body"); } }); } $(document).ready(function() { if("FRONTEND_LOGIN" in window && FRONTEND_LOGIN) { initAdminMode(); } }); !function (n) { "use strict"; function t(n, t) { var r = (65535 & n) + (65535 & t); return (n >> 16) + (t >> 16) + (r >> 16) << 16 | 65535 & r } function r(n, t) { return n << t | n >>> 32 - t } function e(n, e, o, u, c, f) { return t(r(t(t(e, n), t(u, f)), c), o) } function o(n, t, r, o, u, c, f) { return e(t & r | ~t & o, n, t, u, c, f) } function u(n, t, r, o, u, c, f) { return e(t & o | r & ~o, n, t, u, c, f) } function c(n, t, r, o, u, c, f) { return e(t ^ r ^ o, n, t, u, c, f) } function f(n, t, r, o, u, c, f) { return e(r ^ (t | ~o), n, t, u, c, f) } function i(n, r) { n[r >> 5] |= 128 << r % 32, n[14 + (r + 64 >>> 9 << 4)] = r; var e, i, a, d, h, l = 1732584193, g = -271733879, v = -1732584194, m = 271733878; for (e = 0; e < n.length; e += 16) i = l, a = g, d = v, h = m, g = f(g = f(g = f(g = f(g = c(g = c(g = c(g = c(g = u(g = u(g = u(g = u(g = o(g = o(g = o(g = o(g, v = o(v, m = o(m, l = o(l, g, v, m, n[e], 7, -680876936), g, v, n[e + 1], 12, -389564586), l, g, n[e + 2], 17, 606105819), m, l, n[e + 3], 22, -1044525330), v = o(v, m = o(m, l = o(l, g, v, m, n[e + 4], 7, -176418897), g, v, n[e + 5], 12, 1200080426), l, g, n[e + 6], 17, -1473231341), m, l, n[e + 7], 22, -45705983), v = o(v, m = o(m, l = o(l, g, v, m, n[e + 8], 7, 1770035416), g, v, n[e + 9], 12, -1958414417), l, g, n[e + 10], 17, -42063), m, l, n[e + 11], 22, -1990404162), v = o(v, m = o(m, l = o(l, g, v, m, n[e + 12], 7, 1804603682), g, v, n[e + 13], 12, -40341101), l, g, n[e + 14], 17, -1502002290), m, l, n[e + 15], 22, 1236535329), v = u(v, m = u(m, l = u(l, g, v, m, n[e + 1], 5, -165796510), g, v, n[e + 6], 9, -1069501632), l, g, n[e + 11], 14, 643717713), m, l, n[e], 20, -373897302), v = u(v, m = u(m, l = u(l, g, v, m, n[e + 5], 5, -701558691), g, v, n[e + 10], 9, 38016083), l, g, n[e + 15], 14, -660478335), m, l, n[e + 4], 20, -405537848), v = u(v, m = u(m, l = u(l, g, v, m, n[e + 9], 5, 568446438), g, v, n[e + 14], 9, -1019803690), l, g, n[e + 3], 14, -187363961), m, l, n[e + 8], 20, 1163531501), v = u(v, m = u(m, l = u(l, g, v, m, n[e + 13], 5, -1444681467), g, v, n[e + 2], 9, -51403784), l, g, n[e + 7], 14, 1735328473), m, l, n[e + 12], 20, -1926607734), v = c(v, m = c(m, l = c(l, g, v, m, n[e + 5], 4, -378558), g, v, n[e + 8], 11, -2022574463), l, g, n[e + 11], 16, 1839030562), m, l, n[e + 14], 23, -35309556), v = c(v, m = c(m, l = c(l, g, v, m, n[e + 1], 4, -1530992060), g, v, n[e + 4], 11, 1272893353), l, g, n[e + 7], 16, -155497632), m, l, n[e + 10], 23, -1094730640), v = c(v, m = c(m, l = c(l, g, v, m, n[e + 13], 4, 681279174), g, v, n[e], 11, -358537222), l, g, n[e + 3], 16, -722521979), m, l, n[e + 6], 23, 76029189), v = c(v, m = c(m, l = c(l, g, v, m, n[e + 9], 4, -640364487), g, v, n[e + 12], 11, -421815835), l, g, n[e + 15], 16, 530742520), m, l, n[e + 2], 23, -995338651), v = f(v, m = f(m, l = f(l, g, v, m, n[e], 6, -198630844), g, v, n[e + 7], 10, 1126891415), l, g, n[e + 14], 15, -1416354905), m, l, n[e + 5], 21, -57434055), v = f(v, m = f(m, l = f(l, g, v, m, n[e + 12], 6, 1700485571), g, v, n[e + 3], 10, -1894986606), l, g, n[e + 10], 15, -1051523), m, l, n[e + 1], 21, -2054922799), v = f(v, m = f(m, l = f(l, g, v, m, n[e + 8], 6, 1873313359), g, v, n[e + 15], 10, -30611744), l, g, n[e + 6], 15, -1560198380), m, l, n[e + 13], 21, 1309151649), v = f(v, m = f(m, l = f(l, g, v, m, n[e + 4], 6, -145523070), g, v, n[e + 11], 10, -1120210379), l, g, n[e + 2], 15, 718787259), m, l, n[e + 9], 21, -343485551), l = t(l, i), g = t(g, a), v = t(v, d), m = t(m, h); return [l, g, v, m] } function a(n) { var t, r = "", e = 32 * n.length; for (t = 0; t < e; t += 8) r += String.fromCharCode(n[t >> 5] >>> t % 32 & 255); return r } function d(n) { var t, r = []; for (r[(n.length >> 2) - 1] = void 0, t = 0; t < r.length; t += 1) r[t] = 0; var e = 8 * n.length; for (t = 0; t < e; t += 8) r[t >> 5] |= (255 & n.charCodeAt(t / 8)) << t % 32; return r } function h(n) { return a(i(d(n), 8 * n.length)) } function l(n, t) { var r, e, o = d(n), u = [], c = []; for (u[15] = c[15] = void 0, o.length > 16 && (o = i(o, 8 * n.length)), r = 0; r < 16; r += 1) u[r] = 909522486 ^ o[r], c[r] = 1549556828 ^ o[r]; return e = i(u.concat(d(t)), 512 + 8 * t.length), a(i(c.concat(e), 640)) } function g(n) { var t, r, e = ""; for (r = 0; r < n.length; r += 1) t = n.charCodeAt(r), e += "0123456789abcdef".charAt(t >>> 4 & 15) + "0123456789abcdef".charAt(15 & t); return e } function v(n) { return unescape(encodeURIComponent(n)) } function m(n) { return h(v(n)) } function p(n) { return g(m(n)) } function s(n, t) { return l(v(n), v(t)) } function C(n, t) { return g(s(n, t)) } function A(n, t, r) { return t ? r ? s(t, n) : C(t, n) : r ? m(n) : p(n) } "function" == typeof define && define.amd ? define(function () { return A }) : "object" == typeof module && module.exports ? module.exports = A : n.md5 = A }(this); /*! * jQuery Mousewheel 3.1.13 * * Copyright jQuery Foundation and other contributors * Released under the MIT license * http://jquery.org/license */ (function (factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['jquery'], factory); } else if (typeof exports === 'object') { // Node/CommonJS style for Browserify module.exports = factory; } else { // Browser globals factory(jQuery); } }(function ($) { var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'], toBind = ('onwheel' in document || document.documentMode >= 9) ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'], slice = Array.prototype.slice, nullLowestDeltaTimeout, lowestDelta; if ($.event.fixHooks) { for (var i = toFix.length; i;) { $.event.fixHooks[toFix[--i]] = $.event.mouseHooks; } } var special = $.event.special.mousewheel = { version: '3.1.12', setup: function () { if (this.addEventListener) { for (var i = toBind.length; i;) { this.addEventListener(toBind[--i], handler, false); } } else { this.onmousewheel = handler; } // Store the line height and page height for this particular element $.data(this, 'mousewheel-line-height', special.getLineHeight(this)); $.data(this, 'mousewheel-page-height', special.getPageHeight(this)); }, teardown: function () { if (this.removeEventListener) { for (var i = toBind.length; i;) { this.removeEventListener(toBind[--i], handler, false); } } else { this.onmousewheel = null; } // Clean up the data we added to the element $.removeData(this, 'mousewheel-line-height'); $.removeData(this, 'mousewheel-page-height'); }, getLineHeight: function (elem) { var $elem = $(elem), $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent'](); if (!$parent.length) { $parent = $('body'); } return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16; }, getPageHeight: function (elem) { return $(elem).height(); }, settings: { adjustOldDeltas: true, // see shouldAdjustOldDeltas() below normalizeOffset: true // calls getBoundingClientRect for each event } }; $.fn.extend({ mousewheel: function (fn) { return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel'); }, unmousewheel: function (fn) { return this.unbind('mousewheel', fn); } }); function handler(event) { var orgEvent = event || window.event, args = slice.call(arguments, 1), delta = 0, deltaX = 0, deltaY = 0, absDelta = 0, offsetX = 0, offsetY = 0; event = $.event.fix(orgEvent); event.type = 'mousewheel'; // Old school scrollwheel delta if ('detail' in orgEvent) { deltaY = orgEvent.detail * -1; } if ('wheelDelta' in orgEvent) { deltaY = orgEvent.wheelDelta; } if ('wheelDeltaY' in orgEvent) { deltaY = orgEvent.wheelDeltaY; } if ('wheelDeltaX' in orgEvent) { deltaX = orgEvent.wheelDeltaX * -1; } // Firefox < 17 horizontal scrolling related to DOMMouseScroll event if ('axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS) { deltaX = deltaY * -1; deltaY = 0; } // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy delta = deltaY === 0 ? deltaX : deltaY; // New school wheel delta (wheel event) if ('deltaY' in orgEvent) { deltaY = orgEvent.deltaY * -1; delta = deltaY; } if ('deltaX' in orgEvent) { deltaX = orgEvent.deltaX; if (deltaY === 0) { delta = deltaX * -1; } } // No change actually happened, no reason to go any further if (deltaY === 0 && deltaX === 0) { return; } // Need to convert lines and pages to pixels if we aren't already in pixels // There are three delta modes: // * deltaMode 0 is by pixels, nothing to do // * deltaMode 1 is by lines // * deltaMode 2 is by pages if (orgEvent.deltaMode === 1) { var lineHeight = $.data(this, 'mousewheel-line-height'); delta *= lineHeight; deltaY *= lineHeight; deltaX *= lineHeight; } else if (orgEvent.deltaMode === 2) { var pageHeight = $.data(this, 'mousewheel-page-height'); delta *= pageHeight; deltaY *= pageHeight; deltaX *= pageHeight; } // Store lowest absolute delta to normalize the delta values absDelta = Math.max(Math.abs(deltaY), Math.abs(deltaX)); if (!lowestDelta || absDelta < lowestDelta) { lowestDelta = absDelta; // Adjust older deltas if necessary if (shouldAdjustOldDeltas(orgEvent, absDelta)) { lowestDelta /= 40; } } // Adjust older deltas if necessary if (shouldAdjustOldDeltas(orgEvent, absDelta)) { // Divide all the things by 40! delta /= 40; deltaX /= 40; deltaY /= 40; } // Get a whole, normalized value for the deltas delta = Math[delta >= 1 ? 'floor' : 'ceil'](delta / lowestDelta); deltaX = Math[deltaX >= 1 ? 'floor' : 'ceil'](deltaX / lowestDelta); deltaY = Math[deltaY >= 1 ? 'floor' : 'ceil'](deltaY / lowestDelta); // Normalise offsetX and offsetY properties if (special.settings.normalizeOffset && this.getBoundingClientRect) { var boundingRect = this.getBoundingClientRect(); offsetX = event.clientX - boundingRect.left; offsetY = event.clientY - boundingRect.top; } // Add information to the event object event.deltaX = deltaX; event.deltaY = deltaY; event.deltaFactor = lowestDelta; event.offsetX = offsetX; event.offsetY = offsetY; // Go ahead and set deltaMode to 0 since we converted to pixels // Although this is a little odd since we overwrite the deltaX/Y // properties with normalized deltas. event.deltaMode = 0; // Add event and delta to the front of the arguments args.unshift(event, delta, deltaX, deltaY); // Clearout lowestDelta after sometime to better // handle multiple device types that give different // a different lowestDelta // Ex: trackpad = 3 and mouse wheel = 120 if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); } nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200); return ($.event.dispatch || $.event.handle).apply(this, args); } function nullLowestDelta() { lowestDelta = null; } function shouldAdjustOldDeltas(orgEvent, absDelta) { // If this is an older event and the delta is divisable by 120, // then we are assuming that the browser is treating this as an // older mouse wheel event and that we should divide the deltas // by 40 to try and get a more usable deltaFactor. // Side note, this actually impacts the reported scroll distance // in older browsers and can cause scrolling to be slower than native. // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false. return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0; } })); ;// JavaScript Document /* Remember to encode */ /* https://javascriptobfuscator.com/Javascript-Obfuscator.aspx */ var isDOM = (getRef ? true : false); var isIE4 = ((document.all && !isDOM) ? true : false); var isNS4 = (document.layers ? true : false); var local_url = (header_path ? header_path : window.location.protocol + '//' + window.location.host + '/'); var root_local_url = (root_header_path ? root_header_path : window.location.protocol + '//' + window.location.host + '/'); var scripts = document.getElementsByTagName('script'); var myScript = scripts[scripts.length - 1]; var queryString = myScript.src.replace(/^[^\?]+\??/, ''); var global_js_params = parseQuery(queryString); function parseQuery(query) { var Params = new Object(); if (!query) return Params; // return empty object var Pairs = query.split(/[;&]/); for (var i = 0; i < Pairs.length; i++) { var KeyVal = Pairs[i].split('='); if (!KeyVal || KeyVal.length != 2) continue; var key = unescape(KeyVal[0]); var val = unescape(KeyVal[1]); val = val.replace(/\+/g, ' '); Params[key] = val; } return Params; } function getRef(id) { if (isDOM) return document.getElementById(id); if (isIE4) return document.all[id]; if (isNS4) return document.layers[id]; } var refHeight = function () { $(".layoutBlockHeight").each(function () { if ($(this).closest(".cccApp").length) return; var obj = $(this).parent().find(".layoutRefHeight").filter(":visible"); var targetHeight = $(obj).height(); if ($(this).hasClass("layoutBlockLineHeight")) { $(this).css('line-height', targetHeight + 'px'); $(this).css('padding-top', $(obj).css("padding-top")); $(this).css('padding-bottom', $(obj).css("padding-bottom")); } $(this).height(targetHeight); }); if($(".footer-menu-nav").hasClass("notSticky")){ var contentsHeight = $(".footer-menu-nav").outerHeight() + $(".menu-nav").outerHeight() + $(".mainContainer").outerHeight(); if(contentsHeight > $(window).height()){ $(".footer-padding").height("auto"); } else { $(".footer-padding").height($(window).height() - contentsHeight); } } $(".mainContainer").not(".notSticky").height($(window).height() - $(".menu-nav").outerHeight() - $(".footer-menu-nav").outerHeight()); $(".mainContainerHeight").not(".notSticky").height($(window).height() - $(".menu-nav").outerHeight() - $(".footer-menu-nav").outerHeight()); $(".changeBg").click(function(){ $(this).closest(".imagesContainer").find(".changeBg").removeClass("active"); $(this).addClass("active"); $(".overLayBg").backstretch($(this).attr("data-image"), { duration: 3000, fade: 0 }); }); $(".stickToBottom").each(function () { $(this).css('margin-top',$(this).parent().height() - $(this).outerHeight()+'px'); }); $(document).trigger("refHeightLoaded"); }; var scrollTimer = null; $(window).resize(function () { if (scrollTimer) { clearTimeout(scrollTimer); // clear any previous pending timer } scrollTimer = setTimeout(refHeight, 10); // set new timer }); $(document).bind("langLoaded", refHeight); $(document).bind("load", refHeight); $("html").addClass("frontEnd"); ;; function setupDatatable(obj,data,key){ $(obj).data('datatable_settings',data); if(!key) key = "dataTable"; $(obj).data('datatable_key',key); } $(window).load(function(){ $('.auto_datatable').each(function(){ var thisTable = $(this); var dataTableSetting = $(this).data('datatable_settings'); if(canDebug()) console.log(dataTableSetting); $(thisTable).dataTable(dataTableSetting); }); }); if(jQuery.fn.dataTableExt) jQuery.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique, bFiltered, bIgnoreEmpty ) { // check that we have a column id if ( typeof iColumn == "undefined" ) { return []; } // by default we only wany unique data if ( typeof bUnique == "undefined" ) { bUnique = true; } // by default we do want to only look at filtered data if ( typeof bFiltered == "undefined" ) { bFiltered = true; } // by default we do not wany to include empty values if ( typeof bIgnoreEmpty == "undefined" ) { bIgnoreEmpty = true; } // list of rows which we're going to loop through var aiRows; // use only filtered rows if (bFiltered === true) { aiRows = oSettings.aiDisplay; } // use all rows else { aiRows = oSettings.aiDisplayMaster; // all row numbers } // set up data array var asResultData = []; for (var i=0,c=aiRows.length; i -1) { continue; } // else push the value onto the result data array else { asResultData.push(sValue); } } return asResultData; }; var initTooltipster = function(){ $(".tooltipster").not(".tooltipstered").each(function() { var theme = $(this).attr("data-theme"); if(canDebug()) console.log('theme',theme); $(this).tooltipster({ speed: 200, animation: 'grow', position: ($(this).attr("data-position")?$(this).attr("data-position"):'top'), theme: (theme ? theme :'tooltipster-shadow'), content: $(this).attr('data-title') }); $(this).addClass(".tooltipstered"); }); }; $(window).load(function(){ initTooltipster(); }); // JavaScript Document function ajax_showStatusMessage(status_number){ switch(status_number){ default: case -1001: switch(Number(global_js_params.lang)){ default: return '404 Error or Unstable Internet Connection'; break; case 2: return '404 錯誤 或 網絡連接不穩定'; break; case 3: return '404 错误 或 网络连接不稳定'; break; } break; // ----- END ----- upate org ---- } return lang(status_number); } $(window).load(function(){ $.noty.defaults = { layout: 'top', theme: 'defaultTheme', // or 'relax' type: 'alert', text: '', // can be html or string dismissQueue: true, // If you want to use queue feature set this true template: '
', animation: { open: {height: 'toggle'}, // or Animate.css class names like: 'animated bounceInLeft' close: {height: 'toggle'}, // or Animate.css class names like: 'animated bounceOutLeft' easing: 'swing', speed: 500 // opening & closing animation speed }, timeout: false, // delay for closing event. Set false for sticky notifications force: false, // adds notification to the beginning of queue when set to true modal: false, maxVisible: 5, // you can set max visible notification for dismissQueue true option, killer: false, // for close all notifications before show closeWith: ['click'], // ['click', 'button', 'hover', 'backdrop'] // backdrop click will close all notifications callback: { onShow: function() {}, afterShow: function() {}, onClose: function() {}, afterClose: function() {}, onCloseClick: function() {} }, buttons: false // an array of buttons }; $.noty.themes.bootstrapTheme = { name: 'bootstrapTheme', modal: { css: { position: 'fixed', width: '100%', height: '100%', backgroundColor: '#000', zIndex: 10000, opacity: 0.6, display: 'none', left: 0, top: 0 } }, style: function() { var containerSelector = this.options.layout.container.selector; //$(containerSelector).addClass('list-group'); this.$closeButton.append('Close'); this.$closeButton.addClass('close'); this.$bar.css('padding', '10px'); switch (this.options.type) { case 'alert': case 'notification': this.$bar.css('background', '#36AEEA'); this.$bar.css('color', '#fff'); this.$bar.find(".noty_text").addClass("f15"); //this.$bar.addClass( "list-group-item-info" ); break; case 'warning': this.$bar.css('background', '#ff0000'); this.$bar.css('color', '#fff'); this.$bar.find(".noty_text").addClass("f15"); //this.$bar.addClass( "list-group-item-warning" ); break; case 'error': //this.$bar.addClass( "list-group-item-danger" ); break; case 'information': //this.$bar.addClass("list-group-item-info"); break; case 'success': //this.$bar.addClass( "list-group-item-success" ); break; } this.$message.css({ fontSize: '13px', lineHeight: '16px', textAlign: 'center', //padding: '8px 10px 9px', width: 'auto', position: 'relative' }); }, callback: { onShow: function() { }, onClose: function() { } } }; $.noty.layouts.top = { name : 'top', options : {}, container: { object : '