PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.5.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.5.0
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
← All changes | js/library.js +55 -5 3.0.83.5.0 View file →
@@ -1,5 +1,7 @@
1 1 /* global visualizer */
2 +/* global alert */
3 +
2 4 (function (wpmv) {
3 5 var vm, vmv;
4 6
5 7 vm = visualizer.media = {};
@@ -20,9 +22,13 @@
20 22 self.createIframeStates();
21 23 },
22 24
23 25 open: function () {
24 - wpmv.MediaFrame.prototype.open.apply(this, arguments);
26 + try{
27 + wpmv.MediaFrame.prototype.open.apply(this, arguments);
28 + }catch(error){
29 + alert(visualizer.i10n.conflict);
30 + }
25 31 this.$el.addClass('hide-menu');
26 32 }
27 33 });
28 34 })(wp.media.view);
@@ -42,10 +48,27 @@
42 48
43 49 $('.visualizer-chart-canvas').adjust();
44 50
45 51 $(document).ready(function () {
46 - $('.visualizer-chart, .visualizer-library-pagination').fadeIn(500);
52 + // clears the filters in the library form and submits.
53 + $('#viz-lib-reset').on('click', function(e){
54 + e.preventDefault();
55 + $(this).parent('form')[0].reset();
56 + $(this).parent('form').find('.viz-filter').each(function(index, el){
57 + var tag = $(el).prop('tagName').toLowerCase() + (typeof $(el).attr('type') !== 'undefined' ? $(el).attr('type').toLowerCase() : '');
58 + switch(tag){
59 + case 'select':
60 + $(el).prop('selectedIndex', 0);
61 + break;
62 + case 'inputtext':
63 + $(el).val('');
64 + break;
65 + }
47 66
67 + });
68 + $(this).parent('form').submit();
69 + });
70 +
48 71 $('.visualizer-chart-shortcode').click(function (e) {
49 72 var range, selection;
50 73
51 74 if (window.getSelection && document.createRange) {
@@ -60,14 +83,25 @@
60 83 range.select();
61 84 }
62 85 });
63 86
64 - $('.add-new-h2').click(function () {
87 + $('.add-new-chart').click(function () {
65 88 var wnd = window,
66 89 view = new vmv.Chart({action: vu.create});
67 90
91 + window.parent.addEventListener('message', function(event){
92 + switch(event.data) {
93 + case 'visualizer:mediaframe:close':
94 + view.close();
95 + break;
96 + }
97 + }, false);
98 +
99 + // remove the 'type' while refreshing the library page on creation of a new chart.
100 + // this is to avoid cases where users have filtered for chart type A and end up creating chart type B
101 + // remove 'vaction' as well so that additional actions are removed
68 102 wnd.send_to_editor = function () {
69 - wnd.location.href = vu.base;
103 + wnd.location.href = vu.base.replace(/type=[a-zA-Z]*/, '').replace(/vaction/, '');
70 104 };
71 105 view.open();
72 106
73 107 return false;
@@ -77,9 +111,9 @@
77 111 var wnd = window,
78 112 view = new vmv.Chart({action: vu.edit + '&chart=' + $(this).attr('data-chart')});
79 113
80 114 wnd.send_to_editor = function () {
81 - wnd.location.reload();
115 + wnd.location.href = wnd.location.href.replace(/vaction/, '');
82 116 };
83 117
84 118 view.open();
85 119
@@ -105,8 +139,19 @@
105 139 }
106 140 });
107 141 return false;
108 142 });
143 +
144 + $(".visualizer-chart-image").on("click", function () {
145 + $('body').trigger('visualizer:action:specificchart', {action: 'image', id: $(this).attr("data-chart"), data: null, dataObj: {name: $(this).attr("data-chart-title")}});
146 + return false;
147 + });
148 +
149 + // if vaction=addnew is found as a GET request parameter, show the modal.
150 + if(location.href.indexOf('vaction=addnew') !== -1){
151 + $('.add-new-chart').first().trigger('click');
152 + }
153 +
109 154 $(window).resize(function () {
110 155 clearTimeout(resizeTimeout);
111 156 resizeTimeout = setTimeout(function () {
112 157 $('.visualizer-chart-canvas').adjust();
@@ -111,6 +156,11 @@
111 156 resizeTimeout = setTimeout(function () {
112 157 $('.visualizer-chart-canvas').adjust();
113 158 }, 100);
114 159 });
160 +
161 + $('.visualizer-error i.error').on('click', function(){
162 + alert( $(this).attr('data-viz-error') );
163 + });
164 + $('.visualizer-chart:not(.visualizer-chart-display), .visualizer-library-pagination').fadeIn(500);
115 165 });
116 166 })(jQuery, visualizer.media.view, visualizer.urls);