- //================================================================================
- // default_nav.js
- //================================================================================
- //!IMPORTANT! Must be set in Page HTML or here
- //var mediaLgArr = [ "About|Dropdown", "Contact|Dropdown" ];
- //var mediaMdArr = [ "About|Dropdown", "Contact|Dropdown" ];
- //var mediaSmArr = [ "About|Dropdown", "Contact|Dropdown" ];
- //var mediaXsArr = [ "About|Dropdown", "Contact|Dropdown" ];
- //var mediaSliderLg = [ "Slide_Img-1 Sm|uploads/homepage_slider/elp003.jpg", "Slide_Img-2 Sm|uploads/homepage_slider/emily-loving-photography-food-hospitality-05.jpg" ];
- //var mediaSliderMm = [ "Slide_Img-1 Sm|uploads/homepage_slider/elp003.jpg", "Slide_Img-2 Sm|uploads/homepage_slider/emily-loving-photography-food-hospitality-05.jpg" ];
- //var mediaSliderSm = [ "Slide_Img-1 Sm|uploads/homepage_slider/elp003.jpg", "Slide_Img-2 Sm|uploads/homepage_slider/emily-loving-photography-food-hospitality-05.jpg" ];
- //var mediaSliderXs = [ "Slide_Img-1 Sm|uploads/homepage_slider/elp003.jpg", "Slide_Img-2 Sm|uploads/homepage_slider/emily-loving-photography-food-hospitality-05.jpg" ];
- var mediaTypes = [ "lg","md","sm","xs" ]; // should be built from config $Media_Types ?
- //================================================================================
- // Start Set Global Variables
- //================================================================================
- var mediaType;
- var mediaSliderArr;
- var sliderMQImgReplace = 'false'; //set in config file
- var mediaSliderLg;
- var mediaSliderMd;
- var mediaSliderSm;
- var mediaSliderXs;
- var loadComplete = "false";
- var dataTimeout;
- var messageDataTimeout;
- var messageDelayOnLoad;
- var delayOnLoadTimeout = 0;
- var dataInpageAjax;
- var progTriggerFancybox = "false";
- var progTriggerColorbox = "false";
- var progTriggerInpage = "false";
- var progTriggerFullpage = "false";
- var defaultFullpageLg;
- var defaultFullpageMd;
- var defaultFullpageSm;
- var defaultFullpageXs;
- var defaultFullpageTimeout;
- var defaultFullpageTitle;
- var defaultFullpageAjax;
- var dataFullpageAjax;
- var fullpageCloseClick;
- var displayFullpageDiv;
- var displayNoneDivs;
- var displayNoneDivsLg;
- var displayNoneDivsMd;
- var displayNoneDivsSm;
- var displayNoneDivsXs;
- var displayBlockDivs;
- var displayBlockDivsLg;
- var displayBlockDivsMd;
- var displayBlockDivsSm;
- var displayBlockDivsXs;
- //
- var cookieSecs = "";
- var cookieMins = "";
- var cookieHours = "";
- var cookieDays = "";
- var cookieExp = "";
- var cookieName = "";
- var cookieValue = "";
- var cookiePath = "";
- //
- var glbFullpageId = "";
- //================================================================================
- // End Set Global Variables
- //================================================================================
- //alert('testing...');
- //if(typeof targetDivID === 'undefined') {
- //alert('UNDEFINED');
- //}
- //================================================================================
- // Start $(document).ajaxComplete Initialize
- //================================================================================
- $( document ).ajaxComplete(function() {
- // //alert('ajax complete!');
- //
- // initialize(); // initalize google maps poop
- //
- // //defaultNavInit();
- // ========================================
- // start Change Modal Content from Open Modal
- // ========================================
- $('.change_modal').click(function(){
- //ex: #modal-todays-menu
- var changeModalId = $(this).attr('data-mchange-id');
- var changeMIdPound = '#' + changeModalId;
- //alert('changeMIdPound ' + changeMIdPound);
- var changeModalContainer = $(this).attr('data-changediv-id');
- var changeModalAjax = $(this).attr('data-modal-ajax');
- var changeModalTitle = $(this).attr('data-modal-title');
- var changeDivId = $(this).attr('data-changediv-id');
- //alert('changeModalTitle: ' + changeModalTitle);
- //alert('changeModalAjax: ' + changeModalAjax);
- //alert('changeDivId: ' + changeDivId);
- $(changeMIdPound + ' .modal-title').html(changeModalTitle);
- if (typeof changeDivId !== 'undefined' && changeDivId !="") {
- changeDivId = "#" + changeDivId;
- $(changeDivId).load(changeModalAjax);
- } else {
- $(changeMIdPound + ' .modal-body').load(changeModalAjax);
- }
- $(changeMIdPound).modal('show');
- stopPropagation();
- });
- // ========================================
- // end Change Modal Content from Open Modal
- // ========================================
- });
- //================================================================================
- // End $(document).ajaxComplete Initialize
- //================================================================================
- //================================================================================
- // Start Outside $(document).ready
- //================================================================================
- // ========================================
- // start Get Media Query Type
- // ========================================
- //==================== start function Get Bootstrap Media Query Type
- //Large desktop
- //@media (min-width: 1200px) { ... }
- //
- //Portrait tablet to landscape and desktop */
- //@media (min-width: 768px) and (max-width: 979px) { ... }
- //
- //Landscape phone to portrait tablet */
- //@media (max-width: 767px) { ... }
- //
- //Landscape phones and down */
- //@media (max-width: 480px) { ... }
- function getMediaType() {
- //===== LG > 1200
- if ($(this).width() >= 1200) {
- //alert('LG this >= 1200px!');
- mediaType='lg';
- }
- //===== 1200 > Md > 992
- else if ($(this).width() < 1200 && $(this).width()>= 992) {
- //alert('MD 1200 > this >= 992!');
- mediaType='md';
- }
- //===== 992 > Sm > 768
- else if ($(this).width() < 992 && $(this).width()>= 768) {
- // alert('SM 992 > this >= 768!');
- mediaType='sm';
- }
- //===== 768 > Xs
- else if ($(this).width() < 768) {
- //alert('XS 768 > this !');
- mediaType='xs';
- }
- // phone portrait and landscape
- if ($(this).width() < 768 && $(this).width() > 480) {
- //alert('sm MS 768 > this > 480!');
- }
- else if ($(this).width() <= 480) {
- //alert('sm XS <= 480!');
- }
- }// end getMediaType
- //==================== end function Get Bootstrap Media Query Type
- // ========================================
- // end Get Media Query Type
- // ========================================
- // ========================================
- // start Set Onload Page Box
- // ========================================
- var onLoadModal = "false";
- var onLoadFancybox = "false";
- var onLoadColorbox = "false";
- var onLoadInpage = "false";
- var onLoadFullpage = "false";
- var onLoadBox;
- function setOnLoadBox (onLoadBox) {
- if (onLoadBox == "Modal") {
- onLoadModal = "true";
- }
- if (onLoadBox == "Fancybox") {
- onLoadFancybox = "true";
- }
- if (onLoadBox == "Colorbox") {
- onLoadColorbox = "true";
- }
- if (onLoadBox == "Inpage") {
- onLoadInpage = "true";
- }
- if (onLoadBox == "Fullpage") {
- onLoadFullpage = "true";
- }
- //alert("onLoadModal" + onLoadModal);
- //alert("onLoadFancybox" + onLoadFancybox);
- //alert("onLoadColorbox" + onLoadColorbox);
- //alert("onLoadInpage" + onLoadInpage);
- //alert("onLoadFullpage" + onLoadFullpage);
- }
- // ========================================
- // end Set Onload Page Box
- // ========================================
- // ========================================
- // start Light Boxes and Page Ajax
- // ========================================
- var dataFancyboxTitle = "";
- var dataFancyboxAjax = "";
- var dataColorboxAjax = "";
- var dataColorboxTitle = "";
- var inpageButtonClick = false;
- var fullpageButtonClick = 'false';
- //========== start initFancybox
- function initFancybox(fancyboxId) {
- if (progTriggerFancybox != 'true') {
- dataTimeout = $(fancyboxId).attr('data-fancybox-timeout');
- dataFancyboxTitle = $(fancyboxId).attr('data-fancybox-title');
- dataFancyboxAjax = $(fancyboxId).attr('data-fancybox-ajax');
- }
- //alert ('dataFancyboxAjax' + dataFancyboxAjax);
- //alert ('dataFancyboxTitle' + dataFancyboxTitle);
- //alert('dataTimeout: ' + dataTimeout);
- if (typeof dataTimeout !== 'undefined' && dataTimeout !="") {
- setTimeout("parent.jQuery.fancybox.close();", dataTimeout);
- }
- //$('.toggle_fancybox')[0].click();
- //$('.toggle_fancybox').triggerHandler('click', ["views/ajax/fancybox/announcements.html","spooky"]);
- loadFancybox(dataFancyboxAjax,dataFancyboxTitle);
- progTriggerFancybox = "false";
- }//end function
- function loadFancybox(dataFancyboxAjax,dataFancyboxTitle) {
- $.fancybox({
- 'href' : dataFancyboxAjax,
- //'modal' : 'true',
- 'width' : '90%',
- 'height' : 'auto',
- 'type' : 'ajax',
- 'autoSize' : false,
- 'autoScale' : false,
- 'title' : dataFancyboxTitle,
- 'scrolling' : 'false',
- 'scrollOutside' : 'false',
- helpers : {
- overlay : {
- css : {
- //'background' : 'rgba(255, 255, 30, 0.95)'
- 'background' : 'rgba(40, 33, 14, 0.5)'
- }
- },
- title : {
- type: 'outside',
- position : 'top'
- }
- }
- //return false;
- });
- }// end function loadFancybox
- //========== end initFancybox
- //========== start initColorbox
- function initColorbox(colorboxId) {
- //alert('colorboxId: ' + colorboxId);
- //alert('progTriggerColorbox: ' + progTriggerColorbox);
- if (progTriggerColorbox != 'true') {
- dataTimeout = $(colorboxId).attr('data-colorbox-timeout');
- dataColorboxAjax = $(colorboxId).attr('data-colorbox-ajax');
- dataColorboxTitle = $(colorboxId).attr('data-colorbox-title');
- }
- //alert('dataTimeout' + dataTimeout);
- //alert('dataColorboxAjax' + dataColorboxAjax);
- //alert('dataColorboxTitle' + dataColorboxTitle);
- if (typeof dataTimeout !== 'undefined' && dataTimeout !="") {
- setTimeout(function(){
- $.colorbox.close();
- }, dataTimeout);
- }
- loadColorbox(dataColorboxAjax,dataColorboxTitle);
- progTriggerColorbox = "false";
- } // end function initColorbox
- function loadColorbox(dataColorboxAjax,dataColorboxTitle){
- $.colorbox({
- transition:"elastic",
- title:dataColorboxTitle,
- width:"95%",
- height:"auto",
- ajax:true, href:dataColorboxAjax
- });
- }
- //========== end initColorbox
- //========== start initInpage
- function initInpage(inpageId) {
- inpageButtonClick='true';
- //alert('progTriggerInpage: ' + progTriggerInpage);
- if (progTriggerInpage != 'true') {
- dataTimeout = $(inpageId).attr('data-inpage-timeout');
- dataInpageAjax = $(inpageId).attr('data-inpage-ajax');
- }
- //alert('dataTimeout' + dataTimeout);
- //alert('dataInpageAjax' + dataInpageAjax);
- if($("#Inpage_Div").css('display') == 'none'){
- $("#inpage-box").load(dataInpageAjax);
- $("#Inpage_Div").fadeIn(500);
- } else {
- $("#Inpage_Div").fadeOut(100);
- }
- if (typeof dataTimeout !== 'undefined' && dataTimeout != "") {
- setTimeout(function(){
- $("#Inpage_Div").fadeOut(100);
- }, dataTimeout);
- }
- progTriggerInpage = "false";
- }// end function initInpage
- //========== end initInpage
- //========== start initFullpage
- function initFullpage(fullpageId) {
- fullpageButtonClick='true';
- if (progTriggerFullpage != 'true') {
- dataTimeout = $(fullpageId).attr('data-fullpage-timeout');
- dataFullpageAjax = $(fullpageId).attr('data-fullpage-ajax');
- }
- if (dataFullpageAjax == "") {
- dataFullpageAjax = defaultFullpageAjax;
- }
- // $("#Fullpage_Div").fadeIn(500);
- // $("#Fullpage_Div").load(dataFullpageAjax);
- $('#Fullpage_Div').fadeOut(100, function(){
- $('#Fullpage_Div').load(dataFullpageAjax, function(){
- $('#Fullpage_Div').fadeIn(2000);
- });
- });
- /*
- $("#Fullpage_Div").hide(500);
- $("#Fullpage_Div").load(dataFullpageAjax);
- $("#Fullpage_Div").fadeIn(3000);
- */
- /* //poop
- if($("#Fullpage_Div").css('display') == 'none'){
- $("#Fullpage_Div").fadeIn(500);
- $("#Fullpage_Div").load(dataFullpageAjax);
- } else {
- $("#Fullpage_Div").fadeOut(100);
- }
- if (typeof dataTimeout !== 'undefined' && dataTimeout !="") {
- setTimeout(function(){
- $("Fullpage_Div").fadeOut(100);
- // back to default after timeout
- if (defaultFullpageAjax != "") {
- $("#Fullpage_Div").load(defaultFullpageAjax);
- $("#Fullpage_Div").fadeIn(defaultFullpageTimeout);
- }
- }, dataTimeout);
- }
- */
- //alert('fullpage: ' + dataFullpageAjax);
- progTriggerFullpage = "false";
- } //end function initFullpage
- //========== end initFullpage
- //========================================
- // end Light Boxes and Page Ajax
- //========================================
- //========================================
- // start Format Page Based on Media Query
- //========================================
- //var canvasName = 'navmap-canvas';
- var canvasName = 'dropdown-map-canvas';
- //$(document).ready(function() {
- function defaultNavInit(){
- // everything defaults to modal
- //var mediaLgArr = [ "Menu|Dropdown", "Page|Dropdown" ];
- //var mediaMdArr = [ ];
- //var mediaSmArr = [ ];
- //var mediaXsArr = [ ];
- //alert('howdy');
- //alert(testVariable);
- //===== start tool tip js
- //$(function () {
- // $('[data-toggle="tooltip"]').tooltip();
- //});
- //===== end tool tip js
- // https://www.mobilemoxie.com/tools/mobile_handset_emulator/
- //==================== Start If Mobile IS Detected
- if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
- //alert('Mobile!');
- } // if mobile detected
- //==================== End If Mobile IS Detected
- //==================== Start If Mobile NOT Detected
- if (!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
- //alert('Not Mobile!');
- } // if mobile not detected
- //==================== End If Mobile NOT Detected
- //==================== Start Check Operating System
- var userAgent = navigator.userAgent || navigator.vendor || window.opera;
- // Windows Phone must come first because its UA also contains "Android"
- if (/windows phone/i.test(userAgent)) {
- //alert('Windows Phone!');
- }
- if (/android/i.test(userAgent)) {
- //alert('Android!');
- $("#modal_gmap_apple").css("display", "none");
- $("#modal_gmap_android").css("display", "block");
- $("#dropdown_gmap_apple").css("display", "none");
- $("#dropdown_gmap_android").css("display", "block");
- $(".listing_gmap_apple").css("display", "none");
- $(".listing_gmap_android").css("display", "block");
- }
- // iOS detection from: http://stackoverflow.com/a/9039885/177710
- if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
- //alert('iOS! 3');
- //$("#gmap_apple").css").css({display: "none"});
- //$("#gmap_android").css({display: "none"});
- }
- //==================== End Check Operating System
- mediaQueryInit();
- $(window).resize(function() {
- mediaQueryInit();
- });
- } // end Init Function
- //==================== Start Initialize Nav Settings Based on Media Type
- function mediaQueryInit(){
- getMediaType();
- displayMediaTypeDependent(mediaType);
- }// end mediaQueryInit
- //==================== End Initialize Nav Settings Based on Media Type
- //==================== Start Display Media Type Dependent HTML Based on Media Queries
- function displayMediaTypeDependent(mediaType){
- var mediaArr;
- var mediaSliderArr;
- if (mediaType == 'lg') {
- // alert(mediaType + mediaLgArr);
- mediaArr = mediaLgArr;
- mediaSliderArr = mediaSliderLg;
- $("#menu_button_container").css("display", "inline-block");
- }
- else if (mediaType == 'md') {
- // alert(mediaType + mediaMdArr);
- mediaArr = mediaMdArr;
- mediaSliderArr = mediaSliderMd;
- $("#menu_button_container").css("display", "inline-block");
- }
- else if (mediaType == 'sm') {
- // alert(mediaType + mediaSmArr);
- mediaArr = mediaSmArr;
- mediaSliderArr = mediaSliderSm;
- $("#menu_button_container").css("display", "inline-block");
- }
- else if (mediaType == 'xs') {
- //alert(mediaType + mediaXsArr);
- mediaArr = mediaXsArr;
- mediaSliderArr = mediaSliderXs;
- $("#menu_button_container").css("display", "");
- }
- //=== set div display based on media type
- set_div_display(mediaType);
- //===== start insert slider image based on media query
- //sliderMQImgReplace = 'false';
- if (sliderMQImgReplace == 'true') {
- //var slideDataSrc = $('#Slide_Img-1').attr('data-src');
- //alert('slideDataSrc: ' + slideDataSrc);
- //alert('test: ' + mediaSliderArr);
- //$('#Slide_Img-1').attr('data-src', 'img/media-sm/homepage_slider/emily-loving-photography-food-dallas-tx.jpg');
- //#zoominout_slider_name_Img-1 //slidertype + name + img + num
- $.each( mediaSliderArr, function( index, mediaSliderImgVal ){
- var mediaSliderImgValSplt = mediaSliderImgVal.split('|');
- //alert('ID:'+ mediaSliderImgValSplt[0] + ' Loc:'+ mediaSliderImgValSplt[1]);
- var mediaSliderImgID = '#' + mediaSliderImgValSplt[0];
- var bqWorks = mediaSliderImgID.match(/bqworks/g);
- if (bqWorks != null) {
- sliderName = 'bqworks';
- }
- var zoomInOut = mediaSliderImgID.match(/zoominout/g);
- if (zoomInOut != null) {
- sliderName = 'zoominout';
- }
- if (sliderName == 'bqworks') {
- $(mediaSliderImgID).attr('data-src', mediaSliderImgValSplt[1]);
- $(mediaSliderImgID).attr('data-retina', mediaSliderImgValSplt[1]);
- }
- if (sliderName == 'zoominout') {
- $(mediaSliderImgID).attr('src', mediaSliderImgValSplt[1]);
- }
- });
- }
- //===== end insert slider image based on media query
- //===== start insert menu type based on media query
- $.each(mediaArr, function( index, mediaVal ) {
- var mediaSplt = mediaVal.split('|');
- //alert('page:'+ mediaSplt[0] + ' type:'+ mediaSplt[1] + ' Spec:'+ mediaSplt[2]);
- var menuLinkID = '#' + mediaSplt[0] + '-Link';
- var menuModalID = '#' + mediaSplt[0] + '-Modal';
- var menuDropdownID = '#' + mediaSplt[0] + '-Dropdown';
- var menuInpageID = '#' + mediaSplt[0] + '-Inpage';
- var menuFancyboxID = '#' + mediaSplt[0] + '-Fancybox';
- var menuColorboxID = '#' + mediaSplt[0] + '-Colorbox';
- var menuFullpageID = '#' + mediaSplt[0] + '-Fullpage';
- if (mediaSplt[2] == "Map") {
- if (mediaSplt[1] == "Modal") {
- canvasName = 'modal-map-canvas';
- }
- if (mediaSplt[1] == "Dropdown") {
- canvasName = 'dropdown-map-canvas';
- }
- if (mediaSplt[1] == "Inpage") {
- canvasName = 'inpage-map-canvas';
- }
- if (mediaSplt[1] == "Fancybox") {
- canvasName = 'fancybox-map-canvas';
- }
- if (mediaSplt[1] == "Colorbox") {
- canvasName = 'colorbox-map-canvas';
- }
- if (mediaSplt[1] == "Fullpage") {
- canvasName = 'fullpage-map-canvas';
- }
- // alert('canvasName: ' + canvasName);
- }
- //===== Link
- if (mediaSplt[1] == 'Link')
- {
- $(menuLinkID).css("display", "block");
- } else {
- $(menuLinkID).css("display", "none");
- }
- //===== Modal
- if (mediaSplt[1] == 'Modal')
- {
- $(menuModalID).css("display", "block");
- } else {
- $(menuModalID).css("display", "none");
- }
- //===== Dropdown
- if (mediaSplt[1] == 'Dropdown')
- {
- $(menuDropdownID).css("display", "block");
- } else {
- $(menuDropdownID).css("display", "none");
- }
- //===== Inpage
- if (mediaSplt[1] == 'Inpage')
- {
- $(menuInpageID).css("display", "block");
- } else {
- $(menuInpageID).css("display", "none");
- }
- //===== Fancybox
- if (mediaSplt[1] == 'Fancybox')
- {
- $(menuFancyboxID).css("display", "block");
- } else {
- $(menuFancyboxID).css("display", "none");
- }
- //===== Colorbox
- if (mediaSplt[1] == 'Colorbox')
- {
- $(menuColorboxID).css("display", "block");
- } else {
- $(menuColorboxID).css("display", "none");
- }
- //===== Fullpage
- if (mediaSplt[1] == 'Fullpage')
- {
- $(menuFullpageID).css("display", "block");
- } else {
- $(menuFullpageID).css("display", "none");
- }
- });
- //===== end insert menu type based on media query
- }
- //==================== End Display Media Type Dependent HTML Based on Media Queries
- //========================================
- // end Format Page Based on Media Query
- //========================================
- //================================================================================
- // End Outside $(document).ready
- //================================================================================
- //================================================================================
- // Start $(document).ready Initialize
- //================================================================================
- $(document).ready(function() {
- $.ajaxSetup({ cache: false }); //clear cache
- //$('#homepagelink').on('click', mybindClick); //rebind again
- //=====start show default fullpage on homepagelink click
- /* //poop
- if (pageName == "homepage") {
- $("#homepagelink").attr("href", '#');
- $("#homepagelink").click(function(){
- //var dataHomelink = $("#homepagelink").attr('data-homelink'); // get data attribute
- //alert ('dataHomelink: ' + dataHomelink);
- $("#Fullpage_Div").fadeOut(100);
- //open default display
- if (defaultFullpageAjax != "") {
- $("#Fullpage_Div").load(defaultFullpageAjax);
- $("#Fullpage_Div").fadeIn(500);
- }
- });
- }
- */
- //=====end show default fullpage on homepagelink click
- //=====start show default fullpage on homepagelink click
- defaultNavInit();
- //=====start show default fullpage at start if media type match
- /* //poop
- if (defaultFullpageLg == "true" && mediaType == "lg") {
- $("#Fullpage_Div").fadeIn(500);
- $("#Fullpage_Div").load(defaultFullpageAjax);
- }
- if (defaultFullpageMd == "true" && mediaType == "md") {
- $("#Fullpage_Div").fadeIn(500);
- $("#Fullpage_Div").load(defaultFullpageAjax);
- }
- if (defaultFullpageSm == "true" && mediaType == "sm") {
- $("#Fullpage_Div").fadeIn(500);
- $("#Fullpage_Div").load(defaultFullpageAjax);
- }
- if (defaultFullpageXs == "true" && mediaType == "xs") {
- $("#Fullpage_Div").fadeIn(500);
- $("#Fullpage_Div").load(defaultFullpageAjax);
- }
- */
- //=====start set div display to none
- //if (typeof displayNoneDivs !== 'undefined' && displayNoneDivs != "") {
- // set_div_displaynone(displayNoneDivs);
- //}
- //=====end set div display to none
- //========== start toggle modal div
- $(".close .close_lb").click(function(){
- alert('CLOSE!');
- });
- //========== start function modalClose
- /*
- function modalClose() {
- $(".modal-x").click(function(){
- var parentModalId = $(this).parents(".modal").attr("id");
- //alert('parentModalId: ' + parentModalId);
- //if (str.indexOf("Yes") >= 0)
- //if (~str.indexOf("Yes")) // returns -1 if not found
- //if (str.toLowerCase().indexOf("yes") >= 0) //case-insensitive
- //if (/mls/i.test(str))
- if (parentModalId.toLowerCase().indexOf("mls") >= 0)
- {
- //$('.contact').addClass('agentbox_easeouttrans');
- $('.contact').removeClass('agentbox_easeintrans');
- setTimeout(function(){
- //$('.contact').css({
- // 'display': 'none',
- //});
- $('#right').tabSlideOut('close');
- }, 500);
- }
- });
- }
- */
- //========== end function modalClose
- /*
- $('body').on('click','.modal-x',function(){
- var thisModalId = this.id;
- alert('CLOSE!:' + thisModalId);
- //$('#modal-456').modal('hide');
- })
- */
- $('body').on('click','.toggle_modal',function(event){ //ensures hidden elements bind to event
- //$(".toggle_modal").click(function(){
- //alert('toglemodalnow');
- var modalId = this.id;
- modalId = '#' + modalId;
- var dataTarget = $(modalId).attr('data-target');
- var dataModalAjax = $(modalId).attr('data-modal-ajax');
- var dataModalTitle = $(modalId).attr('data-modal-title');
- var dataModalTitleAjax = $(modalId).attr('data-modal-title-ajax');
- var dataTimeout = $(modalId).attr('data-modal-timeout');
- var dataAddClass = $(modalId).attr('data-modal-addclass');
- var dataRemoveClass = $(modalId).attr('data-modal-removeclass');
- var dataCloseModals = $(modalId).attr('data-modal-closemodals');
- var dataRunModalJS = $(modalId).attr('data-modal-runjs');
- //alert('dataModalTitleAjax: ' + dataModalTitleAjax);
- //alert('dataAddClass 1st: ' + dataAddClass);
- if (dataCloseModals != 'false') {
- //alert('close open modals');
- $('.modal').modal('hide'); // closes all active pop ups.
- $('.modal-backdrop').remove(); // removes the grey overlay.
- }
- globalModalTitle = dataModalTitle; //not defined with "var"
- var newModalID = 'modal-' + dataModalTitle;
- newModalID = newModalID.replace(/\s+/g, '-').toLowerCase();
- var newModalPoundID = '#' + newModalID;
- globalNewModalPoundID = newModalPoundID; //not defined with "var"
- //alert('newModalID: ' + newModalID);
- if(dataTarget == '' || typeof dataTarget === 'undefined' ) {
- dataTarget = '#Modal_Open';
- }
- //alert('dataTarget: ' + dataTarget);
- if($(newModalPoundID).length == 0) {
- //alert('div doesnt exist');
- //$('#Modal_Open').clone().attr('id', newModalID).insertAfter('#Modal_Open');
- $(dataTarget).clone().attr('id', newModalID).insertAfter(dataTarget); // changed 11-03-18 to allow unique modal html
- }
- //alert('Test' + " " + newModalPoundID + " " + dataModalTitle + " " + dataModalAjax);
- $(newModalPoundID).modal('show');
- //$(newModalPoundID).modal('toggle');
- //$(newModalPoundID).modal('show');
- //$(newModalPoundID).modal('hide');
- //alert('dataAddClass: ' + dataAddClass)
- if(dataModalTitleAjax != '' && typeof dataModalTitleAjax !== 'undefined' ) {
- $(newModalPoundID).find( '.modal-title' ).load(dataModalTitleAjax,function(data){
- //alert('modal title loaded!');
- });
- } else {
- $(newModalPoundID).find( '.modal-title' ).html(dataModalTitle);
- }
- //alert('modalId: ' + modalId);
- //alert('newModalPoundID' + newModalPoundID);
- //alert('dataModalAjax: ' + dataModalAjax);
- if (modalId == '#toggle_modal_facebook') {
- $( newModalPoundID).find( '.modal-body' ).html($('#facebook_app_container').html());
- } else {
- $( newModalPoundID).find( '.modal-body' ).load(dataModalAjax,function(data){
- //alert('modal loaded!');
- afterModalLoad();
- });
- }
- //initFacebook();//may be depreciated
- //===================
- //alert('afterModalLoad!');
- //alert('dataAddClass: ' + dataAddClass);
- addRemoveClasses(); // run once before load and once after below
- //=====start function add and remove classes
- function addRemoveClasses() {
- if (typeof dataAddClass !== 'undefined' && dataAddClass !="") {
- var addClassArr = new Array();
- addClassArr=dataAddClass.split(",");
- $.each(addClassArr , function(index, addClass) {
- //alert('addClass: ' + addClass);
- var addClassArrSplt=addClass.split("|");
- //alert('addClassArrSplt: ' + addClassArrSplt[0] + ' ' + addClassArrSplt[1]);
- var addClassSelector = addClassArrSplt[0];
- var classToAdd = addClassArrSplt[1];
- if (typeof classToAdd !== 'undefined' && classToAdd !="") {
- $(newModalPoundID).find(addClassSelector).addClass(classToAdd);
- } else {
- $(newModalPoundID).addClass(addClass); // assume not selector/class pair--just a class
- }
- });
- }
- //end add modal class
- //start remove modal class
- if (typeof dataRemoveClass !== 'undefined' && dataRemoveClass !="") {
- var removeClassArr = new Array();
- removeClassArr=dataRemoveClass.split(",");
- $.each(removeClassArr, function(index, removeClass) {
- alert('removeClass: ' + removeClass);
- var removeClassArrSplt=removeClass.split("|");
- //alert('removeClassArrSplt: ' + removeClassArrSplt[0] + ' ' + removeClassArrSplt[1]);
- var removeClassSelector = removeClassArrSplt[0];
- var classToRemove = removeClassArrSplt[1];
- if (typeof classToRemove !== 'undefined' && classToRemove !="") {
- $(newModalPoundID).find(removeClassSelector).removeClass(classToRemove);
- } else {
- $(newModalPoundID).removeClass(removeClass); // assume not selector/class pair--just a class
- }
- });
- }
- }//end function
- //=====start function add and remove classes
- //=====start function after modal load
- function afterModalLoad() {
- addRemoveClasses(); // run once before load and once after below
- //start add custom modal function
- //alert('dataRunModalJS: ' + dataRunModalJS);
- if (typeof dataRunModalJS !== 'undefined' && dataRunModalJS !="") {
- customModalJS(dataRunModalJS);
- }// end if
- //end add custom modal function
- } // end function afterModalLoad()
- //=====end function after modal load
- //===================
- if (typeof dataTimeout !== 'undefined' && dataTimeout != "") {
- setTimeout(function(){
- $().modal('hide');
- }, dataTimeout);
- }
- event.stopPropagation();
- });
- //========== end toggle modal div
- //========== start toggle fancybox div
- $(".toggle_fancybox").click(function(){
- var fancyboxId = this.id;
- fancyboxId = '#' + fancyboxId;
- //alert('ID: ' + fancyboxId);
- initFancybox(fancyboxId);
- });
- //========== end toggle fancybox div
- //========== start toggle colorbox div
- $(".toggle_colorbox").click(function(){
- var colorboxID = this.id;
- colorboxID = '#' + colorboxID;
- //alert('ID: ' + colorboxID);
- initColorbox(colorboxID);
- });
- $(window).resize(function(){
- $.colorbox.resize({
- maxWidth:"auto",
- width:95+'%',
- height: "auto"
- });
- });
- //$("#toggle_colorbox").mCustomScrollbar({
- // scrollButtons:{enable:true},
- // live: "true",
- // theme:"dark-thick",
- // //theme:"dark-thin",
- // scrollbarPosition:"inside"
- //});
- $(".callbacks").colorbox({
- onOpen:function(){ alert('onOpen: colorbox is about to open'); },
- onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
- onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
- onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
- onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
- });
- //========== end toggle colorbox div
- //========== start toggle inpage div
- $(".toggle_inpage").click(function(){
- var inpageId = this.id;
- inpageId = '#' + inpageId;
- //alert('ID: ' + inpageId);
- initInpage(inpageId);
- });
- $(".inpage_close_box").click(function(){
- //alert('X!');
- $("#Inpage_Div").fadeOut(100);
- });
- //========== end toggle inpage div
- //========== start toggle fullpage div
- //$(".toggle_fullpage").click(function(){
- $('body').on('click','.toggle_fullpage',function(event){ //ensures hidden elements bind to event
- var fullpageId = this.id;
- fullpageId = '#' + fullpageId;
- //alert('Fullpage ID: ' + fullpageId);
- glbFullpageId = fullpageId; //set global var
- initFullpage(fullpageId);
- });
- // poop may be depreciated
- // // close fullpage if another box is clicked -- variable defined in HTML or config.cgi
- // //note: toggle-dropdown is has a hyphenated not underscrored
- // //fullpageCloseClick = ".toggle_inpage, .toggle_fancybox, .toggle_colorbox, .toggle_modal, .dropdown-toggle"; //global
- // $(fullpageCloseClick).click(function(){
- // //alert("clicked");
- // $("#Fullpage_Div").fadeOut(100);
- //
- // //open default display
- // if (defaultFullpageAjax != "") {
- // $("#Fullpage_Div").load(defaultFullpageAjax);
- // $("#Fullpage_Div").fadeIn(500);
- // }
- // });
- // poop may be depreciated
- //========== end toggle fullpage div
- $(document).click(function(e) {
- //e.stopPropagation();
- //e.preventDefault();
- //========== start check if outside of inpage div (and nested divs)
- if (e.target.id != 'inpage-container'
- && !$("#inpage-container").find(e.target).length) {
- //&& !='toggle_inpage'
- //var targetID = e.target.id;
- var targetdisplayvalue = $("#Inpage_Div").css('display');
- if (inpageButtonClick == 'true') {
- //alert('outside: ' + targetdisplayvalue);
- $("#inpage-box").load(dataInpageAjax);
- $("#Inpage_Div").fadeIn(500);
- inpageButtonClick = 'false';
- }
- else {
- //$('.toggle_inpage').on("click", function(e) {
- if (targetdisplayvalue == 'block')
- {
- //alert('outside: ' + targetdisplayvalue);
- $("#Inpage_Div").fadeOut(100);
- }
- } // end else
- }
- //========== end check if outside of inpage div (and nested divs)
- //========== start check if outside of fullpage div (and nested divs)
- if (e.target.id != 'fullpage-container'
- && !$("#fullpage-container").find(e.target).length) {
- var fullPageDisplayValue = $("#Fullpage_Div").css('display');
- //alert('outside div!');
- if (fullpageButtonClick == 'true') {
- //alert('outside click: ' + fullPageDisplayValue);
- //alert('dataFullpageAjax: ' +dataFullpageAjax); // gv defined above
- //$("#Fullpage_Div").fadeIn(500);
- //$("#Fullpage_Div").load(dataFullpageAjax);
- /*
- $("#Fullpage_Div").fadeOut("100", function () {});
- setTimeout(function(){
- $("#Fullpage_Div").empty();
- $("#Fullpage_Div").fadeIn(5000);
- $("#Fullpage_Div").load(dataFullpageAjax);
- }, 100);
- */
- /*
- // $("#Fullpage_Div").animate({opacity: 0}, 1000);
- $("#Fullpage_Div").animate({
- opacity: 0,
- //left: "+=50",
- //height: "toggle"
- }, 500, function() {
- //alert('Animation complete');
- $("#Fullpage_Div").css({display: "inline-block"});
- //$("#Fullpage_Div").empty();
- //$("#Fullpage_Div").fadeIn(5000);
- $("#Fullpage_Div").load(dataFullpageAjax);
- $("#Fullpage_Div").animate({opacity: 1},5000);
- });
- */
- fullpageButtonClick = 'false';
- }
- else {
- //alert('no button click!');
- //if fullpageButtonClick not true
- if (fullPageDisplayValue == 'block') {
- //alert('no click outside box');
- //$("#Fullpage_Div").fadeOut(100); // maybe not for fullpage?
- }
- } // end else
- } else {
- //alert('click in div');
- }
- //========== end check if outside of fullpage div (and nested divs)
- }); // end doc ready click
- // $('body').on("click",function (event) {
- // var obj = $(event.target);
- // obj = obj['context']; // context : clicked element inside body
- // var targetDivID = ($(obj).attr('id'));
- //
- // if (typeof(targetDivID) == "undefined"
- // && targetDivID != "Inpage_Div"
- // && targetDivID != "inpage-container"
- //
- // ) {
- // alert('targetDivID'+targetDivID);
- // }
- // });
- }); // end doc ready
- //================================================================================
- // End $(document).ready Initialize
- //================================================================================
- //================================================================================
- // Start Special Functions
- //================================================================================
- //===== start function modalClose
- function modalClose() {
- $(".modal-x").click(function(){
- var parentModalId = $(this).parents(".modal").attr("id");
- //alert('parentModalId: ' + parentModalId);
- //if (str.indexOf("Yes") >= 0)
- //if (~str.indexOf("Yes")) // returns -1 if not found
- //if (str.toLowerCase().indexOf("yes") >= 0) //case-insensitive
- //if (/mls/i.test(str))
- if (parentModalId.toLowerCase().indexOf("mls") >= 0)
- {
- //$('.contact').addClass('agentbox_easeouttrans');
- $('.contact').removeClass('agentbox_easeintrans');
- setTimeout(function(){
- //$('.contact').css({
- // 'display': 'none',
- //});
- $('#right').tabSlideOut('close');
- }, 500);
- }
- });
- }
- //===== end function modalClose
- //===== start function setVisitedCookie
- var visitedPage = "";
- function setVisitedCookie() {
- if (document.cookie.indexOf('visitedIndex=true') == -1) {
- cookieMins = 2;
- cookieExp = cookieMins * 60 * 1000;
- set_cookie("visitedIndex", "true", "/", cookieExp);
- //var expires = new Date((new Date()).valueOf() + visitedCookieExp);
- //document.cookie = "visited=true;expires=" + expires.toUTCString();
- visitedPage = "false";
- //alert('First Time Here!');
- }
- else {
- visitedPage = "true";
- //alert('Already Been Here!');
- }
- } // end function setVisitedCookie
- //===== end function setVisitedCookie
- //================================================================================
- // End Special Functions
- //================================================================================
- //================================================================================
- // Start Functions
- //================================================================================
- //===== start function set cookie
- //var cookieSecs = "";
- //var cookieMins = "";
- //var cookieHours = "";
- //var cookieDays = "";
- //var cookieExp = 1000*60*60*24*15; // 15 days
- // 24 * 60 * 60 * 1000//24 hour
- // days * hours * minutes * seconds * 1000//days
- //var cookieMins = 2;
- //var cookieExp = cookieMins * 60 * 1000;
- //var cookieName = "Bems";
- //var cookieValue = "Barls";
- //var cookiePath = "/";
- //set_cookie(cookieName, cookieValue, cookiePath, cookieExp);
- function set_cookie(cookieName, cookieValue, cookiePath, cookieExp) {
- var cookieExpTime = new Date((new Date()).valueOf() + cookieExp);
- document.cookie = cookieName + "=" + cookieValue + "; path=" + cookiePath + "; expires=" + cookieExpTime.toUTCString();
- }
- //===== end function set cookie
- //===== start function delete cookie
- //var cookieName "Bems";
- //delete_cookie(cookieName);
- function delete_cookie(cookieName) {
- document.cookie = cookieName +'=; path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
- }
- //===== end function delete cookie
- //===== start function set_div_display
- function set_div_display (mediaType) {
- // needs to be at end after all ajax loaded
- displayNoneDivs= '';
- displayBlockDivs = '';
- if (mediaType == "lg") {
- displayNoneDivs = displayNoneDivsLg;
- displayBlockDivs = displayBlockDivsLg;
- if (defaultFullpageLg == "true") {
- displayFullpageDiv = "true";
- } else {
- displayFullpageDiv = "false";
- }
- }
- if (mediaType == "md") {
- displayNoneDivs = displayNoneDivsMd;
- displayBlockDivs = displayBlockDivsMd;
- if (defaultFullpageMd == "true") {
- displayFullpageDiv = "true";
- } else {
- displayFullpageDiv = "false";
- }
- }
- if (mediaType == "sm") {
- displayNoneDivs = displayNoneDivsSm;
- displayBlockDivs = displayBlockDivsSm;
- if (defaultFullpageSm == "true") {
- displayFullpageDiv = "true";
- } else {
- displayFullpageDiv = "false";
- }
- }
- if (mediaType == "xs") {
- displayNoneDivs = displayNoneDivsXs;
- displayBlockDivs = displayBlockDivsXs;
- if (defaultFullpageXs == "true") {
- displayFullpageDiv = "true";
- } else {
- displayFullpageDiv = "false";
- }
- }
- // alert('mediaType: ' + mediaType);
- //=== start Initialized Fullpage Div On Resize
- //alert('displayFullpageDiv: ' + displayFullpageDiv);
- if (displayFullpageDiv == 'true') {
- //=====POOP
- if (pageName == "homepage") {
- // alert('displayFullpageDiv: true');
- //
- // $("#homepagelink").attr("href", '#');
- // $("#homepagelink").attr('data-homelink', 'script');
- //$('#homepagelink').on('click', mybindClick); //rebind again
- //$('#homepagelink').bind('click');
- $('#homepagelink').css("cursor", "auto");
- $('#homepagelink').css("pointer-events", "auto");
- // var dataHomelink = $("#homepagelink").attr('data-homelink');
- // alert ('dataHomelink: ' + dataHomelink);
- }
- //=====POOP
- //=====end show default fullpage on homepagelink click
- //initFullpage('#toggle_fullpage_homepage');
- $("#Fullpage_Div").load(defaultFullpageAjax);
- $("#Fullpage_Div").fadeIn(0);
- //dataTimeout = "0";
- //dataFullpageAjax = defaultFullpageAjax;
- //progTriggerFullpage="true";
- //initFullpage();
- } else {
- //=====POOP
- if (pageName == "homepage") {
- // alert('displayFullpageDiv: false');
- // $("#homepagelink").attr('data-homelink', 'url');
- // $("#homepagelink").addClass('disablelink');
- //alert('disa');
- //$('#homepagelink').unbind('click');
- //$('#homepagelink').off('click'); // click is succesfully removed
- $('#homepagelink').css("cursor", "default");
- $('#homepagelink').css("pointer-events", "none");
- // $("#homepagelink").attr("href", '');
- //
- //$('a#homepagelink').click(function() { return false; });
- //
- // var dataHomelink = $("#homepagelink").attr('data-homelink');
- // alert ('dataHomelink: ' + dataHomelink);
- //
- }
- //var mybindClick = function(event){
- // event.stopPropagation();
- // // execute a bunch of action to preform
- //}
- //=====POOP
- //$("#Fullpage_Div").fadeOut(0);
- }
- //=== end Initialized Fullpage Div On Resize
- if (typeof displayNoneDivs !== 'undefined' && displayNoneDivs != "") {
- //alert('displayNoneDivs: ' + displayNoneDivs);
- $(displayNoneDivs).css("display", 'none');
- }
- if (typeof displayBlockDivs !== 'undefined' && displayBlockDivs != "") {
- //alert('displayBlockDivs: ' + displayBlockDivs);
- $(displayBlockDivs).css("display", 'block');
- }
- // uses mediaTypes Array above
- // $.each(mediaTypes, function( index, mediaTypes ) {
- // alert('mediaTypes: ' + mediaTypes);
- // });
- } // end function
- //===== end function set_div_displaynone
- //================================================================================
- // End Functions
- //================================================================================
Raw Paste