PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 4.0.3
Visualizer – Tables & Charts Manager with Built-in AI Generator v4.0.3
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 4.0.3, at js/simple-editor.js

113 lines 4.3 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 $('p.viz-info-msg').hide();
34 $('.viz-text-editor').hide();
35 $('.viz-simple-editor').hide();
36 $( '#canvas' ).css('z-index', '1').show();
37 });
38
39 // showing the editor
40 button.val( button.attr( 'data-t-editor' ) );
41 button.html( button.attr( 'data-t-editor' ) );
42 button.attr( 'data-current', 'editor' );
43 $('p.viz-editor-selection').hide();
44 $('p.viz-info-msg').show();
45 $('.viz-text-editor').css('z-index', '9999').show();
46 $('.viz-simple-editor').css('z-index', '9999').show();
47 $( '#canvas' ).css('z-index', '-100').hide();
48 }else{
49 // showing the chart
50 $('#chart-data').val($('#edited_text').val());
51 $('#canvas').lock();
52 $('#editor-form').submit();
53
54 button.val( button.attr( 'data-t-chart' ) );
55 button.html( button.attr( 'data-t-chart' ) );
56 button.attr( 'data-current', 'chart' );
57 $('p.viz-editor-selection').show();
58 $('p.viz-info-msg').hide();
59 $('.viz-text-editor').hide();
60 $('.viz-simple-editor').hide();
61 $( '#canvas' ).css('z-index', '1').show();
62 }
63 }
64
65 function initTable() {
66 setTimeout(function(){
67 $('body').trigger('visualizer:db:editor:table:init', {config: { buttons: [] } });
68 $( '#canvas' ).unlock();
69 }, 1000);
70 }
71
72 function showTableEditor(button) {
73 if( button.attr( 'data-current' ) === 'chart'){
74
75 $('body').off('visualizer:change:action').on('visualizer:change:action', function(e){
76 button.val( button.attr( 'data-t-chart' ) );
77 button.html( button.attr( 'data-t-chart' ) );
78 button.attr( 'data-current', 'chart' );
79 $('p.viz-editor-selection').show();
80 $('p.viz-info-msg').hide();
81 $('.viz-table-editor').hide();
82 $('.viz-simple-editor').hide();
83 $( '#canvas' ).css('z-index', '1').show();
84 });
85
86 // showing the editor
87 button.val( button.attr( 'data-t-editor' ) );
88 button.html( button.attr( 'data-t-editor' ) );
89 button.attr( 'data-current', 'editor' );
90 $('p.viz-editor-selection').hide();
91 $('p.viz-info-msg').show();
92 $( '.viz-table-editor' ).css("z-index", "9999").show();
93 $('.viz-simple-editor').css('z-index', '9999').show();
94 $('body').trigger('visualizer:db:editor:table:redraw', {});
95 $( '#canvas' ).css("z-index", "-100").hide();
96 }else{
97 $('#canvas').lock();
98 jQuery('.dataTables_scrollBody .sorting_disabled input').attr('disabled', true);
99 $('#table-editor-form').submit();
100
101 // showing the chart
102 button.val( button.attr( 'data-t-chart' ) );
103 button.html( button.attr( 'data-t-chart' ) );
104 button.attr( 'data-current', 'chart' );
105 $('p.viz-editor-selection').show();
106 $('p.viz-info-msg').hide();
107 $('.viz-table-editor').hide();
108 $('.viz-simple-editor').hide();
109 $( '#canvas' ).css('z-index', '1').show();
110 }
111 }
112
113 })(jQuery, visualizer1);