From cb8a48a4aeb64c814f12052ff094863936d974bf Mon Sep 17 00:00:00 2001 From: Eric Stout Date: Mon, 3 Apr 2017 13:54:58 -0700 Subject: [PATCH] Fixes what json key to check for --- assets/js/all.js | 4 ++-- assets/js/theme.js | 4 ++-- assets/js/theme.min.js | 8 ++++---- functions.php | 2 +- package.json | 2 +- style.css | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/assets/js/all.js b/assets/js/all.js index 6867c8c..e7cc52c 100644 --- a/assets/js/all.js +++ b/assets/js/all.js @@ -610,9 +610,9 @@ var staffgrid = function(){ // Get Thumbnail thats cropped, if it doesn't exist fall back to full size as a last resort - if( staff_post._embedded['wp:featuredmedia'] && staff_post._embedded['wp:featuredmedia'][0].media_details.sizes['profile-image'] ){ + if( staff_post._embedded && staff_post._embedded['wp:featuredmedia'][0].media_details.sizes['profile-image'] ){ featured_img = staff_post._embedded['wp:featuredmedia'][0].media_details.sizes['profile-image'].source_url; - } else if( staff_post._embedded['wp:featuredmedia'] ) { + } else if( staff_post._embedded ) { featured_img = staff_post._embedded['wp:featuredmedia'][0].media_details.sizes.full.source_url; } else{ featured_img = ''; diff --git a/assets/js/theme.js b/assets/js/theme.js index ae14e57..feaf603 100644 --- a/assets/js/theme.js +++ b/assets/js/theme.js @@ -119,9 +119,9 @@ var staffgrid = function(){ // Get Thumbnail thats cropped, if it doesn't exist fall back to full size as a last resort - if( staff_post._embedded['wp:featuredmedia'] && staff_post._embedded['wp:featuredmedia'][0].media_details.sizes['profile-image'] ){ + if( staff_post._embedded && staff_post._embedded['wp:featuredmedia'][0].media_details.sizes['profile-image'] ){ featured_img = staff_post._embedded['wp:featuredmedia'][0].media_details.sizes['profile-image'].source_url; - } else if( staff_post._embedded['wp:featuredmedia'] ) { + } else if( staff_post._embedded ) { featured_img = staff_post._embedded['wp:featuredmedia'][0].media_details.sizes.full.source_url; } else{ featured_img = ''; diff --git a/assets/js/theme.min.js b/assets/js/theme.min.js index a0d126e..fc3b657 100644 --- a/assets/js/theme.min.js +++ b/assets/js/theme.min.js @@ -1,4 +1,4 @@ -this.oneil=this.oneil||{},function(){var e={init:function(){this.serviceUrl=this.serviceUrl||"",this.salesRepUrl=this.salesRepUrl||"",this.routes={complete:"/picker/send"},filepicker.setKey("Am2o1bkgzSAmThV3fSfi2z"),$(".uploadButton").on("click",function(){e.pickFiles()}),$(".moreButton").on("click",function(){$("#UploadPanel").show(),$("#WaitPanel").hide(),$("#ConfirmPanel").hide(),$(".uploadResult").hide()}),$("#ToList").on("change",function(){"external"==$("#ToList").val().toLowerCase()?$("#ToEmailLine").show():$("#ToEmailLine").hide()}),e.populateSalesReps("#ToList",e.salesRepUrlTo),e.populateSalesReps("#FromList",e.salesRepUrlFrom)},populateSalesReps:function(e,t){$.support.cors=!0,$.ajax({url:t,type:"GET",dataType:"json",crossDomain:!0}).done(function(t,i,o){if(t&&t.list)for(var n=$(e),s=t.list,r=0;r");n.append(l);for(var d=a.contacts,c=0;c"+p.external+""))}}}).fail(function(e,t,i){}).always(function(e,t,i){})},pickFiles:function(){var t=e.jsonForm();if(e.validateForm(t)){var i={multiple:!0,folders:!1,service:"COMPUTER"},o={location:"S3",container:e.bucket};filepicker.pickAndStore(i,o,function(t){for(var i=new Array,o=0;o()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(i[o]))return!1}return!0},onUploadComplete:function(t){$("#UploadPanel").hide(),$("#WaitPanel").show(),$("#ConfirmPanel").hide(),$(".uploadResult").hide();var i=e.jsonForm();i.fileList=t,$.ajax(e.serviceUrl+e.routes.complete,{type:"POST",dataType:"json",data:i}).done(function(e){e&&200==e.opStatus?($("#UploadPanel").hide(),$("#WaitPanel").hide(),$("#ConfirmPanel").show()):($("#UploadPanel").show(),$("#WaitPanel").hide(),$("#ConfirmPanel").hide(),$(".uploadResult").show())}).fail(function(e,t){$("#UploadPanel").show(),$("#WaitPanel").hide(),$("#ConfirmPanel").hide(),$(".uploadResult").show()}).always(function(){})}};oneil.BigDownload=e,$(document).ready(function(){e.init()})}(),this.oneil=this.oneil||{},function(){var e={init:function(){this.serviceUrl=this.serviceUrl||"",this.salesRepUrl=this.salesRepUrl||"",this.routes={complete:"/picker/complete"},filepicker.setKey("Am2o1bkgzSAmThV3fSfi2z"),$(".uploadButton").on("click",function(){e.pickFiles()}),$(".moreButton").on("click",function(){$("#UploadPanel").show(),$("#WaitPanel").hide(),$("#ConfirmPanel").hide(),$(".uploadResult").hide()}),e.populateSalesReps()},populateSalesReps:function(){$.support.cors=!0,$.ajax({url:e.salesRepUrl,type:"GET",dataType:"json",crossDomain:!0}).done(function(e,t,i){if(e&&e.list)for(var o=$("#SalesRepList"),n=e.list,s=0;s");o.append(a);for(var l=r.contacts,d=0;d"+c.external+""))}}}).fail(function(e,t,i){}).always(function(e,t,i){})},pickFiles:function(){var t=e.jsonForm();if(e.validateForm(t)){var i={multiple:!0,folders:!1,service:"COMPUTER"},o={location:"S3",container:e.bucket};filepicker.pickAndStore(i,o,function(t){for(var i=new Array,o=0;o()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)},onUploadComplete:function(t){$("#UploadPanel").hide(),$("#WaitPanel").show(),$("#ConfirmPanel").hide(),$(".uploadResult").hide();var i=e.jsonForm();i.fileList=t,$.ajax(e.serviceUrl+e.routes.complete,{type:"POST",dataType:"json",data:i}).done(function(e){e&&200==e.opStatus?($("#UploadPanel").hide(),$("#WaitPanel").hide(),$("#ConfirmPanel").show()):($("#UploadPanel").show(),$("#WaitPanel").hide(),$("#ConfirmPanel").hide(),$(".uploadResult").show())}).fail(function(e,t){$("#UploadPanel").show(),$("#WaitPanel").hide(),$("#ConfirmPanel").hide(),$(".uploadResult").show()}).always(function(){})}};oneil.BigUpload=e,$(document).ready(function(){e.init()})}(),function(e){if(!e.support.cors&&e.ajaxTransport&&window.XDomainRequest){var t=/^https?:\/\//i,i=/^get|post$/i,o=new RegExp("^"+location.protocol,"i"),n=/text\/html/i,s=/\/json/i,r=/\/xml/i;e.ajaxTransport("* text html xml json",function(a,l,d){if(a.crossDomain&&a.async&&i.test(a.type)&&t.test(a.url)&&o.test(a.url)){var c=null,p=(l.dataType||"").toLowerCase();return{send:function(t,i){c=new XDomainRequest,/^\d+$/.test(l.timeout)&&(c.timeout=l.timeout),c.ontimeout=function(){i(500,"timeout")},c.onload=function(){var t="Content-Length: "+c.responseText.length+"\r\nContent-Type: "+c.contentType,o={code:200,message:"success"},a={text:c.responseText};try{if("html"===p||n.test(c.contentType))a.html=c.responseText;else if("json"===p||"text"!==p&&s.test(c.contentType))try{a.json=e.parseJSON(c.responseText)}catch(e){o.code=500,o.message="parseerror"}else if("xml"===p||"text"!==p&&r.test(c.contentType)){var l=new ActiveXObject("Microsoft.XMLDOM");l.async=!1;try{l.loadXML(c.responseText)}catch(e){l=void 0}if(!l||!l.documentElement||l.getElementsByTagName("parsererror").length)throw o.code=500,o.message="parseerror","Invalid XML: "+c.responseText;a.xml=l}}catch(e){throw e}finally{i(o.code,o.message,a,t)}},c.onprogress=function(){},c.onerror=function(){i(500,"error",{text:c.responseText})};var o="";l.data&&(o="string"===e.type(l.data)?l.data:e.param(l.data)),c.open(a.type,a.url),c.send(o)},abort:function(){c&&c.abort()}}}})}}(jQuery);var stagingURL="http://oneilprint.flywheelsites.com";$viewport=$(window).innerWidth();var $docEl=$("html, body"),$wrap=$("main"),scrollTop;$.lockBody=function(){window.pageYOffset&&(scrollTop=window.pageYOffset,$wrap.css({top:-scrollTop})),$docEl.css({height:"100%",overflow:"hidden"})},$.unlockBody=function(){$docEl.css({height:"",overflow:""}),$wrap.css({top:""}),window.scrollTo(0,scrollTop),window.setTimeout(function(){scrollTop=null},0)};var desktopNavigation=function(e){e>860&&($(".menu > li > a").on("click",function(e){var t=$(this),i=t.parent().find("> .sub-menu");t.parent().hasClass("menu-item-has-children")&&(e.preventDefault(),t.hasClass("parent-active")?(console.log("Active parent"),i.slideUp(300),t.removeClass("parent-active")):$(".menu li .parent-active")?($(".parent-active").parent().find("> .sub-menu").slideUp(300),$(".parent-active").removeClass("parent-active"),i.slideToggle(300),t.toggleClass("parent-active")):(t.toggleClass("parent-active"),i.slideToggle(300)))}),$(".menu > li > .sub-menu > li.menu-item-has-children > a").on("click",function(e){e.preventDefault(),$_this=$(this),$_this.toggleClass("parent-active"),$_this.parent().find(".sub-menu").slideToggle(300)}),$(document).click(function(e){$(e.target).closest(".menu-item-has-children").length||($(".parent-active").removeClass("parent-active"),$(".sub-menu").slideUp(300).removeClass("dropdown-open"))}))},staffgrid=function(){$.ajax({dataType:"json",url:stagingURL+"/wp-json/wp/v2/f1_staffgrid_cpt?_embed&filter[orderby]=menu_order&order=asc",success:function(e){var t=[];$(".staff-loader").remove(),$.each(e,function(i,o){var n=e[i],s=n.id,r=n.title.rendered,a=n.acf.title,l=n.acf.staff_bio;n._embedded["wp:featuredmedia"]&&n._embedded["wp:featuredmedia"][0].media_details.sizes["profile-image"]?featured_img=n._embedded["wp:featuredmedia"][0].media_details.sizes["profile-image"].source_url:n._embedded["wp:featuredmedia"]?featured_img=n._embedded["wp:featuredmedia"][0].media_details.sizes.full.source_url:featured_img="",t.push({id:s,image:featured_img}),"Anthony Narducci"===r&&($("#staff-name").html(r),$("#staff-image-featured").attr("style","background: url("+featured_img+") center center no-repeat;"),$("#staff-title").html(a),$("#staff-bio").html(l)),$("#staff-block-grid").append('
'),$("#"+s).on("click",function(){$("html, body").animate({scrollTop:$(".staff-grid").offset().top-100},500),window.innerWidth>767?($("#staff-name").html(r),$("#staff-image-featured").attr("style","background: url("+t[i].image+") center center no-repeat;"),$("#staff-title").html(a),$("#staff-bio").html(l)):($("body").addClass("modal-open"),$.lockBody(),$("#staff-modal").append('

'+r+'

'+a+'
'+l+"
"),$(".close-modal").on("click",function(){$("body").removeClass("modal-open"),$.unlockBody(),$("#staff-modal").empty()}))})})}})},workSamples=function(){$("body").hasClass("page-id-6")?work_ID="6":$("body").hasClass("page-id-430")&&(work_ID="430"),$.ajax({dataType:"json",url:stagingURL+"/wp-json/wp/v2/pages/"+work_ID,success:function(e){$(".staff-loader").remove();var t=e.acf.work_samples_slider;$.each(t,function(e,i){var o=t[e].image.sizes.large,n=t[e].image.sizes.thumbnail,s=t[e].url;""===s&&(s="#work-samples-slider"),$("#work-samples-slider").append('
'),$("#work-samples-nav").append('
')}),$("#work-samples-slider").slick({slidesToShow:1,slidesToScroll:1,arrows:!0,fade:!1,asNavFor:"#work-samples-nav",adaptiveHeight:!1}),$("#work-samples-nav").slick({slidesToShow:5,slidesToScroll:1,asNavFor:"#work-samples-slider",dots:!1,centerMode:!1,focusOnSelect:!0,arrows:!1})}})},getPosts=function(e){$.ajax({dataType:"json",url:stagingURL+"/wp-json/wp/v2/posts/?_embed&page="+e+"&per_page=15",success:function(t){if(t.length<1)$("#load-more").remove();else{$.each(t,function(e,i){var o=t[e],n=o.title.rendered,s=o.excerpt.rendered,r=o.link,a=o._embedded["wp:term"][0][0].slug,l='";0!==o.featured_media?o._embedded["wp:featuredmedia"][0].code?($(".news-posts .posts-container").append(l),console.log("[Rest API]: Thumbnail for post "+o.id+" belongs to custom post type and cannot be accessed from standard posts.")):(thumbnail=o._embedded["wp:featuredmedia"][0].media_details.sizes["profile-image"].source_url,l='",$(".news-posts .posts-container").append(l)):$(".news-posts .posts-container").append(l)});var i=e+1;0===$("#load-more").length?$(".news-posts .load-more-container").append('View More'):$("#load-more").attr("onclick","getPosts("+i+")")}$(".staff-loader").remove(),$("#load-more").on("click",function(e){e.preventDefault()}),Macy.recalculate()}})},getCategories=function(){$.ajax({dataType:"json",url:stagingURL+"/wp-json/wp/v2/categories",success:function(e){$.each(e,function(t,i){var o=e[t].id,n=e[t].name;"Uncategorized"!==n&&($("#post-categories").append('
  • '+n+"
  • "),$("#cat-"+o).on("click",function(e){e.preventDefault(),$.ajax({dataType:"json",url:stagingURL+"/wp-json/wp/v2/posts?_embed&categories="+o,success:function(e){$(".news-posts .posts-container").empty(),$("#load-more").remove(),$.each(e,function(t,i){var o=e[t],n=o.title.rendered,s=o.excerpt.rendered,r=o.link,a=o._embedded["wp:term"][0][0].slug,l='";0!==o.featured_media?o._embedded["wp:featuredmedia"][0].code?($(".news-posts .posts-container").append(l),console.log("[Rest API]: Thumbnail for post "+o.id+" belongs to custom post type and cannot be accessed from standard posts.")):(thumbnail=o._embedded["wp:featuredmedia"][0].media_details.sizes["profile-image"].source_url,l='",$(".news-posts .posts-container").append(l)):$(".news-posts .posts-container").append(l)}),Macy.recalculate()}})}))}),$("#post-categories").append('
  • Clear Filters
  • '),$("#reset-posts").on("click",function(e){e.preventDefault()})}})},clearPosts=function(){$(".news-posts .posts-container").empty(),$(".news-posts .posts-container").append('
    Loading...
    '),getPosts(1)},getIndexACF=function(){$.ajax({dataType:"json",url:stagingURL+"/wp-json/wp/v2/pages/38",success:function(e){var t=e.acf.intro_content_headline,i=e.acf.intro_content;$(".part--intro-content .row .col-10 > h1").empty().html(t),$(".part--intro-content .row .col-10").append(i)}})},getGallerySlider=function(){$.ajax({dataType:"json",url:stagingURL+"/wp-json/wp/v2/pages/229",success:function(e){$(".staff-loader").remove();var t=e.acf.gallery_items;$.each(t,function(e,i){var o=t[e].title,n=t[e].content,s="slide-"+e,r=t[e].image;$("#gallery-top-slider").append(''),$("#gallery-navigation").append(''),!1!==t[e].icons&&$.each(t[e].icons,function(i,o){$("#"+s).find(".slide-icon-container").append('')})}),$("#gallery-top-slider").slick({dots:!1,asNavFor:"#gallery-navigation",arrows:!0,infinite:!0,slidesToShow:1,slidesToScroll:1,autoplay:!1,pauseOnHover:!1}),$("#gallery-navigation").slick({arrows:!0,asNavFor:"#gallery-top-slider",slidesToShow:4,autoplay:!1,focusOnSelect:!0,responsive:[{breakpoint:860,settings:{slidesToShow:4,slidesToScroll:2,infinite:!0,dots:!0,arrows:!1}},{breakpoint:767,settings:{slidesToShow:2,slidesToScroll:2,infinite:!0,dots:!0,arrows:!1}}]})}})};jQuery(document).ready(function(e){var t=Math.floor(bowser.version);(browser=bowser.name+"_"+t,e("body").addClass(browser),bowser.ios&&e("body").addClass("ios"),"ontouchstart"in document.documentElement&&e("body").removeClass("no-touch"),e("body").hasClass("page-template-our-people")&&staffgrid(),e("body").hasClass("page-template-our-work")&&workSamples(),e("body").hasClass("page-template-gallery")&&getGallerySlider(),niftyNav({subMenus:!0,panelPosition:"fixed"}),e("#nifty-nav-toggle").on("click",function(){e("body").toggleClass("nifty-locked")}),desktopNavigation($viewport),e(".search-icon, #close-search, .search-icon-global").on("click",function(t){t.preventDefault(),e("#search-container").slideToggle(300)}),e(".testimonials--slider").slick({dots:!0,arrows:!0,infinite:!0,slidesToShow:1,slidesToScroll:1,autoplay:!1}),e(".partners-slider").slick({dots:!1,arrows:!0,infinite:!0,slidesToShow:4,slidesToScroll:4,autoplay:!0,responsive:[{breakpoint:860,settings:{slidesToShow:2,slidesToScroll:2,infinite:!0,dots:!1,arrows:!1}}]}),e("#featured-case-study-slider, .our-work--slider, #default-page-slider").slick({dots:!1,arrows:!0,infinite:!0,slidesToShow:1,slidesToScroll:1,autoplay:!0,autoplaySpeed:4e3}),$viewport>860&&e("body").hasClass("home"))&&new Waypoint({element:document.getElementById("home-hero"),handler:function(t){"down"===t?(e("#home-navigation--top, #home-navigation--bottom").fadeOut(200),e("header").animate({height:"100px"},200,function(){e("#global-nav").fadeIn(200)})):"up"===t&&(e("#global-nav").fadeOut(200),e("#home-navigation--top, #home-navigation--bottom").fadeIn(200),e("header").animate({height:"198px"},200))}});config={ui:{flyout:"middle left"}},new ShareButton(config),e("body").hasClass("blog")&&(getIndexACF(),getPosts(1),getCategories(),e(".dropdown").on("click",function(){e(this).toggleClass("active"),e("#post-categories").slideToggle()}),e(document).click(function(t){e(t.target).closest(".dropdown").length||(e(".dropdown").removeClass("active"),e("#post-categories").slideUp())}),Macy.init({container:"#masonry",trueOrder:!1,margin:20,columns:3,breakAt:{890:2,618:1}}))});var niftyNav=function(e){$nifty_toggle=$("#nifty-nav-toggle"),$nifty_panel=$(".nifty-panel"),$nifty_nav_item=$(".nifty-nav-item"),$nifty_parent=$(".nifty-panel ul li");var t=$.extend({subMenus:!1,mask:!0,itemClickClose:!0,panelPosition:"absolute",subMenuParentLink:!1},e);if(subMenus=t.subMenus,mask=t.mask,itemClickClose=t.itemClickClose,panelPosition=t.panelPosition,subMenuParentLink=t.subMenuParentLink,niftyRemove=function(){$(".nifty-mask").remove()},niftyUnmask=function(){$(".nifty-mask").animate({opacity:0}),setTimeout(niftyRemove,800)},$nifty_toggle.click(function(){$(this).toggleClass("nifty-active"),$nifty_panel.slideToggle(500).css("position",panelPosition),"fixed"==panelPosition&&$("body").toggleClass("nifty-lock"),!0===mask&&($(".nifty-mask").length>0?niftyUnmask():($("body").append('
    '),$(".nifty-mask").animate({opacity:1}),$(".nifty-mask").click(function(){$nifty_panel.slideUp(500),niftyUnmask(),$nifty_toggle.removeClass("nifty-active"),"fixed"==panelPosition&&$("body").removeClass("nifty-lock")})))}),!0===itemClickClose&&$nifty_nav_item.click(function(){$nifty_panel.slideUp(500),niftyUnmask(),$nifty_toggle.removeClass("nifty-active"),"fixed"==panelPosition&&$("body").removeClass("nifty-lock")}),!0===subMenus){var i;!1===subMenuParentLink&&$(".nifty-panel .menu-item-has-children > a").click(function(e){e.preventDefault()}),$nifty_parent.click(function(){i=$(this),i.find(".sub-menu").slideToggle(),i.find("a").toggleClass("nifty-menu-opened")})}};!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var t=window.Slick||{};t=function(){function t(t,o){var n,s=this;s.defaults={accessibility:!0,adaptiveHeight:!1,appendArrows:e(t),appendDots:e(t),arrows:!0,asNavFor:null,prevArrow:'',nextArrow:'',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(t,i){return e('',nextArrow:'',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(t,i){return e('