diff --git a/CITATION.cff b/CITATION.cff index c5d405a..d2bf74c 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -6,7 +6,7 @@ authors: given-names: Justin - family-names: Tresova given-names: Armand -version: 1.8.0 +version: 1.8.1 doi: 10.5281/zenodo.1171250 date-released: 2017-05-08 url: "https://github.com/XjSv/cooked" \ No newline at end of file diff --git a/SECURITY.md b/SECURITY.md index 0f34d87..0143c5d 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -5,7 +5,8 @@ Versions that are currently being supported with security updates. | Version | Supported | | ------- | ------------------ | -| 1.8.0 | :white_check_mark: | +| 1.8.1 | :white_check_mark: | +| 1.8.0 | :x: | | <= 1.7.15.4 | :x: | ## Reporting a Vulnerability diff --git a/assets/admin/js/cooked-functions.js b/assets/admin/js/cooked-functions.js index ff19790..572ad6e 100644 --- a/assets/admin/js/cooked-functions.js +++ b/assets/admin/js/cooked-functions.js @@ -424,31 +424,31 @@ var $_CookedConditionalTimeout = false; } - if ($_CookedDirectionBuilder.length){ + if ($_CookedDirectionBuilder.length) { cooked_reset_direction_builder(); - $_CookedDirectionBuilder.parent().on('click','.cooked-add-direction-button',function(e){ + $_CookedDirectionBuilder.parent().on('click', '.cooked-add-direction-button',function(e) { e.preventDefault(); var clonedDirectionTemplate = $_CookedDirectionBuilder.parent().find('.cooked-direction-template').clone().removeClass('cooked-template cooked-direction-template').addClass('cooked-direction-block'); $_CookedDirectionBuilder.append(clonedDirectionTemplate); cooked_reset_direction_builder(); }); - $_CookedDirectionBuilder.parent().on('click','.cooked-add-heading-button',function(e){ + $_CookedDirectionBuilder.parent().on('click','.cooked-add-heading-button',function(e) { e.preventDefault(); var clonedHeadingTemplate = $_CookedDirectionBuilder.parent().find('.cooked-heading-template').clone().removeClass('cooked-template cooked-heading-template').addClass('cooked-direction-block cooked-direction-heading'); $_CookedDirectionBuilder.append(clonedHeadingTemplate); cooked_reset_direction_builder(); }); - $_CookedDirectionBuilder.parent().on('click','.cooked-delete-direction',function(e){ + $_CookedDirectionBuilder.parent().on('click','.cooked-delete-direction',function(e) { e.preventDefault(); $(this).parent().remove(); cooked_reset_direction_builder(); }); - $_CookedDirectionBuilder.parent().on('click','.remove-image-button',function(e){ + $_CookedDirectionBuilder.parent().on('click', '.remove-image-button',function(e) { e.preventDefault(); $(this).parent().removeClass('cooked-has-image'); $(this).parent().find('img').remove(); @@ -459,14 +459,14 @@ var $_CookedConditionalTimeout = false; // Instantiates the variable that holds the media library frame. var direction_image_frame,directionID; - $('body').on('click','.cooked-direction-img-placeholder, .cooked-direction-img',function(e){ + $('body').on('click','.cooked-direction-img-placeholder, .cooked-direction-img',function(e) { e.preventDefault(); var thisButton = $(this).parent().find('.direction-image-button'); thisButton.trigger('click'); }); // Runs when the image button is clicked. - $('body').on('click','.direction-image-button',function(e){ + $('body').on('click', '.direction-image-button',function(e) { var thisButton = $(this); directionID = thisButton.data('id'); @@ -487,7 +487,7 @@ var $_CookedConditionalTimeout = false; }); // Runs when an image is selected. - direction_image_frame.on('select', function(){ + direction_image_frame.on('select', function() { // Grabs the attachment selection and creates a JSON representation of the model. var media_attachment = direction_image_frame.state().get('selection').first().toJSON(); @@ -495,7 +495,7 @@ var $_CookedConditionalTimeout = false; // Sends the attachment URL to our custom image input field. $('#direction-'+directionID+'-image-src').attr('src',media_attachment.sizes.thumbnail.url).parent().addClass('cooked-has-image'); $('input[name="_recipe_settings[directions]['+directionID+'][image]"]').val( media_attachment.id ); - $('.direction-image-button[data-id="'+directionID+'"]').prop( 'value',cooked_js_vars.i18n_image_change ); + $('.direction-image-button[data-id="'+directionID+'"]').prop( 'value', cooked_js_vars.i18n_image_change ); }); @@ -503,6 +503,10 @@ var $_CookedConditionalTimeout = false; direction_image_frame.open(); }); + if ($(".cooked-wysiwyg-editor").length) { + $(".cooked-wysiwyg-editor").attr('data-direction-part', 'content'); + } + } if ( $_CookedRecipeGallery.length ){ @@ -788,45 +792,43 @@ function cooked_reset_ingredient_builder() { } // Reset Time Picker Settings & Names -function cooked_reset_direction_builder(){ +function cooked_reset_direction_builder() { var directionBlocks = jQuery('.cooked-direction-block'), total_blocks = 0; - directionBlocks.each(function(){ - + directionBlocks.each(function() { var randomKeyForInterval = cooked_get_random_int(10000000,99999999); total_blocks++; // Set the input "name" values. var $_this = jQuery(this); - $_this.find("[data-direction-part]").each(function(){ - + $_this.find("[data-direction-part]").each(function() { var thisField = jQuery(this); - if ( thisField.attr('name') == ''){ + + if ( thisField.attr('name') == '') { var directionPartName = thisField.data('direction-part'); thisField.attr( 'name','_recipe_settings[directions][' + randomKeyForInterval + '][' + directionPartName + ']' ); } - if ( thisField.attr('data-id') == ''){ + + if ( thisField.attr('data-id') == '') { thisField.attr( 'data-id',randomKeyForInterval ); } - if ( thisField.attr('id') == ''){ + + if ( thisField.attr('id') == '') { var directionPartName = thisField.data( 'direction-part' ); directionPartName = directionPartName.replace( '_', '-' ); thisField.attr( 'id','direction-'+randomKeyForInterval+'-'+directionPartName); } - }); - }); - if ( total_blocks ){ - jQuery('#cooked-directions-builder').css( { 'margin-bottom':'20px' } ); + if ( total_blocks ) { + jQuery('#cooked-directions-builder').css( { 'margin-bottom': '20px' } ); } else { - jQuery('#cooked-directions-builder').css( { 'margin-bottom':'12px' } ); + jQuery('#cooked-directions-builder').css( { 'margin-bottom': '12px' } ); } - } // Get random integer for sortable lists (ingredients and directions) diff --git a/assets/admin/js/cooked-functions.min.js b/assets/admin/js/cooked-functions.min.js index e1b59a0..38d38fc 100644 --- a/assets/admin/js/cooked-functions.min.js +++ b/assets/admin/js/cooked-functions.min.js @@ -1 +1 @@ -var $_CookedConditionalTimeout=!1,cooked_recipe_update_counter=(!function(p){p(document).ready(function(){var c,o,t,e,i,n,a,d,r,l=p(".cooked-color-field"),s=p("#cooked_recipe_settings").find("select"),u=p("#cooked-recipe-tabs"),k=(p("#cooked-settings-wrap"),p("#cooked_recipe_settings")),_=k.find("input#submit");$_CookedTooltips=p(".cooked-tooltip"),$_CookedConditionals=p(".cooked-conditional-hidden"),$_CookedSortable=p(".cooked-sortable"),$_CookedRecipeSaveDefault=p(".cooked-layout-save-default"),$_CookedShortcodeField=p(".cooked-shortcode-field"),$_CookedIngredientBuilder=p("#cooked-ingredients-builder"),$_CookedDirectionBuilder=p("#cooked-directions-builder"),$_CookedRecipeGallery=p("#cooked-recipe-image-gallery"),$_CookedNutritionFactsTab=p("#cooked-recipe-tab-content-nutrition"),$_CookedSettingsPanel=p("#cooked-settings-panel"),$_CookedSettingsTabs=p("#cooked-settings-tabs"),l.length&&l.wpColorPicker(),$_CookedSortable.length&&($_CookedSortable.find(".cooked-icon-drag")?$_CookedSortable.sortable({handle:".cooked-icon-drag"}):$_CookedSortable.sortable()),$_CookedRecipeSaveDefault.length&&($_CookedRecipeSaveDefault.tooltipster({theme:"tooltipster-light",trigger:"click",animation:"grow",delay:0,speed:200,maxWidth:275,contentAsHTML:!0,interactive:!0,functionReady:function(e,t){p(".cooked-save-default-all").on("click",function(e){e.preventDefault();var o,i=p(this),e=i.data("nonce"),n=i.data("bulk-nonce"),t=i.parent(),a=confirm(cooked_js_vars.i18n_confirm_save_default_all),d=p("#_recipe_settings_content"),c=tinymce.get("_recipe_settings_content");o=null===c?d.val():c.getContent(),a&&!i.hasClass("disabled")&&(t.find(".button, .button-primary").addClass("disabled"),p.post(cooked_js_vars.ajax_url,{action:"cooked_save_default",default_content:o,nonce:e},function(e){p.post(cooked_js_vars.ajax_url,{action:"cooked_get_recipe_ids",nonce:n},function(e){var t;i.removeClass("button-primary").addClass("button"),e&&(t=JSON.parse(e),0<(t=Object.keys(t).length))&&cooked_set_default_template(e,t,o,n)})}))}),p(".cooked-save-default-new").on("click",function(e){e.preventDefault();var t=p(this),e=t.data("nonce"),o=t.parent(),i=p("#_recipe_settings_content"),n=tinymce.get("_recipe_settings_content");i=null===n?i.val():n.getContent(),t.hasClass("disabled")||(o.find(".button, .button-primary").addClass("disabled"),p.post(cooked_js_vars.ajax_url,{action:"cooked_save_default",default_content:i,nonce:e},function(e){t.text(cooked_js_vars.i18n_saved),o.find(".button-primary").removeClass("disabled")}).fail(function(e){}))})}}),p(".cooked-layout-load-default").on("click",function(e){e.preventDefault();var e=p(this),t=e.parent(),o=confirm(cooked_js_vars.i18n_confirm_load_default),i=p("#_recipe_settings_content"),n=tinymce.get("_recipe_settings_content");o&&!e.hasClass("disabled")&&(t.find(".button, .button-primary").addClass("disabled"),p.post(cooked_js_vars.ajax_url,{action:"cooked_load_default"},function(e){null===n?i.val(e):(i.val(e),n.setContent(e)),t.find(".button, .button-primary").removeClass("disabled")}).fail(function(e){t.find(".button, .button-primary").removeClass("disabled")}))})),s.length&&s.each(function(){p(this).wrap('
')}),$_CookedTooltips.length&&$_CookedTooltips.tooltipster({theme:"tooltipster-light",animation:"grow",delay:100,speed:200,maxWidth:275,contentAsHTML:!0,interactive:!0}),$_CookedShortcodeField.length&&$_CookedShortcodeField.on("click",function(e){p(this).select()}),$_CookedConditionals.length&&(c=[],$_CookedConditionals.each(function(){var e=p(this),t=p(this).data("condition"),o=p(this).data("value"),i=p("#"+t),o=!!o&&o.split(" "),n=e.is("li")||e.is("span")?"inline-block":"block";i.is(":checkbox")&&i.is(":checked")||i.is(":radio")&&i.is(":checked")||!(i.is(":checkbox")&&!i.is(":checked")||i.is(":radio")&&!i.is(":checked"))&&(!i.is(":checkbox")&&!o&&i.val()||!i.is(":checkbox")&&o&&-1 a").attr("href")).split("#"))[1],p(".cooked-settings-tab-content").hide(),p("#cooked-settings-tab-content-"+n).show(),s.on("click",function(e){p(".tab-content").hide();var t=p(this).find("a"),t=($_CookedSettingsTabs.find("li").removeClass("active"),p(this).addClass("active"),t.attr("href"));"migration"==(t=(t=t.split("#"))[1])?_.hide():_.show(),p(".cooked-settings-tab-content").hide(),p("#cooked-settings-tab-content-"+t).show(),p("#cooked-settings-panel").hasClass("stuck")?window.scrollTo(0,130):window.scrollTo(0,0)})),$_CookedIngredientBuilder.length&&(cooked_reset_ingredient_builder(),$_CookedIngredientBuilder.on("keydown",'input[data-ingredient-part="name"]',function(e){9!==e.keyCode&&13!==e.keyCode||p(this).parents(".cooked-ingredient-block").is(":last-child")&&(e.preventDefault(),p("#cooked-recipe-tab-content-ingredients").find(".cooked-add-ingredient-button").trigger("click"),$_CookedIngredientBuilder.find('.cooked-ingredient-block:last-child input[data-ingredient-part="amount"]').focus())}),$_CookedIngredientBuilder.on("keyup",'input[data-ingredient-part="url"]',function(e){var t=p(this).val(),o=p(this).parents(".recipe-setting-block");t?o.addClass("cooked-has-url"):o.removeClass("cooked-has-url")}),$_CookedIngredientBuilder.parent().on("click",".cooked-add-ingredient-button",function(e){e.preventDefault();e=$_CookedIngredientBuilder.parent().find(".cooked-ingredient-template").clone().removeClass("cooked-template cooked-ingredient-template").addClass("cooked-ingredient-block");$_CookedIngredientBuilder.append(e),cooked_reset_ingredient_builder()}),$_CookedIngredientBuilder.parent().on("click",".cooked-add-heading-button",function(e){e.preventDefault();e=$_CookedIngredientBuilder.parent().find(".cooked-heading-template").clone().removeClass("cooked-template cooked-heading-template").addClass("cooked-ingredient-block cooked-ingredient-heading");$_CookedIngredientBuilder.append(e),cooked_reset_ingredient_builder()}),$_CookedIngredientBuilder.parent().on("click",".cooked-delete-ingredient",function(e){e.preventDefault(),p(this).parent().remove(),cooked_reset_ingredient_builder()})),$_CookedDirectionBuilder.length&&(cooked_reset_direction_builder(),$_CookedDirectionBuilder.parent().on("click",".cooked-add-direction-button",function(e){e.preventDefault();e=$_CookedDirectionBuilder.parent().find(".cooked-direction-template").clone().removeClass("cooked-template cooked-direction-template").addClass("cooked-direction-block");$_CookedDirectionBuilder.append(e),cooked_reset_direction_builder()}),$_CookedDirectionBuilder.parent().on("click",".cooked-add-heading-button",function(e){e.preventDefault();e=$_CookedDirectionBuilder.parent().find(".cooked-heading-template").clone().removeClass("cooked-template cooked-heading-template").addClass("cooked-direction-block cooked-direction-heading");$_CookedDirectionBuilder.append(e),cooked_reset_direction_builder()}),$_CookedDirectionBuilder.parent().on("click",".cooked-delete-direction",function(e){e.preventDefault(),p(this).parent().remove(),cooked_reset_direction_builder()}),$_CookedDirectionBuilder.parent().on("click",".remove-image-button",function(e){e.preventDefault(),p(this).parent().removeClass("cooked-has-image"),p(this).parent().find("img").remove(),p(this).parent().find('input[data-direction-part="image"]').val(""),cooked_reset_direction_builder()}),p("body").on("click",".cooked-direction-img-placeholder, .cooked-direction-img",function(e){e.preventDefault(),p(this).parent().find(".direction-image-button").trigger("click")}),p("body").on("click",".direction-image-button",function(e){var t=p(this);d=t.data("id"),e.preventDefault(),a||(a=wp.media.frames.direction_image_frame=wp.media({title:cooked_js_vars.i18n_image_title,button:{text:cooked_js_vars.i18n_image_button},library:{type:"image"}})).on("select",function(){var e=a.state().get("selection").first().toJSON();p("#direction-"+d+"-image-src").attr("src",e.sizes.thumbnail.url).parent().addClass("cooked-has-image"),p('input[name="_recipe_settings[directions]['+d+'][image]"]').val(e.id),p('.direction-image-button[data-id="'+d+'"]').prop("value",cooked_js_vars.i18n_image_change)}),a.open()})),$_CookedRecipeGallery.length&&(cooked_init_gallery_sorting(),p("body").on("click",".cooked-gallery-add-button",function(e){p(this);e.preventDefault(),r||(r=wp.media.frames.gallery_images_frame=wp.media({title:cooked_js_vars.i18n_gallery_image_title,button:{text:cooked_js_vars.i18n_gallery_image_title},library:{type:"image"},multiple:!0})).on("select",function(){var e,t,o,i=r.state().get("selection").toJSON();for(e in i)i.hasOwnProperty(e)&&(o=(t=i[e]).sizes.thumbnail.url,p("#cooked-recipe-image-gallery").append(''));cooked_init_gallery_sorting()}),r.open()}),p("body").on("click",".cooked-recipe-gallery-item img",function(e){e.preventDefault(),p(this).parent().find(".cooked-gallery-edit-button").trigger("click")}),p("body").on("click",".cooked-gallery-edit-button",function(e){var n=p(this),t=n.data("attachment-id"),a=(e.preventDefault(),wp.media.frames.gallery_images_frame=wp.media({title:cooked_js_vars.i18n_edit_image_title,button:{text:cooked_js_vars.i18n_edit_image_button},library:{type:"image"},multiple:!1}));a.on("open",function(){var e=a.state().get("selection");(attachment=wp.media.attachment(t)).fetch(),e.add(attachment?[attachment]:[])}),a.open(),a.on("select",function(){var e,t,o,i=a.state().get("selection").toJSON();for(e in i)i.hasOwnProperty(e)&&(o=(t=i[e]).sizes.thumbnail.url,n.parent().replaceWith(''));cooked_init_gallery_sorting()})}),$_CookedRecipeGallery.on("click",".remove-image-button",function(e){var t=p(this);d=t.data("id"),e.preventDefault(),d?(p("#direction-"+d+"-image-src").parent().removeClass("cooked-has-image").prop("src",!1),p('input[name="_recipe_settings[directions]['+d+'][image]"]').val(""),p('.direction-image-button[data-id="'+d+'"]').prop("value",cooked_js_vars.i18n_image_title)):t.parent().remove()})),$_CookedNutritionFactsTab.length&&(init_nutrition_facts($_CookedNutritionFactsTab),$_CookedNutritionFactsTab.on("keyup","input",function(e){init_nutrition_facts($_CookedNutritionFactsTab)})),p("#cooked-prep-time").length&&p("#cooked-prep-time,#cooked-cook-time").on("change",function(){cooked_updateTotalTimeValue(parseInt(p("#cooked-prep-time").val()),parseInt(p("#cooked-cook-time").val()))})})}(jQuery),0);function cooked_set_default_template(e,o,i,n){var a,d,c,r;0')}),$_CookedTooltips.length&&$_CookedTooltips.tooltipster({theme:"tooltipster-light",animation:"grow",delay:100,speed:200,maxWidth:275,contentAsHTML:!0,interactive:!0}),$_CookedShortcodeField.length&&$_CookedShortcodeField.on("click",function(e){p(this).select()}),$_CookedConditionals.length&&(c=[],$_CookedConditionals.each(function(){var e=p(this),t=p(this).data("condition"),o=p(this).data("value"),i=p("#"+t),o=!!o&&o.split(" "),n=e.is("li")||e.is("span")?"inline-block":"block";i.is(":checkbox")&&i.is(":checked")||i.is(":radio")&&i.is(":checked")||!(i.is(":checkbox")&&!i.is(":checked")||i.is(":radio")&&!i.is(":checked"))&&(!i.is(":checkbox")&&!o&&i.val()||!i.is(":checkbox")&&o&&-1 a").attr("href")).split("#"))[1],p(".cooked-settings-tab-content").hide(),p("#cooked-settings-tab-content-"+n).show(),s.on("click",function(e){p(".tab-content").hide();var t=p(this).find("a"),t=($_CookedSettingsTabs.find("li").removeClass("active"),p(this).addClass("active"),t.attr("href"));"migration"==(t=(t=t.split("#"))[1])?_.hide():_.show(),p(".cooked-settings-tab-content").hide(),p("#cooked-settings-tab-content-"+t).show(),p("#cooked-settings-panel").hasClass("stuck")?window.scrollTo(0,130):window.scrollTo(0,0)})),$_CookedIngredientBuilder.length&&(cooked_reset_ingredient_builder(),$_CookedIngredientBuilder.on("keydown",'input[data-ingredient-part="name"]',function(e){9!==e.keyCode&&13!==e.keyCode||p(this).parents(".cooked-ingredient-block").is(":last-child")&&(e.preventDefault(),p("#cooked-recipe-tab-content-ingredients").find(".cooked-add-ingredient-button").trigger("click"),$_CookedIngredientBuilder.find('.cooked-ingredient-block:last-child input[data-ingredient-part="amount"]').focus())}),$_CookedIngredientBuilder.on("keyup",'input[data-ingredient-part="url"]',function(e){var t=p(this).val(),o=p(this).parents(".recipe-setting-block");t?o.addClass("cooked-has-url"):o.removeClass("cooked-has-url")}),$_CookedIngredientBuilder.parent().on("click",".cooked-add-ingredient-button",function(e){e.preventDefault();e=$_CookedIngredientBuilder.parent().find(".cooked-ingredient-template").clone().removeClass("cooked-template cooked-ingredient-template").addClass("cooked-ingredient-block");$_CookedIngredientBuilder.append(e),cooked_reset_ingredient_builder()}),$_CookedIngredientBuilder.parent().on("click",".cooked-add-heading-button",function(e){e.preventDefault();e=$_CookedIngredientBuilder.parent().find(".cooked-heading-template").clone().removeClass("cooked-template cooked-heading-template").addClass("cooked-ingredient-block cooked-ingredient-heading");$_CookedIngredientBuilder.append(e),cooked_reset_ingredient_builder()}),$_CookedIngredientBuilder.parent().on("click",".cooked-delete-ingredient",function(e){e.preventDefault(),p(this).parent().remove(),cooked_reset_ingredient_builder()})),$_CookedDirectionBuilder.length&&(cooked_reset_direction_builder(),$_CookedDirectionBuilder.parent().on("click",".cooked-add-direction-button",function(e){e.preventDefault();e=$_CookedDirectionBuilder.parent().find(".cooked-direction-template").clone().removeClass("cooked-template cooked-direction-template").addClass("cooked-direction-block");$_CookedDirectionBuilder.append(e),cooked_reset_direction_builder()}),$_CookedDirectionBuilder.parent().on("click",".cooked-add-heading-button",function(e){e.preventDefault();e=$_CookedDirectionBuilder.parent().find(".cooked-heading-template").clone().removeClass("cooked-template cooked-heading-template").addClass("cooked-direction-block cooked-direction-heading");$_CookedDirectionBuilder.append(e),cooked_reset_direction_builder()}),$_CookedDirectionBuilder.parent().on("click",".cooked-delete-direction",function(e){e.preventDefault(),p(this).parent().remove(),cooked_reset_direction_builder()}),$_CookedDirectionBuilder.parent().on("click",".remove-image-button",function(e){e.preventDefault(),p(this).parent().removeClass("cooked-has-image"),p(this).parent().find("img").remove(),p(this).parent().find('input[data-direction-part="image"]').val(""),cooked_reset_direction_builder()}),p("body").on("click",".cooked-direction-img-placeholder, .cooked-direction-img",function(e){e.preventDefault(),p(this).parent().find(".direction-image-button").trigger("click")}),p("body").on("click",".direction-image-button",function(e){var t=p(this);d=t.data("id"),e.preventDefault(),a||(a=wp.media.frames.direction_image_frame=wp.media({title:cooked_js_vars.i18n_image_title,button:{text:cooked_js_vars.i18n_image_button},library:{type:"image"}})).on("select",function(){var e=a.state().get("selection").first().toJSON();p("#direction-"+d+"-image-src").attr("src",e.sizes.thumbnail.url).parent().addClass("cooked-has-image"),p('input[name="_recipe_settings[directions]['+d+'][image]"]').val(e.id),p('.direction-image-button[data-id="'+d+'"]').prop("value",cooked_js_vars.i18n_image_change)}),a.open()}),p(".cooked-wysiwyg-editor").length)&&p(".cooked-wysiwyg-editor").attr("data-direction-part","content"),$_CookedRecipeGallery.length&&(cooked_init_gallery_sorting(),p("body").on("click",".cooked-gallery-add-button",function(e){p(this);e.preventDefault(),r||(r=wp.media.frames.gallery_images_frame=wp.media({title:cooked_js_vars.i18n_gallery_image_title,button:{text:cooked_js_vars.i18n_gallery_image_title},library:{type:"image"},multiple:!0})).on("select",function(){var e,t,o,i=r.state().get("selection").toJSON();for(e in i)i.hasOwnProperty(e)&&(o=(t=i[e]).sizes.thumbnail.url,p("#cooked-recipe-image-gallery").append(''));cooked_init_gallery_sorting()}),r.open()}),p("body").on("click",".cooked-recipe-gallery-item img",function(e){e.preventDefault(),p(this).parent().find(".cooked-gallery-edit-button").trigger("click")}),p("body").on("click",".cooked-gallery-edit-button",function(e){var n=p(this),t=n.data("attachment-id"),a=(e.preventDefault(),wp.media.frames.gallery_images_frame=wp.media({title:cooked_js_vars.i18n_edit_image_title,button:{text:cooked_js_vars.i18n_edit_image_button},library:{type:"image"},multiple:!1}));a.on("open",function(){var e=a.state().get("selection");(attachment=wp.media.attachment(t)).fetch(),e.add(attachment?[attachment]:[])}),a.open(),a.on("select",function(){var e,t,o,i=a.state().get("selection").toJSON();for(e in i)i.hasOwnProperty(e)&&(o=(t=i[e]).sizes.thumbnail.url,n.parent().replaceWith(''));cooked_init_gallery_sorting()})}),$_CookedRecipeGallery.on("click",".remove-image-button",function(e){var t=p(this);d=t.data("id"),e.preventDefault(),d?(p("#direction-"+d+"-image-src").parent().removeClass("cooked-has-image").prop("src",!1),p('input[name="_recipe_settings[directions]['+d+'][image]"]').val(""),p('.direction-image-button[data-id="'+d+'"]').prop("value",cooked_js_vars.i18n_image_title)):t.parent().remove()})),$_CookedNutritionFactsTab.length&&(init_nutrition_facts($_CookedNutritionFactsTab),$_CookedNutritionFactsTab.on("keyup","input",function(e){init_nutrition_facts($_CookedNutritionFactsTab)})),p("#cooked-prep-time").length&&p("#cooked-prep-time,#cooked-cook-time").on("change",function(){cooked_updateTotalTimeValue(parseInt(p("#cooked-prep-time").val()),parseInt(p("#cooked-cook-time").val()))})})}(jQuery),0);function cooked_set_default_template(e,o,i,n){var a,d,c,r;0 multiplesTrigger ){ + if (totalTimers > multiplesTrigger) { $('#cooked-timers-wrap').addClass('cooked-multiples'); } else { $('#cooked-timers-wrap').removeClass('cooked-multiples'); } $('#cooked-timers-wrap').addClass('cooked-visible'); - $( '#cooked-timers-wrap' ).append('
' + Timer.step + '' + Timer.desc + '
'); - var thisTimerObj = $( '#' + Timer.id ).find('.cooked-timer-obj'); - cookedTimer( thisTimerObj, false ); - setTimeout( function(){ + let timerBlock = cookedTimerBlock(Timer, visibleClass); + $('#cooked-timers-wrap').append(timerBlock); + + var thisTimerObj = $('#' + Timer.id).find('.cooked-timer-obj'); + + cookedTimer(thisTimerObj, false); + + setTimeout(function() { $('#cooked-timers-wrap').css({ 'height' : newHeight + 'em' }); $('.cooked-timer-block').addClass('cooked-visible'); - },50); - + }, 50); } else { + let timerWrap = $('
', { id: 'cooked-timers-wrap' }); + let timerBlock = cookedTimerBlock(Timer); + timerWrap.append(timerBlock); - $('body').append('
' + Timer.step + '' + Timer.desc + '
'); - var thisTimerObj = $( '#' + Timer.id ).find('.cooked-timer-obj'); - cookedTimer( thisTimerObj, false ); - setTimeout( function(){ - $('#cooked-timers-wrap').addClass('cooked-visible'); - },50); + $('body').append(timerWrap); + var thisTimerObj = $('#' + Timer.id).find('.cooked-timer-obj'); + cookedTimer(thisTimerObj, false); + setTimeout(function() { + $('#cooked-timers-wrap').addClass('cooked-visible'); + }, 50); } - - } + }); + } + function cookedTimerBlock(Timer, visibleClass = 'cooked-visible') { + // Create the second div with dynamic id and classes + let timerBlock = $('
', { + id: Timer.id, + class: 'cooked-timer-block ' + visibleClass }); + // Create and append the step span + $('', { + class: 'cooked-timer-step', + text: Timer.step + }).appendTo(timerBlock); + + // Create and append the description span + $('', { + class: 'cooked-timer-desc', + text: Timer.desc + }).appendTo(timerBlock); + + // Create and append the timer object div + $('
', { + class: 'cooked-timer-obj', + 'data-seconds-left': Timer.seconds + }).appendTo(timerBlock); + + // Create and append the icon + $('', { + class: 'cooked-icon cooked-icon-times' + }).appendTo(timerBlock); + + // Create and append the progress bar + let progress = $('
', { class: 'cooked-progress' }); + $('').appendTo(progress); + progress.appendTo(timerBlock); + + return timerBlock; } - function cookedTimer( timerObj, startPaused ){ - + function cookedTimer(timerObj, startPaused) { var timer_sound = cooked_js_vars.timer_sound; - var audio = new Audio( timer_sound ); + var audio = new Audio(timer_sound); var thisTimerID = timerObj.parents('.cooked-timer-block').attr('id'), secondsLeft = timerObj.data('seconds-left'), @@ -216,9 +256,9 @@ var cooked_loading = false; clearDiv: 'cooked-timer-clearDiv', timeout: 'cooked-timer-timeout' }, - onComplete: function(){ + onComplete: function() { audio.play(); - timerObj.addClass( 'cooked-timer-complete' ); + timerObj.addClass('cooked-timer-complete'); } }); diff --git a/assets/js/cooked-functions.min.js b/assets/js/cooked-functions.min.js index beeccdf..78d91c8 100644 --- a/assets/js/cooked-functions.min.js +++ b/assets/js/cooked-functions.min.js @@ -1 +1 @@ -var cooked_loading=!1;!function(k){$_Cooked_Ingredient_Boxes=k(".cooked-ingredient-checkbox"),$_Cooked_Fotorama=k(".cooked-recipe-gallery"),$_Cooked_Ajax_List=k(".cooked-recipe-loader"),$_Cooked_Recipe_Search=k(".cooked-recipe-search"),$_Cooked_Timers=k(".cooked-timer > a"),$_Cooked_FSM_Button=k(".cooked-fsm-button"),$_Cooked_Fotorama.length&&$_Cooked_Fotorama.on("fotorama:ready",function(e,o){setTimeout(function(){$_Cooked_Fotorama.addClass("cooked-gallery-loaded")},100)}),k(document).ready(function(){$_Cooked_Fotorama.length&&$_Cooked_Fotorama.fotorama();{function s(e){e.on("click",function(e){var o=k(this);o.hasClass("cooked-checked")?(o.parent().removeClass("cooked-checked"),o.removeClass("cooked-checked")):(o.parent().addClass("cooked-checked"),o.addClass("cooked-checked"))})}$_Cooked_Ingredient_Boxes.length&&s($_Cooked_Ingredient_Boxes)}var n,d;function i(e){e.on("click",function(e){e.preventDefault();var o,c,s,d,i,e=k(this),t="cookedTimer-"+e.data("timer-id"),a=k("#cooked-timers-wrap").find(".cooked-timer-block").length;k("div#"+t).length?(k("div#"+t).css({background:"#eeeeee"}),setTimeout(function(){k("div#"+t).css({background:""})},200)):4==a?(k("#cooked-timers-wrap").css({transform:"translate3d(0,0.5em,0)"}),setTimeout(function(){k("#cooked-timers-wrap").css({transform:""})},200)):(o=7.5*(a+=1),d=e.parents(".cooked-single-direction").length?e.parents(".cooked-single-direction").data("step"):cooked_js_vars.i18n_timer,c=t,s=e.data("seconds"),d=d,e=e.data("desc"),k("#cooked-timers-wrap").length?(i=1==a?" cooked-visible":"",n'+d+''+e+'
'),r(k("#"+c).find(".cooked-timer-obj"),!1),setTimeout(function(){k("#cooked-timers-wrap").css({height:o+"em"}),k(".cooked-timer-block").addClass("cooked-visible")},50)):(k("body").append('
'+d+''+e+'
'),r(k("#"+c).find(".cooked-timer-obj"),!1),setTimeout(function(){k("#cooked-timers-wrap").addClass("cooked-visible")},50)))})}function r(o,e){var c=cooked_js_vars.timer_sound,s=new Audio(c),d=o.parents(".cooked-timer-block").attr("id"),i=o.data("seconds-left"),t=o.parents(".cooked-timer-block");o.startTimer({classNames:{hours:"cooked-timer-hours",minutes:"cooked-timer-minutes",seconds:"cooked-timer-seconds",clearDiv:"cooked-timer-clearDiv",timeout:"cooked-timer-timeout"},onComplete:function(){s.play(),o.addClass("cooked-timer-complete")}}),o.prepend(''),e&&(o.trigger("pause"),t.addClass("cooked-paused"),t.find("i.cooked-icon-pause").hide(),t.find("i.cooked-icon-play").css({display:"inline-block"}),t.addClass("cooked-paused"),k(this).parent().find("i.cooked-icon-play").css({display:"inline-block"})),a(t,10,10),o.on("update",function(e,o){a(t,o,i)}),o.on("complete",function(e,o){s.play(),t.find("i.cooked-icon-pause").hide(),t.find("i.cooked-icon-play").hide(),t.find(".cooked-timer-seconds").html("00")}),o.on("click","i.cooked-icon-pause",function(e){e.preventDefault(),k(this).hide(),t.addClass("cooked-paused"),k(this).parent().find("i.cooked-icon-play").css({display:"inline-block"}),o.trigger("pause")}),o.on("click","i.cooked-icon-play",function(e){e.preventDefault(),k(this).hide(),t.removeClass("cooked-paused cooked-complete"),k(this).parent().find("i.cooked-icon-pause").css({display:"inline-block"}),o.trigger("resume")}),o.on("click","i.cooked-icon-reverse",function(e){e.preventDefault(),t.removeClass("cooked-paused cooked-complete"),k(this).parent().find("i.cooked-icon-play").css({display:"inline-block"}),k(this).parent().find("i.cooked-icon-pause").hide(),o.remove(),k("#"+d).append('
'),r(k("#"+d).find(".cooked-timer-obj"),!0)}),t.on("click","i.cooked-icon-times",function(e){var o;e.preventDefault(),1==k("#cooked-timers-wrap").find(".cooked-timer-block").length?k("#cooked-timers-wrap").removeClass("cooked-visible"):(o=7.5*(e=k("#cooked-timers-wrap").find(".cooked-timer-block").length-1),k("#cooked-timers-wrap").css({height:o+"em"}),t.removeClass("cooked-visible"),e==n&&k("#cooked-timers-wrap").removeClass("cooked-multiples")),setTimeout(function(){t.remove()},200)})}function a(e,o,c){o=100-o/c*100;e.find(".cooked-progress > span").css({width:o+"%"}),100<=o&&e.addClass("cooked-complete")}k(".cooked-servings").length&&k(".cooked-servings").find("select").on("change",function(e){e.preventDefault();var e=k(this).children("option:selected").val(),o=new URL(window.location.href);o.searchParams.set("servings",e),window.location.href=o.toString()}),$_Cooked_Recipe_Search.length&&(k("body").on("click",function(e){var o=!1;0 a")),c=o.find(".cooked-ingredient-checkbox");i(e),s(c),d.enable(),o.on("click",".cooked-close-fsm",function(e){e.preventDefault(),o.removeClass("cooked-active"),k("body").removeClass("cooked-noscroll cooked-fsm-active"),d.disable(),setTimeout(function(){o.remove()},350)})}),k("body").on("click",".cooked-fsm-mobile-nav > a",function(e){e.preventDefault();var e=k(this),o=e.data("nav-id"),c=e.parents(".cooked-fsm");c.find(".cooked-fsm-mobile-nav > a").removeClass("cooked-active"),c.find(".cooked-fsm-content").removeClass("cooked-active"),e.addClass("cooked-active"),c.find(".cooked-fsm-content.cooked-fsm-"+o).addClass("cooked-active")}))})}(jQuery); \ No newline at end of file +var cooked_loading=!1;!function(k){$_Cooked_Ingredient_Boxes=k(".cooked-ingredient-checkbox"),$_Cooked_Fotorama=k(".cooked-recipe-gallery"),$_Cooked_Ajax_List=k(".cooked-recipe-loader"),$_Cooked_Recipe_Search=k(".cooked-recipe-search"),$_Cooked_Timers=k(".cooked-timer > a"),$_Cooked_FSM_Button=k(".cooked-fsm-button"),$_Cooked_Fotorama.length&&$_Cooked_Fotorama.on("fotorama:ready",function(e,o){setTimeout(function(){$_Cooked_Fotorama.addClass("cooked-gallery-loaded")},100)}),k(document).ready(function(){$_Cooked_Fotorama.length&&$_Cooked_Fotorama.fotorama();{function d(e){e.on("click",function(e){var o=k(this);o.hasClass("cooked-checked")?(o.parent().removeClass("cooked-checked"),o.removeClass("cooked-checked")):(o.parent().addClass("cooked-checked"),o.addClass("cooked-checked"))})}$_Cooked_Ingredient_Boxes.length&&d($_Cooked_Ingredient_Boxes)}var a,s;function i(e){e.on("click",function(e){e.preventDefault();var o,c,e=k(this),d="cookedTimer-"+e.data("timer-id"),s=k("#cooked-timers-wrap").find(".cooked-timer-block").length;k("div#"+d).length?(k("div#"+d).css({background:"#eeeeee"}),setTimeout(function(){k("div#"+d).css({background:""})},200)):4==s?(k("#cooked-timers-wrap").css({transform:"translate3d(0,0.5em,0)"}),setTimeout(function(){k("#cooked-timers-wrap").css({transform:""})},200)):(o=7.5*(s+=1),c=e.parents(".cooked-single-direction").length?e.parents(".cooked-single-direction").data("step"):cooked_js_vars.i18n_timer,c={id:d,seconds:e.data("seconds"),step:c,desc:e.data("desc")},k("#cooked-timers-wrap").length?(e=1==s?" cooked-visible":"",a",{id:"cooked-timers-wrap"}),s=t(c),e.append(s),k("body").append(e),n(k("#"+c.id).find(".cooked-timer-obj"),!1),setTimeout(function(){k("#cooked-timers-wrap").addClass("cooked-visible")},50)))})}function t(e,o="cooked-visible"){o=k("
",{id:e.id,class:"cooked-timer-block "+o}),k("",{class:"cooked-timer-step",text:e.step}).appendTo(o),k("",{class:"cooked-timer-desc",text:e.desc}).appendTo(o),k("
",{class:"cooked-timer-obj","data-seconds-left":e.seconds}).appendTo(o),k("",{class:"cooked-icon cooked-icon-times"}).appendTo(o),e=k("
",{class:"cooked-progress"});return k("").appendTo(e),e.appendTo(o),o}function n(o,e){var c=cooked_js_vars.timer_sound,d=new Audio(c),s=o.parents(".cooked-timer-block").attr("id"),i=o.data("seconds-left"),t=o.parents(".cooked-timer-block");o.startTimer({classNames:{hours:"cooked-timer-hours",minutes:"cooked-timer-minutes",seconds:"cooked-timer-seconds",clearDiv:"cooked-timer-clearDiv",timeout:"cooked-timer-timeout"},onComplete:function(){d.play(),o.addClass("cooked-timer-complete")}}),o.prepend(''),e&&(o.trigger("pause"),t.addClass("cooked-paused"),t.find("i.cooked-icon-pause").hide(),t.find("i.cooked-icon-play").css({display:"inline-block"}),t.addClass("cooked-paused"),k(this).parent().find("i.cooked-icon-play").css({display:"inline-block"})),r(t,10,10),o.on("update",function(e,o){r(t,o,i)}),o.on("complete",function(e,o){d.play(),t.find("i.cooked-icon-pause").hide(),t.find("i.cooked-icon-play").hide(),t.find(".cooked-timer-seconds").html("00")}),o.on("click","i.cooked-icon-pause",function(e){e.preventDefault(),k(this).hide(),t.addClass("cooked-paused"),k(this).parent().find("i.cooked-icon-play").css({display:"inline-block"}),o.trigger("pause")}),o.on("click","i.cooked-icon-play",function(e){e.preventDefault(),k(this).hide(),t.removeClass("cooked-paused cooked-complete"),k(this).parent().find("i.cooked-icon-pause").css({display:"inline-block"}),o.trigger("resume")}),o.on("click","i.cooked-icon-reverse",function(e){e.preventDefault(),t.removeClass("cooked-paused cooked-complete"),k(this).parent().find("i.cooked-icon-play").css({display:"inline-block"}),k(this).parent().find("i.cooked-icon-pause").hide(),o.remove(),k("#"+s).append('
'),n(k("#"+s).find(".cooked-timer-obj"),!0)}),t.on("click","i.cooked-icon-times",function(e){var o;e.preventDefault(),1==k("#cooked-timers-wrap").find(".cooked-timer-block").length?k("#cooked-timers-wrap").removeClass("cooked-visible"):(o=7.5*(e=k("#cooked-timers-wrap").find(".cooked-timer-block").length-1),k("#cooked-timers-wrap").css({height:o+"em"}),t.removeClass("cooked-visible"),e==a&&k("#cooked-timers-wrap").removeClass("cooked-multiples")),setTimeout(function(){t.remove()},200)})}function r(e,o,c){o=100-o/c*100;e.find(".cooked-progress > span").css({width:o+"%"}),100<=o&&e.addClass("cooked-complete")}k(".cooked-servings").length&&k(".cooked-servings").find("select").on("change",function(e){e.preventDefault();var e=k(this).children("option:selected").val(),o=new URL(window.location.href);o.searchParams.set("servings",e),window.location.href=o.toString()}),$_Cooked_Recipe_Search.length&&(k("body").on("click",function(e){var o=!1;0 a")),c=o.find(".cooked-ingredient-checkbox");i(e),d(c),s.enable(),o.on("click",".cooked-close-fsm",function(e){e.preventDefault(),o.removeClass("cooked-active"),k("body").removeClass("cooked-noscroll cooked-fsm-active"),s.disable(),setTimeout(function(){o.remove()},350)})}),k("body").on("click",".cooked-fsm-mobile-nav > a",function(e){e.preventDefault();var e=k(this),o=e.data("nav-id"),c=e.parents(".cooked-fsm");c.find(".cooked-fsm-mobile-nav > a").removeClass("cooked-active"),c.find(".cooked-fsm-content").removeClass("cooked-active"),e.addClass("cooked-active"),c.find(".cooked-fsm-content.cooked-fsm-"+o).addClass("cooked-active")}))})}(jQuery); \ No newline at end of file diff --git a/assets/js/fotorama/fotorama.min.js b/assets/js/fotorama/fotorama.min.js index 6f3cb66..db10fd1 100644 --- a/assets/js/fotorama/fotorama.min.js +++ b/assets/js/fotorama/fotorama.min.js @@ -1 +1 @@ -fotoramaVersion="4.6.4",function(i,ye,be,xe,u){"use strict";var _e="fotorama",Ce="fullscreen",Te=_e+"__wrap",Je=Te+"--video",Ze=Te+"--no-controls",tn=Te+"--only-active",en=_e+"__stage",nn=en+"__frame",on=_e+"__grab",an=_e+"__arr",rn=an+"--disabled",ke=_e+"__nav",sn=ke+"--dots",un=ke+"--thumbs",ln=ke+"__frame",t=_e+"__fade",f=t+"-front",d=t+"-rear",cn="fotorama__shadows",fn=_e+"__active",dn=_e+"__select",hn=_e+"--fullscreen",mn=_e+"__error",pn=_e+"__loading",vn=_e+"__loaded",j=_e+"__grabbing",wn=_e+"__img",gn=_e+"__thumb",t=_e+"__video",yn=t+"-play",Me='" tabindex="0" role="button',t=xe&&xe.fn.jquery.split(".");if(!t||t[0]<1||1==t[0]&&t[1]<8)throw"Fotorama requires jQuery 1.8 or later and will not run without it.";var s=function(c,f){var t,o,e,a={},d=c.documentElement,h="modernizr",i=c.createElement(h).style,n=" -webkit- -moz- -o- -ms- ".split(" "),r="Webkit Moz O ms",m=r.split(" "),p=r.toLowerCase().split(" "),s={},u=[],l=u.slice,v={}.hasOwnProperty;function w(t){i.cssText=t}function g(t,e){return typeof t===e}function y(t,e){for(var n in t){n=t[n];if(!~(""+n).indexOf("-")&&i[n]!==f)return"pfx"!=e||n}return!1}function b(t,e,n){var o=t.charAt(0).toUpperCase()+t.slice(1),a=(t+" "+m.join(o+" ")+o).split(" ");if(g(e,"string")||void 0===e)return y(a,e);var i,r=(t+" "+p.join(o+" ")+o).split(" "),s=e,u=n;for(i in r){var l=s[r[i]];if(l!==f)return!1===u?r[i]:g(l,"function")?l.bind(u||s):l}return!1}for(e in o=void 0!==v&&void 0!==v.call?function(t,e){return v.call(t,e)}:function(t,e){return e in t&&void 0===t.constructor.prototype[e]},Function.prototype.bind||(Function.prototype.bind=function(n){var o=this;if("function"!=typeof o)throw new TypeError;var a=l.call(arguments,1),i=function(){var t,e;return this instanceof i?((t=function(){}).prototype=o.prototype,t=new t,e=o.apply(t,a.concat(l.call(arguments))),Object(e)===e?e:t):o.apply(n,a.concat(l.call(arguments)))};return i}),s.csstransforms3d=function(){return!!b("perspective")},s)o(s,e)&&(t=e.toLowerCase(),a[t]=s[e](),u.push((a[t]?"":"no-")+t));return a.addTest=function(t,e){if("object"==typeof t)for(var n in t)o(t,n)&&a.addTest(n,t[n]);else{if(t=t.toLowerCase(),a[t]!==f)return a;e="function"==typeof e?e():e,"undefined"!=typeof enableClasses&&enableClasses&&(d.className+=" "+(e?"":"no-")+t),a[t]=e}return a},w(""),0,a._version="2.6.2",a._prefixes=n,a._domPrefixes=p,a._cssomPrefixes=m,a.testProp=function(t){return y([t])},a.testAllProps=b,a.testStyles=function(t,e,n,o){var a,i,r,s=c.createElement("div"),u=c.body,l=u||c.createElement("body");if(parseInt(n,10))for(;n--;)(i=c.createElement("div")).id=o?o[n]:h+(n+1),s.appendChild(i);return a=["­",'"].join(""),s.id=h,(u?s:l).innerHTML+=a,l.appendChild(s),u||(l.style.background="",l.style.overflow="hidden",r=d.style.overflow,d.style.overflow="hidden",d.appendChild(l)),a=e(s,t),u?s.parentNode.removeChild(s):(l.parentNode.removeChild(l),d.style.overflow=r),!!a},a.prefixed=function(t,e,n){return e?b(t,e,n):b(t,"pfx")},a}(ye),Se={ok:!1,is:function(){return!1},request:function(){},cancel:function(){},event:"",prefix:""},e="webkit moz o ms khtml".split(" ");if(void 0!==ye.cancelFullScreen)Se.ok=!0;else for(var n=0,o=e.length;n',e)}f.addRule(".spin-vml","behavior:url(#default#VML)");a.prototype.lines=function(t,o){var a=o.length+o.width,e=2*a;function i(){return v(l("group",{coordsize:e+" "+e,coordorigin:-a+" "+-a}),{width:e,height:e})}var n=-(o.width+o.length)*2+"px",r=v(i(),{position:"absolute",top:n,left:n}),s;function u(t,e,n){c(r,c(v(i(),{rotation:360/o.lines*t+"deg",left:~~e}),c(v(l("roundrect",{arcsize:o.corners}),{width:a,height:o.width,left:o.radius,top:-o.width>>1,filter:n}),l("fill",{color:d(o.color,t),opacity:o.opacity}),l("stroke",{opacity:0}))))}if(o.shadow)for(s=1;s<=o.lines;s++)u(s,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(s=1;s<=o.lines;s++)u(s);return c(t,r)};a.prototype.opacity=function(t,e,n,o){var a=t.firstChild;o=o.shadow&&o.lines||0;if(a&&e+o>1):parseInt(o.left,10)+e)+"px",top:(o.top=="auto"?r.y-i.y+(t.offsetHeight>>1):parseInt(o.top,10)+e)+"px"})}a.setAttribute("role","progressbar");n.lines(a,n.opts);if(!m){var s=0,u=(o.lines-1)*(1-o.direction)/2,l,c=o.fps,f=c/o.speed,d=(1-o.opacity)/(f*o.trail/100),h=f/o.lines;(function t(){s++;for(var e=0;e>1)+"px"})}for(;o=r,s="scaledown"===n,u="contain"===n,l="cover"===n,c={x:Ke((c=((c=o)+"").split(/\s+/))[0])||h,y:Ke(c[1])||h},r&&(s||u)||!r&&l?i=(a=De(e.w,0,s?a:1/0))/d.ratio:(r&&l||!r&&(s||u))&&(a=(i=De(e.h,0,s?i:1/0))*d.ratio),t.css({width:a,height:i,left:He(c.x,e.w-a),top:He(c.y,e.h-i)}),f.l={W:d.width,H:d.height,r:d.ratio,w:e.w,h:e.h,m:n,p:o}),!0}function An(t,e,n){return e!==n&&(t<=e?"left":n<=t?"right":"left right")}function zn(t,e,n,o){if(!n)return!1;if(!isNaN(t))return t-(o?0:1);for(var a,i=0,r=e.length;i'+(e||"")+"
"}function On(t){for(var e=t.length;e;){var n=Math.floor(Math.random()*e--),o=t[e];t[e]=t[n],t[n]=o}return t}function Ln(t){return"[object Array]"==Object.prototype.toString.call(t)&&xe.map(t,function(t){return xe.extend({},t)})}function Qe(t,e,n){t.scrollLeft(e||0).scrollTop(n||0)}function In(t){var n;if(t)return n={},xe.each(t,function(t,e){n[t.toLowerCase()]=e}),n}function Dn(t){var e;if(t)return e=+t,isNaN(e)?+(e=t.split("/"))[0]/+e[1]||u:e}function Ue(t,e,n,o){e&&(t.addEventListener?t.addEventListener(e,n,!!o):t.attachEvent("on"+e,n))}function Rn(t){return{tabindex:-1*t+"",disabled:t}}function Wn(e,n){Ue(e,"keyup",function(t){e.getAttribute("disabled")||13==t.keyCode&&n.call(e,t)})}function Hn(e,n){Ue(e,"focus",e.onfocusin=function(t){n.call(e,t)},!0)}function Ye(t,e){t.preventDefault?t.preventDefault():t.returnValue=!1,e&&t.stopPropagation&&t.stopPropagation()}function Kn(t){return t?">":"<"}function Ge(t,e){var n=t.data(),o=Math.round(e.pos),a=function(){n.sliding=!1,(e.onEnd||Ie)()},o=(void 0!==e.overPos&&e.overPos!==e.pos&&(o=e.overPos,a=function(){Ge(t,xe.extend({},e,{overPos:e.pos,time:Math.max(Ae,e.time/2)}))}),xe.extend(Re(o),e.width&&{width:e.width}));n.sliding=!0,Ne?(t.css(xe.extend(Sn(e.time),o)),10l&&(c=!0),d.checked=d.checked||o||a)}function p(t){(i.onTouchEnd||Ie)();var e=r;d.control=r=!1,e&&(d.flow=!1),!e||a&&!d.checked||(t&&Ye(t),y=!0,clearTimeout(b),b=setTimeout(function(){y=!1},1e3),(i.onEnd||Ie).call(f,{moved:c,$target:n,control:o,touch:u,startEvent:s,aborted:!t||"MSPointerCancel"===t.type}))}function v(){d.flow&&setTimeout(function(){d.flow=!1},qe)}return $e?(Ue(f,"MSPointerDown",h),Ue(ye,"MSPointerMove",m),Ue(ye,"MSPointerCancel",p),Ue(ye,"MSPointerUp",p)):(Ue(f,"touchstart",h),Ue(f,"touchmove",m),Ue(f,"touchend",p),Ue(ye,"touchstart",function(){d.flow||setTimeout(function(){d.flow=!0},10)}),Ue(ye,"touchend",v),Ue(ye,"touchcancel",v),Ee.on("scroll",v),t.on("mousedown",h),Pe.on("mousemove",m).on("mouseup",p)),t.on("click","a",function(t){d.checked&&Ye(t)}),d}function Xn(w,g){var n,y,b,x,o,_,a,C,T,k,M,S,i,F,E=w[0],r=w.data(),P={};function N(t,e){F=!0,n=y=t._x,a=t._now,_=[[a,n]],b=x=P.noMove||e?0:En(w,(g.getPos||Ie)()),(g.onStart||Ie).call(E,t)}return P=xe.extend(Bn(g.$wrap,xe.extend({},g,{onStart:function(t,e){T=P.min,k=P.max,M=P.snap,S=t.altKey,F=i=!1,e.control||r.sliding||N(t)},onMove:function(t,e){P.noSwipe||(F||N(t),y=t._x,_.push([t._now,y]),o=An(x=b-(n-y),T,k),x<=T?x=$(x,T):k<=x&&(x=$(x,k)),P.noMove)||(w.css(Re(x)),i||(i=!0,e.touch)||$e||w.addClass(j),(g.onMove||Ie).call(E,t,{pos:x,edge:o}))},onEnd:function(t){if(!P.noSwipe||!t.moved){F||N(t.startEvent,!0),t.touch||$e||w.removeClass(j);for(var e,n,o,a,i,r=(C=xe.now())-qe,s=null,u=Ae,l=g.friction,c=_.length-1;0<=c;c--){if(e=_[c][0],n=Math.abs(e-r),null===s||n"),ft=xe(Xe("fotorama--hidden")),k=xe(Xe(Te)),M=xe(Xe(en)).appendTo(k),S=(M[0],xe(Xe("fotorama__stage__shaft")).appendTo(M)),dt=xe(),ht=xe(Xe(an+" fotorama__arr--prev"+Me)),mt=xe(Xe(an+" fotorama__arr--next"+Me)),pt=ht.add(mt).appendTo(M),vt=xe(Xe("fotorama__nav-wrap")),r=xe(Xe(ke)).appendTo(vt),F=xe(Xe("fotorama__nav__shaft")).appendTo(r),wt=xe(),gt=xe(),yt=(S.data(),F.data(),xe(Xe("fotorama__thumb-border")).appendTo(F)),bt=xe(Xe("fotorama__fullscreen-icon"+Me)),xt=bt[0],_t=xe(Xe(yn)),Ct=xe(Xe("fotorama__video-close")).appendTo(M)[0],Tt=xe(Xe("fotorama__spinner")),E=!1,P={},n={},kt={},N={},Mt={},St={},Ft={},Et=0,Pt=[];function Nt(){xe.each(_,function(t,e){var n,o,a,i,r,s,u;!e.i&&(e.i=ut++,u=Nn(e.video,!0))&&(n={},e.video=u,e.img||e.thumb?e.thumbsReady=!0:(a=_,i=T,"youtube"===(u=(o=e).video).type?(r=(s=Ve()+"img.youtube.com/vi/"+u.id+"/default.jpg").replace(/\/default.jpg$/,"/hqdefault.jpg"),o.thumbsReady=!0):"vimeo"===u.type?xe.ajax({url:Ve()+"vimeo.com/api/v2/video/"+u.id+".json",dataType:"jsonp",success:function(t){o.thumbsReady=!0,jn(a,{img:t[0].thumbnail_large,thumb:t[0].thumbnail_small},o.i,i)}}):o.thumbsReady=!0,n={img:r,thumb:s}),jn(_,{img:n.img,thumb:n.thumb},e.i,T))})}function j(t){return G[t]||T.fullScreen}function jt(t){var e,n,o,a;t!==jt.f&&(t?(i.html("").addClass(_e+" "+rt).append(k).before(ct).before(ft),e=T,xe.Fotorama.instances.push(e)):(k.detach(),ct.detach(),ft.detach(),i.html(lt.urtext).removeClass(rt),e=T,xe.Fotorama.instances.splice(e.index,1)),Un(),n="keydown."+_e,o="keydown."+(a=_e+it),a="resize."+a+" orientationchange."+a,t?(Pe.on(o,function(t){var e,n;s&&27===t.keyCode?O(s,e=!0,!0):(T.fullScreen||x.keyboard&&!T.index)&&(27===t.keyCode?(e=!0,T.cancelFullScreen()):t.shiftKey&&32===t.keyCode&&j("space")||37===t.keyCode&&j("left")||38===t.keyCode&&j("up")?n="<":32===t.keyCode&&j("space")||39===t.keyCode&&j("right")||40===t.keyCode&&j("down")?n=">":36===t.keyCode&&j("home")?n="<<":35===t.keyCode&&j("end")&&(n=">>")),(e||n)&&Ye(t),n&&T.show({index:n,slow:t.altKey,user:!0})}),T.index||Pe.off(n).on(n,"textarea, input, select",function(t){Fe.hasClass(Ce)||t.stopPropagation()}),Ee.on(a,T.resize)):(Pe.off(o),Ee.off(a)),jt.f=t)}function $t(){var t=C<2&&!x.enableifsingleframe||s;n.noMove=t||p,n.noSwipe=t||!x.swipe,w||S.toggleClass(on,!x.click&&!n.noMove&&!n.noSwipe),$e&&k.toggleClass("fotorama__wrap--pan-y",!n.noSwipe)}function qt(t){!0===t&&(t=""),x.autoplay=Math.max(+t||5e3,1.5*v)}function $(t){return t<0?(C+t%C)%C:C<=t?t%C:t}function At(t){return De(t,0,C-1)}function zt(t){return(h?$:At)(t)}function Ot(t){return!!(0
').append(n._html?xe(n.html).removeAttr("id").html(n._html):n.html).appendTo(o),n.caption&&xe(Xe("fotorama__caption",(r="fotorama__caption__wrap",s=n.caption,(u=ye.createElement("div")).textContent=s||"",u.className=r,u.outerHTML))).appendTo(o),n.video&&o.addClass("fotorama__stage__frame--video").append(_t.clone()),Hn(a,function(){setTimeout(function(){Qe(M)},0),de({index:i.eq,user:!0})}),dt=dt.add(o)):"navDot"===l?(Kt(a),wt=wt.add(o)):"navThumb"===l&&(Kt(a),i.$wrap=o.children(":first"),gt=gt.add(o),n.video)&&i.$wrap.append(_t.clone()))})}function Bt(t,e,n,o){return t&&t.length&&qn(t,e,n,o)}function Xt(t){It(t,"stage",function(t,e,n,o,a,i){var r,s,u;o&&(u=$(e),r=n.fit||x.fit,s=n.position||x.position,i.eq=u,Ft[ze][u]=o.css(xe.extend({left:p?0:Fn(e,P.w,x.margin,c)},p&&Sn(0))),u=o[0],xe.contains(ye.documentElement,u)||(o.appendTo(S),O(n.$video)),Bt(i.$img,P,r,s),Bt(i.$full,P,r,s))})}function Qt(t,r){var s,u;"thumbs"!==m||isNaN(t)||(u=(s=-t)+P.nw,gt.each(function(){function t(){return{h:U,w:e.w}}var e=xe(this).data(),n=e.eq,o=t(),a=_[n]||{},i=a.thumbfit||x.thumbfit,a=a.thumbposition||x.thumbposition;o.w=e.w,e.l+e.wu||Bt(e.$img,o,i,a)||r&&Rt([n],"navThumb",t,i,a)}))}function Ut(t,e,n){var o,a;Ut[n]||(o="nav"===n&&K,a=0,e.append(t.filter(function(){for(var t,e=xe(this),n=e.data(),o=0,a=_.length;oP.w/3}function Gt(t){return!(h||E+t&&E-C+t||s)}function Jt(){var t=Gt(0),e=Gt(1);ht.toggleClass(rn,t).attr(Rn(t)),mt.toggleClass(rn,e).attr(Rn(e))}function Zt(){kt.ok&&(kt.prevent={"<":Gt(0),">":Gt(1)})}function te(t){var e,n=t.data(),n=K?(e=n.l,n.w):(e=t.position().left,t.width());return{c:e+n/2,min:-e+10*x.thumbmargin,max:-e+P.w-n-10*x.thumbmargin}}function ee(t){var e=u[b].data();Ge(yt,{time:1.2*t,pos:e.l,width:e.w-2*x.thumbborderwidth})}function q(t){var e,n,o,a=_[t.guessIndex][b];a&&(e=N.min!==N.max,o=t.minMax||e&&te(u[b]),a=e&&(t.keep&&q.l?q.l:De((t.coo||P.nw/2)-te(a).c,o.min,o.max)),n=e&&De(a,N.min,N.max),o=1.1*t.time,Ge(F,{time:o,pos:n||0,onEnd:function(){Qt(n,!0)}}),le(r,An(n,N.min,N.max)),q.l=a)}function ne(t){for(var e=St[t];e.length;)e.shift().removeClass(fn)}function oe(t){var n=Ft[t];xe.each(l,function(t,e){delete n[$(e)]}),xe.each(n,function(t,e){delete n[t],e.detach()})}function ae(t){c=f=E;var e=u[ze];e&&(ne(ze),St[ze].push(e.addClass(fn)),t||T.show.onEnd(!0),En(S,0),oe(ze),Xt(l),n.min=h?-1/0:-Fn(C-1,P.w,x.margin,c),n.max=h?1/0:-Fn(0,P.w,x.margin,c),n.snap=P.w+x.margin,N.min=Math.min(0,P.nw-F.width()),N.max=0,F.toggleClass(on,!(N.noMove=N.min===N.max)))}function ie(n,t){n&&xe.each(t,function(t,e){e&&xe.extend(e,{width:n.width||e.width,height:n.height,minwidth:n.minwidth,maxwidth:n.maxwidth,minheight:n.minheight,maxheight:n.maxheight,ratio:Dn(n.ratio)})})}function A(t,e){i.trigger(_e+":"+t,[T,e])}function re(){clearTimeout(o.t),et=1,x.stopautoplayontouch?T.stopAutoplay():y=!0}function o(){et&&(x.stopautoplayontouch||(se(),z()),o.t=setTimeout(function(){et=0},Ae+qe))}function se(){y=!(!s&&!a)}function z(){var n,t;clearTimeout(z.t),Be.stop(z.w),!x.autoplay||y?T.autoplay&&(T.autoplay=!1,A("stopautoplay")):(T.autoplay||(T.autoplay=!0,A("startautoplay")),n=E,t=u[ze].data(),z.w=Be(function(){return t.state||n!==E},function(){z.t=setTimeout(function(){var t,e;y||n!==E||(e=_[t=W][ze].data(),z.w=Be(function(){return e.state||t!==W},function(){y||t!==W||T.show(h?Kn(!g):W)}))},x.autoplay)}))}function ue(){T.fullScreen&&(T.fullScreen=!1,kn&&T.fullScreen&&Se.cancel(st),Fe.removeClass(Ce),Cn.removeClass(Ce),i.removeClass(hn).insertAfter(ft),P=xe.extend({},tt),O(s,!0,!0),he("x",!1),T.resize(),Rt(l,"stage"),Qe(Ee,e,t),A("fullscreenexit"))}function le(t,e){Y&&(t.removeClass("fotorama__shadows--left fotorama__shadows--right"),e)&&!s&&t.addClass(e.replace(/^|\s/g," "+cn+"--"))}function O(t,e,n){e&&(k.removeClass(Je),s=!1,$t()),t&&t!==s&&(t.remove(),A("unloadvideo")),n&&(se(),z())}function ce(t){k.toggleClass(Ze,t)}function fe(t){var e;n.flow||(e=(t=t?t.pageX:fe.x)&&!Gt(Yt(t))&&x.click,fe.p!==e&&M.toggleClass("fotorama__pointer",e)&&(fe.p=e,fe.x=t))}function de(e){clearTimeout(de.t),x.clicktransition&&x.clicktransition!==x.transition?setTimeout(function(){var t=x.transition;T.setOptions({transition:x.clicktransition}),w=t,de.t=setTimeout(function(){T.show(e)},10)},0):T.show(e)}function he(t,e){n[t]=N[t]=e}function me(t){de({index:xe(this).data().eq,slow:t.altKey,user:!0,coo:t._x-r.offset().left})}function pe(t){de({index:pt.index(this)?">":"<",slow:t.altKey,user:!0})}function ve(t){Hn(t,function(){setTimeout(function(){Qe(M)},0),ce(!1)})}function L(){function t(t,e){o[t?"add":"remove"].push(e)}var e,n,o,a;_=T.data=_||Ln(x.data)||$n(i),C=T.size=_.length,!ge.ok&&x.shuffle&&On(_),Nt(),E=At(E),C&&jt(!0),T.options=x=In(x),p="crossfade"===x.transition||"dissolve"===x.transition,h=x.loop&&(2"===n?f+1:"<"===n?f-1:"<<"===n?0:">>"===n?C-1:n,n=void 0===(n=isNaN(n)?zn(n,_,!0):n)?E||0:n,T.activeIndex=E=zt(n),Z=Ot(E),R=Lt(E),W=$(E+(g?-1:1)),l=[E,Z,R],f=h?n:E;var t=Math.abs(d-f),n=Pn(e.time,function(){return Math.min(v*(1+(t-1)/12),2*v)}),o=e.overPos,a=(e.slow&&(n*=10),u),i=(T.activeFrame=u=_[E],a===u&&!e.user),r=(O(s,u.i!==_[$(c)].i),Vt(l,"stage"),Xt(je?[f]:[f,Ot(f),Lt(f)]),he("go",!0),i||A("show",{user:e.user,time:n}),y=!0,T.show.onEnd=function(t){r.ok||(r.ok=!0,t||ae(!0),i||A("showend",{user:e.user}),!t&&w&&w!==x.transition?(T.setOptions({transition:w}),w=!1):(Ht(),Rt(l,"stage"),he("go",!1),Zt(),fe(),se(),z()))});return p?Vn(u[ze],E!==d?_[d][ze]:null,dt,{time:n,method:x.transition,onEnd:r},Pt):Ge(S,{pos:-Fn(f,P.w,x.margin,c),overPos:o,time:n,onEnd:r}),Jt(),m&&(ne(b),St[b].push(u[b].addClass(fn)),q({time:n,coo:(a=At(E+De(f-d,-1,1)))!==E&&e.coo,guessIndex:void 0!==e.coo?a:E,keep:i}),K)&&ee(n),Z=void 0!==d&&d!==E,d=E,x.hash&&Z&&!T.eq&&(o=u.id||E+1,be.replace(be.protocol+"//"+be.host+be.pathname.replace(/^\/?/,"/")+be.search+"#"+o)),this},T.requestFullScreen=function(){return B&&!T.fullScreen&&(t=Ee.scrollTop(),e=Ee.scrollLeft(),Qe(Ee),he("x",!0),tt=xe.extend({},P),i.addClass(hn).appendTo(Fe.addClass(Ce)),Cn.addClass(Ce),O(s,!0,!0),T.fullScreen=!0,X&&Se.request(st),T.resize(),Rt(l,"stage"),Ht(),A("fullscreenenter")),this},T.cancelFullScreen=function(){return X&&Se.is()?Se.cancel(ye):ue(),this},T.toggleFullScreen=function(){return T[(T.fullScreen?"cancel":"request")+"FullScreen"]()},Ue(ye,Se.event,function(){!_||Se.is()||s||ue()}),T.resize=function(t){var e,n,o,a,i;return _&&(e=arguments[1]||0,n=arguments[2],ie(T.fullScreen?{width:"100%",maxwidth:null,minwidth:null,height:"100%",maxheight:null,minheight:null}:In(t),[P,n||T.fullScreen||x]),t=P.width,o=P.height,a=P.ratio,i=Ee.height()-(m?r.height():0),Ke(t)&&(k.addClass(tn).css({width:t,minWidth:P.minwidth||0,maxWidth:P.maxwidth||99999}),t=P.W=P.w=k.width(),P.nw=m&&He(x.navwidth,t)||t,x.glimpse&&(P.w-=Math.round(2*(He(x.glimpse,t)||0))),S.css({width:P.w,marginLeft:(P.W-P.w)/2}),o=(o=He(o,i))||a&&t/a)&&(t=Math.round(t),o=P.h=Math.round(De(o,He(P.minheight,i),He(P.maxheight,i))),M.stop().animate({width:t,height:o},e,function(){k.removeClass(tn)}),ae(),m&&(r.stop().animate({width:P.nw},e),q({guessIndex:E,time:e,keep:!0}),K)&&Ut.nav&&ee(e),J=n||!0,ge()),Et=M.offset().left),this},T.setOptions=function(t){return xe.extend(x,t),L(),this},T.shuffle=function(){return _&&On(_)&&L(),this},T.destroy=function(){return T.cancelFullScreen(),T.stopAutoplay(),_=T.data=null,jt(),l=[],oe(ze),L.ok=!1,this},T.playVideo=function(){var t=u,e=t.video,n=E;return"object"==typeof e&&t.videoReady&&(X&&T.fullScreen&&T.cancelFullScreen(),Be(function(){return!Se.is()||n!==E},function(){n===E&&(t.$video=t.$video||xe(xe.Fotorama.jst.video(e)),t.$video.appendTo(t[ze]),k.addClass(Je),s=t.$video,$t(),pt.blur(),bt.blur(),A("loadvideo"))})),this},T.stopVideo=function(){return O(s,!0,!0),this},M.on("mousemove",fe),n=Xn(S,{onStart:re,onMove:function(t,e){le(M,e.edge)},onTouchEnd:o,onEnd:function(t){le(M);var e,n,o,a,i=($e&&!nt||t.touch)&&x.arrows&&"always"!==x.arrows;t.moved||i&&t.pos!==t.newPos&&!t.control?(e=t.newPos,n=P.w,o=x.margin,a=c,e=-Math.round(e/(n+(o||0))-(a||0)),T.show({index:e,time:p?v:t.time,overPos:t.overPos,user:!0})):t.aborted||t.control||(n=t.startEvent,o=i,a=n.target,xe(a).hasClass(yn)?T.playVideo():a===xt?T.toggleFullScreen():s?a===Ct&&O(s,!0,!0):o?ce():x.click&&de({index:n.shiftKey||Kn(Yt(n._x)),slow:n.altKey,user:!0}))},timeLow:1,timeHigh:1,friction:2,select:"."+dn+", ."+dn+" *",$wrap:M}),N=Xn(F,{onStart:re,onMove:function(t,e){le(r,e.edge)},onTouchEnd:o,onEnd:function(t){function e(){q.l=t.newPos,se(),z(),Qt(t.newPos,!0)}var n;t.moved?t.pos!==t.newPos?(y=!0,Ge(F,{time:t.time,pos:t.newPos,overPos:t.overPos,onEnd:e}),Qt(t.newPos),Y&&le(r,An(t.newPos,N.min,N.max))):e():(n=t.$target.closest("."+ln,F)[0])&&me.call(n,t.startEvent)},timeLow:.5,timeHigh:2,friction:5,$wrap:r}),kt=Qn(M,{shift:!0,onEnd:function(t,e){re(),o(),T.show({index:e,slow:t.altKey})}}),Mt=Qn(r,{onEnd:function(t,e){re(),o();var n=En(F)+.25*e;F.css(Re(De(n,N.min,N.max))),Y&&le(r,An(n,N.min,N.max)),Mt.prevent={"<":n>=N.max,">":n<=N.min},clearTimeout(Mt.t),Mt.t=setTimeout(function(){Qt(q.l=n,!0)},qe),Qt(n)}}),k.hover(function(){setTimeout(function(){et||ce(!(nt=!0))},0)},function(){nt&&ce(!(nt=!1))}),ot=function(t){Ye(t),pe.call(this,t)},at=(at={onStart:function(){re(),n.control=!0},onTouchEnd:o})||{},pt.each(function(){var e,t=xe(this),n=t.data();n.clickOn||(n.clickOn=!0,xe.extend(Bn(t,{onStart:function(t){e=t,(at.onStart||Ie).call(this,t)},onMove:at.onMove||Ie,onTouchEnd:at.onTouchEnd||Ie,onEnd:function(t){t.moved||ot.call(this,e)}}),{noMove:!0}))}),pt.each(function(){Wn(this,function(t){pe.call(this,t)}),ve(this)}),Wn(xt,T.toggleFullScreen),ve(xt),xe.each("load push pop shift unshift reverse sort splice".split(" "),function(t,e){T[e]=function(){return _=_||[],"load"!==e?Array.prototype[e].apply(_,arguments):arguments[0]&&"object"==typeof arguments[0]&&arguments[0].length&&(_=Ln(arguments[0])),L(),T}}),L()},xe.fn.fotorama=function(a){return this.each(function(){var e=this,t=xe(this),n=t.data(),o=n.fotorama;o?o.setOptions(a,!0):Be(function(){return!(0===(t=e).offsetWidth&&0===t.offsetHeight);var t},function(){n.urtext=t.html(),new xe.Fotorama(t,xe.extend({},c,i.fotoramaDefaults,a,n))})})},xe.Fotorama.instances=[],xe.Fotorama.cache={},xe.Fotorama.measures={},(xe=xe||{}).Fotorama=xe.Fotorama||{},xe.Fotorama.jst=xe.Fotorama.jst||{},xe.Fotorama.jst.style=function(t){var e,n="";return n+=".fotorama"+(null==(e=t.s)?"":e)+" .fotorama__nav--thumbs .fotorama__nav__frame{\npadding:"+(null==(e=t.m)?"":e)+"px;\nheight:"+(null==(e=t.h)?"":e)+"px}\n.fotorama"+(null==(e=t.s)?"":e)+" .fotorama__thumb-border{\nheight:"+(null==(e=t.h-t.b*(t.q?0:2))?"":e)+"px;\nborder-width:"+(null==(e=t.b)?"":e)+"px;\nmargin-top:"+(null==(e=t.m)?"":e)+"px}"},xe.Fotorama.jst.video=function(t){var e="",n=Array.prototype.join;return e+='
\n'},xe(function(){xe("."+_e+':not([data-auto="false"])').fotorama()})}(window,document,location,"undefined"!=typeof jQuery&&jQuery); \ No newline at end of file +fotoramaVersion="4.6.4",function(i,ye,be,xe,u){var _e="fotorama",Ce="fullscreen",Te=_e+"__wrap",Je=Te+"--video",Ze=Te+"--no-controls",tn=Te+"--only-active",en=_e+"__stage",nn=en+"__frame",on=_e+"__grab",an=_e+"__arr",rn=an+"--disabled",ke=_e+"__nav",sn=ke+"--dots",un=ke+"--thumbs",ln=ke+"__frame",t=_e+"__fade",f=t+"-front",d=t+"-rear",cn="fotorama__shadows",fn=_e+"__active",dn=_e+"__select",hn=_e+"--fullscreen",mn=_e+"__error",pn=_e+"__loading",vn=_e+"__loaded",j=_e+"__grabbing",wn=_e+"__img",gn=_e+"__thumb",t=_e+"__video",yn=t+"-play",Me='" tabindex="0" role="button',t=xe&&xe.fn.jquery.split(".");if(!t||t[0]<1||1==t[0]&&t[1]<8)throw"Fotorama requires jQuery 1.8 or later and will not run without it.";var s=function(c,f){var t,o,e,a={},d=c.documentElement,h="modernizr",i=c.createElement(h).style,n=" -webkit- -moz- -o- -ms- ".split(" "),r="Webkit Moz O ms",m=r.split(" "),p=r.toLowerCase().split(" "),s={},u=[],l=u.slice,v={}.hasOwnProperty;function w(t){i.cssText=t}function g(t,e){return typeof t===e}function y(t,e){for(var n in t){n=t[n];if(!~(""+n).indexOf("-")&&i[n]!==f)return"pfx"!=e||n}return!1}function b(t,e,n){var o=t.charAt(0).toUpperCase()+t.slice(1),a=(t+" "+m.join(o+" ")+o).split(" ");if(g(e,"string")||void 0===e)return y(a,e);var i,r=(t+" "+p.join(o+" ")+o).split(" "),s=e,u=n;for(i in r){var l=s[r[i]];if(l!==f)return!1===u?r[i]:g(l,"function")?l.bind(u||s):l}return!1}for(e in o=void 0!==v&&void 0!==v.call?function(t,e){return v.call(t,e)}:function(t,e){return e in t&&void 0===t.constructor.prototype[e]},Function.prototype.bind||(Function.prototype.bind=function(n){var o=this;if("function"!=typeof o)throw new TypeError;var a=l.call(arguments,1),i=function(){var t,e;return this instanceof i?((t=function(){}).prototype=o.prototype,t=new t,e=o.apply(t,a.concat(l.call(arguments))),Object(e)===e?e:t):o.apply(n,a.concat(l.call(arguments)))};return i}),s.csstransforms3d=function(){return!!b("perspective")},s)o(s,e)&&(t=e.toLowerCase(),a[t]=s[e](),u.push((a[t]?"":"no-")+t));return a.addTest=function(t,e){if("object"==typeof t)for(var n in t)o(t,n)&&a.addTest(n,t[n]);else{if(t=t.toLowerCase(),a[t]!==f)return a;e="function"==typeof e?e():e,"undefined"!=typeof enableClasses&&enableClasses&&(d.className+=" "+(e?"":"no-")+t),a[t]=e}return a},w(""),0,a._version="2.6.2",a._prefixes=n,a._domPrefixes=p,a._cssomPrefixes=m,a.testProp=function(t){return y([t])},a.testAllProps=b,a.testStyles=function(t,e,n,o){var a,i,r,s=c.createElement("div"),u=c.body,l=u||c.createElement("body");if(parseInt(n,10))for(;n--;)(i=c.createElement("div")).id=o?o[n]:h+(n+1),s.appendChild(i);return a=["­",'"].join(""),s.id=h,(u?s:l).innerHTML+=a,l.appendChild(s),u||(l.style.background="",l.style.overflow="hidden",r=d.style.overflow,d.style.overflow="hidden",d.appendChild(l)),a=e(s,t),u?s.parentNode.removeChild(s):(l.parentNode.removeChild(l),d.style.overflow=r),!!a},a.prefixed=function(t,e,n){return e?b(t,e,n):b(t,"pfx")},a}(ye),Se={ok:!1,is:function(){return!1},request:function(){},cancel:function(){},event:"",prefix:""},e="webkit moz o ms khtml".split(" ");if(void 0!==ye.cancelFullScreen)Se.ok=!0;else for(var n=0,o=e.length;n',e)}f.addRule(".spin-vml","behavior:url(#default#VML)");a.prototype.lines=function(t,o){var a=o.length+o.width,e=2*a;function i(){return v(l("group",{coordsize:e+" "+e,coordorigin:-a+" "+-a}),{width:e,height:e})}var n=-(o.width+o.length)*2+"px",r=v(i(),{position:"absolute",top:n,left:n}),s;function u(t,e,n){c(r,c(v(i(),{rotation:360/o.lines*t+"deg",left:~~e}),c(v(l("roundrect",{arcsize:o.corners}),{width:a,height:o.width,left:o.radius,top:-o.width>>1,filter:n}),l("fill",{color:d(o.color,t),opacity:o.opacity}),l("stroke",{opacity:0}))))}if(o.shadow)for(s=1;s<=o.lines;s++)u(s,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(s=1;s<=o.lines;s++)u(s);return c(t,r)};a.prototype.opacity=function(t,e,n,o){var a=t.firstChild;o=o.shadow&&o.lines||0;if(a&&e+o>1):parseInt(o.left,10)+e)+"px",top:(o.top=="auto"?r.y-i.y+(t.offsetHeight>>1):parseInt(o.top,10)+e)+"px"})}a.setAttribute("role","progressbar");n.lines(a,n.opts);if(!m){var s=0,u=(o.lines-1)*(1-o.direction)/2,l,c=o.fps,f=c/o.speed,d=(1-o.opacity)/(f*o.trail/100),h=f/o.lines;(function t(){s++;for(var e=0;e>1)+"px"})}for(;o'+(e||"")+"
"}function On(t){for(var e=t.length;e;){var n=Math.floor(Math.random()*e--),o=t[e];t[e]=t[n],t[n]=o}return t}function Ln(t){return"[object Array]"==Object.prototype.toString.call(t)&&xe.map(t,function(t){return xe.extend({},t)})}function Qe(t,e,n){t.scrollLeft(e||0).scrollTop(n||0)}function In(t){var n;if(t)return n={},xe.each(t,function(t,e){n[t.toLowerCase()]=e}),n}function Dn(t){var e;if(t)return e=+t,isNaN(e)?+(e=t.split("/"))[0]/+e[1]||u:e}function Ue(t,e,n,o){e&&(t.addEventListener?t.addEventListener(e,n,!!o):t.attachEvent("on"+e,n))}function Rn(t){return{tabindex:-1*t+"",disabled:t}}function Wn(e,n){Ue(e,"keyup",function(t){e.getAttribute("disabled")||13==t.keyCode&&n.call(e,t)})}function Hn(e,n){Ue(e,"focus",e.onfocusin=function(t){n.call(e,t)},!0)}function Ye(t,e){t.preventDefault?t.preventDefault():t.returnValue=!1,e&&t.stopPropagation&&t.stopPropagation()}function Kn(t){return t?">":"<"}function Ge(t,e){var n=t.data(),o=Math.round(e.pos),a=function(){n.sliding=!1,(e.onEnd||Ie)()},o=(void 0!==e.overPos&&e.overPos!==e.pos&&(o=e.overPos,a=function(){Ge(t,xe.extend({},e,{overPos:e.pos,time:Math.max(Ae,e.time/2)}))}),xe.extend(Re(o),e.width&&{width:e.width}));n.sliding=!0,Ne?(t.css(xe.extend(Sn(e.time),o)),10l&&(c=!0),d.checked=d.checked||o||a)}function p(t){(i.onTouchEnd||Ie)();var e=r;d.control=r=!1,e&&(d.flow=!1),!e||a&&!d.checked||(t&&Ye(t),y=!0,clearTimeout(b),b=setTimeout(function(){y=!1},1e3),(i.onEnd||Ie).call(f,{moved:c,$target:n,control:o,touch:u,startEvent:s,aborted:!t||"MSPointerCancel"===t.type}))}function v(){d.flow&&setTimeout(function(){d.flow=!1},qe)}return $e?(Ue(f,"MSPointerDown",h),Ue(ye,"MSPointerMove",m),Ue(ye,"MSPointerCancel",p),Ue(ye,"MSPointerUp",p)):(Ue(f,"touchstart",h),Ue(f,"touchmove",m),Ue(f,"touchend",p),Ue(ye,"touchstart",function(){d.flow||setTimeout(function(){d.flow=!0},10)}),Ue(ye,"touchend",v),Ue(ye,"touchcancel",v),Ee.on("scroll",v),t.on("mousedown",h),Pe.on("mousemove",m).on("mouseup",p)),t.on("click","a",function(t){d.checked&&Ye(t)}),d}function Xn(w,g){var n,y,b,x,o,_,C,T,k,M,S,a,F,E=w[0],i=w.data(),P={};function N(t,e){F=!0,n=y=t._x,_=[[t._now,n]],b=x=P.noMove||e?0:En(w,(g.getPos||Ie)()),(g.onStart||Ie).call(E,t)}return P=xe.extend(Bn(g.$wrap,xe.extend({},g,{onStart:function(t,e){T=P.min,k=P.max,M=P.snap,S=t.altKey,F=a=!1,e.control||i.sliding||N(t)},onMove:function(t,e){P.noSwipe||(F||N(t),y=t._x,_.push([t._now,y]),o=An(x=b-(n-y),T,k),x<=T?x=$(x,T):k<=x&&(x=$(x,k)),P.noMove)||(w.css(Re(x)),a||(a=!0,e.touch)||$e||w.addClass(j),(g.onMove||Ie).call(E,t,{pos:x,edge:o}))},onEnd:function(t){if(!P.noSwipe||!t.moved){F||N(t.startEvent,!0),t.touch||$e||w.removeClass(j);for(var e,n,o,a,i,r=(C=xe.now())-qe,s=null,u=Ae,l=g.friction,c=_.length-1;0<=c;c--){if(e=_[c][0],n=Math.abs(e-r),null===s||n"),ft=xe(Xe("fotorama--hidden")),k=xe(Xe(Te)),M=xe(Xe(en)).appendTo(k),S=(M[0],xe(Xe("fotorama__stage__shaft")).appendTo(M)),dt=xe(),ht=xe(Xe(an+" fotorama__arr--prev"+Me)),mt=xe(Xe(an+" fotorama__arr--next"+Me)),pt=ht.add(mt).appendTo(M),vt=xe(Xe("fotorama__nav-wrap")),r=xe(Xe(ke)).appendTo(vt),F=xe(Xe("fotorama__nav__shaft")).appendTo(r),wt=xe(),gt=xe(),yt=(S.data(),F.data(),xe(Xe("fotorama__thumb-border")).appendTo(F)),bt=xe(Xe("fotorama__fullscreen-icon"+Me)),xt=bt[0],_t=xe(Xe(yn)),Ct=xe(Xe("fotorama__video-close")).appendTo(M)[0],Tt=xe(Xe("fotorama__spinner")),E=!1,P={},n={},kt={},N={},Mt={},St={},Ft={},Et=0,Pt=[];function Nt(){xe.each(_,function(t,e){var n,o,a,i,r,s,u;!e.i&&(e.i=ut++,u=Nn(e.video,!0))&&(n={},e.video=u,e.img||e.thumb?e.thumbsReady=!0:(a=_,i=T,"youtube"===(u=(o=e).video).type?(r=(s=Ve()+"img.youtube.com/vi/"+u.id+"/default.jpg").replace(/\/default.jpg$/,"/hqdefault.jpg"),o.thumbsReady=!0):"vimeo"===u.type?xe.ajax({url:Ve()+"vimeo.com/api/v2/video/"+u.id+".json",dataType:"jsonp",success:function(t){o.thumbsReady=!0,jn(a,{img:t[0].thumbnail_large,thumb:t[0].thumbnail_small},o.i,i)}}):o.thumbsReady=!0,n={img:r,thumb:s}),jn(_,{img:n.img,thumb:n.thumb},e.i,T))})}function j(t){return G[t]||T.fullScreen}function jt(t){var e,n,o,a;t!==jt.f&&(t?(i.html("").addClass(_e+" "+rt).append(k).before(ct).before(ft),e=T,xe.Fotorama.instances.push(e)):(k.detach(),ct.detach(),ft.detach(),i.html(lt.urtext).removeClass(rt),e=T,xe.Fotorama.instances.splice(e.index,1)),Un(),n="keydown."+_e,o="keydown."+(a=_e+it),a="resize."+a+" orientationchange."+a,t?(Pe.on(o,function(t){var e,n;s&&27===t.keyCode?O(s,e=!0,!0):(T.fullScreen||x.keyboard&&!T.index)&&(27===t.keyCode?(e=!0,T.cancelFullScreen()):t.shiftKey&&32===t.keyCode&&j("space")||37===t.keyCode&&j("left")||38===t.keyCode&&j("up")?n="<":32===t.keyCode&&j("space")||39===t.keyCode&&j("right")||40===t.keyCode&&j("down")?n=">":36===t.keyCode&&j("home")?n="<<":35===t.keyCode&&j("end")&&(n=">>")),(e||n)&&Ye(t),n&&T.show({index:n,slow:t.altKey,user:!0})}),T.index||Pe.off(n).on(n,"textarea, input, select",function(t){Fe.hasClass(Ce)||t.stopPropagation()}),Ee.on(a,T.resize)):(Pe.off(o),Ee.off(a)),jt.f=t)}function $t(){var t=C<2&&!x.enableifsingleframe||s;n.noMove=t||p,n.noSwipe=t||!x.swipe,w||S.toggleClass(on,!x.click&&!n.noMove&&!n.noSwipe),$e&&k.toggleClass("fotorama__wrap--pan-y",!n.noSwipe)}function qt(t){!0===t&&(t=""),x.autoplay=Math.max(+t||5e3,1.5*v)}function $(t){return t<0?(C+t%C)%C:C<=t?t%C:t}function At(t){return De(t,0,C-1)}function zt(t){return(h?$:At)(t)}function Ot(t){return!!(0
').append(n._html?xe(n.html).removeAttr("id").html(n._html):n.html).appendTo(o),n.caption&&xe(Xe("fotorama__caption",(r="fotorama__caption__wrap",s=n.caption,(u=ye.createElement("div")).textContent=s||"",u.className=r,u.outerHTML))).appendTo(o),n.video&&o.addClass("fotorama__stage__frame--video").append(_t.clone()),Hn(a,function(){setTimeout(function(){Qe(M)},0),de({index:i.eq,user:!0})}),dt=dt.add(o)):"navDot"===l?(Kt(a),wt=wt.add(o)):"navThumb"===l&&(Kt(a),i.$wrap=o.children(":first"),gt=gt.add(o),n.video)&&i.$wrap.append(_t.clone()))})}function Bt(t,e,n,o){return t&&t.length&&qn(t,e,n,o)}function Xt(t){It(t,"stage",function(t,e,n,o,a,i){var r,s,u;o&&(u=$(e),r=n.fit||x.fit,s=n.position||x.position,i.eq=u,Ft[ze][u]=o.css(xe.extend({left:p?0:Fn(e,P.w,x.margin,c)},p&&Sn(0))),u=o[0],xe.contains(ye.documentElement,u)||(o.appendTo(S),O(n.$video)),Bt(i.$img,P,r,s),Bt(i.$full,P,r,s))})}function Qt(t,r){var s,u;"thumbs"!==m||isNaN(t)||(u=(s=-t)+P.nw,gt.each(function(){function t(){return{h:U,w:e.w}}var e=xe(this).data(),n=e.eq,o=t(),a=_[n]||{},i=a.thumbfit||x.thumbfit,a=a.thumbposition||x.thumbposition;o.w=e.w,e.l+e.wP.w/3}function Gt(t){return!(h||E+t&&E-C+t||s)}function Jt(){var t=Gt(0),e=Gt(1);ht.toggleClass(rn,t).attr(Rn(t)),mt.toggleClass(rn,e).attr(Rn(e))}function Zt(){kt.ok&&(kt.prevent={"<":Gt(0),">":Gt(1)})}function te(t){var e,n=t.data(),n=K?(e=n.l,n.w):(e=t.position().left,t.width());return{c:e+n/2,min:-e+10*x.thumbmargin,max:-e+P.w-n-10*x.thumbmargin}}function ee(t){var e=u[b].data();Ge(yt,{time:1.2*t,pos:e.l,width:e.w-2*x.thumbborderwidth})}function q(t){var e,n,o,a=_[t.guessIndex][b];a&&(e=N.min!==N.max,n=t.minMax||e&&te(u[b]),a=e&&(t.keep&&q.l?q.l:De((t.coo||P.nw/2)-te(a).c,n.min,n.max)),o=e&&De(a,N.min,N.max),Ge(F,{time:1.1*t.time,pos:o||0,onEnd:function(){Qt(o,!0)}}),le(r,An(o,N.min,N.max)),q.l=a)}function ne(t){for(var e=St[t];e.length;)e.shift().removeClass(fn)}function oe(t){var n=Ft[t];xe.each(l,function(t,e){delete n[$(e)]}),xe.each(n,function(t,e){delete n[t],e.detach()})}function ae(t){c=f=E;var e=u[ze];e&&(ne(ze),St[ze].push(e.addClass(fn)),t||T.show.onEnd(!0),En(S,0),oe(ze),Xt(l),n.min=h?-1/0:-Fn(C-1,P.w,x.margin,c),n.max=h?1/0:-Fn(0,P.w,x.margin,c),n.snap=P.w+x.margin,N.min=Math.min(0,P.nw-F.width()),N.max=0,F.toggleClass(on,!(N.noMove=N.min===N.max)))}function ie(n,t){n&&xe.each(t,function(t,e){e&&xe.extend(e,{width:n.width||e.width,height:n.height,minwidth:n.minwidth,maxwidth:n.maxwidth,minheight:n.minheight,maxheight:n.maxheight,ratio:Dn(n.ratio)})})}function A(t,e){i.trigger(_e+":"+t,[T,e])}function re(){clearTimeout(o.t),et=1,x.stopautoplayontouch?T.stopAutoplay():y=!0}function o(){et&&(x.stopautoplayontouch||(se(),z()),o.t=setTimeout(function(){et=0},Ae+qe))}function se(){y=!(!s&&!a)}function z(){var n,t;clearTimeout(z.t),Be.stop(z.w),!x.autoplay||y?T.autoplay&&(T.autoplay=!1,A("stopautoplay")):(T.autoplay||(T.autoplay=!0,A("startautoplay")),n=E,t=u[ze].data(),z.w=Be(function(){return t.state||n!==E},function(){z.t=setTimeout(function(){var t,e;y||n!==E||(e=_[t=W][ze].data(),z.w=Be(function(){return e.state||t!==W},function(){y||t!==W||T.show(h?Kn(!g):W)}))},x.autoplay)}))}function ue(){T.fullScreen&&(T.fullScreen=!1,kn&&T.fullScreen&&Se.cancel(st),Fe.removeClass(Ce),Cn.removeClass(Ce),i.removeClass(hn).insertAfter(ft),P=xe.extend({},tt),O(s,!0,!0),he("x",!1),T.resize(),Rt(l,"stage"),Qe(Ee,e,t),A("fullscreenexit"))}function le(t,e){Y&&(t.removeClass("fotorama__shadows--left fotorama__shadows--right"),e)&&!s&&t.addClass(e.replace(/^|\s/g," "+cn+"--"))}function O(t,e,n){e&&(k.removeClass(Je),s=!1,$t()),t&&t!==s&&(t.remove(),A("unloadvideo")),n&&(se(),z())}function ce(t){k.toggleClass(Ze,t)}function fe(t){var e;n.flow||(e=(t=t?t.pageX:fe.x)&&!Gt(Yt(t))&&x.click,fe.p!==e&&M.toggleClass("fotorama__pointer",e)&&(fe.p=e,fe.x=t))}function de(e){clearTimeout(de.t),x.clicktransition&&x.clicktransition!==x.transition?setTimeout(function(){var t=x.transition;T.setOptions({transition:x.clicktransition}),w=t,de.t=setTimeout(function(){T.show(e)},10)},0):T.show(e)}function he(t,e){n[t]=N[t]=e}function me(t){de({index:xe(this).data().eq,slow:t.altKey,user:!0,coo:t._x-r.offset().left})}function pe(t){de({index:pt.index(this)?">":"<",slow:t.altKey,user:!0})}function ve(t){Hn(t,function(){setTimeout(function(){Qe(M)},0),ce(!1)})}function L(){function t(t,e){o[t?"add":"remove"].push(e)}var e,n,o,a;_=T.data=_||Ln(x.data)||$n(i),C=T.size=_.length,!ge.ok&&x.shuffle&&On(_),Nt(),E=At(E),C&&jt(!0),T.options=x=In(x),p="crossfade"===x.transition||"dissolve"===x.transition,h=x.loop&&(2"===n?f+1:"<"===n?f-1:"<<"===n?0:">>"===n?C-1:n,n=void 0===(n=isNaN(n)?zn(n,_,!0):n)?E||0:n,T.activeIndex=E=zt(n),Z=Ot(E),R=Lt(E),W=$(E+(g?-1:1)),l=[E,Z,R],f=h?n:E;var t=Math.abs(d-f),n=Pn(e.time,function(){return Math.min(v*(1+(t-1)/12),2*v)}),o=e.overPos,a=(e.slow&&(n*=10),u),i=(T.activeFrame=u=_[E],a===u&&!e.user),r=(O(s,u.i!==_[$(c)].i),Vt(l,"stage"),Xt(je?[f]:[f,Ot(f),Lt(f)]),he("go",!0),i||A("show",{user:e.user,time:n}),y=!0,T.show.onEnd=function(t){r.ok||(r.ok=!0,t||ae(!0),i||A("showend",{user:e.user}),!t&&w&&w!==x.transition?(T.setOptions({transition:w}),w=!1):(Ht(),Rt(l,"stage"),he("go",!1),Zt(),fe(),se(),z()))});return p?Vn(u[ze],E!==d?_[d][ze]:null,dt,{time:n,method:x.transition,onEnd:r},Pt):Ge(S,{pos:-Fn(f,P.w,x.margin,c),overPos:o,time:n,onEnd:r}),Jt(),m&&(ne(b),St[b].push(u[b].addClass(fn)),q({time:n,coo:(a=At(E+De(f-d,-1,1)))!==E&&e.coo,guessIndex:void 0!==e.coo?a:E,keep:i}),K)&&ee(n),Z=void 0!==d&&d!==E,d=E,x.hash&&Z&&!T.eq&&(o=u.id||E+1,be.replace(be.protocol+"//"+be.host+be.pathname.replace(/^\/?/,"/")+be.search+"#"+o)),this},T.requestFullScreen=function(){return B&&!T.fullScreen&&(t=Ee.scrollTop(),e=Ee.scrollLeft(),Qe(Ee),he("x",!0),tt=xe.extend({},P),i.addClass(hn).appendTo(Fe.addClass(Ce)),Cn.addClass(Ce),O(s,!0,!0),T.fullScreen=!0,X&&Se.request(st),T.resize(),Rt(l,"stage"),Ht(),A("fullscreenenter")),this},T.cancelFullScreen=function(){return X&&Se.is()?Se.cancel(ye):ue(),this},T.toggleFullScreen=function(){return T[(T.fullScreen?"cancel":"request")+"FullScreen"]()},Ue(ye,Se.event,function(){!_||Se.is()||s||ue()}),T.resize=function(t){var e,n,o,a,i;return _&&(e=arguments[1]||0,n=arguments[2],ie(T.fullScreen?{width:"100%",maxwidth:null,minwidth:null,height:"100%",maxheight:null,minheight:null}:In(t),[P,n||T.fullScreen||x]),t=P.width,o=P.height,a=P.ratio,i=Ee.height()-(m?r.height():0),Ke(t)&&(k.addClass(tn).css({width:t,minWidth:P.minwidth||0,maxWidth:P.maxwidth||99999}),t=P.W=P.w=k.width(),P.nw=m&&He(x.navwidth,t)||t,x.glimpse&&(P.w-=Math.round(2*(He(x.glimpse,t)||0))),S.css({width:P.w,marginLeft:(P.W-P.w)/2}),o=(o=He(o,i))||a&&t/a)&&(t=Math.round(t),o=P.h=Math.round(De(o,He(P.minheight,i),He(P.maxheight,i))),M.stop().animate({width:t,height:o},e,function(){k.removeClass(tn)}),ae(),m&&(r.stop().animate({width:P.nw},e),q({guessIndex:E,time:e,keep:!0}),K)&&Ut.nav&&ee(e),J=n||!0,ge()),Et=M.offset().left),this},T.setOptions=function(t){return xe.extend(x,t),L(),this},T.shuffle=function(){return _&&On(_)&&L(),this},T.destroy=function(){return T.cancelFullScreen(),T.stopAutoplay(),_=T.data=null,jt(),l=[],oe(ze),L.ok=!1,this},T.playVideo=function(){var t=u,e=t.video,n=E;return"object"==typeof e&&t.videoReady&&(X&&T.fullScreen&&T.cancelFullScreen(),Be(function(){return!Se.is()||n!==E},function(){n===E&&(t.$video=t.$video||xe(xe.Fotorama.jst.video(e)),t.$video.appendTo(t[ze]),k.addClass(Je),s=t.$video,$t(),pt.blur(),bt.blur(),A("loadvideo"))})),this},T.stopVideo=function(){return O(s,!0,!0),this},M.on("mousemove",fe),n=Xn(S,{onStart:re,onMove:function(t,e){le(M,e.edge)},onTouchEnd:o,onEnd:function(t){le(M);var e,n,o,a,i=($e&&!nt||t.touch)&&x.arrows&&"always"!==x.arrows;t.moved||i&&t.pos!==t.newPos&&!t.control?(e=t.newPos,n=P.w,o=x.margin,a=c,e=-Math.round(e/(n+(o||0))-(a||0)),T.show({index:e,time:p?v:t.time,overPos:t.overPos,user:!0})):t.aborted||t.control||(n=i,a=(o=t.startEvent).target,xe(a).hasClass(yn)?T.playVideo():a===xt?T.toggleFullScreen():s?a===Ct&&O(s,!0,!0):n?ce():x.click&&de({index:o.shiftKey||Kn(Yt(o._x)),slow:o.altKey,user:!0}))},timeLow:1,timeHigh:1,friction:2,select:"."+dn+", ."+dn+" *",$wrap:M}),N=Xn(F,{onStart:re,onMove:function(t,e){le(r,e.edge)},onTouchEnd:o,onEnd:function(t){function e(){q.l=t.newPos,se(),z(),Qt(t.newPos,!0)}var n;t.moved?t.pos!==t.newPos?(y=!0,Ge(F,{time:t.time,pos:t.newPos,overPos:t.overPos,onEnd:e}),Qt(t.newPos),Y&&le(r,An(t.newPos,N.min,N.max))):e():(n=t.$target.closest("."+ln,F)[0])&&me.call(n,t.startEvent)},timeLow:.5,timeHigh:2,friction:5,$wrap:r}),kt=Qn(M,{shift:!0,onEnd:function(t,e){re(),o(),T.show({index:e,slow:t.altKey})}}),Mt=Qn(r,{onEnd:function(t,e){re(),o();var n=En(F)+.25*e;F.css(Re(De(n,N.min,N.max))),Y&&le(r,An(n,N.min,N.max)),Mt.prevent={"<":n>=N.max,">":n<=N.min},clearTimeout(Mt.t),Mt.t=setTimeout(function(){Qt(q.l=n,!0)},qe),Qt(n)}}),k.hover(function(){setTimeout(function(){et||ce(!(nt=!0))},0)},function(){nt&&ce(!(nt=!1))}),ot=function(t){Ye(t),pe.call(this,t)},at=(at={onStart:function(){re(),n.control=!0},onTouchEnd:o})||{},pt.each(function(){var e,t=xe(this),n=t.data();n.clickOn||(n.clickOn=!0,xe.extend(Bn(t,{onStart:function(t){e=t,(at.onStart||Ie).call(this,t)},onMove:at.onMove||Ie,onTouchEnd:at.onTouchEnd||Ie,onEnd:function(t){t.moved||ot.call(this,e)}}),{noMove:!0}))}),pt.each(function(){Wn(this,function(t){pe.call(this,t)}),ve(this)}),Wn(xt,T.toggleFullScreen),ve(xt),xe.each("load push pop shift unshift reverse sort splice".split(" "),function(t,e){T[e]=function(){return _=_||[],"load"!==e?Array.prototype[e].apply(_,arguments):arguments[0]&&"object"==typeof arguments[0]&&arguments[0].length&&(_=Ln(arguments[0])),L(),T}}),L()},xe.fn.fotorama=function(a){return this.each(function(){var e=this,t=xe(this),n=t.data(),o=n.fotorama;o?o.setOptions(a,!0):Be(function(){return!(0===(t=e).offsetWidth&&0===t.offsetHeight);var t},function(){n.urtext=t.html(),new xe.Fotorama(t,xe.extend({},c,i.fotoramaDefaults,a,n))})})},xe.Fotorama.instances=[],xe.Fotorama.cache={},xe.Fotorama.measures={},(xe=xe||{}).Fotorama=xe.Fotorama||{},xe.Fotorama.jst=xe.Fotorama.jst||{},xe.Fotorama.jst.style=function(t){var e,n="";return n+=".fotorama"+(null==(e=t.s)?"":e)+" .fotorama__nav--thumbs .fotorama__nav__frame{\npadding:"+(null==(e=t.m)?"":e)+"px;\nheight:"+(null==(e=t.h)?"":e)+"px}\n.fotorama"+(null==(e=t.s)?"":e)+" .fotorama__thumb-border{\nheight:"+(null==(e=t.h-t.b*(t.q?0:2))?"":e)+"px;\nborder-width:"+(null==(e=t.b)?"":e)+"px;\nmargin-top:"+(null==(e=t.m)?"":e)+"px}"},xe.Fotorama.jst.video=function(t){var e="",n=Array.prototype.join;return e+='
\n'},xe(function(){xe("."+_e+':not([data-auto="false"])').fotorama()})}(window,document,location,"undefined"!=typeof jQuery&&jQuery); \ No newline at end of file diff --git a/composer.json b/composer.json index f847d6e..63fbcab 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "recipe" ], "homepage": "https://wordpress.org/plugins/cooked/", - "version": "1.8.0", + "version": "1.8.1", "type": "wordpress-plugin", "license": "GPL-3.0-or-later", "prefer-stable": true, diff --git a/cooked.php b/cooked.php index 601ef50..f24e726 100644 --- a/cooked.php +++ b/cooked.php @@ -4,9 +4,9 @@ Plugin Name: Cooked - Recipe Management Plugin URI: https://wordpress.org/plugins/cooked/ Description: A recipe plugin for WordPress. -Author: Boxy Studio -Author URI: https://boxystudio.com -Version: 1.8.0 +Author: Gora Tech +Author URI: https://goratech.dev +Version: 1.8.1 Text Domain: cooked Domain Path: languages License: GPL2 @@ -30,7 +30,7 @@ require_once __DIR__ . '/vendor/autoload.php'; -define( 'COOKED_VERSION', '1.8.0' ); +define( 'COOKED_VERSION', '1.8.1' ); define( 'COOKED_DEV', false ); if ( ! class_exists( 'Cooked_Plugin' ) ) : diff --git a/includes/class.cooked-admin-enqueues.php b/includes/class.cooked-admin-enqueues.php index 7d057da..fc0635a 100644 --- a/includes/class.cooked-admin-enqueues.php +++ b/includes/class.cooked-admin-enqueues.php @@ -22,18 +22,15 @@ class Cooked_Admin_Enqueues { public static $admin_colors; function __construct() { - - add_action( 'admin_enqueue_scripts', array(&$this, 'admin_enqueues'), 10, 1 ); - add_action( 'admin_enqueue_scripts', array(&$this, 'widget_enqueues'), 11, 1 ); - add_action( 'customize_controls_enqueue_scripts', array(&$this, 'enqueue_widgets'), 10, 1 ); - + add_action( 'admin_enqueue_scripts', [&$this, 'admin_enqueues'], 10, 1 ); + add_action( 'admin_enqueue_scripts', [&$this, 'widget_enqueues'], 11, 1 ); + add_action( 'customize_controls_enqueue_scripts', [&$this, 'enqueue_widgets'], 10, 1 ); } - public static function enqueue_widgets(){ - - $cooked_js_vars = array( - 'rest_url' => esc_url( get_rest_url() ), - ); + public static function enqueue_widgets() { + $cooked_js_vars = [ + 'rest_url' => esc_url(get_rest_url()), + ]; // Gonna need jQuery wp_enqueue_script( 'jquery' ); @@ -41,14 +38,13 @@ public static function enqueue_widgets(){ // Selectize (searchable select fields) wp_enqueue_style( 'cooked-selectize', COOKED_URL . '/assets/admin/css/selectize/selectize.css', [], COOKED_VERSION ); wp_enqueue_style( 'cooked-selectize-custom', COOKED_URL . '/assets/admin/css/selectize/cooked-selectize.css', [], COOKED_VERSION ); - wp_enqueue_script( 'cooked-selectize', COOKED_URL . '/assets/admin/js/selectize/selectize.min.js', array('jquery'), '0.12.6', true ); - wp_enqueue_script( 'cooked-microplugin', COOKED_URL . '/assets/admin/js/selectize/microplugin.min.js', array('jquery'), '0.0.3', true ); + wp_enqueue_script( 'cooked-selectize', COOKED_URL . '/assets/admin/js/selectize/selectize.min.js', ['jquery'], '0.12.6', true ); + wp_enqueue_script( 'cooked-microplugin', COOKED_URL . '/assets/admin/js/selectize/microplugin.min.js', ['jquery'], '0.0.3', true ); // Cooked Widgets JS - wp_register_script( 'cooked-widgets', COOKED_URL . '/assets/admin/js/cooked-widgets.js', array('jquery'), COOKED_VERSION, true ); + wp_register_script( 'cooked-widgets', COOKED_URL . '/assets/admin/js/cooked-widgets.js', ['jquery'], COOKED_VERSION, true ); wp_localize_script( 'cooked-widgets', 'cooked_js_vars', $cooked_js_vars ); wp_enqueue_script( 'cooked-widgets'); - } public function widget_enqueues( $hook ) { @@ -58,10 +54,9 @@ public function widget_enqueues( $hook ) { } public function admin_enqueues( $hook ) { + global $post, $typenow, $pagenow; - global $post,$typenow,$pagenow; - - $cooked_admin_hooks = array( + $cooked_admin_hooks = [ 'index.php', 'post-new.php', 'post.php', @@ -70,7 +65,7 @@ public function admin_enqueues( $hook ) { 'cooked_welcome', 'cooked_pending', 'cooked_pro' - ); + ]; $min = COOKED_DEV ? '' : '.min'; @@ -126,33 +121,33 @@ public function admin_enqueues( $hook ) { wp_enqueue_script( 'cooked-switchery', COOKED_URL . 'assets/admin/js/switchery/switchery.min.js', [], COOKED_VERSION, true ); wp_enqueue_script( 'cooked-vue', COOKED_URL . 'assets/admin/js/vue/vue'.$min.'.js', [], COOKED_VERSION, false ); - $cooked_js_vars = array( - 'ajax_url' => admin_url( 'admin-ajax.php' ), + $cooked_js_vars = [ + 'ajax_url' => admin_url('admin-ajax.php'), 'cooked_plugin_url' => COOKED_URL, - 'time_format' => get_option('time_format','g:ia'), - 'i18n_remaining' => __( 'remaining', 'cooked' ), - 'i18n_image_title' => __( 'Add Image', 'cooked' ), - 'i18n_image_change' => __( 'Change Image', 'cooked' ), - 'i18n_image_button' => __( 'Use this Image', 'cooked' ), - 'i18n_gallery_image_title' => __( 'Add to Gallery', 'cooked' ), - 'i18n_edit_image_title' => __( 'Edit Gallery Item', 'cooked' ), - 'i18n_edit_image_button' => __( 'Update Gallery Item', 'cooked' ), - 'i18n_saved' => __('Saved','cooked'), - 'i18n_applied' => __('Applied','cooked'), - 'i18n_confirm_save_default_all' => __('Are you sure you want to apply this new template to all of your recipes?','cooked'), - 'i18n_confirm_load_default' => __('Are you sure you want to reset this recipe template to the Cooked plugin default?','cooked'), + 'time_format' => get_option('time_format', 'g:ia'), + 'i18n_remaining' => __('remaining', 'cooked'), + 'i18n_image_title' => __('Add Image', 'cooked'), + 'i18n_image_change' => __('Change Image', 'cooked'), + 'i18n_image_button' => __('Use this Image', 'cooked'), + 'i18n_gallery_image_title' => __('Add to Gallery', 'cooked'), + 'i18n_edit_image_title' => __('Edit Gallery Item', 'cooked'), + 'i18n_edit_image_button' => __('Update Gallery Item', 'cooked'), + 'i18n_saved' => __('Saved', 'cooked'), + 'i18n_applied' => __('Applied', 'cooked'), + 'i18n_confirm_save_default_all' => __('Are you sure you want to apply this new template to all of your recipes?', 'cooked'), + 'i18n_confirm_load_default' => __('Are you sure you want to reset this recipe template to the Cooked plugin default?', 'cooked'), /* translators: confirmation for migrating all ### recipes, where ### displays the total number for the migration. */ - 'i18n_confirm_migrate_recipes' => sprintf( __('Please confirm that you are ready to migrate all %s recipes.','cooked'), number_format($total_old_recipes) ), - ); + 'i18n_confirm_migrate_recipes' => sprintf(__('Please confirm that you are ready to migrate all %s recipes.', 'cooked'), number_format($total_old_recipes)), + ]; // Cooked Admin Style Assets - wp_register_script( 'cooked-functions', COOKED_URL . 'assets/admin/js/cooked-functions'.$min.'.js', array('jquery'), COOKED_VERSION, true ); - wp_register_script( 'cooked-migration', COOKED_URL . 'assets/admin/js/cooked-migration'.$min.'.js', array('jquery'), COOKED_VERSION, true ); + wp_register_script( 'cooked-functions', COOKED_URL . 'assets/admin/js/cooked-functions'.$min.'.js', ['jquery'], COOKED_VERSION, true ); + wp_register_script( 'cooked-migration', COOKED_URL . 'assets/admin/js/cooked-migration'.$min.'.js', ['jquery'], COOKED_VERSION, true ); wp_enqueue_style( 'cooked-admin', COOKED_URL . 'assets/admin/css/style'.$min.'.css', [], COOKED_VERSION ); wp_enqueue_style( 'wp-color-picker' ); // Tooltipster - wp_enqueue_script('cooked-tooltipster', COOKED_URL . 'assets/admin/js/tooltipster/jquery.tooltipster.min.js', array('jquery'), COOKED_VERSION, true ); + wp_enqueue_script('cooked-tooltipster', COOKED_URL . 'assets/admin/js/tooltipster/jquery.tooltipster.min.js', ['jquery'], COOKED_VERSION, true ); wp_enqueue_style('cooked-tooltipster-core', COOKED_URL . 'assets/admin/css/tooltipster/tooltipster.min.css', [], COOKED_VERSION, 'screen' ); wp_enqueue_style('cooked-tooltipster-theme', COOKED_URL . 'assets/admin/css/tooltipster/themes/tooltipster-light.min.css', [], COOKED_VERSION, 'screen' ); @@ -163,9 +158,7 @@ public function admin_enqueues( $hook ) { wp_enqueue_script('cooked-migration'); endif; - } - } } diff --git a/includes/class.cooked-admin-menus.php b/includes/class.cooked-admin-menus.php index 6563ae5..529141f 100644 --- a/includes/class.cooked-admin-menus.php +++ b/includes/class.cooked-admin-menus.php @@ -20,59 +20,62 @@ class Cooked_Admin_Menus { - function __construct() { - add_action( 'admin_menu', array( &$this, 'add_menu') ); - if ( !is_admin() ): add_action( 'admin_bar_menu', array( &$this, 'add_admin_bar_menu' ), 100 ); endif; - } + function __construct() { + add_action( 'admin_menu', [&$this, 'add_menu'] ); + if ( !is_admin() ): add_action( 'admin_bar_menu', [&$this, 'add_admin_bar_menu'], 100 ); endif; + } - public function add_menu() { - global $cooked_taxonomies_for_menu; + public function add_menu() { + global $cooked_taxonomies_for_menu; - add_menu_page( __( 'Recipes', 'cooked' ), __( 'Recipes', 'cooked' ), 'edit_cp_recipes', 'cooked_recipes_menu', '', 'none', 58 ); - add_submenu_page('cooked_recipes_menu', __('Add New','cooked'), __('Add New','cooked'), 'edit_cp_recipes', 'post-new.php?post_type=cp_recipe', '' ); - if ( isset($cooked_taxonomies_for_menu) && !empty($cooked_taxonomies_for_menu) ): - foreach ( $cooked_taxonomies_for_menu as $menu_item ): - add_submenu_page( $menu_item['menu'], $menu_item['name'], $menu_item['name'], $menu_item['capability'], $menu_item['url'], '' ); - endforeach; - endif; - add_submenu_page('cooked_recipes_menu', __('Settings', 'cooked'), __('Settings','cooked'), 'edit_cooked_settings', 'cooked_settings', array(&$this, 'cooked_settings_page') ); - add_submenu_page('cooked_recipes_menu', __('What\'s New?','cooked'), __('What\'s New?','cooked'), 'edit_cooked_settings', 'cooked_welcome', array(&$this, 'cooked_welcome_content') ); - if ( !class_exists( 'Cooked_Pro_Plugin' ) ): - add_submenu_page('cooked_recipes_menu', __('Upgrade to Pro','cooked'), '' . __('Upgrade to Pro','cooked') . '', 'edit_cooked_settings', 'cooked_pro', array(&$this, 'cooked_pro') ); - endif; - } + add_menu_page( __( 'Recipes', 'cooked' ), __( 'Recipes', 'cooked' ), 'edit_cp_recipes', 'cooked_recipes_menu', '', 'none', 58 ); + add_submenu_page('cooked_recipes_menu', __('Add New','cooked'), __('Add New','cooked'), 'edit_cp_recipes', 'post-new.php?post_type=cp_recipe', '' ); + if ( isset($cooked_taxonomies_for_menu) && !empty($cooked_taxonomies_for_menu) ): + foreach ( $cooked_taxonomies_for_menu as $menu_item ): + add_submenu_page( $menu_item['menu'], $menu_item['name'], $menu_item['name'], $menu_item['capability'], $menu_item['url'], '' ); + endforeach; + endif; + add_submenu_page('cooked_recipes_menu', __('Settings', 'cooked'), __('Settings','cooked'), 'edit_cooked_settings', 'cooked_settings', array(&$this, 'cooked_settings_page') ); + add_submenu_page('cooked_recipes_menu', __('What\'s New?','cooked'), __('What\'s New?','cooked'), 'edit_cooked_settings', 'cooked_welcome', array(&$this, 'cooked_welcome_content') ); + if ( !class_exists( 'Cooked_Pro_Plugin' ) ): + add_submenu_page('cooked_recipes_menu', __('Upgrade to Pro','cooked'), '' . __('Upgrade to Pro','cooked') . '', 'edit_cooked_settings', 'cooked_pro', array(&$this, 'cooked_pro') ); + endif; + } - public function add_admin_bar_menu() { - global $wp_admin_bar; + public function add_admin_bar_menu() { + global $wp_admin_bar; - $wp_admin_bar->add_menu( array( 'id' => 'cooked-ab', 'title' => ''.__('Recipes','cooked'), 'href' => get_admin_url() . 'edit.php?post_type=cp_recipe' ) ); - $wp_admin_bar->add_menu( array( 'parent' => 'cooked-ab', 'title' => __('All Recipes','cooked'), 'id' => 'cooked-recipes-ab', 'href' => get_admin_url() . 'edit.php?post_type=cp_recipe' ) ); - $wp_admin_bar->add_menu( array( 'parent' => 'cooked-ab', 'title' => __('Add New','cooked'), 'id' => 'cooked-add-new-ab', 'href' => get_admin_url() . 'post-new.php?post_type=cp_recipe' ) ); - $wp_admin_bar->add_menu( array( 'parent' => 'cooked-ab', 'title' => __('Settings','cooked'), 'id' => 'cooked-settings-ab', 'href' => get_admin_url() . 'admin.php?page=cooked_settings' ) ); - } + $wp_admin_bar->add_menu(['id' => 'cooked-ab', 'title' => '' . __('Recipes', 'cooked'), 'href' => get_admin_url() . 'edit.php?post_type=cp_recipe'] ); + $wp_admin_bar->add_menu(['parent' => 'cooked-ab', 'title' => __('All Recipes', 'cooked'), 'id' => 'cooked-recipes-ab', 'href' => get_admin_url() . 'edit.php?post_type=cp_recipe'] ); + $wp_admin_bar->add_menu(['parent' => 'cooked-ab', 'title' => __('Add New', 'cooked'), 'id' => 'cooked-add-new-ab', 'href' => get_admin_url() . 'post-new.php?post_type=cp_recipe'] ); + $wp_admin_bar->add_menu(['parent' => 'cooked-ab', 'title' => __('Settings', 'cooked'), 'id' => 'cooked-settings-ab', 'href' => get_admin_url() . 'admin.php?page=cooked_settings'] ); + } - // Settings Panel - public function cooked_settings_page() { - if(!current_user_can('edit_cooked_settings')) { - wp_die(__('You do not have sufficient permissions to access this page.', 'cooked')); - } - include( COOKED_DIR . 'templates/admin/settings.php' ); - } + // Settings Panel + public function cooked_settings_page() { + if (!current_user_can('edit_cooked_settings')) { + wp_die(__('You do not have sufficient permissions to access this page.', 'cooked')); + } - // Welcome Page - public function cooked_welcome_content() { - if(!current_user_can('edit_cooked_settings')) { - wp_die(__('You do not have sufficient permissions to access this page.', 'cooked')); - } - include( COOKED_DIR . 'templates/admin/welcome.php' ); - } + include COOKED_DIR . 'templates/admin/settings.php'; + } - // Cooked Pro - public function cooked_pro() { - if(!current_user_can('edit_cooked_settings')) { - wp_die(__('You do not have sufficient permissions to access this page.', 'cooked')); - } - include( COOKED_DIR . 'templates/admin/pro.php' ); - } + // Welcome Page + public function cooked_welcome_content() { + if (!current_user_can('edit_cooked_settings')) { + wp_die(__('You do not have sufficient permissions to access this page.', 'cooked')); + } + + include COOKED_DIR . 'templates/admin/welcome.php'; + } + + // Cooked Pro + public function cooked_pro() { + if (!current_user_can('edit_cooked_settings')) { + wp_die(__('You do not have sufficient permissions to access this page.', 'cooked')); + } + + include COOKED_DIR . 'templates/admin/pro.php'; + } } diff --git a/includes/class.cooked-ajax.php b/includes/class.cooked-ajax.php index fe9a1ab..9c2f801 100644 --- a/includes/class.cooked-ajax.php +++ b/includes/class.cooked-ajax.php @@ -25,22 +25,22 @@ function __construct() { */ // Save Default Template - add_action( 'wp_ajax_cooked_save_default', array(&$this,'save_default') ); + add_action( 'wp_ajax_cooked_save_default', [&$this, 'save_default'] ); // Save Default Template in Bulk - add_action( 'wp_ajax_cooked_save_default_bulk', array(&$this,'save_default_bulk') ); + add_action( 'wp_ajax_cooked_save_default_bulk', [&$this, 'save_default_bulk'] ); // Load Default Template - add_action( 'wp_ajax_cooked_load_default', array(&$this,'load_default') ); + add_action( 'wp_ajax_cooked_load_default', [&$this, 'load_default'] ); // Get JSON list of Recipe IDs - add_action( 'wp_ajax_cooked_get_recipe_ids', array(&$this,'get_recipe_ids') ); + add_action( 'wp_ajax_cooked_get_recipe_ids', [&$this, 'get_recipe_ids'] ); // Get JSON list of Recipe IDs, ready for Migration - add_action( 'wp_ajax_cooked_get_migrate_ids', array(&$this,'get_migrate_ids') ); + add_action( 'wp_ajax_cooked_get_migrate_ids', [&$this, 'get_migrate_ids'] ); // Migrate Recipes - add_action( 'wp_ajax_cooked_migrate_recipes', array(&$this,'migrate_recipes') ); + add_action( 'wp_ajax_cooked_migrate_recipes', [&$this, 'migrate_recipes'] ); } public function get_migrate_ids() { @@ -65,9 +65,9 @@ public function get_migrate_ids() { public function migrate_recipes() { $bulk_amount = 10; - if ( !current_user_can('edit_others_cp_recipes') ): + if (!current_user_can('edit_others_cp_recipes')) { wp_die(); - endif; + } if ( isset($_POST['recipe_ids']) ): @@ -101,12 +101,16 @@ public function migrate_recipes() { // Migrate the recipe settings. update_post_meta( $rid, '_recipe_settings', $recipe_settings ); - $recipe_excerpt = ( isset($recipe_settings['excerpt']) && $recipe_settings['excerpt'] ? $recipe_settings['excerpt'] : get_the_title( $rid ) ); + $recipe_excerpt = isset($recipe_settings['excerpt']) && $recipe_settings['excerpt'] ? $recipe_settings['excerpt'] : get_the_title( $rid ); $seo_content = apply_filters( 'cooked_seo_recipe_content', '[cooked-excerpt]

' . __('Ingredients','cooked') . '

[cooked-ingredients checkboxes=false]

' . __('Directions','cooked') . '

[cooked-directions numbers=false]' ); $seo_content = do_shortcode( $seo_content ); - wp_update_post( array( 'ID' => $rid, 'post_excerpt' => $recipe_excerpt, 'post_content' => $seo_content ) ); + wp_update_post([ + 'ID' => $rid, + 'post_excerpt' => $recipe_excerpt, + 'post_content' => $seo_content + ]); endif; endforeach; @@ -128,73 +132,68 @@ public function migrate_recipes() { } public function get_recipe_ids() { - if (!wp_verify_nonce($_POST['nonce'], 'cooked_save_default_bulk') && !current_user_can('read_cp_recipe') ): + if (!wp_verify_nonce($_POST['nonce'], 'cooked_save_default_bulk') || !current_user_can('edit_cooked_default_template')) { wp_die(); - endif; + } - $args = array( + $args = [ 'post_type' => 'cp_recipe', 'posts_per_page' => -1, 'post_status' => 'any', 'fields' => 'ids' - ); + ]; - $_recipe_ids = Cooked_Recipes::get( $args, false, true ); - echo wp_json_encode( $_recipe_ids ); + $_recipe_ids = Cooked_Recipes::get($args, false, true); + echo wp_json_encode($_recipe_ids); wp_die(); } public function save_default_bulk() { $bulk_amount = 5; - if (!wp_verify_nonce($_POST['nonce'], 'cooked_save_default_bulk') && !current_user_can('edit_cp_recipes') ): + if (!wp_verify_nonce($_POST['nonce'], 'cooked_save_default_bulk') || !current_user_can('edit_cooked_default_template')) { wp_die(); - endif; - - if ( isset($_POST['recipe_ids']) ): + } - // Sanitize Recipe IDs - $recipe_ids = json_decode( $_POST['recipe_ids'], true ); - if ( is_array( $recipe_ids ) && !empty( $recipe_ids ) ): + if (isset($_POST['recipe_ids'])) { + $recipe_ids = json_decode($_POST['recipe_ids'], true); + if (is_array($recipe_ids) && !empty($recipe_ids)) { $_recipe_ids = []; - foreach( $recipe_ids as $_rid ): - $safe_id = intval( $_rid ); - if ( $safe_id ): + foreach ($recipe_ids as $_rid) { + $safe_id = intval($_rid); + if ($safe_id) { $_recipe_ids[] = $_rid; - endif; - endforeach; + } + } $recipe_ids = $_recipe_ids; - else: + } else { return false; - endif; + } - $leftover_recipe_ids = array_slice( $recipe_ids, $bulk_amount ); - $recipe_ids = array_slice( $recipe_ids, 0, $bulk_amount ); + $leftover_recipe_ids = array_slice($recipe_ids, $bulk_amount); + $recipe_ids = array_slice($recipe_ids, 0, $bulk_amount); - if ( empty($recipe_ids) ): + if (empty($recipe_ids)) { echo 'false'; wp_die(); - else: - - foreach( $recipe_ids as $rid ): - $recipe_settings = get_post_meta( $rid, '_recipe_settings', true ); - if ( !empty( $recipe_settings ) ): - $recipe_settings['content'] = wp_kses_post( $_POST['default_content'] ); - update_post_meta( $rid, '_recipe_settings', $recipe_settings ); - endif; - endforeach; - - if ( !empty( $leftover_recipe_ids ) ): - echo wp_json_encode( $leftover_recipe_ids ); + } else { + foreach ($recipe_ids as $rid) { + $recipe_settings = get_post_meta($rid, '_recipe_settings', true); + if (!empty($recipe_settings)) { + $recipe_settings['content'] = wp_kses_post($_POST['default_content']); + update_post_meta($rid, '_recipe_settings', $recipe_settings); + } + } + + if (!empty($leftover_recipe_ids)) { + echo wp_json_encode($leftover_recipe_ids); wp_die(); - else: + } else { echo 'false'; wp_die(); - endif; - - endif; - - endif; + } + } + } wp_die(); } @@ -202,11 +201,11 @@ public function save_default_bulk() { public function save_default() { global $_cooked_settings; - if (!wp_verify_nonce($_POST['nonce'], 'cooked_save_default') && !current_user_can('edit_cooked_default_template') ) { + if (!wp_verify_nonce($_POST['nonce'], 'cooked_save_default') || !current_user_can('edit_cooked_default_template')) { wp_die(); } - if ( isset($_POST['default_content']) ) { + if (isset($_POST['default_content'])) { $_cooked_settings['default_content'] = wp_kses_post( $_POST['default_content'] ); update_option('cooked_settings', $_cooked_settings); } else { @@ -217,21 +216,20 @@ public function save_default() { } public function load_default() { + global $_cooked_settings; - if ( !current_user_can('edit_cp_recipes') ) { + if (!current_user_can('edit_cp_recipes')) { wp_die(); } - global $_cooked_settings; - if ( isset($_cooked_settings['default_content']) ) { - $default_content = stripslashes( $_cooked_settings['default_content'] ); + if (isset($_cooked_settings['default_content'])) { + $default_content = stripslashes($_cooked_settings['default_content']); } else { $default_content = Cooked_Recipes::default_content(); } - echo wp_kses_post( $default_content ); + echo wp_kses_post($default_content); wp_die(); } - } diff --git a/includes/class.cooked-functions.php b/includes/class.cooked-functions.php index c272668..9263222 100644 --- a/includes/class.cooked-functions.php +++ b/includes/class.cooked-functions.php @@ -12,13 +12,13 @@ class Cooked_Functions { - public static function sanitize_text_field( $text ){ + public static function sanitize_text_field( $text ) { $text = htmlentities( stripslashes( $text ) ); $text = sanitize_text_field( $text ); return $text; } - public static function array_splice_assoc( &$input, $offset, $length, $replacement = array() ) { + public static function array_splice_assoc( &$input, $offset, $length, $replacement = [] ) { $replacement = (array) $replacement; @@ -71,13 +71,13 @@ public static function wpml_xml( $cooked_settings_tabs_fields ) { echo '
'; } - public static function hex2rgb( $hex ){ + public static function hex2rgb( $hex ) { list( $r,$g,$b ) = sscanf( $hex, "#%02x%02x%02x" ); - $rgb_array = array( $r, $g, $b ); + $rgb_array = [$r, $g, $b]; return implode( ',',$rgb_array ); } - public static function parse_readme_changelog( $readme_url = false, $title = false ){ + public static function parse_readme_changelog( $readme_url = false, $title = false ) { ob_start(); include ( !$readme_url ? COOKED_DIR . 'readme.txt' : $readme_url ); @@ -135,7 +135,7 @@ public static function print_options() { } - public static function print_options_js(){ + public static function print_options_js() { ?>