PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.2.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.2.0
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 3.10.4 All 148 releases
← All changes | js/simple-editor.js +40 -58 3.10.103.2.0 View file →
@@ -7,100 +7,82 @@
7 7 initTable();
8 8 });
9 9
10 10 function onReady() {
11 - $( '#editor-button' ).on( 'click', function(e){
12 - switch($("#viz-editor-type").val()) {
13 - case 'text':
14 - showTextEditor($(this));
15 - break;
16 - case 'table':
17 - showTableEditor($(this));
18 - break;
19 - default:
20 - $('body').trigger('visualizer:chart:edit');
11 + $( '#editor-chart-button' ).on( 'click', function(){
12 + $('.viz-simple-editor-type').hide();
13 + if($("#simple-editor-type").is(':checked')){
14 + switch($("#simple-editor-type").val()) {
15 + case 'textarea':
16 + showText($(this));
17 + break;
18 + }
19 + } else {
20 + showTable($(this));
21 21 }
22 22 });
23 23 }
24 24
25 - function showTextEditor(button) {
25 + function showText(button) {
26 26 if( button.attr( 'data-current' ) === 'chart'){
27 -
28 - $('body').off('visualizer:change:action').on('visualizer:change:action', function(e){
29 - button.val( button.attr( 'data-t-chart' ) );
30 - button.html( button.attr( 'data-t-chart' ) );
31 - button.attr( 'data-current', 'chart' );
32 - $('p.viz-editor-selection').show();
33 - $('.viz-text-editor').hide();
34 - $('.viz-simple-editor').hide();
35 - $( '#canvas' ).css('z-index', '1').show();
36 - });
37 -
38 - // showing the editor
39 27 button.val( button.attr( 'data-t-editor' ) );
40 28 button.html( button.attr( 'data-t-editor' ) );
41 29 button.attr( 'data-current', 'editor' );
42 - $('p.viz-editor-selection').hide();
43 - $('.viz-text-editor').css('z-index', '9999').show();
44 - $('.viz-simple-editor').css('z-index', '9999').show();
45 - $( '#canvas' ).css('z-index', '-100').hide();
30 + $('p.simple-editor-type').hide();
31 + $( '.viz-text-editor' ).css("z-index", "9999").show();
32 + $( '#canvas' ).css("z-index", "-100").hide();
33 + $('.viz-simple-editor').css("z-index", "9999").show();
46 34 }else{
47 - // showing the chart
48 - $('#chart-data').val($('#edited_text').val());
49 - $('#canvas').lock();
50 - $('#editor-form').submit();
51 -
52 35 button.val( button.attr( 'data-t-chart' ) );
53 36 button.html( button.attr( 'data-t-chart' ) );
54 37 button.attr( 'data-current', 'chart' );
55 - $('p.viz-editor-selection').show();
56 - $('.viz-text-editor').hide();
38 + $( '.viz-text-editor' ).hide();
39 + $('p.simple-editor-type').show();
40 + $( '#canvas' ).css("z-index", "1").show();
57 41 $('.viz-simple-editor').hide();
58 - $( '#canvas' ).css('z-index', '1').show();
59 42 }
43 +
44 + $( '#viz-text-editor-button').on('click', function(e){
45 + $( '#editor-chart-button' ).attr("disabled", "disabled");
46 + $('#chart-data').val($('#edited_text').val());
47 + $('#canvas').lock();
48 + $('#editor-form').submit();
49 + $( '#editor-chart-button' ).removeAttr("disabled");
50 + $( '#editor-chart-button' ).trigger('click');
51 + });
60 52 }
61 53
62 54 function initTable() {
63 55 setTimeout(function(){
64 - $('body').trigger('visualizer:db:editor:table:init', {config: { buttons: [] } });
56 + $('body').trigger('visualizer:db:editor:table:init', {});
65 57 $( '#canvas' ).unlock();
66 58 }, 1000);
59 +
60 + // when the data is set and the chart is updated, toggle the screen so that the chart is shown
61 + $('#table-editor-form').on( 'submit', function(e){
62 + $( '#editor-chart-button' ).trigger('click');
63 + $('#canvas').lock();
64 + });
67 65 }
68 66
69 - function showTableEditor(button) {
67 + function showTable(button) {
70 68 if( button.attr( 'data-current' ) === 'chart'){
71 -
72 - $('body').off('visualizer:change:action').on('visualizer:change:action', function(e){
73 - button.val( button.attr( 'data-t-chart' ) );
74 - button.html( button.attr( 'data-t-chart' ) );
75 - button.attr( 'data-current', 'chart' );
76 - $('p.viz-editor-selection').show();
77 - $('.viz-table-editor').hide();
78 - $('.viz-simple-editor').hide();
79 - $( '#canvas' ).css('z-index', '1').show();
80 - });
81 -
82 - // showing the editor
83 69 button.val( button.attr( 'data-t-editor' ) );
84 70 button.html( button.attr( 'data-t-editor' ) );
85 71 button.attr( 'data-current', 'editor' );
86 - $('p.viz-editor-selection').hide();
87 72 $( '.viz-table-editor' ).css("z-index", "9999").show();
88 - $('.viz-simple-editor').css('z-index', '9999').show();
89 73 $('body').trigger('visualizer:db:editor:table:redraw', {});
90 74 $( '#canvas' ).css("z-index", "-100").hide();
75 + $('p.simple-editor-type').hide();
76 + $('.viz-simple-editor').css("z-index", "9999").show();
91 77 }else{
92 - $('#canvas').lock();
93 - $('#table-editor-form').submit();
94 -
95 - // showing the chart
96 78 button.val( button.attr( 'data-t-chart' ) );
97 79 button.html( button.attr( 'data-t-chart' ) );
98 80 button.attr( 'data-current', 'chart' );
99 - $('p.viz-editor-selection').show();
100 - $('.viz-table-editor').hide();
81 + $( '.viz-table-editor' ).hide();
82 + $( '#canvas' ).css("z-index", "1").show();
101 83 $('.viz-simple-editor').hide();
102 - $( '#canvas' ).css('z-index', '1').show();
84 + $('p.simple-editor-type').show();
103 85 }
104 86 }
105 87
106 88 })(jQuery, visualizer1);