1(function($){ 2 $(document).ready(function(){ 3 window.refreshOverlaySlots = function() { 4 if (typeof(bidOnSlots) == "function") { 5 bidOnSlots(overlaySlots,150); 6 } else if(typeof(queueAmazonSlots) == "function") { 7 queueAmazonSlots(overlaySlots); 8 } else if(typeof(refreshSlots) == "function"){ 9 refreshSlots(overlaySlots,150); 10 } 11 12 }; 13 14 if(typeof(window.createOverlaySlots) != "function") { 15 window.createOverlaySlots = function() { 16 if(window.createOverlayPromise) {window.clearTimeout(window.createOverlayPromise);} 17 18 window.createOverlayPromise = setTimeout(function() { 19 googletag.cmd.push(function() { 20 var sections = $("#fancybox-outer .google-overlay-ad"); 21 if (sections.length > 0 ) { 22 var galleryCheck = $(".maincontent.gallery").length; 23 if(galleryCheck == 0) 24 overlaySlots = []; 25 window.block = true; 26 sections.each(function(i) { 27 var section = $(sections[i]); 28 var slotName = section.attr('id'); 29 if(slotName in slotNames) { 30 overlaySlots.push(slotNames[slotName]); 31 //if(typeof(refreshSlots) == "function") refreshSlots([slotNames[slotName]],150); 32 } else { 33 var site = section.data("site") ? section.data("site") : 'Inhabitat'+section.data('mobile'); 34 var passbackSlot = googletag.defineSlot('/2922/'+site+'/'+section.data('template')+'/'+section.data('prefix')+section.data('name')+section.data('additional'), section.data('sizes'),slotName).setConfig({targeting:{'kw':section.data('kw')}}).addService(googletag.pubads()); 35 //googletag.display(slotName); 36 headertag.display(slotName); 37 //if(typeof(refreshSlots) == "function") refreshSlots([passbackSlot],150); 38 slotNames[slotName] = passbackSlot; 39 overlaySlots.push(passbackSlot); 40 } 41 }); 42 if (typeof(bidOnSlots) == "function") { 43 bidOnSlots(overlaySlots); 44 } else if(typeof(queueAmazonSlots) == "function") { 45 queueAmazonSlots(overlaySlots); 46 } else if(typeof(refreshSlots) == "function"){ 47 refreshSlots(overlaySlots,150); 48 } 49 setTimeout(function(){window.block = false},200); 50 } 51 }); 52 }, 200); 53 }; 54 } 55 56 window.isSponsored = function(element,callback) { 57 if(element.find("section.single.post").hasClass("sponsored")) { 58 console.log("is sponsored"); 59 isSponsoredPost = true; 60 window.hideRightRail(); 61 } else { 62 console.log("is not sponsored"); 63 isSponsoredPost = false; 64 window.showRightRail(); 65 if(typeof(callback) == "function") 66 callback(); 67 } 68 }; 69 70 window.hideRightRail = function() { 71 $('.right-wrapp').hide(); 72 $(window).trigger("isSponsored",isSponsoredPost); 73 }; 74 75 window.showRightRail = function() { 76 $('.right-wrapp').show(); 77 $(window).trigger("isSponsored",isSponsoredPost); 78 }; 79 80 if($(".single.post-content")) { 81 $(".single.post-content").children().each(function(i) { 82 if($(this).hasClass("gallery_shortcode")) { 83 var _event = "Gallery Thumbnail Bottom"; 84 if( i < $(".single.post-content").children().length / 2) { 85 _event = "Gallery Thumbnail Top"; 86 } 87 88 $(this).find("ul li.ga-track-which").each(function() { 89 $(this).attr("data-event",_event); 90 }); 91 } 92 }); 93 } 94 95 if($('.maincontent.single').length > 0 && typeof(Ib_Scroll_Config) == "object" && ((Ib_Scroll_Config.isMobile == "1" && Ib_Scroll_Config.isTablet == "1") || (Ib_Scroll_Config.isMobile == "" && Ib_Scroll_Config.isTablet == ""))){ 96 var adheight = 0; 97 var _callback = function() { 98 if(adheight == 0) { 99 return; 100 } 101 var contentSlideId = "#content-slide-"+window.postId+" "; 102 if (window.resizeImageDescPromise){window.clearTimeout(window.resizeImageDescPromise);} 103 104 window.resizeImageDescPromise = setTimeout(function() { 105 var ellipsestext = "..."; 106 var imageDescriptionHeight = $(contentSlideId+ " .content p").outerHeight(); 107 if(imageDescriptionHeight > 36 && adheight>=600 ) { 108 var originaltext = $(contentSlideId+ " .content p").text(); 109 var modifiedtext = ellipsestext+" Show More " + originaltext; 110 var splitText = modifiedtext.split(" "); 111 var updatedText = ""; 112 113 while((imageDescriptionHeight > 36 && window.readmoreClicked==0) ) { 114 splitText.splice((splitText.length-1),1); 115 updatedText = splitText.join(" "); 116 $(contentSlideId+ " .content p").empty(); 117 $(contentSlideId+ " .content p").html(updatedText); 118 imageDescriptionHeight = $(contentSlideId+ " .content p").height(); 119 } 120 121 var finalTextArr = updatedText.split(" "); 122 finalTextArr.splice(0,3); 123 var finalText = finalTextArr.join(" "); 124 var subContent = finalText + '<span class="moreelipses">'+ellipsestext+' <a href="javascript:void(0)" class="overlay-morelink" style="color: DimGray; font-weight: bold;">Show More</a></span>'; 125 $(contentSlideId+ " .content p").empty(); 126 $(contentSlideId+ " .content p").html(subContent); 127 $('.overlay-morelink').unbind('click'); 128 $('.overlay-morelink').click(function(){ 129 window.readmoreClicked = 1; 130 var content = window.GalleryData[window.galleryPostId][window.curSLide]['post_content']; 131 $(contentSlideId+ " .content p").html(content); 132 return false;
133 }); 134 } 135 },50); 136 }; 137 138 googletag.cmd.push(function(){ 139 googletag.pubads().addEventListener('slotRenderEnded', function(event) { 140 if(event.slot.getAdUnitPath() == "/2922/Inhabitat/gallery/300x250_top") { 141 var dom = document.getElementById('google_ads_iframe_/2922/Inhabitat/gallery/300x250_top_0__container__'); 142 if(dom) { 143 adheight = dom.clientHeight; 144 } 145 146 _callback(); 147 } 148 }); 149 }); 150 151 152 var post_height = $(".left").outerHeight(); 153 setTimeout(function(){ 154 let top_ad_height = $(".right").outerHeight(); 155 let sidebar_ad_height = post_height / 2; 156 let news_height = $('.newsletter-sidebar-wrapper').outerHeight() + 30; 157 158 if (top_ad_height >= 600){ 159 sidebar_ad_height = post_height >= 1200 ? (post_height)/2 : 600; 160 } else { 161 sidebar_ad_height = post_height >= 500 ? (post_height)/2 : 250; 162 } 163 164 $(".right").css({ 165 "height": sidebar_ad_height 166 }); 167 168 }, 2000); 169 170 $(window).on('resize', function(){ 171 var dom = document.getElementById('google_ads_iframe_/2922/Inhabitat/gallery/300x250_top_0__container__'); 172 if(dom) { 173 adheight = dom.clientHeight; 174 } 175 _callback(); 176 }); 177 178 $(document).on('rebuildExceprt',function(event) { 179 var dom = document.getElementById('google_ads_iframe_/2922/Inhabitat/gallery/300x250_top_0__container__'); 180 if(dom) { 181 adheight = dom.clientHeight; 182 } 183 _callback(); 184 }) 185 } 186 187 if($('.right').length > 0 && $(".maincontent.single").length > 0) { 188 var stickySidebarAction = function () { 189 var offset = 0; 190 var adjustment = 0, sidebarOffsetTop = 90; 191 if($("#wpadminbar").length > 0) { 192 adjustment += $("#wpadminbar").height(); 193 } 194 if($("#header").length > 0) { 195 adjustment += $("#header").height(); 196 } 197 if($(".wrapper > .container > .google-ad").length > 0 && $(".wrapper > .container > .google-ad").height() > 10 ) { 198 offset = sidebarOffsetTop + 2; 199 } else { 200 offset = sidebarOffsetTop; 201 } 202 var transition = null; 203 try { 204 transition = eval($(".right-inner").css("transform")); 205 } catch(e) { 206 transition = null; 207 } 208 if($(window).scrollTop() > 0 && $(window).scrollTop() > $('.left').first().offset().top - offset && !$('.right').hasClass('scrolled')) { 209 //if($(window).scrollTop() > 0 && $(window).scrollTop() > $('.left').first().offset().top) { 210 $('.right-inner').css( 'max-height', ( $(window).height() - $("#header").height()) + 5) ; 211 $('.right-inner').addClass('scrolled'); 212 $('.right-inner.scrolled').css('top', 70+$('#wpadminbar').outerHeight()); 213 //$('.right-inner').css('padding-top',20); 214 //$('.right-inner').css('margin-top',adjustment); 215 216 var heightout = window.innerHeight-$('#header').height()-$('.right-inner').height()-48; 217 if ($('#wpadminbar').length){ 218 heightout -= $('#wpadminbar').height(); 219 } 220 $('.sidebar-list').height(heightout-46); 221 222 223 } else if($(window).scrollTop() == 0 || $(window).scrollTop() <= $('.left').first().offset().top - offset) { 224 $('.right-inner').css( 'max-height', '') ; 225 $('.right-inner').removeClass('scrolled'); 226 //$('.right-inner').css('padding-top',''); 227 //$('.right-inner').css('margin-top',''); 228 229 $('.right .right-inner').css('transform',''); 230 } else if(transition && previousScroll && previousScroll > $(window).scrollTop() && ($(window).scrollTop() < parseInt(-transition.n[5]) || $(window).scrollTop() - $('.left').first().offset().top + 50 < parseInt(-transition.n[5]))) { 231 if($(window).scrollTop() < parseInt(-transition.n[5])) { 232 transition.n[5] = -$(window).scrollTop(); 233 } else { 234 transition.n[5] = -($(window).scrollTop() - $('.left').first().offset().top + 50); 235 } 236 $('.right .right-inner').css('transform',transition.toString()); 237 } 238 239 var headerHeights = $('#wpadminbar').outerHeight()+$("#header").height()+2; 240 var buffer = $('.newsletter-sidebar-wrapper').length ? $('.newsletter-sidebar-wrapper').outerHeight() : -46; 241 242 //if($(window).scrollTop() > 0 && $(window).scrollTop() > ($(".left").height()/2)+$("#single_fullwidth_lead_2").height()-headerHeights && !$('.sticky-wrapper').hasClass('is-sticky')){ 243 if($(window).scrollTop() > 0 && $(window).scrollTop() > (post_height/2)+$("#single_fullwidth_lead_2").height()+buffer && !$('.sticky-wrapper').hasClass('is-sticky')){ 244 $('.sticky-wrapper').addClass('is-sticky') 245 $("#sticky").css("position", 'fixed'); 246 $("#sticky").css("top", '70px'); 247 if ($('#wpadminbar').length){ 248 let adTopHeight = 70+$('#wpadminbar').outerHeight(); 249 $("#sticky").css("top", adTopHeight+"px" ); 250 } else { 251 $("#sticky").css("top", '70px'); 252 } 253 254 //} else if($(window).scrollTop() == 0 || $(window).scrollTop() <= ($(".left").height()/2)+$("#single_fullwidth_lead_2").height()-headerHeights ) { 255 } else if($(window).scrollTop() == 0 || $(window).scrollTop() <= (post_height/2)+$("#single_fullwidth_lead_2").height()+buffer ) { 256 $('.sticky-wrapper').removeClass('is-sticky') 257 $("#sticky").css("position", ''); 258 $("#sticky").css("top", ''); 259 } 260 261 window.previousScroll = $(window).scrollTop(); 262 263 } 264 265 stickySidebarAction(); 266 $(window).on('scroll',function() { 267 stickySidebarAction(); 268 }); 269 } 270 271 $(".gallery-page-opener").bind("click", function () { 272 window.scrollIndex = $(this).data("idx"); 273 window.scrollPostID = $(this).data("postid"); 274 document.cookie2 = window.scrollIndex; 275 }) 276 }); 277 278 function iframeResizing() { 279 $(".single.post-content iframe").each(function() { 280 if($(this).parent().parent().hasClass("google-ad") || $(this).hasClass('instagram-media') || $(this).parents(".vdb_player ") ) { 281 return; 282 } 283 284 var width = $(this).parent().width(); 285 var height = (4/6) * width; 286 $(this).attr('width',width); 287 $(this).attr('height',height); 288 }); 289 } 290 291 iframeResizing(); 292 $(".single.post-content iframe").load(function() { 293 iframeResizing(); 294 });
295 $(window).on("infiniteScroll:newPage",function() { 296 iframeResizing(); 297 }); 298 $(window).resize(function() { 299 iframeResizing(); 300 301 var $SlideSet = $('.lightbox .gallery-extend .slideset'); 302 var $Slide = $('.lightbox .gallery-extend .slideset .slide:first-child'); 303 var $Thumbnail = $('.lightbox .gallery-extend .thumbnails .thumbnail:first-child'); 304 305 $SlideSet.find('img').each(function(idx, img){ 306 var view = { 307 h:$SlideSet.height(), 308 w:$SlideSet.width() 309 }; 310 var $img = $(img); 311 $img.css('top', (($Slide.outerHeight(true)-$img.height())/2)+'px' ); 312 313 //console.log('IMG: ', ($img.width() + 160 + view.w *0.1), 'VIEW: ',view.w); 314 if (($img.width() + 160 + view.w *0.1) <= view.w){ 315 $img.css('left', '160px' ); 316 } else { 317 $img.css('left', (($Slide.outerWidth(true)-$img.width())/2)+'px' ); 318 } 319 320 }); 321 322 if(typeof(startStopSliders) == "function") { 323 startStopSliders(); 324 } 325 }); 326})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.