1( function( $, wpzoomRecipeCard ) { 2 'use scrict'; 3 4 function wpzoom_set_correct_ids_to_recipe_shortcode() { 5 $('.wpzoom-rcb-post-shortcode, .wpzoom-custom-recipe-card-post').each(function( index ) { 6 var parent_id = $(this).data('parent-id'); 7 8 $(this).find('.btn-print-link').attr( 'data-recipe-id', parent_id ); 9 $(this).find('.wpzoom-rating-stars-container').attr( 'data-recipe-id', parent_id ); 10 11 $('.wp-block-wpzoom-recipe-card-block-print-recipe').attr( 'data-recipe-id', parent_id ); 12 13 }); 14 } 15 16 function wpzoom_set_servings_size_to_print_button() { 17 const servings_size = $(document) 18 .find(".wpzoom-recipe-card-print-link .btn-print-link") 19 .data("servings-size"); 20 21 if (servings_size) { 22 $(document) 23 .find(".wp-block-wpzoom-recipe-card-block-print-recipe") 24 .data("servings-size", servings_size); 25 } 26 } 27 28 function wpzoom_convert_ingredient_fraction() { 29 30 $('.wpzoom-rcb-ingredient-amount').each(function() { 31 32 var amountValue = $( this ).text(); 33 34 if ( -1 !== amountValue.indexOf( '/' ) ) { 35 36 $( this ).attr( 'data-fraction', true ); 37 $( this ).attr( 'data-fraction-value', amountValue ); 38 39 //replace to show it properly 40 amountValue = amountValue.replace( '/', '⁄' ); 41 $( this ).html( amountValue ); 42 43 } 44 45 }); 46 } 47 48 function wpzoom_print_recipe(atts) { 49 const defaults = { 50 servings: 0, 51 "reusable-block-id": 0, 52 "recipe-id": 0, 53 "block-type": "recipe-card", 54 "block-id": "wpzoom-recipe-card", 55 }; 56 57 atts = { 58 ...defaults, 59 ...atts, 60 }; 61 62 const urlParts = wpzoomRecipeCard.homeURL.split(/\?(.+)/); 63 let printUrl = wpzoom_print_add_url_args(atts, urlParts[0], urlParts); 64 const print_window = window.open(printUrl, "_blank"); 65 print_window.wpzoomRecipeCard = wpzoomRecipeCard; 66 print_window.onload = function() { 67 print_window.showPrintAltUnit( atts.recipe_altunit ); 68 print_window.focus(); 69 print_window.document.title = document.title; 70 print_window.history.pushState( '', 'Print Recipe', location.href.replace( location.hash, '' ) ); 71 print_window.setPrintServings( atts.servings ); 72 print_window.rebuildPrintMasonry( print_window ); 73 }; 74 } 75 76 function wpzoom_print_add_url_args(atts, url, urlParts) { 77 if (!atts["recipe-id"]) { 78 return url; 79 } 80 if (wpzoomRecipeCard.permalinks) { 81 url += `wpzoom_rcb_print/${atts["recipe-id"]}/`; 82 83 if (urlParts[1]) { 84 url += `?${urlParts[1]}`; 85 for (const property in atts) { 86 url += `&${property}=${atts[property]}`; 87 } 88 } else { 89 for (const property in atts) { 90 if (!url.match(/\?./)) { 91 url += `?${property}=${atts[property]}`; 92 } else { 93 url += `&${property}=${atts[property]}`; 94 } 95 } 96 } 97 } else { 98 url += `?wpzoom_rcb_print=${atts["recipe-id"]}`; 99 for (const property in atts) { 100 if (!url.match(/\?./)) { 101 url += `?${property}=${atts[property]}`; 102 } else { 103 url += `&${property}=${atts[property]}`; 104 } 105 } 106 if (urlParts[1]) { 107 url += `&${urlParts[1]}`; 108 } 109 } 110 111 return url; 112 } 113 114 $( function() { 115 wpzoom_set_servings_size_to_print_button(); 116 117 $( '.wp-block-wpzoom-recipe-card-block-ingredients .ingredients-list li, .
117wp-block-wpzoom-recipe-card-block-recipe-card .ingredients-list li' ).on( 'click', function( e ) { 118 // Don't do any actions if clicked on link 119 if ( e.target.nodeName === 'A' ) { 120 return; 121 } 122 $( this ).toggleClass( 'ticked' ); 123 } ); 124 125 let instances = 0; 126 127 $( '.wp-block-wpzoom-recipe-card-block-ingredients .ingredients-list li, .wp-block-wpzoom-recipe-card-block-recipe-card .ingredients-list li' ).on( 'mouseover', function( e ) { 128 const $ingredientName = $( this ).find( '.ingredient-item-name' ); 129 const hasStrikeThrough = $ingredientName.hasClass( 'is-strikethrough-active' ); 130 131 // Check if strikethrough is disabled 132 if ( instances === 0 && ! hasStrikeThrough ) { 133 instances = 0; 134 return; 135 } 136 137 // Remove strike through if hover on link 138 if ( e.target.nodeName === 'A' ) { 139 $ingredientName.removeClass( 'is-strikethrough-active' ); 140 } else { 141 if ( ! hasStrikeThrough ) { 142 $ingredientName.addClass( 'is-strikethrough-active' ); 143 } 144 } 145 146 instances++; 147 } ); 148 149 $( 150 ".wpzoom-recipe-card-print-link .btn-print-link, .wp-block-wpzoom-recipe-card-block-print-recipe" 151 ).each(function () { 152 const $printBtn = $(this); 153 154 $printBtn.on("click", function (e) { 155 const $this = $(this); 156 const recipeID = $this.data("recipe-id"); 157 const servings = $this.data("servings-size"); 158 const reusableBlockID = $this.data("reusable-block-id"); 159 160 const isRecipeCardBlock = $this.parents( 161 ".wp-block-wpzoom-recipe-card-block-recipe-card" 162 ).length; 163 const isIngredientsBlock = $this.parents( 164 ".wp-block-wpzoom-recipe-card-block-ingredients" 165 ).length; 166 const isDirectionsBlock = $this.parents( 167 ".wp-block-wpzoom-recipe-card-block-directions" 168 ).length; 169 const isSnippetButton = $this.hasClass( 170 "wp-block-wpzoom-recipe-card-block-print-recipe" 171 ); 172 173 let blockType; 174 let blockId; 175 176 if (isRecipeCardBlock) { 177 blockType = "recipe-card"; 178 blockId = $this 179 .parents( 180 ".wp-block-wpzoom-recipe-card-block-recipe-card" 181 ) 182 .attr("id"); 183 } else if (isIngredientsBlock) { 184 blockType = "ingredients-block"; 185 blockId = $this 186 .parents( 187 ".wp-block-wpzoom-recipe-card-block-ingredients" 188 ) 189 .attr("id"); 190 } else if (isDirectionsBlock) { 191 blockType = "directions-block"; 192 blockId = $this 193 .parents( 194 ".wp-block-wpzoom-recipe-card-block-directions" 195 ) 196 .attr("id"); 197 } else if (isSnippetButton) { 198 blockType = "recipe-card"; 199 blockId = $this 200 .attr("href") 201 .substr(1, $this.attr("href").length); 202 } 203 204 // Print attributes. 205 const atts = {}; 206 if (recipeID) { 207 atts["recipe-id"] = recipeID; 208 } 209 if (reusableBlockID) { 210 atts["reusable-block-id"] = reusableBlockID; 211 } 212 if (servings) { 213 atts["servings"] = servings; 214 } 215 if (blockType) { 216 atts["block-type"] = blockType; 217 } 218 if (blockId) { 219 atts["block-id"] = blockId; 220 } 221 if( $( '#toggle-off' ).is( ':checked' ) ) { 222 atts["recipe_altunit"] = true; 223 } 224 if (recipeID) { 225 e.preventDefault(); 226 wpzoom_print_recipe(atts); 227 } 228 }); 229 }); 230 231 //NoSleep.js 232 if ( typeof NoSleep === "function") { 233 var noSleep = new NoSleep(); 234 var toggleEl = $("#toggle_button"); 235 var wakeLockEnabled = false; 236 237 toggleEl.on( 'click', function() { 238 if ( ! wakeLockEnabled && toggleEl.is(":checked") ) { 239 noSleep.enable(); // keep the screen on! 240 wakeLockEnabled = true; 241 } else { 242 noSleep.disable(); // let the screen turn off. 243 wakeLockEnabled = false; 244 } 245 }); 246 247 if( '1' == wpzoomRecipeCard.defaultCookMode ) { 248 $('#toggle_button').trigger('click'); 249 } 250 251 252 } 253 254 $( '.recipe-card-image-popup-link' ).magnificPopup( { 255 type: 'image', 256 closeBtnInside: true, 257 } ); 258 259 $( '.directions-list' ).magnificPopup( { 260 delegate: '.direction-step .direction-step-image-popup-link', 261 type: 'image', 262 closeBtnInside: true, 263 gallery: { 264 enabled: true, 265 }, 266 } ); 267 268 wpzoom_set_correct_ids_to_recipe_shortcode(); 269 wpzoom_convert_ingredient_fraction(); 270 271 $('#toggle-on').prop( 'checked', true ); 272 $('#toggle-off').prop( 'checked', false ); 273 274 $('#toggle-on').on( 'change', function() { 275 if( this.checked ) { 276 altUnit = $(this).val(); 277 $('.wpzoom-rcb-ingredient').toggle(); 278 $('.wpzoom-rcb-alt-ingredient').toggle(); 279 280 $('.btn-print-link').attr( 'data-recipe-altunit', altUnit ); 281 $('.wp-block-wpzoom-recipe-card-block-print-recipe').attr( 'data-recipe-altunit', altUnit ); 282 } 283 }); 284 $('#toggle-off').on( 'change', function() { 285 if( this.checked ) { 286 altUnit = $(this).val(); 287 $('.wpzoom-rcb-ingredient').toggle(); 288 $('.wpzoom-rcb-alt-ingredient').toggle(); 289 290 $('.btn-print-link').attr( 'data-recipe-altunit', altUnit ); 291 $('.wp-block-wpzoom-recipe-card-block-print-recipe').attr( 'data-recipe-altunit', altUnit ); 292 } 293 }); 294 295 $elementToMove = $('[data-js-move=true]:first-child'); 296 $elementTarget = $elementToMove.data('js-selector'); 297 $( $elementToMove ).appendTo( $elementTarget ); 298 299 //Recipe Index Block load more functionality 300 $( '.wpzoom-recipe-index-load-more' ).on( 'click', function( e ) { 301 302 e.preventDefault(); 303 304 let button = $(this), 305 recipesContainer = button.parent(), 306 recipeList = recipesContainer.find( '.wpzoom-rcb-index-list' ), 307 recipes = recipeList.children(), 308 query = recipesContainer.data( 'query' ), 309 attributes = recipesContainer.data( 'attributes' ), 310 page = button.data( 'current-page' ) + 1, 311 max_pages = button.data( 'max-pages' ), 312 btnLabel = button.html(); 313 314 const data = { 315 'action' : 'wpzoom_ajax_load_more_recipes_index', 316 'query': JSON.stringify( query ), 317 'attributes': JSON.stringify( attributes ), 318 'page' : page 319 }; 320 321 $.ajax( {
322 url : wpzoomRecipeCard.ajax_url, // AJAX handler 323 data : data, 324 type : 'POST', 325 beforeSend : function ( xhr ) { 326 button.text( 'Loading...' ); 327 }, 328 success : function( data ){ 329 if( data ) { 330 331 var newItems = $(data).find('li.wpzoom-rcb-index-item'); 332 recipeList.append(newItems); 333 334 if ( page == max_pages ) { 335 button.hide() // if last page, remove the button 336 } 337 338 button.text( btnLabel ); 339 button.data( 'current-page', page++ ); 340 341 } else { 342 button.hide() // if no data, remove the button as well 343 } 344 } 345 } ); 346 347 } ); 348 349 $('.wpzoom-recipe-index-filter-clear').on('click', function(e) { 350 e.preventDefault(); 351 352 let permalink = wpzoomRecipeCard.permalink; 353 354 $(this).parent().find('select').each(function() { 355 var selectElement = $(this); 356 if (!selectElement.find('option[value="all"]').length) { 357 // If 'all' option is not present, set the first option as selected 358 var firstOption = selectElement.find('option').first(); 359 if (firstOption.length) { 360 firstOption.prop('selected', true); 361 selectElement.trigger('change'); 362 } 363 } else { 364 // If 'all' option is present, select it 365 selectElement.val('all'); 366 selectElement.trigger('change'); 367 } 368 }); 369 370 window.history.pushState( {}, '', permalink ); 371 }); 372 373 //Recipe Index Block select term functionality 374 $('select[data-term="cuisine"], select[data-term="course"], select[data-term="difficulty"]' ).on( 'change', function() { 375 376 let $this = $( this ), 377 filterContainer = $this.parent(), 378 recipesContainer = filterContainer.parent(), 379 recipeList = recipesContainer.find( '.wpzoom-rcb-index-list' ), 380 query = recipesContainer.data( 'query' ), 381 attributes = recipesContainer.data( 'attributes' ), 382 amount = recipesContainer.data( 'recipe-amount' ), 383 selectCuisine = filterContainer.find( '[data-term="cuisine"]' ), 384 selectCourse = filterContainer.find( '[data-term="course"]' ), 385 selectDifficulty = filterContainer.find( '[data-term="difficulty"]' ), 386 cuisineValue = selectCuisine.val(), 387 courseValue = selectCourse.val(), 388 difficultyValue = selectDifficulty.val(), 389 permalink = wpzoomRecipeCard.permalink, 390 loadMore = recipesContainer.find( '.wpzoom-recipe-index-load-more' ); 391 392 // Update URL parameters based on selected values 393 var queryParams = []; 394 if ( cuisineValue !== 'all' && cuisineValue !== undefined ) queryParams.push( 'recipe_cuisine=' + cuisineValue ); 395 if ( courseValue !== 'all' && courseValue !== undefined ) queryParams.push( 'recipe_course=' + courseValue ); 396 if ( difficultyValue !== 'all' && difficultyValue !== undefined ) queryParams.push( 'recipe_difficulty=' + difficultyValue ); 397 398 var newUrl = permalink + ( queryParams.length > 0 ? '?' + queryParams.join('&') : '' ); 399 window.history.pushState( {}, '', newUrl ); 400 401 $.post( 402 wpzoomRecipeCard.ajax_url, 403 { 404 action: 'wpzoom_get_recipes_by_selected_term', 405 cuisine_term: cuisineValue, 406 course_term: courseValue, 407 difficulty_term: difficultyValue, 408 baseURL: permalink, 409 query: JSON.stringify( query ), 410 attributes: JSON.stringify( attributes ), 411 412 }, 413 function( response, status, code ) { 414 if ( status == 'success' ) { 415 416 loadMore.data( 'max-pages', response.data.max_num_pages ); 417 loadMore.data( 'current-page', 1 ); 418 419 var $items = response.data.recipes; 420 recipeList.html( $items ); 421 422 var paginationItems = $(response.data.pagination); 423 $('.recipe-index-pagination').html( paginationItems ); 424 425 var dataQuery = response.data.query; 426 recipesContainer.data( 'query', dataQuery ); 427 428 if( amount < response.data.total ) { 429 loadMore.show(); 430 } else { 431 loadMore.hide(); 432 } 433 434 } 435 } 436 ); 437 438 } ); 439 440 441 } ); 442}( jQuery, wpzoomRecipeCard ) ); 443 444/** 445 * Make embeds responsive so they don't overflow their container. 446 * Add max-width & max-height to <iframe> elements, depending on their width & height props. 447 * 448 * @see Twenty Twenty-One file responsive-embeds.js. 449 * @since 3.3.0 450 * 451 * @return {void} 452 */ 453 function recipeCardResponsiveEmbeds() { 454 let proportion, parentWidth; 455 456 // Loop iframe elements. 457 document.querySelectorAll("iframe").forEach(function (iframe) { 458 // Only continue if the iframe has a width & height defined. 459 if (iframe.width && iframe.height) { 460 // Calculate the proportion/ratio based on the width & height. 461 proportion = parseFloat(iframe.width) / parseFloat(iframe.height); 462 // Get the parent element's width. 463 parentWidth = parseFloat( 464 window 465 .getComputedStyle(iframe.parentElement, null) 466 .width.replace("px", "") 467 ); 468 // Set the max-width & height. 469 iframe.style.maxWidth = "100%"; 470 iframe.style.maxHeight = 471 Math.round(parentWidth / proportion).toString() + "px"; 472 } 473 }); 474} 475 476// Run on initial load. 477recipeCardResponsiveEmbeds(); 478 479// Run on resize. 480window.onresize = recipeCardResponsiveEmbeds; 481 482/* eslint-disable */ 483/*! Magnific Popup - v1.1.0 - 2016-02-20
484* http://dimsemenov.com/plugins/magnific-popup/ 485* Copyright (c) 2016 Dmitry Semenov; */ 486!function(a) { "function" == typeof define && define.amd ? define(["jquery"], a) : a("object" == typeof exports ? require("jquery") : window.jQuery || window.Zepto) }(function(a) { var b, c, d, e, f, g, h = "Close", i = "BeforeClose", j = "AfterClose", k = "BeforeAppend", l = "MarkupParse", m = "Open", n = "Change", o = "mfp", p = "." + o, q = "mfp-ready", r = "mfp-removing", s = "mfp-prevent-close", t = function() { }, u = !!window.jQuery, v = a(window), w = function(a, c) { b.ev.on(o + a + p, c) }, x = function(b, c, d, e) { var f = document.createElement("div"); return f.className = "mfp-" + b, d && (f.innerHTML = d), e ? c && c.appendChild(f) : (f = a(f), c && f.appendTo(c)), f }, y = function(c, d) { b.ev.triggerHandler(o + c, d), b.st.callbacks && (c = c.charAt(0).toLowerCase() + c.slice(1), b.st.callbacks[c] && b.st.callbacks[c].apply(b, a.isArray(d) ? d : [d])) }, z = function(c) { return c === g && b.currTemplate.closeBtn || (b.currTemplate.closeBtn = a(b.st.closeMarkup.replace("%title%", b.st.tClose)), g = c), b.currTemplate.closeBtn }, A = function() { a.magnificPopup.instance || (b = new t, b.init(), a.magnificPopup.instance = b) }, B = function() { var a = document.createElement("p").style, b = ["ms", "O", "Moz", "Webkit"]; if (void 0 !== a.transition) return !0; for (; b.length;)if (b.pop() + "Transition" in a) return !0; return !1 }; t.prototype = { constructor: t, init: function() { var c = navigator.appVersion; b.isLowIE = b.isIE8 = document.all && !document.addEventListener, b.isAndroid = /android/gi.test(c), b.isIOS = /iphone|ipad|ipod/gi.test(c), b.supportsTransition = B(), b.probablyMobile = b.isAndroid || b.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent), d = a(document), b.popupsCache = {} }, open: function(c) { var e; if (c.isObj === !1) { b.items = c.items.toArray(), b.index = 0; var g, h = c.items; for (e = 0; e < h.length; e++)if (g = h[e], g.parsed && (g = g.el[0]), g === c.el[0]) { b.index = e; break } } else b.items = a.isArray(c.items) ? c.items : [c.items], b.index = c.index || 0; if (b.isOpen) return void b.updateItemHTML(); b.types = [], f = "", c.mainEl && c.mainEl.length ? b.ev = c.mainEl.eq(0) : b.ev = d, c.key ? (b.popupsCache[c.key] || (b.popupsCache[c.key] = {}), b.currTemplate = b.popupsCache[c.key]) : b.currTemplate = {}, b.st = a.extend(!0, {}, a.magnificPopup.defaults, c), b.fixedContentPos = "auto" === b.st.fixedContentPos ? !b.probablyMobile : b.st.fixedContentPos, b.st.modal && (b.st.closeOnContentClick = !1, b.st.closeOnBgClick = !1, b.st.showCloseBtn = !1, b.st.enableEscapeKey = !1), b.bgOverlay || (b.bgOverlay = x("bg").on("click" + p, function() { b.close() }), b.wrap = x("wrap").attr("tabindex", -1).on("click" + p, function(a) { b._checkIfClose(a.target) && b.close() }), b.container = x("container", b.wrap)), b.contentContainer = x("content"), b.st.preloader && (b.preloader = x("preloader", b.container, b.st.tLoading)); var i = a.magnificPopup.modules; for (e = 0; e < i.length; e++) { var j = i[e]; j = j.charAt(0).toUpperCase() + j.slice(1), b["init" + j].call(b) } y("BeforeOpen"), b.st.showCloseBtn && (b.st.closeBtnInside ? (w(l, function(a, b, c, d) { c.close_replaceWith = z(d.type) }), f += " mfp-close-btn-in") : b.wrap.append(z())), b.st.alignTop && (f += " mfp-align-top"), b.fixedContentPos ? b.wrap.css({ overflow: b.st.overflowY, overflowX: "hidden", overflowY: b.st.overflowY }) : b.wrap.css({ top: v.scrollTop(), position: "absolute" }), (b.st.fixedBgPos === !1 || "auto" === b.st.fixedBgPos && !b.fixedContentPos) && b.bgOverlay.css({ height: d.height(), position: "absolute" }), b.st.enableEscapeKey && d.on("keyup" + p, function(a) { 27 === a.keyCode && b.close() }), v.on("resize" + p, function() { b.updateSize() }), b.st.closeOnContentClick || (f += " mfp-auto-cursor"), f && b.wrap.addClass(f); var k = b.wH = v.height(), n = {}; if (b.fixedContentPos && b._hasScrollBar(k)) { var o = b._getScrollbarSize(); o && (n.marginRight = o) } b.fixedContentPos && (b.isIE7 ? a("body, html").css("overflow", "hidden") : n.overflow = "hidden"); var r = b.st.mainClass; return b.isIE7 && (r += " mfp-ie7"), r && b._addClassToMFP(r), b.updateItemHTML(), y("BuildControls"), a("html").css(n), b.bgOverlay.add(b.
486wrap).prependTo(b.st.prependTo || a(document.body)), b._lastFocusedEl = document.activeElement, setTimeout(function() { b.content ? (b._addClassToMFP(q), b._setFocus()) : b.bgOverlay.addClass(q), d.on("focusin" + p, b._onFocusIn) }, 16), b.isOpen = !0, b.updateSize(k), y(m), c }, close: function() { b.isOpen && (y(i), b.isOpen = !1, b.st.removalDelay && !b.isLowIE && b.supportsTransition ? (b._addClassToMFP(r), setTimeout(function() { b._close() }, b.st.removalDelay)) : b._close()) }, _close: function() { y(h); var c = r + " " + q + " "; if (b.bgOverlay.detach(), b.wrap.detach(), b.container.empty(), b.st.mainClass && (c += b.st.mainClass + " "), b._removeClassFromMFP(c), b.fixedContentPos) { var e = { marginRight: "" }; b.isIE7 ? a("body, html").css("overflow", "") : e.overflow = "", a("html").css(e) } d.off("keyup" + p + " focusin" + p), b.ev.off(p), b.wrap.attr("class", "mfp-wrap").removeAttr("style"), b.bgOverlay.attr("class", "mfp-bg"), b.container.attr("class", "mfp-container"), !b.st.showCloseBtn || b.st.closeBtnInside && b.currTemplate[b.currItem.type] !== !0 || b.currTemplate.closeBtn && b.currTemplate.closeBtn.detach(), b.st.autoFocusLast && b._lastFocusedEl && a(b._lastFocusedEl).focus(), b.currItem = null, b.content = null, b.currTemplate = null, b.prevHeight = 0, y(j) }, updateSize: function(a) { if (b.isIOS) { var c = document.documentElement.clientWidth / window.innerWidth, d = window.innerHeight * c; b.wrap.css("height", d), b.wH = d } else b.wH = a || v.height(); b.fixedContentPos || b.wrap.css("height", b.wH), y("Resize") }, updateItemHTML: function() { var c = b.items[b.index]; b.contentContainer.detach(), b.content && b.content.detach(), c.parsed || (c = b.parseEl(b.index)); var d = c.type; if (y("BeforeChange", [b.currItem ? b.currItem.type : "", d]), b.currItem = c, !b.currTemplate[d]) { var f = b.st[d] ? b.st[d].markup : !1; y("FirstMarkupParse", f), f ? b.currTemplate[d] = a(f) : b.currTemplate[d] = !0 } e && e !== c.type && b.container.removeClass("mfp-" + e + "-holder"); var g = b["get" + d.charAt(0).toUpperCase() + d.slice(1)](c, b.currTemplate[d]); b.appendContent(g, d), c.preloaded = !0, y(n, c), e = c.type, b.container.prepend(b.contentContainer), y("AfterChange") }, appendContent: function(a, c) { b.content = a, a ? b.st.showCloseBtn && b.st.closeBtnInside && b.currTemplate[c] === !0 ? b.content.find(".mfp-close").length || b.content.append(z()) : b.content = a : b.content = "", y(k), b.container.addClass("mfp-" + c + "-holder"), b.contentContainer.append(b.content) }, parseEl: function(c) { var d, e = b.items[c]; if (e.tagName ? e = { el: a(e) } : (d = e.type, e = { data: e, src: e.src }), e.el) { for (var f = b.types, g = 0; g < f.length; g++)if (e.el.hasClass("mfp-" + f[g])) { d = f[g]; break } e.src = e.el.attr("data-mfp-src"), e.src || (e.src = e.el.attr("href")) } return e.type = d || b.st.type || "inline", e.index = c, e.parsed = !0, b.items[c] = e, y("ElementParse", e), b.items[c] }, addGroup: function(a, c) { var d = function(d) { d.mfpEl = this, b._openClick(d, a, c) }; c || (c = {}); var e = "click.magnificPopup"; c.mainEl = a, c.items ? (c.isObj = !0, a.off(e).on(e, d)) : (c.isObj = !1, c.delegate ? a.off(e).on(e, c.delegate, d) : (c.items = a, a.off(e).on(e, d))) }, _openClick: function(c, d, e) { var f = void 0 !== e.midClick ? e.midClick : a.magnificPopup.defaults.midClick; if (f || !(2 === c.which || c.ctrlKey || c.metaKey || c.altKey || c.shiftKey)) { var g = void 0 !== e.disableOn ? e.disableOn : a.magnificPopup.defaults.disableOn; if (g) if (a.isFunction(g)) { if (!g.call(b)) return !0 } else if (v.width() < g) return !0; c.type && (c.preventDefault(), b.isOpen && c.stopPropagation()), e.el = a(c.mfpEl), e.delegate && (e.items = d.find(e.delegate)), b.open(e) } }, updateStatus: function(a, d) { if (b.preloader) { c !== a && b.container.removeClass("mfp-s-" + c), d || "loading" !== a || (d = b.st.tLoading); var e = { status: a, text: d }; y("UpdateStatus", e), a = e.status, d = e.text, b.preloader.html(d), b.preloader.find("a").on("click", function(a) { a.stopImmediatePropagation() }), b.container.addClass("mfp-s-" + a), c = a } }, _checkIfClose: function(c) { if (!a(c).hasClass(s)) { var d = b.st.closeOnContentClick, e = b.st.closeOnBgClick; if (d && e) return !0; if (!b.content || a(c).hasClass("mfp-close") || b.preloader && c === b.preloader[0]) return !0; if (c === b.content[0] || a.contains(b.content[0], c)) { if (d) return !0 } else if (e && a.contains(document, c)) return !0; return !1 } }, _addClassToMFP: function(a) { b.bgOverlay.addClass(a), b.wrap.addClass(a) }, _removeClassFromMFP: function(a) { this.bgOverlay.removeClass(a), b.wrap.removeClass(a) }, _hasScrollBar: function(a) { return (b.isIE7 ? d.height() : document.body.scrollHeight) > (a || v.height()) }, _setFocus: function() { (b.st.focus ? b.content.find(b.st.focus).eq(0) : b.wrap).focus() }, _onFocusIn: function(c) { return c.target === b.wrap[0] || a.contains(b.wrap[0], c.target) ? void 0 : (b._setFocus(), !1) }, _parseMarkup: function(b, c, d) { var e; d.data && (c = a.extend(d.data, c)), y(l, [b, c, d]), a.each(c, function(c, d) { if (void 0 === d || d === !1) return !0; if (e = c.split("_"), e.length > 1) { var f = b.find(p + "-" + e[0]); if (f.length > 0) { var g = e[1]; "replaceWith" === g ? f[0] !== d[0] && f.replaceWith(d) : "img" === g ? f.is("img") ? f.attr("src", d) : f.replaceWith(a("<img>").attr("src", d).attr("class", f.attr("class"))) : f.attr(e[1], d) } } else b.find(p + "-" + c).html(d) }) }, _getScrollbarSize: function() { if (void 0 === b.scrollbarSize) { var a = document.createElement("div"); a.style.cssText = "width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;", document.body.appendChild(a), b.scrollbarSize = a.offsetWidth - a.clientWidth, document.body.removeChild(a) } return b.scrollbarSize } }, a.magnificPopup = { instance: null, proto: t.prototype, modules: [], open: function(b, c) { return A(), b = b ? a.extend(!0, {}, b) : {}, b.isObj = !0, b.index = c || 0, this.instance.open(b) }, close: function() { return a.magnificPopup.instance && a.magnificPopup.instance.close() }, registerModule: function(b, c) { c.options && (a.magnificPopup.defaults[b] = c.options), a.extend(this.proto, c.proto), this.modules.push(b) }, defaults: { disableOn: 0, key: null, midClick: !1, mainClass: "", preloader: !0, focus: "", closeOnContentClick: !1, closeOnBgClick: !0, closeBtnInside: !0, showCloseBtn: !0, enableEscapeKey: !0, modal: !1, alignTop: !1, removalDelay: 0, prependTo: null, fixedContentPos: "auto", fixedBgPos: "auto", overflowY: "auto", closeMarkup: '<button title="%title%" type="button" class="mfp-close">×</button>', tClose: "Close (Esc)", tLoading: "Loading...", autoFocusLast: !0 } }, a.fn.magnificPopup = function(c) { A(); var d = a(this); if ("string" == typeof c) if ("open" === c) { var e, f = u ? d.data("magnificPopup") : d[0].magnificPopup, g = parseInt(arguments[1], 10) || 0; f.items ? e = f.items[g] : (e = d, f.delegate && (e = e.find(f.delegate)), e = e.eq(g)), b._openClick({ mfpEl: e }, d, f) } else b.isOpen && b[c].apply(b, Array.prototype.slice.call(arguments, 1)); else c = a.extend(!0, {}, c), u ? d.data("magnificPopup", c) : d[0].magnificPopup = c, b.addGroup(d, c); return d }; var C, D, E, F = "inline", G = function() { E && (D.after(E.addClass(C)).detach(), E = null) }; a.magnificPopup.registerModule(F, { options: { hiddenClass: "hide", markup: "", tNotFound: "Content not found" }, proto: { initInline: function() { b.types.push(F), w(h + "." + F, function() { G() }) }, getInline: function(c, d) { if (G(), c.src) { var e = b.st.inline, f = a(c.src); if (f.length) { var g = f[0].parentNode; g && g.tagName && (D || (C = e.hiddenClass, D = x(C), C = "mfp-" + C), E = f.after(D).detach().removeClass(C)), b.updateStatus("ready") } else b.updateStatus("error", e.tNotFound), f = a("<div>"); return c.inlineElement = f, f } return b.updateStatus("ready"), b._parseMarkup(d, {}, c), d } } }); var H, I = "ajax", J = function() { H && a(document.body).removeClass(H) }
486, K = function() { J(), b.req && b.req.abort() }; a.magnificPopup.registerModule(I, { options: { settings: null, cursor: "mfp-ajax-cur", tError: '<a href="%url%">The content</a> could not be loaded.' }, proto: { initAjax: function() { b.types.push(I), H = b.st.ajax.cursor, w(h + "." + I, K), w("BeforeChange." + I, K) }, getAjax: function(c) { H && a(document.body).addClass(H), b.updateStatus("loading"); var d = a.extend({ url: c.src, success: function(d, e, f) { var g = { data: d, xhr: f }; y("ParseAjax", g), b.appendContent(a(g.data), I), c.finished = !0, J(), b._setFocus(), setTimeout(function() { b.wrap.addClass(q) }, 16), b.updateStatus("ready"), y("AjaxContentAdded") }, error: function() { J(), c.finished = c.loadError = !0, b.updateStatus("error", b.st.ajax.tError.replace("%url%", c.src)) } }, b.st.ajax.settings); return b.req = a.ajax(d), "" } } }); var L, M = function(c) { if (c.data && void 0 !== c.data.title) return c.data.title; var d = b.st.image.titleSrc; if (d) { if (a.isFunction(d)) return d.call(b, c); if (c.el) return c.el.attr(d) || "" } return "" }; a.magnificPopup.registerModule("image", { options: { markup: '<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>', cursor: "mfp-zoom-out-cur", titleSrc: "title", verticalFit: !0, tError: '<a href="%url%">The image</a> could not be loaded.' }, proto: { initImage: function() { var c = b.st.image, d = ".image"; b.types.push("image"), w(m + d, function() { "image" === b.currItem.type && c.cursor && a(document.body).addClass(c.cursor) }), w(h + d, function() { c.cursor && a(document.body).removeClass(c.cursor), v.off("resize" + p) }), w("Resize" + d, b.resizeImage), b.isLowIE && w("AfterChange", b.resizeImage) }, resizeImage: function() { var a = b.currItem; if (a && a.img && b.st.image.verticalFit) { var c = 0; b.isLowIE && (c = parseInt(a.img.css("padding-top"), 10) + parseInt(a.img.css("padding-bottom"), 10)), a.img.css("max-height", b.wH - c) } }, _onImageHasSize: function(a) { a.img && (a.hasSize = !0, L && clearInterval(L), a.isCheckingImgSize = !1, y("ImageHasSize", a), a.imgHidden && (b.content && b.content.removeClass("mfp-loading"), a.imgHidden = !1)) }, findImageSize: function(a) { var c = 0, d = a.img[0], e = function(f) { L && clearInterval(L), L = setInterval(function() { return d.naturalWidth > 0 ? void b._onImageHasSize(a) : (c > 200 && clearInterval(L), c++, void (3 === c ? e(10) : 40 === c ? e(50) : 100 === c && e(500))) }, f) }; e(1) }, getImage: function(c, d) { var e = 0, f = function() { c && (c.img[0].complete ? (c.img.off(".mfploader"), c === b.currItem && (b._onImageHasSize(c), b.updateStatus("ready")), c.hasSize = !0, c.loaded = !0, y("ImageLoadComplete")) : (e++, 200 > e ? setTimeout(f, 100) : g())) }, g = function() { c && (c.img.off(".mfploader"), c === b.currItem && (b._onImageHasSize(c), b.updateStatus("error", h.tError.replace("%url%", c.src))), c.hasSize = !0, c.loaded = !0, c.loadError = !0) }, h = b.st.image, i = d.find(".mfp-img"); if (i.length) { var j = document.createElement("img"); j.className = "mfp-img", c.el && c.el.find("img").length && (j.alt = c.el.find("img").attr("alt")), c.img = a(j).on("load.mfploader", f).on("error.mfploader", g), j.src = c.src, i.is("img") && (c.img = c.img.clone()), j = c.img[0], j.naturalWidth > 0 ? c.hasSize = !0 : j.width || (c.hasSize = !1) } return b._parseMarkup(d, { title: M(c), img_replaceWith: c.img }, c), b.resizeImage(), c.hasSize ? (L && clearInterval(L), c.loadError ? (d.addClass("mfp-loading"), b.updateStatus("error", h.tError.replace("%url%", c.src))) : (d.removeClass("mfp-loading"), b.updateStatus("ready")), d) : (b.updateStatus("loading"), c.loading = !0, c.hasSize || (c.imgHidden = !0, d.addClass("mfp-loading"), b.findImageSize(c)), d) } } }); var N, O = function() { return void 0 === N && (N = void 0 !== document.createElement("p").style.MozTransform), N }; a.magnificPopup.registerModule("zoom", { options: { enabled: !1, easing: "ease-in-out", duration: 300, opener: function(a) { return a.is("img") ? a : a.find("img") } }, proto: { initZoom: function() { var a, c = b.st.zoom, d = ".zoom"; if (c.enabled && b.supportsTransition) { var e, f, g = c.duration, j = function(a) { var b = a.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"), d = "all " + c.duration / 1e3 + "s " + c.easing, e = { position: "fixed", zIndex: 9999, left: 0, top: 0, "-webkit-backface-visibility": "hidden" }, f = "transition"; return e["-webkit-" + f] = e["-moz-" + f] = e["-o-" + f] = e[f] = d, b.css(e), b }, k = function() { b.content.css("visibility", "visible") }; w("BuildControls" + d, function() { if (b._allowZoom()) { if (clearTimeout(e), b.content.css("visibility", "hidden"), a = b._getItemToZoom(), !a) return void k(); f = j(a), f.css(b._getOffset()), b.wrap.append(f), e = setTimeout(function() { f.css(b._getOffset(!0)), e = setTimeout(function() { k(), setTimeout(function() { f.remove(), a = f = null, y("ZoomAnimationEnded") }, 16) }, g) }, 16) } }), w(i + d, function() { if (b._allowZoom()) { if (clearTimeout(e), b.st.removalDelay = g, !a) { if (a = b._getItemToZoom(), !a) return; f = j(a) } f.css(b._getOffset(!0)), b.wrap.append(f), b.content.css("visibility", "hidden"), setTimeout(function() { f.css(b._getOffset()) }, 16) } }), w(h + d, function() { b._allowZoom() && (k(), f && f.remove(), a = null) }) } }, _allowZoom: function() { return "image" === b.currItem.type }, _getItemToZoom: function() { return b.currItem.hasSize ? b.currItem.img : !1 }, _getOffset: function(c) { var d; d = c ? b.currItem.img : b.st.zoom.opener(b.currItem.el || b.currItem); var e = d.offset(), f = parseInt(d.css("padding-top"), 10), g = parseInt(d.css("padding-bottom"), 10); e.top -= a(window).scrollTop() - f; var h = { width: d.width(), height: (u ? d.innerHeight() : d[0].offsetHeight) - g - f }; return O() ? h["-moz-transform"] = h.transform = "translate(" + e.left + "px," + e.top + "px)" : (h.left = e.left, h.top = e.top), h } } }); var P = "iframe", Q = "//about:blank", R = function(a) { if (b.currTemplate[P]) { var c = b.currTemplate[P].find("iframe"); c.length && (a || (c[0].src = Q), b.isIE8 && c.css("display", a ? "block" : "none")) } }; a.magnificPopup.registerModule(P, { options: { markup: '<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>', srcAction: "iframe_src", patterns: { youtube: { index: "youtube.com", id: "v=", src: "//www.youtube.com/embed/%id%?autoplay=1" }, vimeo: { index: "vimeo.com/", id: "/", src: "//player.vimeo.com/video/%id%?autoplay=1" }, gmaps: { index: "//maps.google.", src: "%id%&output=embed" } } }, proto: { initIframe: function() { b.types.push(P), w("BeforeChange", function(a, b, c) { b !== c && (b === P ? R() : c === P && R(!0)) }), w(h + "." + P, function() { R() }) }, getIframe: function(c, d) { var e = c.src, f = b.st.iframe; a.each(f.patterns, function() { return e.indexOf(this.index) > -1 ? (this.id && (e = "string" == typeof this.id ? e.substr(e.lastIndexOf(this.id
486) + this.id.length, e.length) : this.id.call(this, e)), e = this.src.replace("%id%", e), !1) : void 0 }); var g = {}; return f.srcAction && (g[f.srcAction] = e), b._parseMarkup(d, g, c), b.updateStatus("ready"), d } } }); var S = function(a) { var c = b.items.length; return a > c - 1 ? a - c : 0 > a ? c + a : a }, T = function(a, b, c) { return a.replace(/%curr%/gi, b + 1).replace(/%total%/gi, c) }; a.magnificPopup.registerModule("gallery", { options: { enabled: !1, arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', preload: [0, 2], navigateByImgClick: !0, arrows: !0, tPrev: "Previous (Left arrow key)", tNext: "Next (Right arrow key)", tCounter: "%curr% of %total%" }, proto: { initGallery: function() { var c = b.st.gallery, e = ".mfp-gallery"; return b.direction = !0, c && c.enabled ? (f += " mfp-gallery", w(m + e, function() { c.navigateByImgClick && b.wrap.on("click" + e, ".mfp-img", function() { return b.items.length > 1 ? (b.next(), !1) : void 0 }), d.on("keydown" + e, function(a) { 37 === a.keyCode ? b.prev() : 39 === a.keyCode && b.next() }) }), w("UpdateStatus" + e, function(a, c) { c.text && (c.text = T(c.text, b.currItem.index, b.items.length)) }), w(l + e, function(a, d, e, f) { var g = b.items.length; e.counter = g > 1 ? T(c.tCounter, f.index, g) : "" }), w("BuildControls" + e, function() { if (b.items.length > 1 && c.arrows && !b.arrowLeft) { var d = c.arrowMarkup, e = b.arrowLeft = a(d.replace(/%title%/gi, c.tPrev).replace(/%dir%/gi, "left")).addClass(s), f = b.arrowRight = a(d.replace(/%title%/gi, c.tNext).replace(/%dir%/gi, "right")).addClass(s); e.click(function() { b.prev() }), f.click(function() { b.next() }), b.container.append(e.add(f)) } }), w(n + e, function() { b._preloadTimeout && clearTimeout(b._preloadTimeout), b._preloadTimeout = setTimeout(function() { b.preloadNearbyImages(), b._preloadTimeout = null }, 16) }), void w(h + e, function() { d.off(e), b.wrap.off("click" + e), b.arrowRight = b.arrowLeft = null })) : !1 }, next: function() { b.direction = !0, b.index = S(b.index + 1), b.updateItemHTML() }, prev: function() { b.direction = !1, b.index = S(b.index - 1), b.updateItemHTML() }, goTo: function(a) { b.direction = a >= b.index, b.index = a, b.updateItemHTML() }, preloadNearbyImages: function() { var a, c = b.st.gallery.preload, d = Math.min(c[0], b.items.length), e = Math.min(c[1], b.items.length); for (a = 1; a <= (b.direction ? e : d); a++)b._preloadItem(b.index + a); for (a = 1; a <= (b.direction ? d : e); a++)b._preloadItem(b.index - a) }, _preloadItem: function(c) { if (c = S(c), !b.items[c].preloaded) { var d = b.items[c]; d.parsed || (d = b.parseEl(c)), y("LazyLoad", d), "image" === d.type && (d.img = a('<img class="mfp-img" />').on("load.mfploader", function() { d.hasSize = !0 }).on("error.mfploader", function() { d.hasSize = !0, d.loadError = !0, y("LazyLoadError", d) }).attr("src", d.src)), d.preloaded = !0 } } } }); var U = "retina"; a.magnificPopup.registerModule(U, { options: { replaceSrc: function(a) { return a.src.replace(/\.\w+$/, function(a) { return "@2x" + a }) }, ratio: 1 }, proto: { initRetina: function() { if (window.devicePixelRatio > 1) { var a = b.st.retina, c = a.ratio; c = isNaN(c) ? c() : c, c > 1 && (w("ImageHasSize." + U, function(a, b) { b.img.css({ "max-width": b.img[0].naturalWidth / c, width: "100%" }) }), w("ElementParse." + U, function(b, d) { d.src = a.replaceSrc(d, c) })) } } } }), A() }); 487/* eslint-enable */
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.