PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 1.6.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v1.6.0
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/media/view.js +21 -44 3.0.81.6.0 View file →
@@ -1,9 +1,5 @@
1 -/*jshint scripturl:true*/
2 -/* global google */
3 -/* global visualizer */
4 -/* global showNotice */
5 -(function($, wpm, visualizer) {
1 +(function($, wpm) {
6 2 var libraryWidth, libraryHeight, wpmv, wpmV, wpmvv, wpmvvl, wpmvvb, l10n;
7 3
8 4 wpmv = wpm.view;
9 5 wpmV = wpm.View;
@@ -58,20 +54,9 @@
58 54 settings.width = self.options.width;
59 55 settings.height = self.options.height;
60 56
61 57 table = new gv.DataTable({cols: series});
62 -
63 - switch (type) {
64 - case "gauge":
65 - case "table":
66 - case "timeline":
67 - chart = type.charAt(0).toUpperCase() + type.slice(1);
68 - break;
69 - default:
70 - chart = type.charAt(0).toUpperCase() + type.slice(1) + 'Chart';
71 - break;
72 - }
73 -
58 + chart = type == 'gauge' ? 'Gauge' : type.charAt(0).toUpperCase() + type.slice(1) + 'Chart';
74 59 chart = new gv[chart](self.el);
75 60
76 61 switch (type) {
77 62 case 'pie':
@@ -76,9 +61,9 @@
76 61 switch (type) {
77 62 case 'pie':
78 63 if (settings.slices) {
79 64 for (i in settings.slices) {
80 - if (settings.slices[i]['color'] === '') {
65 + if (settings.slices[i]['color'] == '') {
81 66 delete settings.slices[i]['color'];
82 67 }
83 68 }
84 69 }
@@ -90,9 +75,9 @@
90 75 case 'scatter':
91 76 case 'candlestick':
92 77 if (settings.series) {
93 78 for (i in settings.series) {
94 - if (settings.series[i]['color'] === '') {
79 + if (settings.series[i]['color'] == '') {
95 80 delete settings.series[i]['color'];
96 81 }
97 82 }
98 83 }
@@ -97,9 +82,9 @@
97 82 }
98 83 }
99 84 break;
100 85 case 'geo':
101 - if (settings.region !== undefined && settings.region.replace(/^\s+|\s+$/g, '') === '') {
86 + if (settings.region != undefined && settings.region.replace(/^\s+|\s+$/g, '') == '') {
102 87 settings['region'] = 'world';
103 88 }
104 89 break;
105 90 case 'gauge':
@@ -107,9 +92,9 @@
107 92 default:
108 93 return;
109 94 }
110 95
111 - if (series[0] && (series[0].type === 'date' || series[0].type === 'datetime')) {
96 + if (series[0] && (series[0].type == 'date' || series[0].type == 'datetime')) {
112 97 axis = false;
113 98 switch (type) {
114 99 case 'line':
115 100 case 'area':
@@ -140,9 +125,9 @@
140 125
141 126 for (i = 0; i < data.length; i++) {
142 127 row = [];
143 128 for (j = 0; j < series.length; j++) {
144 - if (series[j].type === 'date' || series[j].type === 'datetime') {
129 + if (series[j].type == 'date' || series[j].type == 'datetime') {
145 130 date = new Date(data[i][j]);
146 131 data[i][j] = null;
147 132 if (Object.prototype.toString.call(date) === "[object Date]") {
148 133 if (!isNaN(date.getTime())) {
@@ -157,9 +142,9 @@
157 142
158 143 if (settings.series) {
159 144 for (i = 0; i < settings.series.length; i++) {
160 145 format = settings.series[i].format;
161 - if (!format || format === '') {
146 + if (!format || format == '') {
162 147 continue;
163 148 }
164 149
165 150 formatter = null;
@@ -268,20 +253,8 @@
268 253 paginationView.render();
269 254 }
270 255
271 256 self.renderCollection();
272 - $('.visualizer-library-chart').css('position', 'relative')
273 - .append($(
274 - // jshint ignore:start
275 - '<div class="visualizer-chart-bg"></div>'
276 - + '<div class="visualizer-chart-insert-bg">'
277 - + '<button class="button button-primary visualizer-library-chart-insert">' + visualizer.i10n.insert + '</button>'
278 - + '</div>'
279 - // jshint ignore:end
280 - ))
281 - .on('mouseover', function(){
282 - $(this).addClass('hover');
283 - });
284 257 content.unlock();
285 258 }
286 259 }
287 260 });
@@ -380,9 +353,9 @@
380 353 createFilters: function() {
381 354 var self = this;
382 355
383 356 self.filters = {};
384 - _.each(l10n.library.types, function(type, i) {
357 + _.each(['all', 'pie', 'line', 'area', 'bar', 'column', 'geo', 'scatter', 'gauge', 'candlestick'], function(type, i) {
385 358 self.filters[type] = {
386 359 text: l10n.library.filters[type],
387 360 key: type,
388 361 priority: (i + 1) * 10
@@ -423,11 +396,15 @@
423 396
424 397 self.$el.html(_.chain(items).map(function(item) {
425 398 var content, className;
426 399
427 - content = item === '...' || item === self.options.page ? self.make('span', { class: 'visualizer-library-pagination-page' }, item) : self.make('a', { class: 'visualizer-library-pagination-page', href: 'javascript:;', 'data-page': item }, item);
400 + content = item == '...' || item == self.options.page
401 + ? self.make('span', { class: 'visualizer-library-pagination-page' }, item)
402 + : self.make('a', { class: 'visualizer-library-pagination-page', href: 'javascript:;', 'data-page': item }, item);
428 403
429 - className = item === self.options.page ? 'visualizer-library-pagination-item visualizer-library-pagination-active' : 'visualizer-library-pagination-item';
404 + className = item == self.options.page
405 + ? 'visualizer-library-pagination-item visualizer-library-pagination-active'
406 + : 'visualizer-library-pagination-item';
430 407
431 408 return self.make('li', { class: className }, content);
432 409 }).value());
433 410 },
@@ -441,9 +418,9 @@
441 418 }
442 419 } else {
443 420 tmp = current - Math.floor( max / 2 );
444 421
445 - if ( max % 2 === 0 ) {
422 + if ( max % 2 == 0 ) {
446 423 tmp++;
447 424 }
448 425
449 426 if ( tmp < 1 ) {
@@ -457,14 +434,14 @@
457 434 for ( i = 1; i <= max; i++ ) {
458 435 pagenation.push(tmp++);
459 436 }
460 437
461 - if ( pagenation[0] !== 1 ) {
438 + if ( pagenation[0] != 1 ) {
462 439 pagenation[0] = 1;
463 440 pagenation[1] = '...';
464 441 }
465 442
466 - if ( pagenation[max - 1] !== total ) {
443 + if ( pagenation[max - 1] != total ) {
467 444 pagenation[max - 1] = total;
468 445 pagenation[max - 2] = '...';
469 446 }
470 447 }
@@ -475,9 +452,9 @@
475 452 onPageChange: function(e) {
476 453 this.controller.trigger('visualizer:library:page', $(e.target).data('page'));
477 454 }
478 455 });
479 -})(jQuery, wp.media, visualizer);
456 +})(jQuery, wp.media);
480 457
481 458 (function($) {
482 459 $.fn.lock = function() {
483 460 $(this).each(function() {
@@ -509,9 +486,9 @@
509 486 $this.append(locker);
510 487 });
511 488
512 489 return $(this);
513 - };
490 + }
514 491
515 492 $.fn.unlock = function() {
516 493 $(this).each(function() {
517 494 var $this = $(this);
@@ -522,6 +499,6 @@
522 499 }).find('.locker').remove();
523 500 });
524 501
525 502 return $(this);
526 - };
503 + }
527 504 })(jQuery);