Code cleanup for scrutinizer.

This commit is contained in:
James Cole
2017-11-25 08:54:52 +01:00
parent f2cf0ed446
commit f7b1168e7c
36 changed files with 53 additions and 179 deletions

View File

@@ -18,6 +18,8 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: overviewUri, transactionsUri, indexUri,accounting */
var balanceDifference = 0;
var difference = 0;
var selectedAmount = 0;
@@ -101,14 +103,11 @@ function storeReconcile() {
function checkReconciledBox(e) {
var el = $(e.target);
var amount = parseFloat(el.val());
console.log('Amount is ' + amount);
// if checked, add to selected amount
if (el.prop('checked') === true && el.data('younger') === false) {
console.log("Sum is: " + selectedAmount + " - " + amount + " = " + (selectedAmount - amount));
selectedAmount = selectedAmount - amount;
}
if (el.prop('checked') === false && el.data('younger') === false) {
console.log("Sum is: " + selectedAmount + " + " + amount + " = " + (selectedAmount + amount));
selectedAmount = selectedAmount + amount;
}
difference = balanceDifference - selectedAmount;

View File

@@ -18,8 +18,7 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: spent, budgeted, available, currencySymbol, budgetIndexUri, updateIncomeUri, periodStart, periodEnd, budgetAmountUri, accounting */
/** global: infoIncomeUri, spent, budgeted, available, currencySymbol, budgetIndexUri, updateIncomeUri, periodStart, periodEnd, budgetAmountUri, accounting */
/**
*
*/
@@ -150,9 +149,6 @@ function updateBudgetedAmounts(e) {
link.attr('href', 'budgets/show/' + id + '/' + data.limit);
}
});
return;
}
/**

View File

@@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: Chart, defaultChartOptions, accounting, defaultPieOptions, noDataForChart */
/** global: Chart, defaultChartOptions, accounting, defaultPieOptions, noDataForChart, todayText */
var allCharts = {};
@@ -131,7 +131,6 @@ function lineChart(URI, container) {
function lineChartWithDay(URI, container, today) {
"use strict";
console.log('in lineChartWithDay');
var colorData = true;
var options = $.extend(true, {}, defaultChartOptions);
var chartType = 'line';
@@ -342,7 +341,6 @@ function drawAChart(URI, container, chartType, options, colorData, today) {
};
if (today >= 0) {
chartOpts.lineAtIndex.push(today - 1);
console.log('push opt');
}
allCharts[container] = new Chart(ctx, chartOpts);
}

View File

@@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: moment, dateRangeMeta,dateRangeConfig, accountingConfig, accounting, currencySymbol, mon_decimal_point, frac_digits, showFullList, showOnlyTop, mon_thousands_sep */
/** global: moment, token, dateRangeMeta,dateRangeConfig, accountingConfig, accounting, currencySymbol, mon_decimal_point, frac_digits, showFullList, showOnlyTop, mon_thousands_sep */
$(function () {

View File

@@ -18,7 +18,7 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: accountFrontpageUri, token, billCount, accountExpenseUri, accountRevenueUri */
/** global: accountFrontpageUri, today, piggyInfoUri, token, billCount, accountExpenseUri, accountRevenueUri */
$(function () {
"use strict";

View File

@@ -18,7 +18,7 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: routeForTour, routeStepsUri, routeForFinishedTour, forceDemoOff */
/** global: routeForTour, token, routeStepsUri, routeForFinishedTour, forceDemoOff */
$(function () {
"use strict";

View File

@@ -18,7 +18,7 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: zoomLevel, latitude, longitude, google, doPlaceMarker */
/** global: zoomLevel, latitude, longitude, L, mapboxToken, doPlaceMarker */
/*
Some vars as prep for the map:

View File

@@ -156,29 +156,6 @@ function countChecked() {
}
}
function getAmounts() {
$('.mass_reconcile span').html(reconcile_selected_txt + ' (<i class="fa fa-spinner fa-spin "></i>)');
var checked = $('.select_all_single:checked');
var ids = [];
$.each(checked, function (i, v) {
ids.push(parseInt($(v).data('transaction')));
});
// go to specially crafted URL:
var bases = document.getElementsByTagName('base');
var baseHref = null;
if (bases.length > 0) {
baseHref = bases[0].href;
}
$.getJSON(baseHref + 'json/transactions/amount', {transactions: ids}).done(function (data) {
$('.mass_reconcile span').text(reconcile_selected_txt + ' (' + data.amounts + ')');
console.log(data);
});
return;
}
/**
*
*/