PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 2.4.1
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v2.4.1
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
post-carousel / admin / assets / js / post-carousel-admin.js

post-carousel-admin.js in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 2.4.1, at admin/assets/js/post-carousel-admin.js

119 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 ; (function ($) {
2 'use strict'
3
4 /**
5 * JavaScript code for admin dashboard.
6 *
7 */
8
9 $(function () {
10 /* Preloader */
11 $("#sp_pcp_view_options .spf-metabox").css("visibility", "hidden");
12
13 var PCP_layout_type = $(
14 '#spf-section-sp_pcp_layouts_1 .spf-field-layout_preset .spf-siblings .spf--sibling'
15 )
16 var PCP_get_layout_value = $(
17 '#spf-section-sp_pcp_layouts_1 .spf-field-layout_preset .spf-siblings .spf--sibling.spf--active'
18 )
19 .find('input')
20 .val()
21
22 // Carousel Layout.
23 if (PCP_get_layout_value !== 'carousel_layout') {
24 $(
25 '#sp_pcp_view_options .spf-nav ul li.menu-item_sp_pcp_view_options_3'
26 ).hide();
27 $(
28 '#sp_pcp_view_options .spf-nav ul li.menu-item_sp_pcp_view_options_1 a'
29 ).click();
30 } else {
31 $(
32 '#sp_pcp_view_options .spf-nav ul li.menu-item_sp_pcp_view_options_3'
33 ).show()
34 }
35
36 /**
37 * Show/Hide tabs on changing of layout.
38 */
39 $(PCP_layout_type).on('change', 'input', function (event) {
40 //event.stopPropagation()
41 var PCP_get_layout_value = $(this).val();
42
43 // Carousel Layout.
44 if (PCP_get_layout_value !== 'carousel_layout') {
45 $(
46 '#sp_pcp_view_options .spf-nav ul li.menu-item_sp_pcp_view_options_3'
47 ).hide();
48 $(
49 '#sp_pcp_view_options .spf-nav ul li.menu-item_sp_pcp_view_options_1 a'
50 ).click();
51 } else {
52 $(
53 '#sp_pcp_view_options .spf-nav ul li.menu-item_sp_pcp_view_options_3'
54 ).show()
55 }
56 })
57
58 /* Preloader js */
59 $("#sp_pcp_view_options .spf-metabox").css({ "backgroundImage": "none", "visibility": "visible", "minHeight": "auto" });
60 $("#sp_pcp_view_options .spf-nav-metabox li").css("opacity", 1);
61
62 /* Copy to clipboard */
63 $('.pcp-shortcode-selectable').click(function (e) {
64 e.preventDefault();
65 pcp_copyToClipboard($(this));
66 pcp_SelectText($(this));
67 $(this).focus().select();
68 $('.pcp-after-copy-text').animate({
69 opacity: 1,
70 bottom: 25
71 }, 300);
72 setTimeout(function () {
73 jQuery(".pcp-after-copy-text").animate({
74 opacity: 0,
75 }, 200);
76 jQuery(".pcp-after-copy-text").animate({
77 bottom: 0
78 }, 0);
79 }, 2000);
80 });
81 $('.sp_pcp_input').click(function (e) {
82 e.preventDefault();
83 /* Get the text field */
84 var copyText = $(this);
85 /* Select the text field */
86 copyText.select();
87 document.execCommand("copy");
88 $('.pcp-after-copy-text').animate({
89 opacity: 1,
90 bottom: 25
91 }, 300);
92 setTimeout(function () {
93 jQuery(".pcp-after-copy-text").animate({
94 opacity: 0,
95 }, 200);
96 jQuery(".pcp-after-copy-text").animate({
97 bottom: 0
98 }, 0);
99 }, 2000);
100 });
101 function pcp_copyToClipboard(element) {
102 var $temp = $("<input>");
103 $("body").append($temp);
104 $temp.val($(element).text()).select();
105 document.execCommand("copy");
106 $temp.remove();
107 }
108 function pcp_SelectText(element) {
109 var r = document.createRange();
110 var w = element.get(0);
111 r.selectNodeContents(w);
112 var sel = window.getSelection();
113 sel.removeAllRanges();
114 sel.addRange(r);
115 }
116
117 })
118 })(jQuery)
119