PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 2.2.10
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v2.2.10
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
← All changes | admin/views/sp-framework/assets/js/spf.js +9 -167 2.4.11 → 2.2.10 View file →
@@ -3033,38 +3033,32 @@
3033 3033 event.preventDefault()
3034 3034 var data = {
3035 3035 action: 'sps_get_taxonomies',
3036 3036 pcp_post_types: $(this).val(),
3037 - nonce: $('#spf_pcp_metabox_noncesp_pcp_view_options').val()
3037 + ajax_nonce: $('#spf_pcp_metabox_noncesp_pcp_view_options').val()
3038 3038 }
3039 - $.post(ajaxurl, data, function (response) {
3040 - $('.sp_pcp_post_taxonomy select').html(response)
3039 + $.post(ajaxurl, data, function (resp) {
3040 + $('.sp_pcp_post_taxonomy select').html(resp)
3041 3041 $('.sp_pcp_post_taxonomy select').trigger('chosen:updated')
3042 3042 })
3043 3043 })
3044 +
3044 3045 // Update terms list on the change of post taxonomy.
3045 - $(document).on('change', '.sp_pcp_post_taxonomy select', function (e) {
3046 - e.preventDefault();
3046 + $('.sp_pcp_post_taxonomy select').change(function (event) {
3047 + event.preventDefault()
3047 3048 var taxSelector = $(this)
3048 3049 var data = {
3049 3050 action: 'sps_get_terms', // Callback function.
3050 3051 pcp_post_taxonomy: $(this).val(),
3051 - nonce: $('#spf_pcp_metabox_noncesp_pcp_view_options').val()
3052 + ajax_nonce: $('#spf_pcp_metabox_noncesp_pcp_view_options').val()
3052 3053 }
3053 - $.ajax({
3054 - type: "POST",
3055 - url: ajaxurl,
3056 - data: data,
3057 - error: function (response) {
3058 - console.log(response)
3059 - },
3060 - success: function (response) {
3054 + $.post(ajaxurl, data, function (resp) {
3061 3055 $(taxSelector)
3062 3056 .parent()
3063 3057 .parent('.sp_pcp_post_taxonomy')
3064 3058 .next('.sp_pcp_taxonomy_terms')
3065 3059 .find('select')
3066 - .html(response)
3060 + .html(resp)
3067 3061 $(taxSelector)
3068 3062 .parent()
3069 3063 .parent('.sp_pcp_post_taxonomy')
3070 3064 .next('.sp_pcp_taxonomy_terms')
@@ -3069,9 +3063,8 @@
3069 3063 .parent('.sp_pcp_post_taxonomy')
3070 3064 .next('.sp_pcp_taxonomy_terms')
3071 3065 .find('select')
3072 3066 .trigger('chosen:updated')
3073 - }
3074 3067 })
3075 3068 })
3076 3069
3077 3070 // Populate specific post list in the drop-down.
@@ -3159,157 +3152,6 @@
3159 3152
3160 3153 $('.post_content_sorter .spf--sortable-item:has(div.pcp-pro-only)').css({"pointer-events": "none", "borderColor": "#bebebe"});
3161 3154 $('.post_content_sorter .spf--sortable-item:has(div.pcp-pro-only)').find('h4.spf-accordion-title, .spf--sortable-helper').css({"backgroundColor": "#f0f0f0", "color": "#777", "marginLeft": "0", "paddingRight": "0"});
3162 3155 $('.post_content_sorter .spf--sortable-item:has(div.pcp-pro-only)').find('.spf--sortable-helper .fa').css("color", "#777");
3163 -
3164 -
3165 -
3166 - var preview_box = $('#spsp-preview-box');
3167 - var pcp_display = $('#sp_pcp_display').hide();
3168 -
3169 - // $('#spsp-show-preview:contains(Hide)').
3170 - $(document).on('click','#spsp-show-preview:contains(Hide)', function (e) {
3171 - e.preventDefault();
3172 - var _this = $( this );
3173 - _this.html('<i class="fa fa-eye" aria-hidden="true"></i> Show Preview');
3174 - preview_box.html('');
3175 - pcp_display.hide();
3176 - });
3177 - $(document).on('click', '#spsp-show-preview:not(:contains(Hide))', function (e) {
3178 - e.preventDefault();
3179 - /// console.log(ajaxurl);
3180 - var _data = $( 'form#post' ).serialize();
3181 - var _this = $( this );
3182 - // console.log(_data);
3183 - var $sp_id = $(this).data('id');
3184 - var data = {
3185 - action: 'spf_preview_meta_box',
3186 - id: $sp_id,
3187 - data: _data,
3188 - nonce: $('#spf_pcp_metabox_noncesp_pcp_view_options').val()
3189 - };
3190 - $.ajax({
3191 - type: "POST",
3192 - url: ajaxurl,
3193 - data: data,
3194 - error: function (response) {
3195 - console.log(response)
3196 - },
3197 - success: function (response) {
3198 - pcp_display.show();
3199 - preview_box.html(response);
3200 -
3201 - _this.html('<i class="fa fa-eye-slash" aria-hidden="true"></i> Hide Preview');
3202 - // console.log(response)
3203 - $(document).on('change', '#sp_pcp_view_options', function (e) {
3204 - e.preventDefault();
3205 - // if(_this.html().indexOf('Hide')){
3206 - _this.html('<i class="fa fa-refresh" aria-hidden="true"></i> Update Preview');
3207 - // }
3208 -
3209 - // console.log(_this+ ':conatain(hide)');
3210 - // console.log($('#spsp-show-preview:contains(Hide)'));
3211 - });
3212 - $(document).on('change', '#spf-section-sp_pcp_layouts_1', function (e) {
3213 - e.preventDefault();
3214 - // if(_this.html().indexOf('Hide')){
3215 - _this.html('<i class="fa fa-refresh" aria-hidden="true"></i> Update Preview');
3216 - // }
3217 -
3218 - });
3219 - $("html, body").animate({ scrollTop: pcp_display.offset().top - 50 }, "slow");
3220 - // $("html, body").animate({ scrollTop: 50}, "slow");
3221 - }
3222 - })
3223 - });
3224 -
3225 - // Smart-post-show export.
3226 - var $export_type = $('.pcp_what_export').find('input:checked').val();
3227 - $('.pcp_what_export').on('change', function () {
3228 - $export_type = $(this).find('input:checked').val();
3229 - });
3230 -
3231 - $('.pcp_export .spf--button').click(function (event) {
3232 - event.preventDefault();
3233 -
3234 - var $shortcode_ids = $('.pcp_post_ids select').val();
3235 - var $ex_nonce = $('#spf_options_noncesp_post_carousel_tools').val();
3236 - var selected_shortcode = $export_type === 'selected_shortcodes' ? $shortcode_ids : 'all_shortcodes';
3237 - if ($export_type === 'all_shortcodes' || $export_type === 'selected_shortcodes') {
3238 - var data = {
3239 - action: 'pcp_export_shortcodes',
3240 - pcp_ids: selected_shortcode,
3241 - nonce: $ex_nonce,
3242 - }
3243 - } else {
3244 - $('.spf-form-result.spf-form-success').text('No carousel selected.').show();
3245 - setTimeout(function () {
3246 - $('.spf-form-result.spf-form-success').hide().text('');
3247 - }, 3000);
3248 - }
3249 - $.post(ajaxurl, data, function (resp) {
3250 - if (resp) {
3251 - // Convert JSON Array to string.
3252 - var json = JSON.stringify(resp);
3253 - // Convert JSON string to BLOB.
3254 - json = [json];
3255 - var blob = new Blob(json);
3256 - var link = document.createElement('a');
3257 - var pcp_time = $.now();
3258 - link.href = window.URL.createObjectURL(blob);
3259 - link.download = "smart-post-show-" + pcp_time + ".json";
3260 - link.click();
3261 - $('.spf-form-result.spf-form-success').text('Exported successfully!').show();
3262 - setTimeout(function () {
3263 - $('.spf-form-result.spf-form-success').hide().text('');
3264 - $('.pcp_post_ids select').val('').trigger('chosen:updated');
3265 - }, 3000);
3266 - }
3267 - });
3268 - });
3269 - // smart-post-show import.
3270 - $('.pcp_import button.import').click(function (event) {
3271 - event.preventDefault();
3272 - var pcp_shortcodes = $('#import').prop('files')[0];
3273 - if ($('#import').val() != '') {
3274 - var $im_nonce = $('#spf_options_noncesp_post_carousel_tools').val();
3275 - var reader = new FileReader();
3276 - reader.readAsText(pcp_shortcodes);
3277 - reader.onload = function (event) {
3278 - var jsonObj = JSON.stringify(event.target.result);
3279 - $.ajax({
3280 - url: ajaxurl,
3281 - type: 'POST',
3282 - data: {
3283 - shortcode: jsonObj,
3284 - action: 'pcp_import_shortcodes',
3285 - nonce: $im_nonce,
3286 - },
3287 - success: function (resp) {
3288 - $('.spf-form-result.spf-form-success').text('Imported successfully!').show();
3289 - setTimeout(function () {
3290 - $('.spf-form-result.spf-form-success').hide().text('');
3291 - $('#import').val('');
3292 - window.location.replace($('#pcp_shortcode_link_redirect').attr('href'));
3293 - }, 2000);
3294 - }
3295 - });
3296 - }
3297 - } else {
3298 - $('.spf-form-result.spf-form-success').text('No exported json file chosen.').show();
3299 - setTimeout(function () {
3300 - $('.spf-form-result.spf-form-success').hide().text('');
3301 - }, 3000);
3302 - }
3303 - });
3304 -
3305 - $(document).on('keyup change', '.sp_post_carousel_page_pcp_settings #spf-form', function (e) {
3306 - e.preventDefault();
3307 - var $button = $(this).find('.spf-save');
3308 - $button.css({"background-color": "#00C263", "pointer-events": "initial"}).val('Save Settings');
3309 - });
3310 - $('.sp_post_carousel_page_pcp_settings .spf-save').click(function(e) {
3311 - e.preventDefault();
3312 - $(this).css({"background-color": "#C5C5C6","pointer-events": "none"}).val('Changes Saved');
3313 -})
3314 3156
3315 3157 })(jQuery, window, document)