/js/link.net.js
JavaScript | 4278 lines | 3900 code | 237 blank | 141 comment | 986 complexity | 23a6e85e0261ac07b25ac9024fd6813a MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- /**
- * VERSION: 1.0
- * DATE: 2012-09-20
- *
- * @author: mediacreed, mediacreed.com
- **/
-
- /* start GENERAL CUSTOMIZATION PROPERTIES */
- var templateBaseURL = "http://localhost/YTS/mobilesoft/mobilesoft/";/*"http://themes.mediacreed.com/html/synergy/"*/
- var themeColor = "#008dd3";
- var menuActive = true;
- var menuHoverActive = true; /* it will change to false if menuActive == true. If 'menuActive'
- is false and this true than on hover it will show the menu */
- var menuTextOutColor = "#777777";
-
- var customPageStart = true;
- var customPageStartURL = "#portfolio.html";
- var customPageStartSide = "none";
- var customPageStartType = "full_width_gallery";
-
- var phpUrlPath = "php/contact_mobilesoft.php";
- var contactFormDemo = false; /* SET IT TO FALSE FOR CONTACT FORM TO WORK */
- /* end GENERAL CUSTOMIZATION PROPERTIES */
-
-
- /* start ready function */
- $(document).ready(function(){
- readyAndLoad++;
- $(window).error(function(msg, url, line){
- console.log("error: ", msg, " url: ", url, " line: ", line );
- });
- if( readyAndLoad == 2 ){ checkIfTouchDevice(); }
- });
- /* end ready function */
-
- /* start load function */
- $(window).load(function(){
- readyAndLoad++;
- if(templateBaseURL == "http://www.your_domain.com/" || templateBaseURL == "null"){
- $("body").empty().css("visibility", "visible").append("<br/><span>Please check the documentation on page 4 on how to change the 'templateBaseURL' path!!!</span>");
- return;
- }
- if( readyAndLoad == 2 ){
- checkIfTouchDevice();
- }
- });
- /* end load function */
-
- /* start GENERAL JS PROPERTIES */
- var readyAndLoad = 0;
- var firstRun = true;
- var isOverMenu = false;
- var templateMenuW = 0;
- var videojsHolder = "";
- /* end GENERAL JS PROPERTIES */
-
- /*================= GENERAL TXT NAMES ==========================*/
- var t_scrBarV1 = "#module-scrollbar-holder";
- var t_scrBarV2 = "#module-scrollbar-holder_v2";
- var txt_modCont = "#module-container #module-container-holder";
-
-
- var touchDevice = 0;
- function checkIfTouchDevice(){
- touchDevice = !!("ontouchstart" in window) ? 1 : 0;
- prepareTemplate();
- }
- //remove the template loader
- function removeTemplateLoader(){
- $(".main-template-loader").remove();
- var browserVersion = $.browser.version + "";
- var documentMode = document.documentMode;
- var indexOfChar = browserVersion.indexOf(".");
- browserVersion = browserVersion.substring(0, indexOfChar);
- if ($.browser.msie && (browserVersion < 8 || ( browserVersion >= 8 && documentMode < 8))){
- $("body").empty().css("visibility", "visible");
- $("body").append("Your browser is too old for this website. Please upgrade your browser version or experience this website in: Firefox, Chrome, Opera or Safari")
- return;
- }
- if ( ($.browser.msie && ( browserVersion.substr(0,1) > 8 && documentMode > 8 )) || !$.browser.msie ){
- if( $("#menu-container").hasClass("shadow-side-all") == false )
- $("#menu-container").addClass("shadow-side-all");
- }
- /*FIRST RUN CONFIGURATION*/
- prepareTemplate();
- }
- /*prepare the settings for the template*/
- var templateFirstRun = true;
- var templateFirstRunDone = false;
- function prepareTemplate(){
- if( templateFirstRun == true ){
- $("#template-logo").click(function(event){
- event.preventDefault();
- if( $(this).attr("data-href") != undefined && $(this).attr("data-href") != ""){
- window.location.hash = $(this).attr("data-href");
- }
- else{
- window.location.href = templateBaseURL;
- }
- });
- storeMenuArr();
- menuListeners();
- checkWhatToLoad();
- templateFirstRun = false;
- }
- else{ settingsForScreens(); }
- }
- /* check what page to load - only on the first run */
- function checkWhatToLoad(){
- var hrefPath = "";
- var url = "";
- currModuleType = $("#template-menu").attr("data-current-module-type");
- sideType = $("#template-menu").attr("data-side");
- url = $("#template-menu").attr("data-href").replace('#','');
- prevURL = "#" + url;
- if( templateFirstRun == true ){
- var checkURL = document.URL;
- checkURL = checkURL.replace(templateBaseURL, "");
- var hashURL = "";
- if(checkURL.indexOf("#") == -1 && checkURL != ""){
- if( checkURL == "index.html" || checkURL == "index.htm" ){
- checkURL = "";
- if( checkURL == "" && customPageStart == true ){
- checkURL = customPageStartURL;
- checkURL = checkURL.replace(templateBaseURL, "");
- }
- checkURL = checkURL.replace("#", "");
- checkURL = checkURL.substring( checkURL.lastIndexOf("/") + 1);
- hashURL = updateMenu(checkURL, prevURL, false, true);
- window.location.hash = hashURL;
- }
- else{
- window.location.href = templateBaseURL + checkURL;
- }
- }
- else{
- if( checkURL == "" && customPageStart == true ){
- checkURL = customPageStartURL;
- checkURL = checkURL.replace(templateBaseURL, "");
- url = customPageStartURL.replace("#", "");
- }else{
- checkURL = checkURL.replace("#", "");
- checkURL = checkURL.substring( checkURL.lastIndexOf("/") + 1);
- checkURL = (checkURL != "" && checkURL != "#") ? checkURL : url;
- url = checkURL;
- if( checkURL.indexOf("index.html") != -1 || checkURL.indexOf("index.htm") != -1){
- checkURL = checkURL.substring( checkURL.lastIndexOf("#") + 1);
- }
- }
- checkURL = checkURL.replace("#", "");
- checkURL = checkURL.substring( checkURL.lastIndexOf("/") + 1);
- hashURL = updateMenu(checkURL, prevURL, false, true);
- window.location.hash = hashURL;
- }
- }
- hrefPath = oldMenuData[3];
- hrefPath = (hrefPath == undefined) ? "" : hrefPath;
-
- setMobileMenuOption(oldMenuData[2]);
- $("#module-container").empty();
- $("#module-container").load( hrefPath + url + ' #module-container > *', firstRunLoaded );
- }
- /* select the current mobile option */
- function setMobileMenuOption( option ){
- var i =0;
- option = option.replace("#", "");
- $("#template-smpartphone-menu select").find("option").each(function(){
- var optVal = $(this).attr("value").replace("#", "");
- if( optVal == option ) {
- $(this).attr("selected","selected");
- }
- i++;
- });
- }
- /* on template hash change */
- function onTemplateHashChange( event, runLoad ){
- var url = window.location.hash + "",
- oldMenuID = menuOptionID,
- oldSubID = submenuOptionID,
- disabMenu = true,
- tempMenuData = menuData;
-
- url = url.replace("#", "");
- url = url.substring( url.lastIndexOf("/") + 1);
-
- updateMenu( url, prevURL, undefined, true);
- oldMenuData = tempMenuData;
- if( oldMenuID != menuOptionID ){
- disabMenu = undefined;
- }
- menuOptionOut(oldMenuID, oldSubID, disabMenu);
- menuData = ( menuOptionsArr[ menuOptionID ][ 1 ] != "null" ) ? menuOptionsArr[ menuOptionID ][ 1 ]: menuOptionsArr[ menuOptionID ][ 6 ][ submenuOptionID ][ 1 ] ;
- setMobileMenuOption(menuData[2]);
- touchContainer();
- urlChanged();
- }
- /* update menu */
- function updateMenu( currentURL, prevURL, sameURLParent, animate ){
- currentURL = currentURL.replace("#", "");
- prevURL = prevURL.replace("#", "");
-
- var returnURL = "",
- i = 0,
- j = 0,
- tempMenuID = 0,
- tempSubmID = 0,
- idx = menuOptionsArr.length;
-
- while(idx--){
- if( menuOptionsArr[ idx ][ 1 ] != "null" ){
- if(currentURL == menuOptionsArr[ idx ][ 1 ][ 2 ]){
- returnURL = "#" + menuOptionsArr[ idx ][ 1 ][ 2 ];
- setMenuData(menuOptionsArr[ idx ][ 1 ]);
- menuOptionID = idx;
- submenuOptionID = -1;
- if( animate == true ){
- menuOptionIn(menuOptionID, submenuOptionID);
- }
- idx = 0;
- }
- }
- else{
- var subMenu = menuOptionsArr[ idx ][ 6 ];
- var subLength = subMenu.length;
- while( subLength-- ){
- if( currentURL == subMenu[ subLength ][ 1 ][ 2 ]){
- returnURL = subMenu[ subLength ][ 0 ];
- setMenuData(subMenu[ subLength ][ 1 ]);
- menuOptionID = idx;
- submenuOptionID = subLength;
- if( animate == true ){
- menuOptionIn(menuOptionID, submenuOptionID);
- }
- idx = 0;
- }
- }
- }
- }
- return returnURL;
- }
- /* on first run loaded html page */
- function firstRunLoaded(response, status, xhr){
- $(window).bind('hashchange', onTemplateHashChange);
- switch ( status ){
- case "error":console.log( "Error loading the INDEX page: " + response );
- break;
- case "success": TweenMax.to($(".main-template-loader"), .3, { css:{opacity: "0"}, ease:Sine.easeOut, onComplete: removeTemplateLoader });
- break;
- }
- }
- /* menu width */
- function getMenuWidth(){
- return $("#menu-container").width();
- }
- /* menu height */
- function getMenuHeight(){
- return $("#menu-container").height();
- }
- /* settings for screen resolutions */
- function settingsForScreens(){
- $("body").css("visibility", "visible" );
- var menuWidth = parseInt( $("#menu-container .menu-content-holder").css("width"), 10 );
- var menuHider = parseInt( $("#menu-container #menu-hider").width(), 10 );
- var menuHiderIcon = parseInt( $("#menu-container #menu-hider #menu-hider-icon").width(), 10 );
- var menuHeight = parseInt( $("#menu-container").css("height"), 10 );
-
- var menuHiderH = parseInt( $("#menu-container #menu-hider").height(), 10 );
- var menuHiderIconH = parseInt( $("#menu-container #menu-hider #menu-hider-icon").height(), 10 );
- templateMenuW = menuWidth + menuHider;
- $("#menu-hider-icon").click(menuHideClick);
- $("#module-container").css( "width", ($(window).width() - templateMenuW) + "px" );
-
- if( $(window).width() > 767){
- $("#menu-container").css('left', -(menuWidth + menuHider + menuHiderIcon) + 'px');
- $("#menu-container").css( 'visibility', 'visible' );
-
- $("#menu-hider").css( 'display', 'inline' );
- $("#menu-hider").css( 'visibility', 'visible' );
-
- /*start-up animation*/
- $("#module-container").css( "opacity", 1 );
- $("#module-container").css( "left", menuWidth + menuHider + "px" );
-
- $("footer").css( 'display', 'inline' );
- TweenMax.to( $("#menu-container"), .4, { css:{left: "0px"}, ease:Sine.easeInOut, delay: 0.5, onComplete: endStartupAnimation });
- /*end start-up animation*/
- }
- if( $(window).width() <= 767 ){
- templateMenuW = 0;
- var containerH = $(window).height() - (menuHeight + menuHiderH);
- $("#menu-container").css("left", "0px");
- $("#menu-container").css("top", -(menuHeight + menuHiderH + menuHiderIconH) + "px");
- $("#menu-container").css( "visibility", "visible" );
-
- $("#menu-hider").css( "display", "inline" );
- $("#menu-hider").css( "visibility", "visible" );
-
- /*start-up animation*/
- $("#module-container").css( "opacity", "1" );
- $("#module-container").css( "left", "0px" );
- $("#module-container").css( "top", (menuHeight + menuHiderH) + "px" );
- $("#module-container").css( "height", containerH );
-
- TweenMax.to( $("#menu-container"), .4, { css:{top: "0px"}, ease:Sine.easeInOut, delay: 0.5, onComplete: endStartupAnimation });
- /*end start-up animation*/
- }
- $("#template-smpartphone-menu select").change(
- function(){
- if( $(this).val() != "#"){
- var hashURL = updateMenu( $(this).val(), prevURL, undefined, false);
- window.location.hash = hashURL;
- }
- });
- /*
- if( touchDevice == 1){
- $("#theme-panel").css("display", "none");
- $("#console-log").css("display", "inline");
- $("#console-log").css("left", "300px");
- $("#console-log").css("top", "10px")
- }*/
- }
- var delayInterval = "";
- function endStartupAnimation(){
- templateFirstRunDone = true;
- delayInterval = setInterval(function()
- {
- showModule();
- clearInterval( delayInterval );
- }, 200);
- }
- /*end module start*/
- function endModuleStart(){
-
- }
- /*menu hide click*/
- function menuHideClick(){
- var winW = $(window).width(),
- winH = $(window).height();
- if( menuActive == true ){
- menuActive = false;
- alwaysUpdate();
- if( winW >= 768 ){
- var menuHider = ($("#menu-hider").length > 0 ) ? parseInt($("#menu-hider").width(), 10) : 0,
- menuWidth = parseInt( $("#menu-container").css("width"), 10 ) - menuHider,
- menuVal = 0;
- TweenMax.to( $("#template-wrapper"), .4, { css:{left: -(menuWidth ) + "px"}, ease:Sine.easeInOut });
- TweenMax.to( $("#menu-container"), .4, { css:{left: menuVal + "px"}, ease:Sine.easeInOut, onComplete:function()
- {if(touchDevice == 0)activateHoverMenu();}
- });
- }
- else{
- var menuHiderH = parseInt( $("#menu-container #menu-hider").height(), 10 ),
- menuHeight = parseInt( $("#menu-container").css("height"), 10 ) - menuHiderH,
- menuVal = 0;
-
- TweenMax.to( $("#template-wrapper"), .4, { css:{top: -(menuHeight ) + "px"}, ease:Sine.easeInOut });
- TweenMax.to( $("#menu-container"), .4, { css:{top: menuVal + "px"}, ease:Sine.easeInOut, onComplete:function()
- {if(touchDevice == 0)activateHoverMenu();}
- });
- }
- }
- else{
- if(touchDevice == 0)disableHoverMenu();
- menuActive = true;
- isOverMenu = false;
- alwaysUpdate();
- TweenMax.to( $("#template-wrapper"), .4, { css:{left: "0px", top: "0px"}, ease:Sine.easeInOut });
- TweenMax.to( $("#menu-container"), .4, { css:{left: "0px"}, top: "0px", ease:Sine.easeInOut });
- }
-
- }
- /* activate hover menu */
- function activateHoverMenu(){
- $("#menu-container").bind( "mouseenter", overMenu );
- $("#menu-hider-icon").bind( "mouseenter", menuHiderOver );
- $("#menu-hider-icon").bind( "mouseleave", menuHiderOver );
- $("#menu-container").bind( "mouseleave", outMenu );
- }
- /* menu hider over */
- function menuHiderOver(event){
- event.stopPropagation();
- }
- /* disable hover menu */
- function disableHoverMenu(){
- $("#menu-container").unbind( "mouseenter", overMenu );
- $("#menu-hider-icon").unbind( "mouseenter", menuHiderOver );
- $("#menu-hider-icon").unbind( "mouseleave", menuHiderOver );
- $("#menu-container").unbind( "mouseleave", outMenu );
- }
- /* over menu */
- function overMenu(){
- if( menuActive == true) return;
- isOverMenu = true;
- TweenMax.to( $("#template-wrapper"), .4, { css:{left: "0px", top:"0px"}, ease:Sine.easeInOut });
- TweenMax.to( $("#menu-container"), .4, { css:{left: "0px", top:"0px"}, ease:Sine.easeInOut });
- alwaysUpdate();
- }
- /* out menu */
- function outMenu(){
- if( menuActive == true) return;
- isOverMenu = false;
- var winW = $(window).width(),
- winH = $(window).height();
- if(winW >= 768){
- var menuWidth = parseInt( $("#menu-container").css("width"), 10 ) - parseInt($("#menu-hider").width(), 10),
- menuVal = 0;
- TweenMax.to( $("#template-wrapper"), .4, { css:{left: -(menuWidth ) + "px", top:"0px"}, ease:Sine.easeInOut });
- TweenMax.to( $("#menu-container"), .4, { css:{left: menuVal + "px", top:"0px"}, ease:Sine.easeInOut });
- }else{
- var menuHiderH = parseInt( $("#menu-container #menu-hider").height(), 10 ),
- menuHeight = parseInt( $("#menu-container").css("height"), 10 ) - menuHiderH,
- menuVal = 0;
-
- TweenMax.to( $("#template-wrapper"), .4, { css:{top: -(menuHeight ) + "px", left: "0px"}, ease:Sine.easeInOut });
- TweenMax.to( $("#menu-container"), .4, { css:{top: menuVal + "px", left: "0px"}, ease:Sine.easeInOut, onComplete:function()
- {if(touchDevice == 0)activateHoverMenu();}
- });
- }
- alwaysUpdate()
- }
- /* always update */
- function alwaysUpdate(){
- if( currentSlide != null )resizeImage(currentSlide, true);/* ONLY IF SLIDESHOW ACTIVE */
- if( $showModuleBackground != null )resizeImage( $showModuleBackground, true );/*BACKGROUND CHECK*/
-
- var winW = $(window).width();
- var winH = $(window).height();
- var newModContW = winW - get_OffsetWidth();
- var newModContH = winH;
- var cModuleType = $("#template-menu").attr("data-current-module-type")
- if( winW < 768 ){
- var menuHiderH = parseInt( $("#menu-container #menu-hider").height(), 10 ),
- menuHeight = winH - menuHiderH;
- newModContH = menuHeight;
- }
-
- TweenMax.to( $("#module-container"), .4, { css:{width: newModContW + "px", height: newModContH + "px"}, ease:Sine.easeInOut });
-
- if( $("#module-container-old") != null && $("#module-container-old").length > 0 ){
- if($("#module-container-old #module-background-holder").length > 0){resizeImage($("#module-container-old #module-background-holder"), true);}
- if($("#module-container-old #slide-current").length > 0){resizeImage($("#module-container-old #slide-current"), true);}
- }
-
- var thumbsHolder = $('#slideshow-thumbs');
- if( thumbsHolder.length > 0){
- var val = (newModContW - thumbsHolder.width() )* .5;
- TweenMax.to( thumbsHolder, .4, {css:{marginLeft: val}, easing:Sine.easeOut});
- }
- var slideHolder = $("#slideshow .slideshow-slide", $("#module-container"));
- if( slideHolder.length > 0 ){
- $("#slideshow-captions", slideHolder ).each(function(){
- $(this ).css("top", (newModContH * 0.3) + "px");
- TweenMax.to( $(this ), .4, { css:{width: (newModContW * 0.5) + "px"}, ease:Sine.easeInOut });
- });
- }
-
- var moduleContainerHolder = $(txt_modCont);
- var modulePosition = moduleContainerHolder.attr("data-id");
- if( modulePosition == "module-position-bc" || modulePosition == "module-position-cc" ){
- if( moduleContainerHolder.length > 0 ){
- var value = Math.round(( newModContW - $(":first", moduleContainerHolder).width() ) * 0.5 );
- TweenMax.to( moduleContainerHolder, .4, {css:{left: value}, easing:Sine.easeOut});
- }
- }
-
- var fullWidGalModule = $("#module-full-width-gallery");
- if( fullWidGalModule.length > 0 ){
- if( initialThumbW <= 0)
- return;
- moduleUpdate_full_width_gallery();
-
- }
- var contactModule = $("#module-contact #module-contact-holder");
- if( contactModule.length > 0 ){
- moduleUpdate_contact();
- TweenMax.to( contactModule, .4, {css:{left: (newModContW - contactModule.width())*.5}, easing:Sine.easeOut});
- }
- var fullWidModule = $("#module-full-width");
- if( fullWidModule.length > 0 ){
- moduleUpdate_full_width( true );
- }
- var fullscreenVideo = $("#module-fullscreen-video");
- if( fullscreenVideo.length > 0 ){
- moduleUpdate_fullscreen_video( true )
- }
-
- if( cModuleType == "text_page"){
- moduleUpdate_text_page();
- }
-
- }
- /*----------------- start showTemplate --------------------*/
-
- var $showModuleBackground = null;
- var $showModuleBackgroundSolid = null;
- var showDone = false;
- function showModule(){
- if( templateFirstRunDone == false ){return;}
- if( moduleList != null ){
- moduleList.destroy();
- moduleList = null;
- }
- if( $("#template-menu").attr("data-current-module-type") == "slideshow" ){
- if(firstMediaLoaded == false ){return;}
- firstMediaLoaded = false;
- TweenMax.to( $("#loading-animation"), .3, { css:{right:"-104px"}, delay: .3, ease:Circ.easeOut });
- if( isOtherURL == true ){urlChanged();}
- else{
- loadedContent = true;
- moduleSlideshow();
- }
- }
- else{
- $showModuleBackground = $("#module-container #module-background-holder #module-background");
- $showModuleBackgroundSolid = $("#module-container #module-background-holder div");
- showDone = true;
- if( $showModuleBackground != null && $showModuleBackground.length > 0 ){
- if( backLoaded == true){
- showDone = true;
- animateModuleBackground();
- }
- }
- else if( $showModuleBackgroundSolid != null && $showModuleBackgroundSolid.length > 0 ){
- backLoaded = true;
- if( backLoaded == true){
- showDone = true;
- $showModuleBackground = null;
- $showModuleBackgroundSolid.css('display', 'inline').css("opacity", "0").css("visibility", "visible");
- TweenMax.to( $showModuleBackgroundSolid, .4, { css:{opacity:"1"}, delay: .4, ease:Sine.easeOut, onComplete:
- function(){
- if( isOtherURL == true ){urlChanged();}
- else{startModule();}
- }
- });
- TweenMax.to( $("#loading-animation"), .3, { css:{right:"-104px"}, ease:Circ.easeOut });
- }
- }
- else{
- $showModuleBackground = null;
- backLoaded = false;
- if( isOtherURL == true ){urlChanged();}
- else{TweenMax.to( $("#loading-animation"), .3, { css:{right:"-104px"}, delay: .3, ease:Circ.easeOut, onComplete: startModule });}
- }
- }
- }
- var backLoaded = false;
- /* animate module background */
- function animateModuleBackground(){
- backLoaded = true;
- if( showDone == true ){
- showDone = false;
- backLoaded = false;
- TweenMax.to( $("#loading-animation"), .3, { css:{right:"-104px"}, delay: .3, ease:Circ.easeOut, onComplete:
- function(){
- if( isOtherURL == true ){urlChanged();}
- else{hideAnimationCompleted();}
- }
- });
- }
- }
- /* hide animation completed */
- function hideAnimationCompleted(){
- $showModuleBackground = $("#module-container #module-background");
- if( $showModuleBackground.length > 0 ){
- resizeImage( $showModuleBackground );
- $showModuleBackground.css('display', 'inline').css("opacity", "0").css("visibility", "visible").css("left", (- 60) + "px");
- TweenMax.to( $showModuleBackground, .6, { css:{opacity:"1", left: "0px" }, ease:Circ.easeOut, onComplete:
- function(){
- if( isOtherURL == true ){urlChanged();}
- else{startModule();}
- }
- });
- }
- }
- var endModuleFunction = null;
- var endPreviousModule = false;
- var previousModuleType = "";
- /* start module */
- function startModule(){
- loadedContent = true;
- var moduleType = $("#template-menu").attr("data-current-module-type");
- if( menuData[2] != oldMenuData[2] && menuData[2] != undefined ){
- clearCustomInterval( showModuleInterval );
- urlChanged();
- return;
- }
- previousModuleType = moduleType;
- endShowPage();
- templateCollectGarbage();
- switch( moduleType ){
- case "slideshow": moduleSlideshow();
- break;
- case "home2": moduleHome2();
- break;
- case "home3": moduleHome3();
- break;
- case "banner": moduleBanner();
- break;
- case "text_page": moduleTextPage();
- break;
- case "news": moduleNews();
- break;
- case "contact": moduleContact();
- break;
- case "showreel": moduleShowreel();
- break;
- case "gallery": moduleGallery();
- break;
- case "full_width": moduleFullWidth();
- break;
- case "full_width_gallery": moduleFullWidthGallery();
- break;
- case "page_columns": modulePageColumns();
- break;
- case "fullscreen_video": moduleFullscreenVideo();
- break;
- case "pricing_tables": modulePricingTables();
- break;
- }
- }
- /* end show page */
- function endShowPage(){
- if( firstRun == true ){
- firstRun = false;
- /*endModuleStart();*/
- }
- if( $("#module-container-old").length > 0 ){
- $("body").find("#module-container-old").each( function(){ $(this).empty().remove(); });
- }
- }
- /*----------------- end showTemplate ----------------------*/
-
- /*----------------- start Modules Methods -----------------*/
-
- /*================= SLIDESHOW =============================*/
- var slideshowLimit = 0;
- var slideshowCurrID = 0;
- var slideshowPrevID = 0;
- var oldSlide = '';
- var slidesArray = new Array();
- var thumbsList = null;
- var currentSlide = null;
- var slideshowAutoPlay = false;
- var timerSec = 5;
- var timerSlideshow = null;
- var firstMediaLoaded = false;
- function moduleSlideshow(){
- slideshowCurrID = 0;
- slideshowPrevID = 0;
- currentSlide = $("#slide-current");
- currentSlide.attr("style", "display:list-item; visibility: visible; left:" + (-60) + "px;");
- resizeImage( currentSlide );
- currentSlide.css( "opacity", "0");
- storeAllSlides();
- $("#module-container").css( 'visibility', 'visible' );
- TweenMax.to( currentSlide, .6, { css:{opacity:"1", left: "0px" }, ease:Circ.easeOut, onComplete: slideshowShowThumbs });
- }
- function onFirstMediaLoaded() {
- firstMediaLoaded = true;
- showModule();
- $("#slide-current").attr("onload", "");
- }
- function storeAllSlides(){
- var i = 0;
- $("#slideshow").children().each(function() {
- slidesArray[ i ] = new Array();
- if( i != 0){
- var imgSrc = $('#slide-src', this);
- var imgTag = '<img src="'+ imgSrc.attr("data-src") + '" alt="" />';
- imgSrc.after(imgTag).remove();
- }
- slidesArray[ i ][ 0 ] = $('img', this);
- var captions = new Array();
- var captionsW = new Array();
- var j = 0;
- $('#slideshow-captions', this ).css("top", ($(window).height() * 0.3) + "px");
- $('#slideshow-captions', this ).css("left", ($("#module-container").width() * 0.5) + "px");
- $('#slideshow-captions', this ).children().each(function(){
- captions[ j ] = $(this);
- captionsW[ j ] = $(this).width();
- j++;
- });
- slidesArray[ i ][ 1 ] = captions;
- slidesArray[ i ][ 2 ] = captionsW;
- i++;
- });
- slideshowLimit = i++;
- if( slidesArray[ 0 ][ 1 ].length != 0 )captionAvailable = true;
- currentThumb = $('#slideshow-thumbs-container .slideshow-thumb-holder').slice( 0, 1);
- if( currentThumb.hasClass( 'thumb-selected' ) == false ){
- $(currentThumb).addClass( 'thumb-selected' );
- $("#thumb-image-hover", currentThumb).removeClass().attr("style", "left: 0px; top: 0px;");
- $("img", $(currentThumb)).attr("style", "border-color:" + themeColor + ";");
- }
- }
- function startTimer(){
- if( timerSlideshow == null ){
- timerSlideshow = $.timer(checkSlideshowTimer);
- timerSlideshow.set({ time : timerSec * 1000, autostart : false });
- }
- }
- function checkSlideshowTimer(){
- timerSlideshow.stop();
- if( slideshowCurrID < slideshowLimit-1 ){
- slideshowPrevID = slideshowCurrID;
- slideshowCurrID++;
- }
- else{
- slideshowPrevID = slideshowCurrID;
- slideshowCurrID = 0;
- }
- var spanEmpty = document.getElementById("slideshow-thumbs-counter").getElementsByTagName("span");
- $(spanEmpty).empty().append( (slideshowCurrID+1) + '/' + total);
- stopOrHidePrevCaptions();
- }
- function stopSlideshowTimer(){ timerSlideshow.stop(); }
- function deleteSlideshowTimer(){
- if( timerSlideshow != null ){
- timerSlideshow.stop();
- timerSlideshow = null;
- }
- }
- /* END SHOW PAGE WHEN SLIDESHOW MODULE IS NEXT */
- function slideshowShowThumbs(){
- endShowPage();
- if( thumbsList != null ){
- thumbsList.destroy();
- thumbsList = null;
- }
- if(touchDevice == 0){
- thumbsList = $("#slideshow-thumbs-content").McCustomList({ scrollDirection: "horizontal", scrollType: "linear" });
- thumbsList.setupList({
- scrollContainer: $('#slideshow-thumbs-container'),
- mouseWheelSupport: "yes",
- buttonsSupport: "no",
- draggerContainer: null,
- draggerScroll: null,
- totalMinusSize: 0,
- scrollSpeed: 112,
- offsetSize: -4, /* this is the margin right of the thumbs. On the last thumbs we have this margin */
- horizFixHolder: $('.horizontal-fix-slideshow-thumbs')
- });
- $("#slideshow-thumbs-container").find(".slideshow-thumb-holder").hover(
- function(event) {
- if( $(this).hasClass( 'thumb-selected' ) == false )
- {
- customHoverAnimation( "over", event, $(this), $("#thumb-image-hover", this) );
- TweenMax.to( $("img", this), .6, { css:{borderColor: themeColor}, ease:Circ.easeOut });
- }
- },
- function(event) {
- var color = '#ffffff';
- if( $(this).hasClass( 'thumb-selected' ) == false )
- {
- customHoverAnimation( "out", event, $(this), $("#thumb-image-hover", this) );
- TweenMax.to( $("img", this), .6, { css:{borderColor: color}, ease:Circ.easeOut });
- }
- }
- );
- var instanceArr = $(".slideshow-thumbs-arrow-backward .slideshow-thumbs-arrow-backg");
- var initOpacity = instanceArr.css("opacity");
- var initBackColor = rgb2hex( instanceArr.css("background-color") );
- var bothArrows = $(".slideshow-thumbs-arrow-backward, .slideshow-thumbs-arrow-forward");
- var thumbArrBack = $("#slideshow-thumbs-holder .slideshow-thumbs-arrow-backward");
- var thumbArrForw = $("#slideshow-thumbs-holder .slideshow-thumbs-arrow-forward");
- bothArrows.unbind('mouseenter mouseleave');
- bothArrows.hover(
- function() {
- TweenMax.to( $(".slideshow-thumbs-arrow-backg", this), 0.3, {css:{opacity: "1", backgroundColor: themeColor }, easing:Sine.easeOut });
- },
- function() {
- TweenMax.to( $(".slideshow-thumbs-arrow-backg", this), 0.3, {css:{opacity: initOpacity, backgroundColor: initBackColor}, easing:Sine.easeOut });
- }
- );
- thumbArrBack.unbind("click");thumbArrForw.unbind("click");
- thumbArrForw.click(function() {
- if( thumbsList != null )thumbsList.listAutoScroll(-1);
- });
- thumbArrBack.click(function(){
- if( thumbsList != null )thumbsList.listAutoScroll(1);
- });
- }
- else{
- if( touchDevice == 1 ){
- var thumbArrBack = $("#slideshow-thumbs-holder .slideshow-thumbs-arrow-backward");
- var thumbArrForw = $("#slideshow-thumbs-holder .slideshow-thumbs-arrow-forward");
- thumbArrBack.css("display", "none");
- thumbArrForw.css("display", "none");
-
- }
- }
- var total = slidesArray.length;
- var spanEmpty = document.getElementById("slideshow-thumbs-counter").getElementsByTagName("span");
- $(spanEmpty).empty().append( (slideshowCurrID+1) + '/' + total);
-
- /*'[id^="matchItem_"]' "#slideshow-thumb-holder" //'div[id^="matchItem_"]'*/
- var slideshowThumbsCont = $("#slideshow-thumbs-container .slideshow-thumb-holder");
- slideshowThumbsCont.click(function() {
- var index = slideshowThumbsCont.index( this );
- if( slideshowCurrID == index ) return;
- slideshowPrevID = slideshowCurrID;
- slideshowCurrID = index;
- if(timerSlideshow != null )timerSlideshow.stop();
- $(spanEmpty).empty().append( (index+1) + '/' + total);
- changeThumbsSelection( this );
- stopOrHidePrevCaptions();
- });
- var thumbsHolder = $('#slideshow-thumbs');
- var val = -Math.abs(thumbsHolder.width() - get_OffsetWidth()) / 2;
- thumbsHolder.attr("style", "margin-left:" + val + "px; bottom: -84px; visibility: visible;");
- if(touchDevice == 1){
- $('.horizontal-fix-slideshow-thumbs').css( "width", 999999 );
- $('#slideshow-thumbs-container').css("width", $('#slideshow-thumbs-container').width() );
- $('.horizontal-fix-slideshow-thumbs').css("width", '');
- $("#slideshow-thumbs-content").css("overflow", "auto");
- $("#slideshow-thumbs-content").css("-webkit-overflow-scrolling", "touch");
- }
- startTimer();
- initialThumbContW = $("#slideshow-thumbs-content").width();
- moduleUpdate_slideshow();
- TweenMax.to( thumbsHolder, .6, { css:{bottom:"4px"}, delay:0.6, ease:Circ.easeOut, onComplete: checkCaption });
- }
- var initialThumbContW = 0;
- function changeThumbsSelection( cThumb ) {
- oldThumb = $('#slideshow-thumbs-container .thumb-selected');
- var color = "#ffffff";
- if( oldThumb.length > 0 ){
- oldThumb.removeClass('thumb-selected');
- TweenMax.to( $("#thumb-image-hover", oldThumb), .3, { css:{ left:"-100%", top: "0%"}, ease:Sine.easeInOut});
- TweenMax.to( $('img', oldThumb), .6, { css:{borderColor: color}, ease:Circ.easeOut });
- }
- currentThumb = $(cThumb);
- if( currentThumb.hasClass( 'thumb-selected' ) == false ){
- currentThumb.addClass('thumb-selected');
- TweenMax.to( $("#thumb-image-hover", currentThumb), .3, { css:{ left:"0", top: "0%"}, ease:Sine.easeInOut });
- TweenMax.to( $('img', currentThumb), .6, { css:{borderColor: themeColor}, ease:Circ.easeOut });
- }
- }
- function changeSlideshowSlides( prevSlideID, currSlideID ){
- if( slidesArray[ prevSlideID ][ 0 ].attr('id') == 'slide-current' ){
- slidesArray[ prevSlideID ][ 0 ].removeAttr("id");
- oldSlide = slidesArray[ prevSlideID ][ 0 ];
- oldSlide.css("style", "z-index: 1;");
- }
- slidesArray[ currSlideID ][ 0 ].attr( "id", "slide-current" );
- currentSlide = slidesArray[ currSlideID ][ 0 ];
- if(currentSlide.css("style") != undefined)currentSlide.removeAttr('style');
-
- currentSlide.attr("style", "z-index: 2; display:list-item; left: 0px; visibility: visible;");
- resizeImage( currentSlide );
- currentSlide.css("opacity", "0");
- TweenMax.to( currentSlide, .6, { css:{opacity:"1" }, ease:Sine.easeOut, onComplete: completeSlideTransition });
- }
- function completeSlideTransition(){
- var i = 0;
- var total = slidesArray.length;
- for( i = 0; i < total; i++ ){
- if( i != slideshowPrevID && i != slideshowCurrID )slidesArray[ i ][ 0 ].attr("style", "display:none; opacity: 0; visibility: hidden;");
- }
- if( oldSlide != '' )oldSlide.attr("style", "display:none; opacity: 0; visibility: hidden;");
- checkCaption();
- }
- var showingInProgress = 0;
- function checkCaption(){
- if( showingInProgress == 1)return;
- if( slideshowAutoPlay == true && timerSlideshow != null ){
- /*checkSlideshowTimer();*/
- timerSlideshow.play(true);
- }
- if( slidesArray[ slideshowCurrID ][ 1 ].length != 0 ){
- showingInProgress = 1;
- var i = 0;
- var total = slidesArray[ slideshowCurrID ][ 1 ].length;
- var windowH = $(window).height();
- var windowW = $(window).width();
- for( i = 0; i < total; i++ ){
- var obj = slidesArray[ slideshowCurrID ][ 1 ][ i ];
- obj.css( 'width', '' );
- var width = slidesArray[ slideshowCurrID ][ 2 ][ i ] + 10;
- var topY = i * 45;
- var val = (i == total - 1) ? windowW * .5 : -(width + windowW * .5);
- var styleValue = "top:" + topY + "px; left:" + val + "px; display:inline-block; opacity:1;";
- obj.attr("style", styleValue);
- if( i == total - 1 ){ TweenMax.to( obj, 5, { css:{left: -(width + windowW * .5) +'px'}, ease:SlowMo.ease.config(0.7, 0.96), onComplete:resetShowing }); }
- else{ TweenMax.to( obj, 5, { css:{left: windowW * .5 +'px'}, ease:SlowMo.ease.config(0.7, 0.96) }); }
- }
- }
- }
- function resetShowing(){
- showingInProgress = 0;
- if( slidesArray[ slideshowCurrID ][ 1 ].length != 0 ){
- var i = 0;
- var total = slidesArray[ slideshowCurrID ][ 1 ].length;
- for( i = 0; i < total; i++ ){
- slidesArray[ slideshowCurrID ][ 1 ][ i ].css("opacity", "0");
- }
- }
- }
- function stopOrHidePrevCaptions()
- {
- var slideHolder = $("#slideshow .slideshow-slide");
- if( slideHolder.length > 0 ){
- $("#slideshow-captions", slideHolder ).each(function(){
- $(this ).css("top", ($(window).height() * 0.3) + "px");
- $(this ).css("left", ($("#module-container").width() * 0.5) + "px");
- });
- }
- if( slidesArray[ slideshowPrevID ][ 1 ].length != 0 ){
- showingInProgress = 0;
- var i = 0;
- var total = slidesArray[ slideshowPrevID ][ 2 ].length;
- var windowH = $(window).height();
- var windowW = $(window).width();
- for( i = 0; i < total; i++ ){
- var width = slidesArray[ slideshowPrevID ][ 2 ][ i ];
- var topY = windowH * .3 + i * 45;
- var obj = slidesArray[ slideshowPrevID ][ 1 ][ i ];
- if( i == total - 1 ){ TweenMax.to( obj, .2, { css:{left: -(width + windowW * .5) +'px', opacity:"0"}, ease:Sine.easeOut, onComplete: runOtherSlide }); }
- else{ TweenMax.to( obj, .2, { css:{left: windowW * .5 +'px', opacity:"0"}, ease:Sine.easeOut }); }
- }
- }
- else{ changeSlideshowSlides( slideshowPrevID, slideshowCurrID); }
- }
- function runOtherSlide(){ changeSlideshowSlides( slideshowPrevID, slideshowCurrID); }
-
- /*================= HOME 2 ================================*/
- var stdCurrIndex = 0;
- var stdPrevIndex = 0;
- function moduleHome2(){
- var textPageInstanceHolder = $( txt_modCont);
- var textPageInstance = $( "#module-home-layout2", textPageInstanceHolder);
- if( textPageInstance.length <= 0 )return;
-
- moduleUpdate_home2();
-
- var val = parseInt( textPageInstanceHolder.css("left"), 10);
- textPageInstanceHolder.attr("style", "left: 100%; visibility: visible;");
- TweenMax.to( textPageInstanceHolder, .6, { css:{ left: val }, ease:Circ.easeOut });
-
- var slidesBannArray = [];
- var stdBannCont = $("#standard-banner-controls");
- var controlPin = $("#control-pin", stdBannCont);
- var controlPinArr = [];
- var i = 0;
- stdBannCont.css("margin-left", -(stdBannCont.width()*.5) );
-
- $("#standard-banner").find("a").each(
- function(){
- var dataSrc = $("#dataSrc", this);
- if(dataSrc. length > 0 ){
- var imgTag = '<img src="' + dataSrc.attr("data-src") +'" />';
- dataSrc.after( imgTag ).remove();
- }
- slidesBannArray[ i ] = $(this)
- i++;
- }
- );
- i = 0;
- stdBannCont.find("#control-pin").each(
- function(){
- controlPinArr[ i ] = $(this)
- i++;
- }
- );
-
- controlPin.hover(
- function(){
- if( $(this).hasClass("selected") == false )
- TweenMax.to( $(".control-pin-hover", this), .3, {css:{opacity:"1"}, easing:Sine.easeOut});
- },
- function(){
- if( $(this).hasClass("selected") == false )
- TweenMax.to( $(".control-pin-hover", this), .3, {css:{opacity:"0"}, easing:Sine.easeOut});
- }
- );
-
- controlPin.click(function() {
- stdPrevIndex = stdCurrIndex;
- stdCurrIndex = $(controlPin).index(this);
- if( stdCurrIndex == stdPrevIndex )return;
- controlPinArr[ stdPrevIndex ].removeClass("selected");
- controlPinArr[ stdCurrIndex ].addClass("selected");
- TweenMax.to( $(".control-pin-hover", controlPinArr[ stdPrevIndex ]), .3, {css:{opacity:"0"}, easing:Sine.easeOut});
- TweenMax.to( $(".control-pin-hover", controlPinArr[ stdCurrIndex ]), .3, {css:{opacity:"1"}, easing:Sine.easeOut});
- changeHome2Slides();
- });
- function changeHome2Slides(){
- slidesBannArray[ stdCurrIndex ].attr("class", "selected opacity_0");
- TweenMax.to( slidesBannArray[ stdPrevIndex ], .6, {css:{opacity:"0"}, easing:Sine.easeOut, onComplete:
- function(){ hideOtherBannerSlides();}
-
- });
- TweenMax.to( slidesBannArray[ stdCurrIndex ], .6, {css:{opacity:"1"}, easing:Sine.easeOut});
- }
- function hideOtherBannerSlides(){
- var i = 0;
- var t = slidesBannArray.length;
- for( i = 0; i < t; i++ ){
- if( i != stdCurrIndex )slidesBannArray[ i ].attr("class", "");
- }
- }
-
- var clients = $(".home-layout-clients a");
- if( clients.length > 0 ){
- clients.hover(
- function(){
- TweenMax.to( $(".client-over", this), .6, { css:{opacity: "1"}, easing:Sine.easeOut});
- },
- function(){
- TweenMax.to( $(".client-over", this), .6, { css:{opacity: "0"}, easing:Sine.easeOut});
- }
- );
- }
- var contentLi = $(".home-layout2-content ul li");
- var baseColor = rgb2hex( $(".layout2-description p", contentLi).css("color") );
- if(touchDevice == 0)if(contentLi.length > 0){
- contentLi.hover(
- function(){
- TweenMax.to( $(".layout2-description p", this), .6, { css:{color: themeColor}, easing:Sine.easeOut});
- TweenMax.to( $("div:first", this), 0.3, { css:{top: "-5px"}, easing:Sine.easeOut});
- },
- function(){
- TweenMax.to( $(".layout2-description p", this), .6, { css:{color: baseColor}, easing:Sine.easeOut});
- TweenMax.to( $("div:first", this), 0.3, { css:{top: "0px"}, easing:Sine.easeOut});
- }
- );
- }
- }
- function animateBannerHome2( img ){ TweenMax.to( img, 0.4, {css:{opacity:"1"}, easing:Sine.easeOut}); }
-
- /*================= END HOME 2 ============================*/
-
- /*================= HOME 3 ================================*/
- var homeInterval = "";
- function moduleHome3(){
- var textPageInstanceHolder = $( txt_modCont);
- var textPageInstance = $( "#module-home-layout3", textPageInstanceHolder);
- var modWrapper = $("#module-wrapper", textPageInstance);
- if( textPageInstance.length <= 0 )return;
-
- moduleUpdate_home3();
-
- var val = parseInt( textPageInstanceHolder.css("left"), 10);
- textPageInstanceHolder.css("left", "100%").css("visibility", "visible");
- TweenMax.to( textPageInstanceHolder, .6, { css:{ left: val }, ease:Circ.easeOut });
-
- var homeLayoutVideo = $("#video-wrapper", textPageInstanceHolder);
- templateAddMediaVideo( homeLayoutVideo.attr("data-video-type"), homeLayoutVideo, undefined );
-
- $("#home-advertise1, #home-advertise2", textPageInstanceHolder).hover(
- function(){
- var back = $(".advertise-details", this);
- TweenMax.to( back, .3, { css:{ backgroundColor: "#3f3f3f" }, ease:Sine.easeOut });
- TweenMax.to( $("span", back), .3, { css:{ color: "#f1f1f1" }, ease:Sine.easeOut });
- },
- function(){
- var back = $(".adveā¦
Large files files are truncated, but you can click here to view the full file