PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.0.8
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.0.8
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
visualizer / js / frame.js

frame.js in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.0.8, at js/frame.js

212 lines 8.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /* global prompt */
2 /* global visualizer */
3 /* global alert */
4
5 (function ($) {
6 $(window).load(function(){
7 // scroll to the selected chart type.
8 if($('label.type-label.type-label-selected').length > 0) {
9 $('label.type-label.type-label-selected')[0].scrollIntoView();
10 }
11 });
12
13 $(document).ready(function () {
14 init_permissions();
15
16 $('.type-radio').change(function () {
17 $('.type-label-selected').removeClass('type-label-selected');
18 $(this).parent().addClass('type-label-selected');
19 });
20
21 $('#vz-chart-settings h2').click(function () {
22 $("#vz-chart-source").hide();
23 $("#vz-chart-permissions").removeClass('open').addClass('bottom-fixed');
24 $(this).parent().removeClass('bottom-fixed').addClass('open');
25 $("#vz-chart-permissions .viz-group-header").hide();
26 return false;
27 });
28 $('#vz-chart-settings .customize-section-back').click(function () {
29 $("#vz-chart-source").show();
30 $(this).parent().parent().removeClass('open').addClass('bottom-fixed');
31
32 return false;
33 });
34 $('.viz-group-title').click(function () {
35 var parent = $(this).parent();
36
37 if (parent.hasClass('open')) {
38 parent.removeClass('open');
39 } else {
40 parent.parent().find('.viz-group.open').removeClass('open');
41 parent.addClass('open');
42 }
43 });
44 $('#view-remote-file').click(function () {
45 var url = $(this).parent().find('#remote-data').val();
46
47 if (url !== '') {
48 if (/^([a-z]([a-z]|\d|\+|-|\.)*):(\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900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})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(url)) {
49 if (url.substr(url.length - 8) === '/pubhtml') {
50 url = url.substring(0, url.length - 8) + '/export?format=csv';
51 }
52
53 $('#canvas').lock();
54 $(this).parent().submit();
55 } else {
56 alert(visualizer.l10n.invalid_source);
57 }
58 }
59 });
60
61 $('#vz-import-file').click(function (e) {
62 e.preventDefault();
63 if ($.trim($(this).parent().find("#csv-file").val()) !== '') {
64 $('#canvas').lock();
65 $(this).parent().submit();
66 }
67 });
68
69 $('#thehole').load(function () {
70 $('#canvas').unlock();
71 });
72
73 $('.viz-section-title').click(function () {
74 $(this).toggleClass('open').parent().find('.viz-section-items').toggle();
75 });
76
77 $('.more-info').click(function () {
78 $(this).parent().find('.viz-section-description:first').toggle();
79 return false;
80 });
81
82 $('#cancel-button').click(function () {
83 $('#cancel-form').submit();
84 });
85
86 });
87
88 function init_permissions(){
89 $('#vz-chart-permissions h2').click(function () {
90 $("#vz-chart-source").hide();
91 $("#vz-chart-permissions .viz-group-header").show();
92 $("#vz-chart-settings").removeClass('open').addClass('bottom-fixed');
93
94 $('#settings-button').click(function(e) {
95 e.preventDefault();
96 $('#permissions-form').submit();
97 $('#settings-form').submit();
98 });
99
100 $(this).parent().removeClass('bottom-fixed').addClass('open');
101
102 return false;
103 });
104 $('#vz-chart-permissions .customize-section-back').click(function () {
105 $("#vz-chart-source").show();
106
107 $("#vz-chart-permissions .viz-group-header").hide();
108 $('#settings-button').click(function(e) {
109 e.preventDefault();
110 $('#settings-form').submit();
111 });
112
113 $(this).parent().parent().removeClass('open').addClass('bottom-fixed');
114
115 return false;
116 });
117
118 $('.visualizer-permission').chosen({
119 width : '50%',
120 search_contains : true
121 });
122
123 $('.visualizer-permission-type').each(function(x, y){
124 var type = $(y).attr('data-visualizer-permission-type');
125 var child = $('.visualizer-permission-' + type + '-specific');
126 if($(y).val() === 'all'){
127 child.next('div.chosen-container').hide();
128 return;
129 }
130 });
131
132 $('.visualizer-permission-type').on('change', function(evt, params) {
133 var type = $(this).attr('data-visualizer-permission-type');
134 var child = $('.visualizer-permission-' + type + '-specific');
135 child.empty();
136 if(params.selected === 'all'){
137 child.next('div.chosen-container').hide();
138 return;
139 } else {
140 child.next('div.chosen-container').show();
141 }
142 child.append('<option value="">' + visualizer.l10n['loading'] + '</option>').trigger('chosen:updated');
143 $.ajax({
144 url : visualizer.ajax['url'],
145 method : 'post',
146 data : {
147 'action' : visualizer.ajax['actions']['permissions'],
148 'nonce' : visualizer.ajax['nonces']['permissions'],
149 'type' : params.selected
150 },
151 success : function(d, textStatus, XMLHttpRequest){
152 if(d.success) {
153 child.empty();
154 $.each(d.data, function(k, v){
155 child.append('<option value="' + k + '">' + v + '</option>');
156 });
157 child.trigger('chosen:updated');
158 }
159 }
160 });
161 });
162 }
163 })(jQuery);
164
165 (function ($) {
166 $.fn.lock = function () {
167 $(this).each(function () {
168 var $this = $(this);
169 var position = $this.css('position');
170
171 if (!position) {
172 position = 'static';
173 }
174
175 switch (position) {
176 case 'absolute':
177 case 'relative':
178 break;
179 default:
180 $this.css('position', 'relative');
181 break;
182 }
183 $this.data('position', position);
184
185 var width = $this.width(),
186 height = $this.height();
187
188 var locker = $('<div class="locker"></div>');
189 locker.width(width).height(height);
190
191 var loader = $('<div class="locker-loader"></div>');
192 loader.width(width).height(height);
193
194 locker.append(loader);
195 $this.append(locker);
196 $(window).resize(function () {
197 $this.find('.locker,.locker-loader').width($this.width()).height($this.height());
198 });
199 });
200
201 return $(this);
202 };
203
204 $.fn.unlock = function () {
205 $(this).each(function () {
206 $(this).find('.locker').remove();
207 $(this).css('position', $(this).data('position'));
208 });
209
210 return $(this);
211 };
212 })(jQuery);