PluginProbe
Essential Widgets / 2.0
Essential Widgets v2.0
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 2.0, at admin/js/admin-scripts.js

102 lines 2.4 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(
42 'click',
43 function (e) {
44 e.preventDefault();
45
46 if (!$(this).hasClass('ui-state-active')) {
47 $('.nav-tab').removeClass('nav-tab-active');
48 $('.wpcatchtab').removeClass('active').fadeOut(0);
49
50 $(this).addClass('nav-tab-active');
51
52 var anchorAttr = $(this).attr('href');
53
54 $(anchorAttr).addClass('active').fadeOut(0).fadeIn(500);
55 }
56 }
57 );
58 });
59
60 // jQuery Match Height init for sidebar spots
61 $(document).ready(function () {
62 $(
63 '.catchp-sidebar-spot .sidebar-spot-inner, .col-2 .catchp-lists li, .col-3 .catchp-lists li, .catch-modules'
64 ).matchHeight();
65 });
66
67 $(function () {
68 /* CPT switch */
69 $('.ctp-switch').on('click', function () {
70 var loader = $(this).parent().next();
71
72 loader.show();
73
74 var main_control = $(this);
75 var ew_switch_tabs_nonce = main_control.prev('input').val();
76 var data = {
77 action: 'ctp_switch',
78 value: this.checked,
79 security: ew_switch_tabs_nonce,
80 option_name: main_control.attr('rel'),
81 };
82
83 $.post(ajaxurl, data, function (response) {
84 console.log('asdfsdf');
85 response = $.trim(response);
86
87 if ('1' == response) {
88 main_control.parent().parent().addClass('active');
89 main_control.parent().parent().removeClass('inactive');
90 } else if ('0' == response) {
91 main_control.parent().parent().addClass('inactive');
92 main_control.parent().parent().removeClass('active');
93 } else {
94 alert(response);
95 }
96 loader.hide();
97 });
98 });
99 /* CPT switch End */
100 });
101 })(jQuery);
102