# post-carousel/2.4.1/admin/assets/js/post-carousel-admin.js

Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog &amp; News, version 2.4.1. 119 lines.

- Page: https://pluginprobe.com/plugins/post-carousel/2.4.1/code/admin/assets/js/post-carousel-admin.js
- Raw: https://pluginprobe.com/plugins/post-carousel/2.4.1/raw/admin/assets/js/post-carousel-admin.js
- Modified: 2021-11-06T05:45:56+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/post-carousel/2.4.1/code/admin/assets/js/post-carousel-admin.js#L10-L20`.

```javascript
; (function ($) {
  'use strict'

  /**
   * JavaScript code for admin dashboard.
   *
   */

  $(function () {
    /* Preloader */
    $("#sp_pcp_view_options .spf-metabox").css("visibility", "hidden");

    var PCP_layout_type = $(
      '#spf-section-sp_pcp_layouts_1 .spf-field-layout_preset .spf-siblings .spf--sibling'
    )
    var PCP_get_layout_value = $(
      '#spf-section-sp_pcp_layouts_1 .spf-field-layout_preset .spf-siblings .spf--sibling.spf--active'
    )
      .find('input')
      .val()

    // Carousel Layout.
    if (PCP_get_layout_value !== 'carousel_layout') {
      $(
        '#sp_pcp_view_options .spf-nav ul li.menu-item_sp_pcp_view_options_3'
      ).hide();
      $(
        '#sp_pcp_view_options .spf-nav ul li.menu-item_sp_pcp_view_options_1 a'
      ).click();
    } else {
      $(
        '#sp_pcp_view_options .spf-nav ul li.menu-item_sp_pcp_view_options_3'
      ).show()
    }

    /**
     * Show/Hide tabs on changing of layout.
     */
    $(PCP_layout_type).on('change', 'input', function (event) {
      //event.stopPropagation()
      var PCP_get_layout_value = $(this).val();

      // Carousel Layout.
      if (PCP_get_layout_value !== 'carousel_layout') {
        $(
          '#sp_pcp_view_options .spf-nav ul li.menu-item_sp_pcp_view_options_3'
        ).hide();
        $(
          '#sp_pcp_view_options .spf-nav ul li.menu-item_sp_pcp_view_options_1 a'
        ).click();
      } else {
        $(
          '#sp_pcp_view_options .spf-nav ul li.menu-item_sp_pcp_view_options_3'
        ).show()
      }
    })

    /* Preloader js */
    $("#sp_pcp_view_options .spf-metabox").css({ "backgroundImage": "none", "visibility": "visible", "minHeight": "auto" });
    $("#sp_pcp_view_options .spf-nav-metabox li").css("opacity", 1);

      /* Copy to clipboard */
  $('.pcp-shortcode-selectable').click(function (e) {
    e.preventDefault();
    pcp_copyToClipboard($(this));
    pcp_SelectText($(this));
    $(this).focus().select();
    $('.pcp-after-copy-text').animate({
      opacity: 1,
      bottom: 25
    }, 300);
    setTimeout(function () {
      jQuery(".pcp-after-copy-text").animate({
        opacity: 0,
      }, 200);
      jQuery(".pcp-after-copy-text").animate({
        bottom: 0
      }, 0);
    }, 2000);
  });
  $('.sp_pcp_input').click(function (e) {
    e.preventDefault();
    /* Get the text field */
    var copyText = $(this);
    /* Select the text field */
    copyText.select();
    document.execCommand("copy");
    $('.pcp-after-copy-text').animate({
      opacity: 1,
      bottom: 25
    }, 300);
    setTimeout(function () {
      jQuery(".pcp-after-copy-text").animate({
        opacity: 0,
      }, 200);
      jQuery(".pcp-after-copy-text").animate({
        bottom: 0
      }, 0);
    }, 2000);
  });
   function pcp_copyToClipboard(element) {
      var $temp = $("<input>");
      $("body").append($temp);
      $temp.val($(element).text()).select();
      document.execCommand("copy");
      $temp.remove();
    }
    function pcp_SelectText(element) {
      var r = document.createRange();
      var w = element.get(0);
      r.selectNodeContents(w);
      var sel = window.getSelection();
      sel.removeAllRanges();
      sel.addRange(r);
    }

  })
})(jQuery)

```
