| @@ -1,8 +1,4 @@ | ||
| 1 | -/*jshint scripturl:true*/ | |
| 2 | -/* global google */ | |
| 3 | -/* global visualizer */ | |
| 4 | -/* global showNotice */ | |
| 5 | 1 | (function($, wpm) { |
| 6 | 2 | var libraryWidth, libraryHeight, wpmv, wpmV, wpmvv, wpmvvl, wpmvvb, l10n; |
| 7 | 3 | |
| 8 | 4 | wpmv = wpm.view; |
| @@ -58,9 +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 | - chart = type === 'gauge' ? 'Gauge' : type.charAt(0).toUpperCase() + type.slice(1) + 'Chart'; | |
| 58 | + chart = type == 'gauge' ? 'Gauge' : type.charAt(0).toUpperCase() + type.slice(1) + 'Chart'; | |
| 63 | 59 | chart = new gv[chart](self.el); |
| 64 | 60 | |
| 65 | 61 | switch (type) { |
| 66 | 62 | case 'pie': |
| @@ -65,9 +61,9 @@ | ||
| 65 | 61 | switch (type) { |
| 66 | 62 | case 'pie': |
| 67 | 63 | if (settings.slices) { |
| 68 | 64 | for (i in settings.slices) { |
| 69 | - if (settings.slices[i]['color'] === '') { | |
| 65 | + if (settings.slices[i]['color'] == '') { | |
| 70 | 66 | delete settings.slices[i]['color']; |
| 71 | 67 | } |
| 72 | 68 | } |
| 73 | 69 | } |
| @@ -79,9 +75,9 @@ | ||
| 79 | 75 | case 'scatter': |
| 80 | 76 | case 'candlestick': |
| 81 | 77 | if (settings.series) { |
| 82 | 78 | for (i in settings.series) { |
| 83 | - if (settings.series[i]['color'] === '') { | |
| 79 | + if (settings.series[i]['color'] == '') { | |
| 84 | 80 | delete settings.series[i]['color']; |
| 85 | 81 | } |
| 86 | 82 | } |
| 87 | 83 | } |
| @@ -86,9 +82,9 @@ | ||
| 86 | 82 | } |
| 87 | 83 | } |
| 88 | 84 | break; |
| 89 | 85 | case 'geo': |
| 90 | - if (settings.region !== undefined && settings.region.replace(/^\s+|\s+$/g, '') === '') { | |
| 86 | + if (settings.region != undefined && settings.region.replace(/^\s+|\s+$/g, '') == '') { | |
| 91 | 87 | settings['region'] = 'world'; |
| 92 | 88 | } |
| 93 | 89 | break; |
| 94 | 90 | case 'gauge': |
| @@ -96,9 +92,9 @@ | ||
| 96 | 92 | default: |
| 97 | 93 | return; |
| 98 | 94 | } |
| 99 | 95 | |
| 100 | - if (series[0] && (series[0].type === 'date' || series[0].type === 'datetime')) { | |
| 96 | + if (series[0] && (series[0].type == 'date' || series[0].type == 'datetime')) { | |
| 101 | 97 | axis = false; |
| 102 | 98 | switch (type) { |
| 103 | 99 | case 'line': |
| 104 | 100 | case 'area': |
| @@ -129,9 +125,9 @@ | ||
| 129 | 125 | |
| 130 | 126 | for (i = 0; i < data.length; i++) { |
| 131 | 127 | row = []; |
| 132 | 128 | for (j = 0; j < series.length; j++) { |
| 133 | - if (series[j].type === 'date' || series[j].type === 'datetime') { | |
| 129 | + if (series[j].type == 'date' || series[j].type == 'datetime') { | |
| 134 | 130 | date = new Date(data[i][j]); |
| 135 | 131 | data[i][j] = null; |
| 136 | 132 | if (Object.prototype.toString.call(date) === "[object Date]") { |
| 137 | 133 | if (!isNaN(date.getTime())) { |
| @@ -146,9 +142,9 @@ | ||
| 146 | 142 | |
| 147 | 143 | if (settings.series) { |
| 148 | 144 | for (i = 0; i < settings.series.length; i++) { |
| 149 | 145 | format = settings.series[i].format; |
| 150 | - if (!format || format === '') { | |
| 146 | + if (!format || format == '') { | |
| 151 | 147 | continue; |
| 152 | 148 | } |
| 153 | 149 | |
| 154 | 150 | formatter = null; |
| @@ -357,9 +353,9 @@ | ||
| 357 | 353 | createFilters: function() { |
| 358 | 354 | var self = this; |
| 359 | 355 | |
| 360 | 356 | self.filters = {}; |
| 361 | - _.each(l10n.library.types, function(type, i) { | |
| 357 | + _.each(['all', 'pie', 'line', 'area', 'bar', 'column', 'geo', 'scatter', 'gauge', 'candlestick'], function(type, i) { | |
| 362 | 358 | self.filters[type] = { |
| 363 | 359 | text: l10n.library.filters[type], |
| 364 | 360 | key: type, |
| 365 | 361 | priority: (i + 1) * 10 |
| @@ -400,11 +396,15 @@ | ||
| 400 | 396 | |
| 401 | 397 | self.$el.html(_.chain(items).map(function(item) { |
| 402 | 398 | var content, className; |
| 403 | 399 | |
| 404 | - 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); | |
| 405 | 403 | |
| 406 | - 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'; | |
| 407 | 407 | |
| 408 | 408 | return self.make('li', { class: className }, content); |
| 409 | 409 | }).value()); |
| 410 | 410 | }, |
| @@ -418,9 +418,9 @@ | ||
| 418 | 418 | } |
| 419 | 419 | } else { |
| 420 | 420 | tmp = current - Math.floor( max / 2 ); |
| 421 | 421 | |
| 422 | - if ( max % 2 === 0 ) { | |
| 422 | + if ( max % 2 == 0 ) { | |
| 423 | 423 | tmp++; |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | if ( tmp < 1 ) { |
| @@ -434,14 +434,14 @@ | ||
| 434 | 434 | for ( i = 1; i <= max; i++ ) { |
| 435 | 435 | pagenation.push(tmp++); |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | - if ( pagenation[0] !== 1 ) { | |
| 438 | + if ( pagenation[0] != 1 ) { | |
| 439 | 439 | pagenation[0] = 1; |
| 440 | 440 | pagenation[1] = '...'; |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | - if ( pagenation[max - 1] !== total ) { | |
| 443 | + if ( pagenation[max - 1] != total ) { | |
| 444 | 444 | pagenation[max - 1] = total; |
| 445 | 445 | pagenation[max - 2] = '...'; |
| 446 | 446 | } |
| 447 | 447 | } |
| @@ -486,9 +486,9 @@ | ||
| 486 | 486 | $this.append(locker); |
| 487 | 487 | }); |
| 488 | 488 | |
| 489 | 489 | return $(this); |
| 490 | - }; | |
| 490 | + } | |
| 491 | 491 | |
| 492 | 492 | $.fn.unlock = function() { |
| 493 | 493 | $(this).each(function() { |
| 494 | 494 | var $this = $(this); |
| @@ -499,6 +499,6 @@ | ||
| 499 | 499 | }).find('.locker').remove(); |
| 500 | 500 | }); |
| 501 | 501 | |
| 502 | 502 | return $(this); |
| 503 | - }; | |
| 503 | + } | |
| 504 | 504 | })(jQuery); |