PluginProbe
Essential Widgets / trunk
Essential Widgets vtrunk
3.2.1 3.3 3.2 trunk 1.0.0 1.0.1 1.1 1.2 1.2.1 1.2.2 1.3 1.4 1.4.1 1.5 1.6 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.8 1.9 2.0 2.1 2.2 All 31 releases
essential-widgets / admin / js / admin-scripts.js

admin-scripts.js in Essential Widgets trunk, at admin/js/admin-scripts.js

98 lines 2.6 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 $(function () {
5 /* For Input Switch */
6 $(".input-switch").on("click", function () {
7 var loader = $(this).parent().next();
8
9 loader.show();
10
11 var main_control = $(this);
12 var ew_nonce = main_control.prev("input").val();
13 var data = {
14 action: "ew_switch",
15 value: this.checked,
16 security: ew_nonce,
17 option_name: main_control.attr("rel"),
18 };
19
20 $.post(ajaxurl, data, function (response) {
21 response = $.trim(response);
22
23 if ("1" == response) {
24 main_control.parent().parent().addClass("active");
25 main_control.parent().parent().removeClass("inactive");
26 } else if ("0" == response) {
27 main_control.parent().parent().addClass("inactive");
28 main_control.parent().parent().removeClass("active");
29 } else {
30 alert(response);
31 }
32
33 loader.hide();
34 });
35 });
36 /* For Input Switch End */
37 });
38
39 $(function () {
40 // Tabs
41 $(".catchp_widget_settings .nav-tab-wrapper a").on("click", function (e) {
42 e.preventDefault();
43
44 if (!$(this).hasClass("ui-state-active")) {
45 $(".nav-tab").removeClass("nav-tab-active");
46 $(".wpcatchtab").removeClass("active").fadeOut(0);
47
48 $(this).addClass("nav-tab-active");
49
50 var anchorAttr = $(this).attr("href");
51
52 $(anchorAttr).addClass("active").fadeOut(0).fadeIn(500);
53 }
54 });
55 });
56
57 // jQuery Match Height init for sidebar spots
58 $(document).ready(function () {
59 $(
60 ".catchp-sidebar-spot .sidebar-spot-inner, .col-2 .catchp-lists li, .col-3 .catchp-lists li, .catch-modules",
61 ).matchHeight();
62 });
63
64 $(function () {
65 /* CPT switch */
66 $(".ctp-switch").on("click", function () {
67 var loader = $(this).parent().next();
68
69 loader.show();
70
71 var main_control = $(this);
72 var ew_switch_tabs_nonce = main_control.prev("input").val();
73 var data = {
74 action: "ctp_switch",
75 value: this.checked,
76 security: ew_switch_tabs_nonce,
77 option_name: main_control.attr("rel"),
78 };
79
80 $.post(ajaxurl, data, function (response) {
81 response = $.trim(response);
82
83 if ("1" == response) {
84 main_control.parent().parent().addClass("active");
85 main_control.parent().parent().removeClass("inactive");
86 } else if ("0" == response) {
87 main_control.parent().parent().addClass("inactive");
88 main_control.parent().parent().removeClass("active");
89 } else {
90 alert(response);
91 }
92 loader.hide();
93 });
94 });
95 /* CPT switch End */
96 });
97 })(jQuery);
98