PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 1.0.1
Visualizer – Tables & Charts Manager with Built-in AI Generator v1.0.1
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 / library.js

library.js in Visualizer – Tables & Charts Manager with Built-in AI Generator 1.0.1, at js/library.js

91 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function(wpmv) {
2 var vm, vmv;
3
4 vm = visualizer.media = {};
5 vmv = vm.view = {};
6
7 vmv.Chart = wpmv.MediaFrame.extend({
8 initialize: function() {
9 var self = this;
10
11 _.defaults(self.options, {
12 action: '',
13 state: 'iframe:visualizer'
14 });
15
16 wpmv.MediaFrame.prototype.initialize.apply(self, arguments);
17
18 wpmv.settings.tabUrl = self.options.action;
19 self.createIframeStates();
20 },
21
22 open: function() {
23 wpmv.MediaFrame.prototype.open.apply(this, arguments);
24 this.$el.addClass('hide-menu');
25 }
26 });
27 })(wp.media.view);
28
29 (function($, vmv, vu) {
30 var resizeTimeout;
31
32 $.fn.adjust = function() {
33 var width = $('#visualizer-library').width(),
34 margin = width * 0.02;
35
36 width *= 0.305;
37 $(this).width(width - 14).height(width * 0.75).parent().css('margin-right', margin + 'px').css('margin-bottom', margin + 'px');
38 }
39
40 $('.visualizer-chart-canvas').adjust();
41
42 $(document).ready(function() {
43 $('.visualizer-chart-shortcode').click(function(e) {
44 var range, selection;
45
46 if (window.getSelection && document.createRange) {
47 selection = window.getSelection();
48 range = document.createRange();
49 range.selectNodeContents(e.target);
50 selection.removeAllRanges();
51 selection.addRange(range);
52 } else if (document.selection && document.body.createTextRange) {
53 range = document.body.createTextRange();
54 range.moveToElementText(e.target);
55 range.select();
56 }
57 });
58
59 $('.add-new-h2').click(function() {
60 var wnd = window,
61 view = new vmv.Chart({action: vu.create});
62
63 wnd.send_to_editor = function() {
64 wnd.location.href = vu.base;
65 };
66 view.open();
67
68 return false;
69 });
70
71 $('.visualizer-chart-edit').click(function() {
72 var wnd = window,
73 view = new vmv.Chart({action: vu.edit + '&chart=' + $(this).attr('data-chart')});
74
75 wnd.send_to_editor = function() {
76 wnd.location.reload();
77 };
78
79 view.open();
80
81 return false;
82 });
83
84 $(window).resize(function() {
85 clearTimeout(resizeTimeout);
86 resizeTimeout = setTimeout(function() {
87 $('.visualizer-chart-canvas').adjust();
88 }, 100);
89 });
90 });
91 })(jQuery, visualizer.media.view, visualizer.urls);