From 5820583d4a1bbf6f46b9047c5983e9f9e611bd36 Mon Sep 17 00:00:00 2001 From: Dmitry Khomutov Date: Sun, 17 Sep 2017 11:22:05 +0700 Subject: [PATCH] Reformated JS code. --- public/assets/js/app.js | 49 ++++++------ public/assets/js/build-plugins/codeception.js | 41 +++++----- public/assets/js/build-plugins/loc.js | 61 +++++++------- public/assets/js/build-plugins/phpspec.js | 26 +++--- public/assets/js/build-plugins/phptallint.js | 31 ++++---- public/assets/js/build-plugins/phpunit.js | 79 ++++++++++--------- public/assets/js/build-plugins/summary.js | 61 ++++++++------ public/assets/js/build-plugins/warnings.js | 63 +++++++-------- public/assets/js/build.js | 30 +++---- public/assets/js/class.js | 19 ++--- src/PHPCensor/Languages/lang.ru.php | 2 +- 11 files changed, 244 insertions(+), 218 deletions(-) diff --git a/public/assets/js/app.js b/public/assets/js/app.js index 48ea1776..a3df4a4e 100644 --- a/public/assets/js/app.js +++ b/public/assets/js/app.js @@ -1,4 +1,3 @@ - var PHPCensor = { intervals: {}, @@ -12,10 +11,10 @@ var PHPCensor = { if (typeof PROJECT_ID != 'undefined') { PHPCensor.intervals.getProjectBuilds = setInterval(PHPCensor.getProjectBuilds, 10000); } - + if (typeof DASHBOARD != 'undefined') { PHPCensor.intervals.getDashboard = setInterval(PHPCensor.getDashboard, 10000); - PHPCensor.intervals.getTimeline = setInterval(PHPCensor.getTimeline, 10000); + PHPCensor.intervals.getTimeline = setInterval(PHPCensor.getTimeline, 10000); } }); @@ -49,7 +48,7 @@ var PHPCensor = { }, getDashboard: function () { - $('.project-box').each(function(index) { + $('.project-box').each(function (index) { var projectId = this.id.substring(12); $.ajax({ @@ -165,10 +164,10 @@ if (!Function.prototype.bind) { function confirmDelete(url, reloadAfter) { var dialog = new PHPCensorConfirmDialog({ - title: Lang.get('confirm_title'), - message: Lang.get('confirm_message'), + title: Lang.get('confirm_title'), + message: Lang.get('confirm_message'), confirmBtnCaption: Lang.get('confirm_ok'), - cancelBtnCaption: Lang.get('confirm_cancel'), + cancelBtnCaption: Lang.get('confirm_cancel'), /* confirm-btn click handler */ @@ -296,7 +295,9 @@ var PHPCensorConfirmDialog = Class.extend({ /* Bind the close event of the dialog to the set of onClose* methods */ - this.$dialog.on('hidden.bs.modal', function () {this.onClose()}.bind(this)); + this.$dialog.on('hidden.bs.modal', function () { + this.onClose() + }.bind(this)); this.$dialog.on('hidden.bs.modal', function () { if (this.confirmed) { this.onCloseConfirmed(); @@ -336,17 +337,20 @@ var PHPCensorConfirmDialog = Class.extend({ /** * Called only when confirmed dialog was closed */ - onCloseConfirmed: function () {}, + onCloseConfirmed: function () { + }, /** * Called only when canceled dialog was closed */ - onCloseCanceled: function () {}, + onCloseCanceled: function () { + }, /** * Called always when the dialog was closed */ - onClose: function () {}, + onClose: function () { + }, showStatusMessage: function (message, closeTimeout) { this.$confirmBtn.hide(); @@ -371,13 +375,11 @@ var PHPCensorConfirmDialog = Class.extend({ /** * Used to initialise the project form: */ -function setupProjectForm() -{ +function setupProjectForm() { $('.github-container').hide(); - $('#element-reference').change(function() - { - var el = $(this); + $('#element-reference').change(function () { + var el = $(this); var val = el.val(); var type = $('#element-type').val(); var acceptable = { @@ -394,16 +396,16 @@ function setupProjectForm() }; - if( acceptable[type] !== undefined ) { - for(var i in acceptable[type]) { - if(val.match(acceptable[type][i])) { + if (acceptable[type] !== undefined) { + for (var i in acceptable[type]) { + if (val.match(acceptable[type][i])) { el.val(val.replace(acceptable[type][i], '$1')); } } } }); - $('#element-type').change(function() { + $('#element-type').change(function () { if ($(this).val() == 'github') { $('#loading').show(); @@ -432,10 +434,10 @@ function setupProjectForm() $('#element-reference').trigger('change'); }); - $('#element-github').change(function() { + $('#element-github').change(function () { var val = $('#element-github').val(); - if(val != 'choose') { + if (val != 'choose') { $('#element-type').val('github'); $('#element-reference').val(val); @@ -457,7 +459,8 @@ function setupProjectForm() var Lang = { get: function () { - var args = Array.prototype.slice.call(arguments);; + var args = Array.prototype.slice.call(arguments); + ; var string = args.shift(); if (STRINGS[string]) { diff --git a/public/assets/js/build-plugins/codeception.js b/public/assets/js/build-plugins/codeception.js index 079e8e4b..64600f75 100644 --- a/public/assets/js/build-plugins/codeception.js +++ b/public/assets/js/build-plugins/codeception.js @@ -1,35 +1,36 @@ var codeceptionPlugin = ActiveBuild.UiPlugin.extend({ - id: 'build-codeception-errors', - css: 'col-xs-12', - title: Lang.get('codeception'), - lastData: null, - lastMeta: null, + id: 'build-codeception-errors', + css: 'col-xs-12', + title: Lang.get('codeception'), + lastData: null, + lastMeta: null, displayOnUpdate: false, - rendered: false, + rendered: false, - register: function() { - var self = this; - var query_data = ActiveBuild.registerQuery('codeception-data', -1, {key: 'codeception-data'}); + register: function () { + var self = this; + var query_data = ActiveBuild.registerQuery('codeception-data', -1, {key: 'codeception-data'}); var query_meta_data = ActiveBuild.registerQuery('codeception-meta', -1, {key: 'codeception-meta'}); - $(window).on('codeception-data', function(data) { + $(window).on('codeception-data', function (data) { self.onUpdateData(data); }); - $(window).on('codeception-meta', function(data) { + $(window).on('codeception-meta', function (data) { self.onUpdateMeta(data); }); - $(window).on('build-updated', function() { + $(window).on('build-updated', function () { if (!self.rendered) { self.displayOnUpdate = true; + query_data(); query_meta_data(); } }); }, - render: function() { + render: function () { return $('' + '' + '' + @@ -41,7 +42,7 @@ var codeceptionPlugin = ActiveBuild.UiPlugin.extend({ '
' + Lang.get('status') + '
'); }, - onUpdateData: function(e) { + onUpdateData: function (e) { if (!e.queryData) { $('#build-codeception-errors').hide(); return; @@ -52,6 +53,7 @@ var codeceptionPlugin = ActiveBuild.UiPlugin.extend({ var tests = this.lastData[0].meta_value; var tbody = $('#codeception-data tbody'); + tbody.empty(); if (tests.length == 0) { @@ -64,9 +66,9 @@ var codeceptionPlugin = ActiveBuild.UiPlugin.extend({ '' + (tests[i].pass ? '' + Lang.get('success') + '' : '' + Lang.get('failed') + '') + '' + '' + tests[i].suite + '' + '' + tests[i].feature + '' + - '' + tests[i].file + ''+ - '' + ((tests[i].message) ? tests[i].message : '') + ''+ - '' + tests[i].time + ''+ + '' + tests[i].file + '' + + '' + ((tests[i].message) ? tests[i].message : '') + '' + + '' + tests[i].time + '' + ''); tbody.append(rows); @@ -75,7 +77,7 @@ var codeceptionPlugin = ActiveBuild.UiPlugin.extend({ $('#build-codeception-errors').show(); }, - onUpdateMeta: function(e) { + onUpdateMeta: function (e) { if (!e.queryData) { return; } @@ -85,8 +87,9 @@ var codeceptionPlugin = ActiveBuild.UiPlugin.extend({ this.lastMeta = e.queryData; - var data = this.lastMeta[0].meta_value; + var data = this.lastMeta[0].meta_value; var tfoot = $('#codeception-data tfoot'); + tfoot.empty(); var row = $('' + diff --git a/public/assets/js/build-plugins/loc.js b/public/assets/js/build-plugins/loc.js index 3b77da56..778c0a8e 100644 --- a/public/assets/js/build-plugins/loc.js +++ b/public/assets/js/build-plugins/loc.js @@ -1,30 +1,31 @@ var locPlugin = ActiveBuild.UiPlugin.extend({ - id: 'build-lines-chart', - css: 'col-xs-12', - title: Lang.get('lines_of_code'), - lastData: null, + id: 'build-lines-chart', + css: 'col-xs-12', + title: Lang.get('lines_of_code'), + lastData: null, displayOnUpdate: false, - rendered: false, - chartData: null, + rendered: false, + chartData: null, - register: function() { - var self = this; + register: function () { + var self = this; var query = ActiveBuild.registerQuery('phploc-lines', -1, {num_builds: 10, key: 'phploc'}) - $(window).on('phploc-lines', function(data) { + $(window).on('phploc-lines', function (data) { self.onUpdate(data); }); - $(window).on('build-updated', function(data) { + $(window).on('build-updated', function (data) { if (data.queryData && data.queryData.status > 1 && !self.rendered) { query(); } }); }, - render: function() { - var self = this; + render: function () { + var self = this; var container = $('
'); + container.append(''); $(document).on('shown.bs.tab', function () { @@ -35,42 +36,42 @@ var locPlugin = ActiveBuild.UiPlugin.extend({ return container; }, - onUpdate: function(e) { + onUpdate: function (e) { this.lastData = e.queryData; this.displayChart(); }, - displayChart: function() { - var self = this; - var builds = this.lastData; + displayChart: function () { + var self = this; + var builds = this.lastData; self.rendered = true; self.chartData = { - labels: [], + labels: [], datasets: [ { - label: Lang.get('lines'), + label: Lang.get('lines'), strokeColor: "#555299", - pointColor: "#555299", - data: [] + pointColor: "#555299", + data: [] }, { - label: Lang.get('logical_lines'), + label: Lang.get('logical_lines'), strokeColor: "#00A65A", - pointColor: "#00A65A", - data: [] + pointColor: "#00A65A", + data: [] }, { - label: Lang.get('comment_lines'), + label: Lang.get('comment_lines'), strokeColor: "#8AA4AF", - pointColor: "#8AA4AF", - data: [] + pointColor: "#8AA4AF", + data: [] }, { - label: Lang.get('noncomment_lines'), + label: Lang.get('noncomment_lines'), strokeColor: "#00A7D0", - pointColor: "#00A7D0", - data: [] + pointColor: "#00A7D0", + data: [] } ] }; @@ -98,7 +99,7 @@ var locPlugin = ActiveBuild.UiPlugin.extend({ Chart.defaults.global.responsive = true; phpLocChart.Line(self.chartData, { - datasetFill: false, + datasetFill: false, multiTooltipTemplate: "<%=datasetLabel%>: <%= value %>" }); } diff --git a/public/assets/js/build-plugins/phpspec.js b/public/assets/js/build-plugins/phpspec.js index a7c36bdc..3537b70e 100644 --- a/public/assets/js/build-plugins/phpspec.js +++ b/public/assets/js/build-plugins/phpspec.js @@ -1,28 +1,29 @@ var phpspecPlugin = ActiveBuild.UiPlugin.extend({ - id: 'build-phpspec-errors', - css: 'col-xs-12', - title: Lang.get('phpspec'), - lastData: null, + id: 'build-phpspec-errors', + css: 'col-xs-12', + title: Lang.get('phpspec'), + lastData: null, displayOnUpdate: false, - rendered: false, + rendered: false, - register: function() { - var self = this; + register: function () { + var self = this; var query = ActiveBuild.registerQuery('phpspec', -1, {key: 'phpspec'}) - $(window).on('phpspec', function(data) { + $(window).on('phpspec', function (data) { self.onUpdate(data); }); - $(window).on('build-updated', function() { + $(window).on('build-updated', function () { if (!self.rendered) { self.displayOnUpdate = true; + query(); } }); }, - render: function() { + render: function () { return $('' + '' + @@ -36,7 +37,7 @@ var phpspecPlugin = ActiveBuild.UiPlugin.extend({ '
'); }, - onUpdate: function(e) { + onUpdate: function (e) { if (!e.queryData) { $('#build-phpspec-errors').hide(); return; @@ -47,6 +48,7 @@ var phpspecPlugin = ActiveBuild.UiPlugin.extend({ var tests = this.lastData[0].meta_value; var tbody = $('#phpspec-data tbody'); + tbody.empty(); for (var i in tests.suites) { @@ -68,7 +70,7 @@ var phpspecPlugin = ActiveBuild.UiPlugin.extend({ tbody.append(row); } } - + // show plugin once preparation of grid is done $('#build-phpspec-errors').show(); } diff --git a/public/assets/js/build-plugins/phptallint.js b/public/assets/js/build-plugins/phptallint.js index 99c55120..789e5978 100644 --- a/public/assets/js/build-plugins/phptallint.js +++ b/public/assets/js/build-plugins/phptallint.js @@ -1,26 +1,26 @@ var phptalPlugin = ActiveBuild.UiPlugin.extend({ - id: 'build-phptal', - css: 'col-xs-12', - title: 'PHPTAL Lint', + id: 'build-phptal', + css: 'col-xs-12', + title: 'PHPTAL Lint', lastData: null, rendered: false, - register: function() { - var self = this; + register: function () { + var self = this; var query = ActiveBuild.registerQuery('phptallint-data', -1, {key: 'phptallint-data'}) - $(window).on('phptallint-data', function(data) { + $(window).on('phptallint-data', function (data) { self.onUpdate(data); }); - $(window).on('build-updated', function() { + $(window).on('build-updated', function () { if (!self.rendered) { query(); } }); }, - render: function() { + render: function () { return $('' + '' + '' + @@ -31,7 +31,7 @@ var phptalPlugin = ActiveBuild.UiPlugin.extend({ '
'); }, - onUpdate: function(e) { + onUpdate: function (e) { if (!e.queryData) { $('#build-phptal').hide(); return; @@ -41,7 +41,8 @@ var phptalPlugin = ActiveBuild.UiPlugin.extend({ this.lastData = e.queryData; var errors = this.lastData[0].meta_value; - var tbody = $('#phptal-data tbody'); + var tbody = $('#phptal-data tbody'); + tbody.empty(); if (errors.length == 0) { @@ -54,15 +55,15 @@ var phptalPlugin = ActiveBuild.UiPlugin.extend({ if (ActiveBuild.fileLinkTemplate) { var fileLink = ActiveBuild.fileLinkTemplate.replace('{FILE}', file); - fileLink = fileLink.replace('{LINE}', errors[i].line); + fileLink = fileLink.replace('{LINE}', errors[i].line); - file = '' + file + ''; + file = '' + file + ''; } var row = $('' + - ''+file+'' + - ''+errors[i].line+'' + - ''+errors[i].message+''); + '' + file + '' + + '' + errors[i].line + '' + + '' + errors[i].message + ''); if (errors[i].type == 'error') { row.addClass('danger'); diff --git a/public/assets/js/build-plugins/phpunit.js b/public/assets/js/build-plugins/phpunit.js index 980d32be..e4f02a20 100644 --- a/public/assets/js/build-plugins/phpunit.js +++ b/public/assets/js/build-plugins/phpunit.js @@ -1,27 +1,27 @@ var phpunitPlugin = ActiveBuild.UiPlugin.extend({ - id: 'build-phpunit-errors', - css: 'col-xs-12', - title: Lang.get('phpunit'), - lastData: null, + id: 'build-phpunit-errors', + css: 'col-xs-12', + title: Lang.get('phpunit'), + lastData: null, displayOnUpdate: false, - rendered: false, - statusMap: { - success : 'ok', - failed: 'remove', - error: 'warning-sign', - todo: 'info-sign', + rendered: false, + statusMap: { + success: 'ok', + failed: 'remove', + error: 'warning-sign', + todo: 'info-sign', skipped: 'exclamation-sign' }, - register: function() { + register: function () { var self = this; var query = ActiveBuild.registerQuery('phpunit-data', -1, {key: 'phpunit-data'}) - $(window).on('phpunit-data', function(data) { + $(window).on('phpunit-data', function (data) { self.onUpdate(data); }); - $(window).on('build-updated', function() { + $(window).on('build-updated', function () { if (!self.rendered) { self.displayOnUpdate = true; query(); @@ -29,19 +29,18 @@ var phpunitPlugin = ActiveBuild.UiPlugin.extend({ }); }, - render: function() { - + render: function () { return $('' + '' + '' + - '' + - '' + - '' + + '' + + '' + + '' + '' + '
' + Lang.get('status') + '' + Lang.get('test_message') + '' + Lang.get('trace') + '' + Lang.get('status') + '' + Lang.get('test_message') + '' + Lang.get('trace') + '
'); }, - onUpdate: function(e) { + onUpdate: function (e) { if (!e.queryData) { $('#build-phpunit-errors').hide(); return; @@ -53,27 +52,29 @@ var phpunitPlugin = ActiveBuild.UiPlugin.extend({ var tests = this.lastData[0].meta_value; var thead = $('#phpunit-data thead tr'); var tbody = $('#phpunit-data tbody'); - thead.empty().append(''+Lang.get('status')+''+Lang.get('test_message')+''+Lang.get('trace')+''); + + thead.empty().append('' + Lang.get('status') + '' + Lang.get('test_message') + '' + Lang.get('trace') + ''); tbody.empty(); if (tests.length == 0) { $('#build-phpunit-errors').hide(); + return; } - var counts = { success: 0, failed: 0, error: 0, skipped: 0, todo: 0 }, total = 0; + var counts = {success: 0, failed: 0, error: 0, skipped: 0, todo: 0}, total = 0; for (var i in tests) { var severity = tests[i].severity || (tests[i].pass ? 'success' : 'failed'), - label = ('success' == severity) ? 'success' : ( + label = ('success' == severity) ? 'success' : ( ('error' == severity) ? 'danger' : 'warning' ); - + if ('fail' === severity) { severity = 'failed'; } - var status = $(''+Lang.get(severity)+''), + var status = $('' + Lang.get(severity) + ''), content = $(''), trace = $(''), message = $('
').appendTo(content), @@ -104,44 +105,44 @@ var phpunitPlugin = ActiveBuild.UiPlugin.extend({ $('#build-phpunit-errors').show(); }, - repr: function(data) - { - switch(typeof(data)) { + repr: function (data) { + switch (typeof(data)) { case 'boolean': return '' + (data ? 'true' : 'false') + ''; case 'string': return '"' + data + '"'; - case 'undefined': case null: + case 'undefined': + case null: return 'null'; case 'object': var rows = []; - if(data instanceof Array) { - for(var i in data) { + if (data instanceof Array) { + for (var i in data) { rows.push('' + this.repr(data[i]) + ','); } } else { - for(var key in data) { + for (var key in data) { rows.push( '' + - '' + this.repr(key) + '' + - '=>' + - '' + this.repr(data[key]) + ',' + + '' + this.repr(key) + '' + + '=>' + + '' + this.repr(data[key]) + ',' + ''); } } return '' + - '' + - rows.join('') + - '' + + '' + + rows.join('') + + '' + '
array(
)
array(
)
'; } return '???'; }, - buildTrace: function(trace){ + buildTrace: function (trace) { var list = '
    '; - trace.forEach(function(line){ + trace.forEach(function (line) { list += '
  1. ' + line + '
  2. '; }); list += '
'; diff --git a/public/assets/js/build-plugins/summary.js b/public/assets/js/build-plugins/summary.js index 0d598d58..e6fddae4 100644 --- a/public/assets/js/build-plugins/summary.js +++ b/public/assets/js/build-plugins/summary.js @@ -1,36 +1,48 @@ var SummaryPlugin = ActiveBuild.UiPlugin.extend({ - id: 'build-summary', - css: 'col-xs-12', - title: Lang.get('build-summary'), - statusLabels: [Lang.get('pending'), Lang.get('running'), Lang.get('success'), Lang.get('failed'), Lang.get('failed_allowed')], - statusClasses: ['info', 'warning', 'success', 'danger', 'danger'], + id: 'build-summary', + css: 'col-xs-12', + title: Lang.get('build-summary'), + statusLabels: [ + Lang.get('pending'), + Lang.get('running'), + Lang.get('success'), + Lang.get('failed'), + Lang.get('failed_allowed') + ], + statusClasses: [ + 'info', + 'warning', + 'success', + 'danger', + 'danger' + ], - register: function() { - var self = this; + register: function () { + var self = this; var query = ActiveBuild.registerQuery('plugin-summary', 5, {key: 'plugin-summary'}) - $(window).on('plugin-summary', function(data) { + $(window).on('plugin-summary', function (data) { self.onUpdate(data); }); - $(window).on('build-updated', function() { + $(window).on('build-updated', function () { query(); }); }, - render: function() { + render: function () { return $( '' + '' + - '' + - '' + - '' + - '' + + '' + + '' + + '' + + '' + '
'+Lang.get('stage')+''+Lang.get('plugin')+''+Lang.get('status')+'' + Lang.get('duration') + ' (' + Lang.get('seconds') + ')' + Lang.get('stage') + '' + Lang.get('plugin') + '' + Lang.get('status') + '' + Lang.get('duration') + ' (' + Lang.get('seconds') + ')
' ); }, - onUpdate: function(e) { + onUpdate: function (e) { if (!e.queryData) { $('#build-summary').hide(); return; @@ -38,20 +50,21 @@ var SummaryPlugin = ActiveBuild.UiPlugin.extend({ var tbody = $('#plugin-summary tbody'), summary = e.queryData[0].meta_value; + tbody.empty(); - for(var stage in summary) { - for(var plugin in summary[stage]) { + for (var stage in summary) { + for (var plugin in summary[stage]) { var data = summary[stage][plugin], - duration = data.started ? ((data.ended || Math.floor(Date.now()/1000)) - data.started) : '-'; + duration = data.started ? ((data.ended || Math.floor(Date.now() / 1000)) - data.started) : '-'; tbody.append( '' + - '' + Lang.get('stage_' + stage) + '' + - '' + Lang.get(plugin) + '' + - '' + - this.statusLabels[data.status] + - '' + - '' + duration + '' + + '' + Lang.get('stage_' + stage) + '' + + '' + Lang.get(plugin) + '' + + '' + + this.statusLabels[data.status] + + '' + + '' + duration + '' + '' ); } diff --git a/public/assets/js/build-plugins/warnings.js b/public/assets/js/build-plugins/warnings.js index 7619ad14..fdf289f0 100644 --- a/public/assets/js/build-plugins/warnings.js +++ b/public/assets/js/build-plugins/warnings.js @@ -1,49 +1,50 @@ var warningsPlugin = ActiveBuild.UiPlugin.extend({ - id: 'build-warnings-chart', - css: 'col-xs-12', + id: 'build-warnings-chart', + css: 'col-xs-12', title: Lang.get('quality_trend'), - keys: { - 'codeception-errors': Lang.get('codeception_errors'), - 'phplint-errors': Lang.get('phplint_errors'), - 'phpunit-errors': Lang.get('phpunit_errors'), - 'phptallint-errors': Lang.get('phptal_errors'), - 'phptallint-warnings': Lang.get('phptal_warnings'), - 'phpmd-warnings': Lang.get('phpmd_warnings'), + keys: { + 'codeception-errors': Lang.get('codeception_errors'), + 'phplint-errors': Lang.get('phplint_errors'), + 'phpunit-errors': Lang.get('phpunit_errors'), + 'phptallint-errors': Lang.get('phptal_errors'), + 'phptallint-warnings': Lang.get('phptal_warnings'), + 'phpmd-warnings': Lang.get('phpmd_warnings'), 'phpdoccheck-warnings': Lang.get('phpdoccheck_warnings'), - 'phpcpd-warnings': Lang.get('phpcpd_warnings'), - 'phpcs-warnings': Lang.get('phpcs_warnings'), - 'phpcs-errors': Lang.get('phpcs_errors') + 'phpcpd-warnings': Lang.get('phpcpd_warnings'), + 'phpcs-warnings': Lang.get('phpcs_warnings'), + 'phpcs-errors': Lang.get('phpcs_errors') }, - data: {}, + data: {}, displayOnUpdate: false, - rendered: false, - chartData: null, + rendered: false, + chartData: null, - register: function() { + register: function () { var self = this; var queries = []; for (var key in self.keys) { - queries.push(ActiveBuild.registerQuery(key, -1, {num_builds: 10, key: key})); + queries.push(ActiveBuild.registerQuery(key, -1, {num_builds: 10, key: key})); } - $(window).on('codeception-errors phptallint-warnings phptallint-errors phplint-errors phpunit-errors phpmd-warnings phpdoccheck-warnings phpcpd-warnings phpcs-warnings phpcs-errors', function(data) { + $(window).on('codeception-errors phptallint-warnings phptallint-errors phplint-errors phpunit-errors phpmd-warnings phpdoccheck-warnings phpcpd-warnings phpcs-warnings phpcs-errors', function (data) { self.onUpdate(data); }); - $(window).on('build-updated', function(data) { + $(window).on('build-updated', function (data) { if (!self.rendered && data.queryData && data.queryData.status > 1) { self.displayOnUpdate = true; for (var query in queries) { - queries[query](); + queries[query](); } } }); }, - render: function() { - var self = this; + render: function () { + var self = this; var container = $('
'); + container.append(''); $(document).on('shown.bs.tab', function () { @@ -54,8 +55,8 @@ var warningsPlugin = ActiveBuild.UiPlugin.extend({ return container; }, - onUpdate: function(e) { - var self = this; + onUpdate: function (e) { + var self = this; var builds = e.queryData; if (!builds || !builds.length) { @@ -79,8 +80,8 @@ var warningsPlugin = ActiveBuild.UiPlugin.extend({ } }, - displayChart: function() { - var self = this; + displayChart: function () { + var self = this; self.rendered = true; var colors = [ @@ -97,7 +98,7 @@ var warningsPlugin = ActiveBuild.UiPlugin.extend({ ]; self.chartData = { - labels: [], + labels: [], datasets: [] }; @@ -105,10 +106,10 @@ var warningsPlugin = ActiveBuild.UiPlugin.extend({ var color = colors.shift(); self.chartData.datasets.push({ - label: self.keys[key], + label: self.keys[key], strokeColor: color, - pointColor: color, - data: [] + pointColor: color, + data: [] }); } @@ -132,7 +133,7 @@ var warningsPlugin = ActiveBuild.UiPlugin.extend({ if ($('#information').hasClass('active') && self.chartData) { $('#build-warnings-chart').show(); - var ctx = $("#build-warnings-linechart").get(0).getContext("2d"); + var ctx = $("#build-warnings-linechart").get(0).getContext("2d"); var buildWarningsChart = new Chart(ctx); Chart.defaults.global.responsive = true; diff --git a/public/assets/js/build.js b/public/assets/js/build.js index 38498edd..bfe55494 100644 --- a/public/assets/js/build.js +++ b/public/assets/js/build.js @@ -6,7 +6,7 @@ var Build = Class.extend({ queries: {}, updateInterval: null, - init: function(build) { + init: function (build) { var self = this; self.buildId = build; }, @@ -18,7 +18,7 @@ var Build = Class.extend({ self.registerQuery('build-updated', 5); - $(window).on('build-updated', function(data) { + $(window).on('build-updated', function (data) { self.buildData = data.queryData; @@ -68,12 +68,12 @@ var Build = Class.extend({ }); }, - registerQuery: function(name, seconds, query) { + registerQuery: function (name, seconds, query) { var self = this; var uri = 'build/ajax-meta/' + self.buildId; var query = query || {}; - var cb = function() { + var cb = function () { var fullUri = window.APP_URL + uri; if (name == 'build-updated') { @@ -84,7 +84,7 @@ var Build = Class.extend({ dataType: "json", url: fullUri, data: query, - success: function(data) { + success: function (data) { $(window).trigger({type: name, queryData: data}); }, error: handleFailedAjax @@ -102,7 +102,7 @@ var Build = Class.extend({ clearInterval(this.queries[name]); }, - registerPlugin: function(plugin) { + registerPlugin: function (plugin) { this.plugins[plugin.id] = plugin; plugin.register(); }, @@ -110,14 +110,14 @@ var Build = Class.extend({ storePluginOrder: function () { var renderOrder = []; - $('.ui-plugin > div').each(function() { + $('.ui-plugin > div').each(function () { renderOrder.push($(this).attr('id')); }); localStorage.setItem('app-plugin-order', JSON.stringify(renderOrder)); }, - renderPlugins: function() { + renderPlugins: function () { var self = this; var rendered = []; var renderOrder = localStorage.getItem('app-plugin-order'); @@ -149,7 +149,7 @@ var Build = Class.extend({ $(window).trigger({type: 'build-updated', queryData: self.buildData}); }, - renderPlugin: function(plugin) { + renderPlugin: function (plugin) { var output = plugin.render(); output = $('
').append(output); @@ -160,9 +160,9 @@ var Build = Class.extend({ if (plugin.title) { content.prepend( - '

'+plugin.title+'

'+ - '
'+ - '
' ); } @@ -177,13 +177,13 @@ var Build = Class.extend({ css: 'col-xs-12', box: false, - init: function(){ + init: function () { }, - register: function() { + register: function () { var self = this; - $(window).on('build-updated', function(data) { + $(window).on('build-updated', function (data) { self.onUpdate(data); }); }, diff --git a/public/assets/js/class.js b/public/assets/js/class.js index 785e7aaf..b07d6389 100644 --- a/public/assets/js/class.js +++ b/public/assets/js/class.js @@ -3,14 +3,15 @@ * MIT Licensed. */ // Inspired by base2 and Prototype -(function(){ - var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/; +(function () { + var initializing = false, fnTest = /xyz/.test(function () {xyz;}) ? /\b_super\b/ : /.*/; // The base Class implementation (does nothing) - this.Class = function(){}; + this.Class = function () { + }; // Create a new Class that inherits from this class - Class.extend = function(prop) { + Class.extend = function (prop) { var _super = this.prototype; // Instantiate a base class (but only create the instance, @@ -23,9 +24,9 @@ for (var name in prop) { // Check if we're overwriting an existing function prototype[name] = typeof prop[name] == "function" && - typeof _super[name] == "function" && fnTest.test(prop[name]) ? - (function(name, fn){ - return function() { + typeof _super[name] == "function" && fnTest.test(prop[name]) ? + (function (name, fn) { + return function () { var tmp = this._super; // Add a new ._super() method that is the same method @@ -46,7 +47,7 @@ // The dummy class constructor function Class() { // All construction is actually done in the init method - if ( !initializing && this.init ) + if (!initializing && this.init) this.init.apply(this, arguments); } @@ -61,4 +62,4 @@ return Class; }; -})(); \ No newline at end of file +})(); diff --git a/src/PHPCensor/Languages/lang.ru.php b/src/PHPCensor/Languages/lang.ru.php index 9f3fcaac..b125d28d 100644 --- a/src/PHPCensor/Languages/lang.ru.php +++ b/src/PHPCensor/Languages/lang.ru.php @@ -312,7 +312,7 @@ PHP Censor', 'seconds' => 'сек.', 'plugin' => 'Плагин', 'stage_setup' => 'Установка', - 'stage_test' => 'тестирование', + 'stage_test' => 'Тестирование', 'stage_complete' => 'Завершение', 'stage_success' => 'Успешное завершение', 'stage_failure' => 'Провал',