PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.7.7
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.7.7
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
visualizer / js / simple-editor.js

simple-editor.js in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.7.7, at js/simple-editor.js

106 lines 3.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /* global visualizer1 */
2
3 (function($, v) {
4
5 $(document).ready(function(){
6 onReady();
7 initTable();
8 });
9
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');
21 }
22 });
23 }
24
25 function showTextEditor(button) {
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 button.val( button.attr( 'data-t-editor' ) );
40 button.html( button.attr( 'data-t-editor' ) );
41 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();
46 }else{
47 // showing the chart
48 $('#chart-data').val($('#edited_text').val());
49 $('#canvas').lock();
50 $('#editor-form').submit();
51
52 button.val( button.attr( 'data-t-chart' ) );
53 button.html( button.attr( 'data-t-chart' ) );
54 button.attr( 'data-current', 'chart' );
55 $('p.viz-editor-selection').show();
56 $('.viz-text-editor').hide();
57 $('.viz-simple-editor').hide();
58 $( '#canvas' ).css('z-index', '1').show();
59 }
60 }
61
62 function initTable() {
63 setTimeout(function(){
64 $('body').trigger('visualizer:db:editor:table:init', {config: { buttons: [] } });
65 $( '#canvas' ).unlock();
66 }, 1000);
67 }
68
69 function showTableEditor(button) {
70 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 button.val( button.attr( 'data-t-editor' ) );
84 button.html( button.attr( 'data-t-editor' ) );
85 button.attr( 'data-current', 'editor' );
86 $('p.viz-editor-selection').hide();
87 $( '.viz-table-editor' ).css("z-index", "9999").show();
88 $('.viz-simple-editor').css('z-index', '9999').show();
89 $('body').trigger('visualizer:db:editor:table:redraw', {});
90 $( '#canvas' ).css("z-index", "-100").hide();
91 }else{
92 $('#canvas').lock();
93 $('#table-editor-form').submit();
94
95 // showing the chart
96 button.val( button.attr( 'data-t-chart' ) );
97 button.html( button.attr( 'data-t-chart' ) );
98 button.attr( 'data-current', 'chart' );
99 $('p.viz-editor-selection').show();
100 $('.viz-table-editor').hide();
101 $('.viz-simple-editor').hide();
102 $( '#canvas' ).css('z-index', '1').show();
103 }
104 }
105
106 })(jQuery, visualizer1);