;(function($, win, undefined) { 'use strict'; $(document).ready(function(){ $("#add img").load(function(){ var add =$("#add img").height(); console.log(add); $("#ad2").css({height:add}); }) }) function init() { var doc = document; var lang = doc.documentElement.lang; var pageModule = doc.body.getAttribute('data-module'); var resizeTimer = -1; var orbit = { helpers: { // Cross-browser class manipulation addClass: function(el, className) { if (el.classList) { el.classList.add(className); } else { el.className += ' ' + className; } }, hasClass: function(el, cls) { return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1; }, // hide empty elements, not actually "remove" removeEmpty: function(els, parent) { var $els = $(els); $.each($els, function(i, val) { if ($els.eq(i).text().trim() === '') { // check if there's parent el if (typeof parent === 'string') { $els .closest($(parent)) .addClass('hide'); } else { $els.eq(i).addClass('hide'); } } }); }, // system wide truncation utility truncateText: function(els, maxLen) { var els = doc.querySelectorAll(els); var newTitle = ''; var i = -1; var elsLen = els.length; for (i = 0; i < elsLen; i++) { if (els[i].firstChild !== null) { if (els[i].firstChild.length > maxLen) { newTitle = els[i].firstChild.textContent; els[i].textContent = newTitle.substring(0, maxLen) + '...'; } } } }, }, plugins: { // RWD image resize script bullEye: function() { $('.bullseye').bullseye({ fadeEffect: false }); } }, nav: { // Add class name to the menu item when its child items are more than 8 items addMegaDropdownClass: function(els, len, className) { var els = doc.querySelectorAll(els); var elsLen = els.length; var i = -1; if (elsLen > 1) { for (i = 0; i < elsLen; i++) { if (els[i].children.length > len) { this.helpers.addClass(els[i].parentNode, className || 'mega-dropdown'); } } } }, // set up mobile dropdown setDropdown: function() { var $caret1 = $(''); var $caret2 = $(''); var $li = null; var $this = null; var cls = 'active'; // add class and caret on element that has dropdown $('.nav-level-1') .parent('li') .addClass('has-dropdown level-1'); // check if the DOM exists if ($('.has-dropdown.level-1 > .dropdown-toggle-icon').length < 1) { $caret1.appendTo('.has-dropdown.level-1'); $('.nav-level-2') .parent('li') .addClass('has-dropdown level-2'); $caret2.appendTo('.has-dropdown.level-2'); } // same click event for first and second level dropdown $('.dropdown-toggle-icon.level-1, .dropdown-toggle-icon.level-2').on('click', function() { $this = $(this); $li = $this.parent('li'); // toggle els class if ($li.hasClass(cls)) { $li.removeClass(cls); } else { $li.siblings('li').removeClass(cls); $li.addClass(cls); } }); }, // remove mobile dropdown removeDropdown: function() { $('.dropdown-toggle-icon').remove(); } }, // Modules announcement: { // Print page printPage: function(el) { var $el = $(el); $el.on('click', function(e) { e.preventDefault(); window.print(); }); if (lang === 'en') { $el .find('.print-txt') .text('Print this page'); } } }, member: { // equal height for member layout equalHeight: function() { var bigbrother = -1; $('.i-member-item').each(function() { bigbrother = bigbrother > $('.i-member-item').height() ? bigbrother : $('.i-member-item').height(); }); $('.i-member-item').each(function() { $('.i-member-item').height(bigbrother); }); }, // Remove table row, list item if it only has sigle title or value not in pair removeEmptyRow: function() { // Remove index page empty item $('.i-member-profile-item .i-member-value').each(function() { if ($(this).text().trim() === '' || $(this).text().trim() === ':') { $(this).parent().addClass('hide'); } }); // Remove empty table cell on show page $('.show-member .member-data th, .show-member .member-data td').each(function() { if ($(this).text().trim() === '') { $(this).parent('tr').addClass('hide'); } }); }, }, archives: { // remove empty title removeEmptyTitle: function(el) { var $el = $(el); var $els = $el.children(); $.each($els, function(i, val) { if ($els.eq(i).text().trim() === '') { $els.eq(i).addClass('hide'); } }); $.each($el, function(i, val) { if ($el.eq(i).children('.hide').length >= 2) { $el.eq(i).addClass('hide'); } }); }, // enable Bootstrap panel to have more than one set extendPanel: function() { // check if there are panel in this page var len = $('.i-archive .panel-title').length; var i = -1; if (len > 0) { // add number after collpase id and href for (i = 0; i < len; i++) { $('.panel-title:eq(' + i + ') .collapsed').attr('href', '#collapse' + i); $('.panel-collapse:eq(' + i + ')').attr('id', 'collapse' + i); } } } }, // Add link and cursor class name on element that has data-link attribute //addLinkOnADBanner: function(els) { //$.each(els, function() { // if ($(this).data('link') !== '' && !$(this).hasClass('youtube')) { // $(this).on('click', function() { // var target = $(this).data('target'), // link = $(this).data('link'); // if (target === '_blank') { // window.open(link, target); // } else { // window.location.href = link; // } // }).addClass('cursor'); // } //}); //}, // Sitemenu dropdown sitemenuDropdown: function(els) { var els = doc.querySelectorAll('.sitemenu-list.level-2'); var len = els.length; var i = -1; var caret = null; for (i = 0; i < len; i++) { if (els[i].children.length) { caret = doc.createElement('span'); caret.className = 'sitemenu-dropdown-toggle fa fa-caret-down'; caret.setAttribute('data-toggle', 'dropdown'); els[i].parentNode.insertBefore(caret, els[i]); this.helpers.addClass(els[i], 'dropdown-menu'); } } }, // Go back top button goBackTop: function(txt, speed) { var top = document.createElement('div'); top.className = 'go-back-top no-print'; top.textContent = txt; doc.body.appendChild(top); $(window).scroll(function() { if ($(this).scrollTop() !== 0) { $('.go-back-top').fadeIn(); } else { $('.go-back-top').fadeOut(); } }); $('.go-back-top').click(function() { $('body, html').animate({ scrollTop: 0 }, speed); return false; }); } }; // expose ORBITFRONT to gobal scope win.ORBITFRONT = orbit; // Specific functions that will be running on each page switch (pageModule) { case 'home': break; case 'announcement': orbit.announcement.printPage('.print-button'); break; case 'member': orbit.member.removeEmptyRow(); break; case 'archive': orbit.archives.removeEmptyTitle('.i-archive__category-item'); orbit.archives.extendPanel(); break; case 'gallery': orbit.helpers.truncateText('.show-description', 15); break; default: break; } // Functions that will be running on every page orbit.sitemenuDropdown(); orbit.goBackTop('top', 800); orbit.plugins.bullEye(); if ($(window).width() < 768) { orbit.nav.setDropdown(); } // Responsive specific $(window).resize(function() { if ($(window).width() < 768) { clearTimeout(resizeTimer); resizeTimer = setTimeout(orbit.nav.setDropdown, 500); } else { resizeTimer = setTimeout(orbit.nav.removeDropdown, 500); } }); } $(document).ready(function() { init(); if ($('.sitemenu-wrap li').length === 0) { $('#sitemenu').css({'display':'none'}); } }); $(document).ready(function() { var $sliderHeight = $('.slider').height(); var $liCount = $('.w-annc.widget-announcement-3 li').length; $('.w-annc.widget-announcement-3 ul').height( $sliderHeight * $liCount ); $('.w-annc.widget-announcement-3 li').height( $sliderHeight ); $('.w-annc.widget-announcement-2 li').click(function(){ var liIndex = $(this).index(); $('.w-annc.widget-announcement-3 ul').stop(true,false).animate({top:$sliderHeight*liIndex*-1}); }) }) // Run the init function when DOM is ready $(document).ready(function() { init(); }); $(document).ready(function(){ $('.widget-link.widget1').eq(0).addClass('active'); $('.w-annc.widget-announcement-11').eq(0).addClass('active'); $('#tab li').eq(0).addClass('active'); $('.w-annc.widget-announcement-11').eq(0).animate({opacity:'1'}) $('.widget-link.widget1').eq(0).animate({'opacity':'1','top':'10px'}).animate({'top':'0'},"fast"); var list = $('.w-annc.widget-announcement-11.active li') for(var i=0;i