1){ if (vars.curr_page > 1){ vars.curr_page –; } else { vars.curr_page = vars.page_count; } vars.open_first = ‘last’; $(‘.blu-gal-pages’).find(‘.blu-gal-page[data-page-no=’ + vars.curr_page + ‘]’).click(); } else { bluOpenImagePreview($(“.blu-gal-img”).last()); } } }) $(‘.blu-gal-preview-share-btn’).click(function(event){ $(‘.blu-gal-slideshow-btn’).data(‘on’, false); $(‘.blu-gal-slideshow-btn’).removeClass(‘blu-gal-slideshow-btn-on’); bluGalSetSlideshow(‘stop’); event.stopPropagation(); if ($(this).data(‘opened’)){ $(this).data(‘opened’, false); $(‘.blu-gal-img-preview-share’).find(‘.blu-gal-options’).fadeOut(); } else { $(this).data(‘opened’, true); $(‘.blu-gal-img-preview-share’).find(‘.blu-gal-options’).css({ ‘left’:20, // ‘left’: $(‘.blu-social-share-btn’).position().left – $(‘.blu-social-share-wrapper’).bluWidth(), ‘top’:$(this).position().top + 40 }) $(‘.blu-gal-img-preview-share’).find(‘.blu-gal-options’).fadeIn(); } }) }) ]]> -1) ? true: false; //get main page if (google_hash){ var main_page = hash[1]; } else { var main_page = hash[0].substring(1); } if (main_page == ”){ main_page = ‘home’; } //get additional parameters active_page[‘Param’] = ”; var page_param = new Array(); var n = 0 for (var i=2; i 0) || main_page == ‘favorites’){ active_page[‘Controller’] = main_page; active_page[‘GoToGal’] = false; if (main_page == ‘proofs’){ if (page_param.length > 0){ active_page[‘Permalink’] = hash[2]; if (page_param.length == 1){ active_page[‘Page’] = page_param[0]; } else { active_page[‘Page’] = page_param[1]; } active_page[‘GoToGal’] = true; } else { $(“.blu-menu-wrapper”).find(‘a’).removeClass(‘blu-menu-active’); } } else if (main_page == ‘profile’ && page_param.length > 0){ active_page[‘Param’] = hash[2]; } } else { //find main page $(‘.blu-menu-wrapper’).find(‘a[data-type=”menu”]’).each(function(){ //alert(main_page + ‘==’ + $(this).data(‘href’)); if (main_page == $(this).data(‘href’) || (main_page == ‘proofs’ && $(this).data(‘sectype’) == ‘proof’)){ $.each($(this).data(‘pageinfo’), function(k, v){ active_page[k] = v; }) $(“.blu-menu-wrapper”).find(‘a’).removeClass(‘blu-menu-active’); $(this).addClass(‘blu-menu-active’); //set active sub btn if ($(this).parent().hasClass(‘blu-submenu’)){ $(this).parent().find(‘.blu-submenu-btn’).each(function(){ var $sub_btn = $(this); //alert(main_page) if($sub_btn.data(‘href’) == main_page + ‘/’ + page_param[0]) { $sub_btn.addClass(‘blu-submenu-btn-active’); } }) } } }) //if sub section if (page_param.length > 0){ if (main_page == ‘proofs’){ active_page[‘GalPrefix’] = ‘Wed’; } else { active_page[‘GalPrefix’] = ”; } active_page[‘Permalink’] = page_param[0]; if (active_page[‘GalPrefix’] != ‘Wed’){ active_page[‘Page’] = page_param[1]; } else { active_page[‘Page’] = page_param[0]; } if (active_page[‘Type’] == ‘text’){ active_page[‘Controller’] = ‘text_sections’; active_page[‘PageView’] = ‘dropdown’; } else { active_page[‘Controller’] = ‘gallery’; } } else { active_page[‘PageView’] = ”; } } /*//main button if (page_param.length == 0){ if (page == ‘cart’ || page == ‘profile’){ active_page.Controller = page; } else { $(‘.blu-menu-wrapper’).find(‘a[data-type=”menu”]’).each(function(){ if (page == $(this).data(‘href’)){ active_page = $(this).data(‘page’); $(“.blu-menu-wrapper”).find(‘a’).removeClass(‘blu-menu-active’); $(this).addClass(‘blu-menu-active’); } }) } // sub section } else { }*/ //check if gallery music was playing if (active_page.AddedToHome && !google_hash){ bluLoadAjax(‘home’, active_page, ‘.blu-page’, ‘.blu-page’); } else { bluLoadAjax(active_page[‘Controller’], active_page, ‘.blu-page’, ‘.blu-page’); } } $(window).bind(“hashchange”, function(){ bluHashChange(); }) $(window).trigger(“hashchange”); vars.masonry_inited = false; vars.slick_inited = false; function bluLoadImages(wrapper, type, crop, open_first, max_w, max_h){ crop = typeof crop !== ‘undefined’ ? crop : ‘none’; vars.crop_img = crop; open_first = typeof open_first !== ‘undefined’ ? open_first : false; //for arrow navigation view var src, r, img_w, img_h; vars.active_gal_view = type; $(‘.blu-gal-img-info’).fadeOut(0); $(‘.blu-images-holder’).css({ ‘height’:’auto’, ‘width’:’auto’, ‘margin’:0 }) $(‘.blu-gal-img-main-wrapper’).css({ ‘height’:’auto’, ‘width’:’auto’ }) $(‘.blu-gallery-wrapper’).css({ ‘height’:’auto’, ‘width’:’auto’ }) $(‘.blu-gal-img-preview-wrapper’).find(‘.blu-img’).attr(‘src’, ”); /*$(‘.blu-gal-cursor-area-left’).fadeOut(0); $(‘.blu-gal-cursor-area-right’).fadeOut(0); $(‘.blu-gal-cursor-left’).fadeOut(0); $(‘.blu-gal-cursor-right’).fadeOut(0);*/ if (vars.masonry_inited){ $(‘.blu-images-holder’).masonry(‘destroy’); vars.masonry_inited = false; } if (vars.slick_inited && false){ $(‘.blu-images-holder’).slick(‘slickPause’); $(‘.blu-images-holder’).slick(‘unslick’); vars.slick_inited = false; } $(‘.blu-gal-img’).stop().fadeTo(0, 1); $(‘.blu-gal-img-main-wrapper’).stop().fadeTo(0, 1); $(‘.blu-gal-img’).removeClass(‘blu-position-abs’); $(‘.blu-gal-img’).css({ ‘width’:’auto’, ‘left’:’auto’, ‘top’:’auto’, ‘opacity’:1 }) //$(‘.blu-gal-slideshow-btn’).fadeOut(0); //bluResize(); if (type == ‘blog_thumbs’){ $(‘.blu-galleries-wrapper’).find(‘img’).css({ ‘margin’:’auto’ //’width’:’100%’ }) } else if (type == ‘thumbs’){ if ($(“.blu-gallery-marker”).length){ //$(‘.blu-section’).addClass(‘blu-thumb-padding’); } else { bluSetThumbSize(“all”); $(‘.blu-images-holder’).masonry({ // options itemSelector: ‘.blu-gal-img’, columnWidth: ‘.blu-grid-sizer’, percentPosition: true }); vars.masonry_inited = true; } $(‘.blu-images-holder’).css({ ‘margin-left’: 40//(vars.win_w – 80 – vars.content_w)/2, }) } else if (type == ‘arrow’){ vars.slick_inited = true; vars.slick_loaded = false; $(‘.blu-grid-sizer’).fadeOut(0); $(‘.blu-images-holder’).find(‘.blu-gal-img’).removeClass(‘blu-gal-img-thumb’); $(‘.blu-images-holder’).find(‘.blu-gal-img’).css({ ‘top’:0 }) $(wrapper).css({ ‘margin-left’:’auto’, ‘margin-right’:’auto’ }) $(‘.blu-gal-img-wrapper’).css({ ‘width’:’auto’, ‘height’:’auto’ }) $(wrapper).find(‘img’).css({ ‘margin’:’auto’ }) $(‘.blu-gal-arrow’).fadeIn(); $(‘.blu-gal-slideshow-btn’).css({ ‘display’:’inline-block’ }); $(‘.blu-gal-slideshow-btn’).data(‘on’, false); $(‘.blu-gal-slideshow-btn’).click(); vars.first_slide = true; } else if (type == ‘blog’){ bluResizeBlog(); } //set watermark if ($(‘.blu-watermark’).length){ $(‘.blu-watermark’).fadeTo(0, 0.50); if (type == ‘thumbs’){ } } //load videos $(wrapper).find(‘.blu-gal-video’).each(function(){ //gallery videos if($(‘.blu-gallery-marker’).length){ var $img_parent = $(this).parent().parent().parent(); if (type == ‘thumbs’){ $(this).find(‘.blu-gal-video-code p’).fadeOut(0); } else { $(this).find(‘.blu-gal-video-code p’).fadeIn(0); $img_parent.find(‘.blu-gal-img-wrapper’).css({ ‘width’: ‘auto’, ‘height’: ‘auto’ }); } $img_parent.find(‘.blu-gal-img-main-wrapper’).stop().fadeTo(0, 0); $img_parent.css({ ‘display’: ‘none’}); $img_parent.css({ ‘visibility’: ‘visible’}); $img_parent.fadeIn(); $(this).css({ ‘visibility’: ‘visible’}); $img_parent.find(‘.blu-gal-img-main-wrapper’).stop().fadeTo(0, 1); $img_parent.find(‘.blu-featured-link-over-wrapper’).fadeOut(0); } else { //featured preview videos var $img_parent = $(this).parent().parent(); $(this).find(‘.blu-gal-video-code p’).fadeOut(0); $img_parent.find(‘.blu-featured-link-over-wrapper’).stop().fadeTo(0, 0); $img_parent.addClass(‘blu-gal-img-thumb’); $img_parent.css({ ‘visibility’: ‘visible’}); $img_parent.fadeIn(); $(this).css({ ‘visibility’: ‘visible’}); $img_parent.find(‘.blu-gal-img-main-wrapper’).stop().fadeTo(0, 1); } }) $(wrapper).find(‘.blu-img, .blu-featured-img, .blu-text-img, .blu-blog-thumb-img’).each(function(){ if (type == ‘text’ || type == ‘contact’){ var $img_parent = $(this).parent(); } else if (type == ‘blog_thumbs’){ var $img_parent = $(this).parent().parent(); } else { if($(‘.blu-gallery-marker’).length){ var $img_parent = $(this).parent().parent().parent(); } else { var $img_parent = $(this).parent().parent(); } } //reset img if (type != ‘blog_thumbs’ || (type == ‘blog_thumbs’ && $(this).data(‘n’) >= vars.blog_thumbs_first && $(this).data(‘n’) -1) ? true: false; if (!google_hash){ a = hash[0].substring(1); } if( (prev_page[‘Permalink’] == ‘home’ && active_page[‘Permalink’] == ‘home’) ){ } a = a_passed; if ($(‘a[data-anchor=”‘+ a + ‘”]’).length){ //alert(a); var goal_top = $(‘a[data-anchor=”‘+ a + ‘”]’).position().top;// + $(‘a[data-anchor=”‘+ a + ‘”]’).parent().position().top; goal_top += $(‘.blu-header’).outerHeight(); if ($(‘.blu-menu’).data(‘fixed’)){ goal_top -= 20; } $(‘html,body’).animate({ scrollTop: goal_top }, 1000); } } //SET CURSOR POSITION function bluMoveCaretToStart(el) { if (typeof el.selectionStart == “number”) { el.selectionStart = el.selectionEnd = 0; } else if (typeof el.createTextRange != “undefined”) { el.focus(); var range = el.createTextRange(); range.collapse(true); range.select(); } } $.fn.bluHeight = function(){ // find the closest visible parent and get it’s hidden children var visibleParent = this.closest(‘:visible’).children(), h; // set a temporary class on the hidden parent of the element visibleParent.addClass(‘blu-temp-show’); // get the height h = this.height(); // remove the temporary class visibleParent.removeClass(‘blu-temp-show’); return h; }; $.fn.bluWidth = function(){ // find the closest visible parent and get it’s hidden children var visibleParent = this.closest(‘:visible’).children(), h; // set a temporary class on the hidden parent of the element visibleParent.addClass(‘blu-temp-show’); // get the height w = this.width(); // remove the temporary class visibleParent.removeClass(‘blu-temp-show’); return w; }; //SET FIELD FOCUS, BLUR EVENTS $.fn.bluSetForm = function(action, after_action, reset_form, use_enter){ var $form = this.find(‘form’); $form.submit(false); var focused = true; //format all fields this.find(‘input[type=text], input[type=password], textarea’).each(function(){ $(this).blur(function(){ if ($(this).val() == ”){ $(this).parent().addClass(“blu-input-default”); $(this).val($(this).data(‘default_value’)) $(this).data(‘default’, true); if ($(this).data(‘class’) == ‘blu-input-pass’){ $(this).removeAttr(‘type’); $(this).attr(‘type’, ‘text’); } } }) //set password field behavior if ($(this).data(‘class’) == ‘blu-input-pass’){ //$(this).focus(function(){ ///$(this).val(”); //}) //set text fields behavior } var elem = $(this); $(this).focus(function(){ var id = $(this).attr(‘id’); var elem = document.getElementById(id); bluMoveCaretToStart(elem); window.setTimeout(function() { bluMoveCaretToStart(elem); }, 1); }) $(this).keydown(function(){ if ($(this).data(‘default’)){ $(this).parent().removeClass(“blu-input-default”); $(this).data(‘default’, false); if ($(this).data(‘class’) == ‘blu-input-pass’){ $(this).removeAttr(‘type’); $(this).attr(‘type’, ‘password’); } $(this).val(”); } }) if (!focused){ $(this).focus(); focused = true; } }) var $btn = this.find(‘input[type=submit], input[type=button]’); $btn.click(function(){ var validated = true; var invalid_str = ”; //validate $form.find(‘input[type=text], textarea’).each(function(){ if (($(this).val() == ” || $(this).val() == $(this).data(‘default_value’)) && $(this).data(‘required’)){ validated = false; invalid_str += $(this).data(‘default_value’) + ‘, ‘; } }); if (invalid_str != ”){ invalid_str = invalid_str.replace(/,s*$/, “”); } if (validated){ var post = ‘data=’ + JSON.stringify($form.bluSerializeObject()); $form.fadeTo(‘fast’, 0.3); $btn.val(‘sending…’); $.post(action, post, function(data){ var success = data.substring(0, 1); var data = data.substring(1, data.length); $form.fadeTo(‘fast’, 1); $btn.val($btn.data(‘default_value’)); if (success == ‘0’){ $(‘.blu-form-msg’).html(data); if(data == “Please log into your profile first.”){ $(‘#blu_shop_link_profile’).click(); } } else { if (reset_form){ bluResetForm($form); } $(after_action).data(‘data’, data); $(after_action).click(); } }); } else { $(‘.blu-form-msg’).html(‘Please enter the following: ‘ + invalid_str); } }) $form.bind(‘keypress’, function(e){ if ( e.keyCode == 13 && ($btn.is(“:focus”) || use_enter)) { $(this).find(‘input[type=submit], input[type=button]’).click(); } }); return this; } $.fn.bluSerializeObject = function(){ var o = {}; var a = this.serializeArray(); $.each(a, function() { if (o[this.name] !== undefined) { if (!o[this.name].push) { o[this.name] = [o[this.name]]; } o[this.name].push(this.value || ”); } else { o[this.name] = this.value || ”; } }); return o; }; function bluResetForm($form){ var reset_form = true; $form.find(‘input[type=text], input[type=password], textarea’).each(function(){ $(this).parent().addClass(“blu-input-default”); if ($(this).attr(‘type’) == ‘password’){ $(this).removeAttr(‘type’); $(this).attr(‘type’, ‘text’); } $(this).val($(this).data(‘default_value’)) $(this).data(‘default’, 1); $(‘.blu-form-msg’).html(”); }) $form.find(‘input[type=checkbox]’).each(function(){ $(this).prop(‘checked’, false); }); } function bluLoadAjax(file, post, data_holder, fadein_holder, redirect){ $(data_holder).stop().fadeTo(‘fast’, 0); $(‘.blu-loader-main’).fadeIn(); if (file == ‘favorites’){ file = ‘gallery.php?favorites’; post = ”; } else { file += ‘.php’; } if (file == ‘profile.php’ && post[‘Param’] != ”){ file += “?” + post[‘Param’]; } var json_post = JSON.stringify(post); redirect = typeof redirect !== ‘undefined’ ? redirect : ”; $.ajax({ type: “POST”, url: ‘https://www.slatesrestaurant.com/blu_source/controllers/’ + file + ”, data: {data : json_post}, cache: false, success: function(data){ $(‘.blu-loader-main’).fadeOut(‘fast’); $(data_holder).html(data); $(data_holder).stop().fadeTo(“fast”, 1); if (fadein_holder != ” && $(fadein_holder).length){ if (fadein_holder != ‘.blu-popup’ && file != ‘comments.php’){ window.scrollTo(0, 0); //check if gallery music was playing } else { bluPositionPopup(); } if (!$(‘.blu-footer’).data(‘opened’) && !$(‘#blu_splash_marker’).length){ bluResize(); $(‘.blu-header’).removeClass(‘blu-header-splash’); $(‘.blu-page’).removeClass(‘blu-page-splash’); $(‘.blu-page’).height(‘auto’); $(‘.blu-copyright’).removeClass(‘blu-copyright-splash’); $(‘.blu-footer’).data(‘opened’, true); $(‘.blu-footer’).fadeIn(); } else if (!$(‘.blu-footer’).data(‘opened’) && $(‘#blu_splash_marker’).length){ $(‘.blu-page’).css({ “padding-top”:20 }) $(‘.blu-footer-custom’).remove(); $(‘.blu-header’).addClass(‘blu-header-splash’); $(‘.blu-page’).addClass(‘blu-page-splash’); $(‘.blu-copyright’).addClass(‘blu-copyright-splash’); } $(fadein_holder).fadeIn(function(){ if (fadein_holder == ‘.blu-popup’ && (file == ‘proof_login.php’ || file == ‘link_pass.php’)){ $(fadein_holder).find(‘input[type=text]’).focus(); } bluResize(); //if home page scroll to the hash if ( post.AddedToHome && data_holder == ‘.blu-page’ && post.Type != ‘text’ && post.Type != ‘links’ && post.Type != ‘testimonials’){ bluScrollPage(post.Permalink); } }); } else if (redirect){ window.location.href = redirect; } } }) } function bluPopUp(view, post){ post = typeof post !== ‘undefined’ ? post : ”; bluPopupScale(‘.blu-popup-bg’); //$(‘.blu-popup’).find(‘h1’).html(title); $(‘.blu-popup-content’).empty(); if (view == ‘contact_map’){ $(‘.blu-popup-content’).html(post); bluPositionPopup(); $(‘.blu-popup’).fadeIn(function(){ //window.scrollTo(0, 0); }); } else { bluLoadAjax(view, post, ‘.blu-popup-content’, ‘.blu-popup’); } $(‘.blu-popup-bg’).fadeTo(0, 0.9); $(‘.blu-popup’).find(‘.blu-close-btn’).click(function(){ bluPopupClose($(this).parent().parent()); }) } function bluPositionPopup(){ $(‘.blu-popup-holder’).css({ ‘top’: $(window).scrollTop() + (vars.win_h – $(‘.blu-popup-holder’).bluHeight())/2 }) } function bluPopupScale(elem){ if ($(elem).length){ $(elem).width($(document).width()); $(elem).height($(document).height()); if ($(elem).parent().find(‘.blu-popup-holder’).length){ if ($(elem).parent().find(‘.blu-popup-holder’).height() > (vars.win_h – 60)){ $(elem).parent().find(‘.blu-popup-holder’).addClass(‘blu-popup-holder-mobile’); } else { $(elem).parent().find(‘.blu-popup-holder’).removeClass(‘blu-popup-holder-mobile’); } } } } function bluPopupClose(obj){ obj.fadeOut(); } function bluSetEvenHeight($obj){ //adjust for half pixel positioning $obj.height(‘auto’); var h = $obj.bluHeight(); if (h % 2 != 0){ h++; } $obj.height(h) } //PARALLAX FUNCTIONS /* fix vertical when not overflow call fullscreenFix() if .fullscreen content changes */ function bluParallaxFullscreenFix(){ var h = $(‘body’).height(); // set .fullscreen height $(“.blu-parallax-content-b”).each(function(i){ if($(this).innerHeight() > h){ $(this).closest(“.blu-parallax-fullscreen”).addClass(“overflow”); } }); } /* resize background images */ function bluParallaxBgResize(){ var windowH = $(window).height(); var windowW = $(window).width(); var parallax_h = vars.win_h/1.5; if (parallax_h vars.win_w ){ parallax_h = Math.round(vars.win_h/1.5); } $(“.blu-parallax-bg”).each(function(i){ var path = $(this); // variables var contW = path.width(); var contH = path.height(); var imgW = path.attr(“data-img-width”); var imgH = path.attr(“data-img-height”); var ratio = imgW / imgH; if (!path.hasClass(‘blu-no-parallax’)){ // overflowing difference var diff = parseFloat(path.attr(“data-diff”)); diff = diff ? diff : 0; // remaining height to have fullscreen image only on parallax var remainingH = 0; if(path.hasClass(“blu-parallax”) && !$(“html”).hasClass(“touch”)){ var maxH = contH > windowH ? contH : windowH; remainingH = windowH – contH; } // set img values depending on cont imgH = contH + remainingH + diff; imgW = imgH * ratio; // fix when too large if(contW > imgW){ imgW = contW; imgH = imgW / ratio; } // } else { imgW = windowW; imgH = imgW / ratio; } path.data(“resized-imgW”, imgW); path.data(“resized-imgH”, imgH); path.css(“background-size”, imgW + “px ” + imgH + “px”); //alert(imgH); if (!path.hasClass(‘blu-no-parallax’)){ path.height(parallax_h); } else { path.height(imgH); } }); } /* set parallax background-position */ function bluParallaxPosition(e){ var heightWindow = $(window).height(); var topWindow = $(window).scrollTop(); var bottomWindow = topWindow + heightWindow; var currentWindow = (topWindow + bottomWindow) / 2; $(“.blu-parallax”).each(function(i){ var path = $(this); if (!path.hasClass(‘blu-no-parallax’) && ” == ‘yes’ ){ var height = path.height(); var top = path.offset().top; var bottom = top + height; // only when in range if(bottomWindow > top && topWindow < bottom){ var imgW = path.data("resized-imgW"); var imgH = path.data("resized-imgH"); // min when image touch top of window var min = 0; // max when image touch bottom of window var max = - imgH + heightWindow; // overflow changes parallax var overflowH = height ($(window).height()/3)) { $('.blu-back-to-top-wrapper').stop(true, true).fadeIn(); } else { $('.blu-back-to-top-wrapper').stop(true, true).fadeOut(); } //home parallax if(!$("html").hasClass("touch") && $('.blu-parallax').length){ bluParallaxPosition(); } //set active menu buttons var hash = bluGetHash(); var home_sec = hash.indexOf("!") > -1 ? false: true; if (active_page[‘Type’] == ‘home’ && home_sec && false){ $(“a[data-type=’section’]”).each(function(){ var this_top = $(this).offset().top – $(window).scrollTop() – 10; if (this_top -105){ $(‘.blu-menu’).find(‘a’).removeClass(‘blu-menu-active’); $(‘.blu-menu’).find(‘a[data-href=”‘ + $(this).data(‘anchor’) + ‘”]’).addClass(‘blu-menu-active’); /* if ($(‘.blu-menu’).find(‘a[data-href=”‘ + $(this).data(‘anchor’) + ‘”]’).data(‘page’).Type == ‘home’){ bluSetHash(”, false); } else { bluSetHash($(this).data(‘anchor’), false); }*/ } }) } if (false){ var $blu_blog_thumbs = $(‘.blu-blog-thumbs’); if ($blu_blog_thumbs.length){ //console.log($(this).scrollTop()); if ($(this).scrollTop() <= 260){ $blu_blog_thumbs.css({ position:'absolute', right:0, top:0 }) } else { $blu_blog_thumbs.css({ position:'fixed', right:(vars.win_w - vars.content_w)/2 - 20 - 20, top:10 }) } } } }); /*function bluSetThumbSize($obj){ if (vars.active_gal_view == 'thumbs'){ var w = $obj.find('img').width(); var h = $obj.find('img').height(); $obj.find('.blu-featured-link-over-wrapper').width(w - 0 * 2); $obj.find('.blu-featured-link-over-wrapper').height(h - 0 * 2); $obj.find('.blu-featured-link-over-bg').width(w - 0 * 2); $obj.find('.blu-featured-link-over-bg').height(h - 0 * 2); } }*/ function bluSetThumbSize($obj){ //alert('no'); if (vars.win_w <= 600 || 0){ var thumbs_per_row = 1; //var col_percent = 50; } else { var thumbs_per_row = 4; //var col_percent = 33.33; } var pad = (8/vars.content_w) * 100; //col_percent -= pad; if ($obj == 'all'){ var $images_holder = $('.blu-images-holder'); } else { var $images_holder = $obj.parent(); var count = $images_holder.find('.blu-gal-img').length; if (count <= 4 && !0){ //thumbs_per_row = count; } } var col_percent = Math.round(100/thumbs_per_row); var w = Math.floor((vars.content_w - 8 * (thumbs_per_row - 1) )/thumbs_per_row); //console.log(w + " == " + vars.content_w + " == " + thumbs_per_row); //console.log(vars.win_w); $images_holder.css({ }) $images_holder.each(function(){ var $this = $(this); var count = $this.find('.blu-gal-img').length; /*if (count count){ holder_w = (w + 8) * count; $(this).css({ 'margin': '0 auto' }) } else { holder_w = (w + 8) * thumbs_per_row; $(this).css({ 'margin': '0 auto' }) } $(this).width(holder_w); }) var count = 0; //$(".blu-images-center").find('blu-gal-img').each(function() { // count++; //}) //count = $obj.parent().children().length; //alert(count); //alert($(".blu-images-holder").length); //alert($(".blu-images-center div").children('.blu-gal-img').length); if ($obj != 'all'){ //w -= 8 var img_w = $obj.find('img').data('w'); //bluWidth(); var img_h = $obj.find('img').data('h'); //bluHeight(); var img_r = img_w / img_h; img_w = w; img_h = img_w / img_r; if (!vars.crop_img || vars.crop_img == 'none'){ var h = img_h; } else if (vars.crop_img == 'square'){ var h = img_w; if(img_h img_h) { img_h = h; img_w = img_h * img_r; $obj.find('img').height(img_h); $obj.find('img').width(img_w); } } //$('.blu-gal-img').width(w); $obj.find('.blu-featured-link-over-wrapper').width(w); $obj.find('.blu-featured-link-over-wrapper').height(h); //$obj.find('.blu-featured-link-over-bg').width(w); //$obj.find('.blu-featured-link-over-bg').height(h); //$obj.find('.blu-gal-img-main-wrapper').width(w); $obj.find('.blu-gal-img-wrapper').width(w); $obj.find('.blu-gal-img-wrapper').height(h); $obj.find('iframe').width(w); $obj.find('iframe').height(h); var horizontal = (img_w > img_h) ? true:false; if (horizontal){ if (!vars.crop_img){ var w_diff = 0; } else { var w_diff = Math.abs((img_w – w) / 2); } //console.log(“w_diff = ” + w_diff) $obj.find(‘img’).css({ ‘margin-left’: -w_diff, ‘height’:’100%’, //’width’: ‘auto’, ‘max-width’: ‘none’ }) } else { var h_diff = Math.abs((img_h – h) / 2); $obj.find(‘img’).css({ //’margin-top’: -h_diff, ‘max-height’: ‘none’, //vars.win_h – 20, ‘height’:’auto’, ‘width’: ‘100%’, }) } } } $.fn.filterByData = function(prop, val) { return this.filter( function() { return $(this).data(prop)==val; } ); } function bluScaleThumbs() { $(‘.blu-section’).width(vars.content_w); $(‘.blu-images-holder’).css({ ‘margin-left’:0//8 }) //NOTE: 1 unit = a 2/3 vertical image (this is arbitrary) var max_thumb_h = 372; var max_thumb_area = vars.content_w;// – 8 * 2; var thumb_dist = 8; //========================================= // // Now loop through and determine the row // for each image // //========================================= var curr_row = 1; //var row_full = false; //var remaining_row_ratio = max_ratio_per_row; var num = 1; var thumb_h_array = new Array(); //var min_row_ratio = 50; var row_count = 1; var total_row_w = -thumb_dist; var w, h, r; var type = ‘image’; //var prev_h = 0; $(‘.blu-gal-img’).each(function(){ var $this = $(this); type = ($this.hasClass(‘blu-gal-video-main’)) ? ‘video’:’image’; if (type == ‘image’){ w = $(this).find(‘.blu-img’).data(‘thumb-w’); //bluWidth(); h = $(this).find(‘.blu-img’).data(‘thumb-h’); //bluHeight(); } else if (type == ‘video’){ w = $(this).find(‘iframe’).width(); //bluWidth(); h = $(this).find(‘iframe’).height(); //bluHeight(); } r = w / h; h = max_thumb_h; w = h * r; total_row_w += w + thumb_dist; if (total_row_w > max_thumb_area){ curr_row++; row_count++; total_row_w = w; } $(this).data(“my_row”, curr_row); $(this).data(“my_num”, num); $(this).data(“my_width”, w); $(this).data(“my_height”, h); $(this).data(“my_ratio”, r); num++; }); //curr_row = 1; //total_row_w = 0; var left = 0; var top = 0; var w_per = 0; var img_count_row = 0; //alert(max_thumb_area); for (var i=1; i max_thumb_h && i == row_count){ h = max_thumb_h w = h * r; } $this.css({ ‘width’:w, “top”: top, “left”: left }) if (type == ‘video’){ $(this).find(‘iframe’).width(w); $(this).find(‘iframe’).height(h); } left += w + thumb_dist; $(this).find(‘.blu-featured-link-over-wrapper’).width(w); $(this).find(‘.blu-featured-link-over-wrapper’).height(h); $(this).find(‘.blu-featured-link-over-bg’).width(w); $(this).find(‘.blu-featured-link-over-bg’).height(h); $(this).find(‘.blu-gal-img-main-wrapper’).width(w); $(this).find(‘.blu-gal-img-main-wrapper’).height(h); $(this).find(‘.blu-gal-img-wrapper’).width(w); $(this).find(‘.blu-gal-img-wrapper’).height(h); $(this).find(‘.blu-img, .blu-featured-img’).css({ ‘height’: h, ‘width’:w, ‘max-width’: ‘none’ }); }); top += h + thumb_dist; } $(‘.blu-gallery-wrapper’).height(top); $(‘.blu-images-holder’).height(top + 40); } function bluSetThumbRowHeight(row, height, last_row, last_adj) { //=============================================== // // Loop through and set all the thumbs with the // specified row to the specified height // //=============================================== var row_w = 0; var thumb_space = 8; var max_thumb_h = 400; var max_thumb_area = vars.win_w – 8 * 2;// – (thumb_space * 2) – 1; var total_row_w = 0; $(‘.blu-gal-img’).each(function(){ var my_row = $(this).data(“my_row”); if(my_row == row) { var img_w = $(this).find(‘img’).data(‘w’); //bluWidth(); var img_h = $(this).find(‘img’).data(‘h’); //bluHeight(); var img_r = img_w / img_h; var h = height; var w = h * img_r; $(this).data(“my_height”, h); $(this).data(“my_width”, w); total_row_w += (w + thumb_space); } }); //============================================== // // Now that all heights are set for the row // have to loop through again, and find out the // total width of the row. If it is not the width // of the window, have to adjust // //================================================== /*$(‘.blu-gal-img’).each(function(){ var my_row = $(this).data(“my_row”); if(my_row == row) { var my_w = $(this).data(“my_width”); total_row_w += (my_w + thumb_space); } });*/ // Subract off thumbspace for the last image //total_row_w -= thumb_space; //console.log(max_thumb_area – total_row_w); if(Math.abs(max_thumb_area – total_row_w) max_thumb_area) { var new_h = height – .25; } else if (total_row_w max_thumb_h && last_row) { //new_h = max_thumb_h; //} /* if(last_row && new_h > max_thumb_h) { // // Do nothing if it’s the last row and the thumb is already // at it’s max height. // new_h = max_thumb_h; bluSetThumbRowHeight(row, new_h, last_row, true); } else { bluSetThumbRowHeight(row, new_h, last_row); }*/ } else { //================================================= // // We hit the target width for the row, so // set the size for everything, and then call // the function to position the thumbs // //================================================== $(‘.blu-gal-img’).each(function(){ $(this).css({ ‘width’:’auto’ }) var my_row = $(this).data(“my_row”); var my_h = $(this).data(“my_height”); var my_w = $(this).data(“my_width”); //console.log($(this).data(“my_num”) + “:” + my_row + ” == ” + row); if(my_row == row) { // When the row width == win_w, then we can position the thumbs //console.log(my_w); $(this).find(‘.blu-featured-link-over-wrapper’).width(my_w); $(this).find(‘.blu-featured-link-over-wrapper’).height(my_h); $(this).find(‘.blu-featured-link-over-bg’).width(my_w); $(this).find(‘.blu-featured-link-over-bg’).height(my_h); $(this).find(‘.blu-gal-img-main-wrapper’).width(my_w); $(this).find(‘.blu-gal-img-main-wrapper’).height(my_h); $(this).find(‘.blu-gal-img-wrapper’).width(my_w); $(this).find(‘.blu-gal-img-wrapper’).height(my_h); $(this).find(‘img’).css({ ‘height’: ‘100%’, ‘width’:’auto’, ‘max-width’: ‘none’ }); } }); bluPositionThumbs(); } } function bluPositionThumbs(){ var top = 0; var left = 0; var curr_row = 1; var thumb_space = 8; var prev_h = 0; $(‘.blu-gal-img’).each(function(){ var my_row = $(this).data(“my_row”); var my_h = $(this).data(“my_height”); var my_w = $(this).data(“my_width”); if(my_row != curr_row){ curr_row = my_row; left = 0; top += prev_h + thumb_space; } $(this).css({ “top”: top, “left”: left }) left += my_w + thumb_space; prev_h = my_h; }); //=============================================== // // Since the thumbs are absolute positioned now // have the set the wrapper’s height // //=============================================== $(‘.blu-gallery-wrapper’).height(top + prev_h); } /* function bluSetThumbSize($obj){ if (vars.win_w <= 600 || 0){ var thumbs_per_row = 2; var col_percent = 50; } else { var thumbs_per_row = 3; var col_percent = 33.33; } var pad = (8/vars.content_w) * 100; //col_percent -= pad; var w = Math.floor((vars.content_w - 8 * (thumbs_per_row - 1) )/thumbs_per_row); if($("#blu-galleries-marker").length) { var thumbs_per_row = 1; var col_percent = 100; var w = vars.content_w; } else { var thumbs_per_row = 5; var col_percent = 20; var w = (vars.win_w - 40 * 2 - 8 * (thumbs_per_row - 1))/thumbs_per_row; } //console.log(w + " == " + vars.content_w); //console.log(vars.win_w); $('.blu-grid-sizer').css({ 'width': col_percent + '%' }) $('.blu-gal-img-thumb').css({ 'width': col_percent + '%' }) var count = 0; //$(".blu-images-center").find('blu-gal-img').each(function() { // count++; //}) //count = $obj.parent().children().length; //alert(count); //alert($(".blu-images-holder").length); //alert($(".blu-images-center div").children('.blu-gal-img').length); if ($obj != 'all'){ //w -= 8 var img_w = $obj.find('img').data('w'); //bluWidth(); var img_h = $obj.find('img').data('h'); //bluHeight(); var img_r = img_w / img_h; img_w = w; img_h = img_w / img_r; if (!vars.crop_img){ var h = img_h; } else { var h = img_w; if($("#blu-galleries-marker").length) { var h = (w / 1.5) / 2.5; } if(img_h img_h) ? true:false; if (horizontal){ if (!vars.crop_img){ var w_diff = 0; } else { var w_diff = Math.abs((img_w - w) / 2); } //console.log("w_diff = " + w_diff) $obj.find('img').css({ 'margin-left': -w_diff, 'width': '100%', 'height':'auto', 'max-width': 'none' }) } else { var h_diff = Math.abs((img_h - h) / 2); $obj.find('img').css({ //'margin-top': -h_diff, 'max-height': 'none', //vars.win_h - 20, 'height':'auto', 'width': '100%', }) } } }*/ function bluResize(){ vars.win_w = $(window).width(); vars.win_h = $(window).height(); vars.content_w = 1200; vars.content_h = Math.round(667); vars.content_r = vars.content_w / vars.content_h; if (vars.content_w > (vars.win_w – 40 * 2)){ vars.content_w = (vars.win_w – 40 * 2); vars.content_h = Math.round(vars.content_w / vars.content_r); } var max_h = vars.win_h – $(‘.blu-header’).bluHeight() – 40 – $(‘.blu-gal-header’).bluHeight(); if (vars.content_h > max_h){ vars.content_h = max_h; } //$(‘#blu-wrapper-inner-border’).height($(‘#blu-wrapper-inner’).height() + 40 * 2 – 20); if (vars.active_gal_view == ‘blog’){ //vars.content_w -= 200; } /*vars.blog_w = 900; if (vars.blog_w > (vars.win_w – 80)){ vars.blog_w = vars.win_w – 80; }*/ vars.blog_w = vars.content_w – 270; $(‘.blu-section’).width(vars.content_w); //$(‘.blu-gallery-wrapper-blog’).width(vars.blog_w); //$(‘.blu-gal-header-blog’).width(vars.blog_w); $(‘.blu-page’).css({ ‘min-height’:vars.content_h }) //set mobile menu if (vars.win_w vars.win_w – 60){ $(‘.blu-logo’).find(‘img’).width(vars.win_w – 60); $(‘.blu-logo’).find(‘img’).height($(‘.blu-logo’).find(‘img’).width() / 1); } $(‘.blu-logo’).width(vars.win_w – 60); $(‘.blu-logo’).height($(‘.blu-logo-main’).find(‘img’).height()); $(‘.blu-header’).height($(‘.blu-logo-main’).find(‘img’).height()); } } else { if ($(‘.blu-menu’).data(‘mobile’)){ $(‘.blu-menu’).data(‘mobile’, false); $(‘.blu-menu’).removeClass(‘blu-menu-mobile’); $(‘.blu-shop-links’).removeClass(‘blu-shop-links-mobile’); $(‘.blu-menu-wrapper’).removeClass(‘blu-menu-wrapper-mobile’); $(‘.blu-logo’).removeClass(‘blu-logo-mobile’); $(“.blu-menu-wrapper”).css({ //’top’:’50%’ }) $(‘.blu-menu-wrapper’).stop().fadeIn(); $(‘.blu-menu-mobile-btn’).stop().fadeOut(0); $(‘.blu-menu-mobile-bg’).fadeOut(0); } //POSITION MENU vars.menu_w = 0; $(‘.blu-menu-wrapper’).find(“a”).each(function(){ vars.menu_w += $(this).width() + 16 * 2; }) $(‘.blu-logo-main’).css({ ‘left’: Math.round(($(‘.blu-header’).width() – $(‘.blu-logo-main’).width())/2) }) $(‘.blu-header’).css({ ‘height’:54 + 30 }) if (vars.menu_w <= (vars.content_w - $('.blu-logo-main').width())){ //logo can be in middle of menu $('.blu-header').css({ 'padding-bottom':0 }) $('.blu-logo-main').css({ 'top': 0 }) $('.blu-logo-main').css({ 'top': 15 }) var btn_w = 0; var btn_left = 0; var btn_right = 0; var btns_left_w = 0 var btns_right_w = 0; $('.blu-menu-wrapper').find("a").each(function(){ btn_w = $(this).width() + 16 * 2; btn_left += btn_w; $(this).data('btn_w', btn_w); if (btn_left <= (vars.menu_w/2 + 30)){ $(this).data('pos', 'left'); btns_left_w += btn_w; } else { $(this).data('pos', 'right'); btns_right_w += btn_w; } }) $(".blu-menu-wrapper").addClass('blu-menu-wrapper-abs'); $('.blu-menu').addClass('blu-menu-abs'); $('.blu-menu').css({ 'top':$('.blu-logo-main').height()/2, 'left': 0, 'padding-top':0 }) btn_left = ($(".blu-menu-wrapper").width() - $('.blu-logo-main').width())/2 - btns_left_w - 20; //console.log(vars.content_w + " == " + btn_left); btn_right = ($(".blu-menu-wrapper").width() - ($(".blu-menu-wrapper").width() - $('.blu-logo-main').width())/2) + 20; $('.blu-menu-wrapper').find("a").each(function(){ if ($(this).data('pos') == 'left'){ if ($(this).data('secsubtype') == 'dropdown' || $(this).data('secsubtype') == 'featured-blog'){ $(this).parent().css({ 'position':'absolute', 'left': btn_left }) } else { $(this).css({ 'position':'absolute', 'left': btn_left }) } btn_left += $(this).data('btn_w'); } else { if ($(this).data('secsubtype') == 'dropdown' || $(this).data('secsubtype') == 'featured-blog'){ $(this).parent().css({ 'position':'absolute', 'left': btn_right }) } else { $(this).css({ 'position':'absolute', 'left': btn_right }) } btn_right += $(this).data('btn_w'); } }) } else { //logo above the menu $('.blu-menu').removeClass('blu-menu-abs'); $('.blu-menu-wrapper').find("a").each(function(){ if ($(this).data('secsubtype') == 'dropdown' || $(this).data('secsubtype') == 'featured-blog'){ $(this).parent().css({ 'position':'relative', 'left': 'auto', 'right':'auto' }) } else { $(this).css({ 'position':'relative', 'left': 'auto', 'right':'auto' }) } }) $('.blu-menu-wrapper').removeClass('blu-menu-wrapper-abs'); vars.menu_pos = (vars.win_w - $('.blu-menu').width())/2; if (vars.menu_pos < 20){ vars.menu_pos = 20; } $('.blu-logo-main').css({ 'top': 0 }) if (vars.menu_pos < 100){ $('.blu-menu').css({ //'right':vars.menu_pos }) $('.blu-music').css({ 'right':vars.menu_pos }) $('.blu-social-links-footer').css({ //'left':vars.menu_pos }) $('.blu-logo').css({ //'padding-left':vars.menu_pos }) } $('.blu-menu').css({ 'top':$('.blu-logo-main').height(), 'padding-top':0 }) $('.blu-header').css({ 'padding-bottom':30 }) } } $('.blu-menu-mobile-btn').data('opened', false); if (!$('.blu-header').data('opened')){ $('.blu-header').data('opened', true); $('.blu-header').fadeTo('fast', 1, function(){ if (!$('.blu-page').data('opened')){ $('.blu-page').data('opened', true); $('.blu-page').fadeTo('fast', 1) } }) } // $('.blu-wrapper').width(480) //alert(vars.win_w); //resize home page elements if ($('.blu-home-wrapper').length || $('.blu-fullscreen-bg-video').length){ positionHome() } //resize single text sec elements if ($('.blu-parallax').length){ bluParallaxFullscreenFix(); bluParallaxBgResize(); if(!$("html").hasClass("touch")){ bluParallaxPosition(); } } bluPopupScale('.blu-gal-img-preview-bg'); bluPopupScale('.blu-popup-bg'); //for fixed top menu vars.menu_top = $('.blu-header').height() - 20; //$('.blu-menu').height($('.blu-header').height()); //position gallery arrows if ($('.blu-gallery-marker').length){ bluScaleImagePreview(); } // Set width of blog links in blog posts if ($('#blu_blog_links').length){ $('#blu_blog_links').css({ 'top':$('.blu-gal-title').bluHeight() + 40 }) } //set fav icon pos if ($('.blu-gal-img').length){ //vars.thumb_w = '33.33%'; //$('.blu-grid-sizer').width(vars.thumb_w); //$('.blu-gal-img-thumb').width(vars.thumb_w); //alert(vars.active_gal_view); if ($('.blu-images-holder').length){ if (vars.active_gal_view == 'thumbs' && $(".blu-gallery-marker").length) { bluScaleThumbs(); } else { if (vars.active_gal_view == 'thumbs'){ $('.blu-images-holder').width(vars.content_w + 8) } else { $('.blu-images-holder').width(vars.content_w) } } } if (!$(".blu-gallery-marker").length){ $('.blu-gal-img').each(function(){ //$(this).find('.blu-img-icons').width($(this).find('img').bluWidth()); $(this).find('.blu-gal-img-info').width($(this).find('img').bluWidth()); if (vars.active_gal_view == 'thumbs'){ bluSetThumbSize($(this)); } }) } } if (vars.active_gal_view == 'blog' || vars.active_gal_view == 'blog_thumbs'){ bluResizeBlog(); } else if (vars.active_gal_view == 'arrow'){ bluResizeArrow(); } if ($('.blu-test').length){ bluPositionTests(); } if ($('.blu-link').length){ bluPositionLinks(); } if ($("#blu_contact_content").length && !0){ $("#blu_contact_content").css({ 'margin-top':-$('.blu-parallax').height() + ($('.blu-parallax').height() - $(".blu-contact-wrapper").bluHeight())/2 }) } if ($('.blu-multi-section').length || $('.blu-text-section').length){ bluPositionText(); } if ($('.blu-contact-section').length){ bluPositionContact(); } if ($('#blu_splash_marker').length){ bluPositionSplash(); } if ($(".blu-blog-thumbs").length){ bluPositionBlogThumbs(); $('.blu-section').css({ 'min-height':$('.blu-blog-thumbs').bluHeight() + 40 }) } } function bluShowTooltip(txt, $trigger){ var $tooltip = $trigger.find('.blu-tooltip'); if (txt == ''){ //$tooltip.data('opened', false); //$tooltip.stop().fadeOut(0); $('.blu-tooltip').remove() ; } else { if (!$tooltip.length){ $('.blu-tooltip-main').clone().appendTo($trigger); $trigger.find('.blu-tooltip-main').addClass('blu-tooltip'); $trigger.find('.blu-tooltip').removeClass('blu-tooltip-main'); $tooltip = $trigger.find('.blu-tooltip'); $tooltip.removeClass('blu-tooltip-main'); } $tooltip.stop().fadeOut(0); $tooltip.html(txt); $tooltip.css({ 'top': -35, 'left': $trigger.bluWidth() - $tooltip.bluWidth() }) $tooltip.data('opened', true); $tooltip.stop().fadeIn('fast'); } } function zoomDisable(){ $('head meta[name=viewport]').remove(); $('head').prepend(''); } function zoomEnable(){ $('head meta[name=viewport]').remove(); $('head').prepend(''); } function bluPositionBlogThumbs(){ if ($(".blu-blog-thumbs").length){ $('.blu-blog-thumb-holder').css({ 'top': Math.round($('.blu-header').bluHeight() + 35), 'right': Math.round((vars.win_w - vars.content_w)/2) }) $(".blu-blog-thumbs").find('.blu-gal-sub-title').height($('.blu-gal-title-blog').height() + $('.blu-gal-sub-title').height()); } } $(function(){ //prevent right click $(this).bind("contextmenu", function(e) { e.preventDefault(); }); //bluResize(); $(window).scroll(); $('.blu-back-to-top').click(function(){ bluScrollPage('home'); }) //PARALLAX SETTINGS /* detect touch */ if("ontouchstart" in window){ document.documentElement.className = document.documentElement.className + " touch"; } if(!$("html").hasClass("touch") && '' == 'yes'){ /* background fix */ $(".blu-parallax").css("background-attachment", "fixed"); } $('.blu-news').bluSetForm('https://www.slatesrestaurant.com/blu_source/controllers/actions_news.php', $('.blu-news').find('.blu-after-action'), true); //set sound vars }); ]]>

Source

Leave a Comment

Your email address will not be published. Required fields are marked *