PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.4.2
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.4.2
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 +26 -3 3.1.13.4.2 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 = {};
@@ -60,14 +62,25 @@
60 62 range.select();
61 63 }
62 64 });
63 65
64 - $('.add-new-h2').click(function () {
66 + $('.add-new-chart').click(function () {
65 67 var wnd = window,
66 68 view = new vmv.Chart({action: vu.create});
67 69
70 + window.parent.addEventListener('message', function(event){
71 + switch(event.data) {
72 + case 'visualizer:mediaframe:close':
73 + view.close();
74 + break;
75 + }
76 + }, false);
77 +
78 + // remove the 'type' while refreshing the library page on creation of a new chart.
79 + // this is to avoid cases where users have filtered for chart type A and end up creating chart type B
80 + // remove 'vaction' as well so that additional actions are removed
68 81 wnd.send_to_editor = function () {
69 - wnd.location.href = vu.base;
82 + wnd.location.href = vu.base.replace(/type=[a-zA-Z]*/, '').replace(/vaction/, '');
70 83 };
71 84 view.open();
72 85
73 86 return false;
@@ -77,9 +90,9 @@
77 90 var wnd = window,
78 91 view = new vmv.Chart({action: vu.edit + '&chart=' + $(this).attr('data-chart')});
79 92
80 93 wnd.send_to_editor = function () {
81 - wnd.location.reload();
94 + wnd.location.href = wnd.location.href.replace(/vaction/, '');
82 95 };
83 96
84 97 view.open();
85 98
@@ -105,12 +118,22 @@
105 118 }
106 119 });
107 120 return false;
108 121 });
122 +
123 + // if vaction=addnew is found as a GET request parameter, show the modal.
124 + if(location.href.indexOf('vaction=addnew') !== -1){
125 + $('.add-new-chart').trigger('click');
126 + }
127 +
109 128 $(window).resize(function () {
110 129 clearTimeout(resizeTimeout);
111 130 resizeTimeout = setTimeout(function () {
112 131 $('.visualizer-chart-canvas').adjust();
113 132 }, 100);
133 + });
134 +
135 + $('.visualizer-error i.error').on('click', function(){
136 + alert( $(this).attr('data-viz-error') );
114 137 });
115 138 });
116 139 })(jQuery, visualizer.media.view, visualizer.urls);