Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
This should fix most Javascript errors.
James Colef8268a864b59
diff --git a/public/js/ff/charts.defaults.js b/public/js/ff/charts.defaults.jsindex bbcce69ccb..c670667dd1 100644--- a/public/js/ff/charts.defaults.js+++ b/public/js/ff/charts.defaults.js@@ -8,6 +8,8 @@* See the LICENSE file for details.*/+/** global: accounting */+var defaultChartOptions = {scales: {xAxes: [@@ -20,7 +22,7 @@ var defaultChartOptions = {yAxes: [{display: true,ticks: {- callback: function (tickValue, index, ticks) {+ callback: function (tickValue) {"use strict";return accounting.formatMoney(tickValue);diff --git a/public/js/ff/charts.js b/public/js/ff/charts.jsindex 82977288d2..8fc2915fc5 100644--- a/public/js/ff/charts.js+++ b/public/js/ff/charts.js@@ -7,7 +7,7 @@** See the LICENSE file for details.*/-+/** global: Chart, defaultChartOptions, accounting, defaultPieOptions, noDataForChart */var allCharts = {};/*@@ -97,7 +97,7 @@ function doubleYChart(URI, container) {{display: true,ticks: {- callback: function (tickValue, index, ticks) {+ callback: function (tickValue) {"use strict";return accounting.formatMoney(tickValue);@@ -111,7 +111,7 @@ function doubleYChart(URI, container) {{display: true,ticks: {- callback: function (tickValue, index, ticks) {+ callback: function (tickValue) {"use strict";return accounting.formatMoney(tickValue);diff --git a/public/js/ff/export/index.js b/public/js/ff/export/index.jsindex e1699c3c8d..006afca9ba 100644--- a/public/js/ff/export/index.js+++ b/public/js/ff/export/index.js@@ -8,6 +8,8 @@* See the LICENSE file for details.*/+/** global: jobKey */+var intervalId = 0;$(function () {@@ -79,7 +81,7 @@ function callExport() {// call status, keep calling it until response is "finished"?intervalId = window.setInterval(checkStatus, 500);- $.post('export/submit', data).done(function (data) {+ $.post('export/submit', data).done(function () {// stop polling:window.clearTimeout(intervalId);diff --git a/public/js/ff/firefly.js b/public/js/ff/firefly.jsindex c35bd4fbe8..c3b1b46bd7 100644--- a/public/js/ff/firefly.js+++ b/public/js/ff/firefly.js@@ -7,6 +7,8 @@** See the LICENSE file for details.*/+/** global: moment, dateRangeConfig, accounting, currencySymbol, mon_decimal_point, frac_digits, showFullList, showOnlyTop */+$(function () {"use strict";diff --git a/public/js/ff/import/status.js b/public/js/ff/import/status.jsindex 2b15cac1b6..1a48091eaf 100644--- a/public/js/ff/import/status.js+++ b/public/js/ff/import/status.js@@ -8,6 +8,8 @@* See the LICENSE file for details.*/+/** global: jobImportUrl, langImportSingleError, langImportMultiError, jobStartUrl, langImportTimeOutError, langImportFinished, langImportFatalError */+var startedImport = false;var startInterval = 2000;var interval = 500;@@ -31,7 +33,7 @@ function checkImportStatus() {$.getJSON(jobImportUrl).done(reportOnJobImport).fail(failedJobImport);}-function importComplete(data) {+function importComplete() {"use strict";var bar = $('#import-status-bar');bar.removeClass('active');diff --git a/public/js/ff/index.js b/public/js/ff/index.jsindex 04a17e9133..ba6c9993e1 100644--- a/public/js/ff/index.js+++ b/public/js/ff/index.js@@ -8,11 +8,13 @@* See the LICENSE file for details.*/+/** global: Tour, showTour, accountFrontpageUri, billCount, accountExpenseUri, accountRevenueUri */+$(function () {"use strict";// do chart JS stuff.drawChart();- if (showTour) {+ if (showTour == true) {$.getJSON('json/tour').done(function (data) {var tour = new Tour({@@ -55,6 +57,9 @@ function getBoxAmounts() {"use strict";var boxes = ['in', 'out', 'bills-unpaid', 'bills-paid'];for (var x in boxes) {+ if (!boxes.hasOwnProperty(x)) {+ continue;+ }var box = boxes[x];$.getJSON('json/box/' + box).done(putData).fail(failData);}diff --git a/public/js/ff/piggy-banks/show.js b/public/js/ff/piggy-banks/show.jsindex 4c02df137c..be5093f6ba 100644--- a/public/js/ff/piggy-banks/show.js+++ b/public/js/ff/piggy-banks/show.js@@ -7,6 +7,7 @@** See the LICENSE file for details.*/+/** global: piggyBankID, lineChart */$(function () {"use strict";diff --git a/public/js/ff/reports/audit/all.js b/public/js/ff/reports/audit/all.jsindex dc28051a29..1724789bf4 100644--- a/public/js/ff/reports/audit/all.js+++ b/public/js/ff/reports/audit/all.js@@ -8,6 +8,8 @@* See the LICENSE file for details.*/+/** global: hideable */+$(function () {"use strict";@@ -65,7 +67,7 @@ function showOnlyColumns(checkboxes) {for (var i = 0; i < hideable.length; i++) {var opt = hideable[i];- if(checkboxes.indexOf(opt) > -1) {+ if (checkboxes.indexOf(opt) > -1) {$('td.hide-' + opt).show();$('th.hide-' + opt).show();} else {@@ -96,8 +98,12 @@ function readCookie(name) {var ca = document.cookie.split(';');for (var i = 0; i < ca.length; i++) {var c = ca[i];- while (c.charAt(0) === ' ') c = c.substring(1, c.length);- if (c.indexOf(nameEQ) === 0) return decodeURIComponent(c.substring(nameEQ.length, c.length));+ while (c.charAt(0) === ' ') {+ c = c.substring(1, c.length);+ }+ if (c.indexOf(nameEQ) === 0) {+ return decodeURIComponent(c.substring(nameEQ.length, c.length));+ }}return null;}diff --git a/public/js/ff/reports/budget/month.js b/public/js/ff/reports/budget/month.jsindex c7aad72832..14d845fb6e 100644--- a/public/js/ff/reports/budget/month.js+++ b/public/js/ff/reports/budget/month.js@@ -8,6 +8,7 @@* See the LICENSE file for details.*/+/** global: budgetExpenseUri, accountExpenseUri, mainUri */$(function () {"use strict";diff --git a/public/js/ff/reports/category/month.js b/public/js/ff/reports/category/month.jsindex d8ba767acd..84f3444d9b 100644--- a/public/js/ff/reports/category/month.js+++ b/public/js/ff/reports/category/month.js@@ -8,6 +8,7 @@* See the LICENSE file for details.*/+/** global: categoryIncomeUri, categoryExpenseUri, accountIncomeUri, accountExpenseUri, mainUri */$(function () {"use strict";diff --git a/public/js/ff/reports/default/all.js b/public/js/ff/reports/default/all.jsindex 351b4b30bf..06e374dcee 100644--- a/public/js/ff/reports/default/all.js+++ b/public/js/ff/reports/default/all.js@@ -8,6 +8,8 @@* See the LICENSE file for details.*/+/** global: accountReportUri, incomeReportUri, expenseReportUri, incExpReportUri, startDate, endDate, accountIds */+$(function () {"use strict";@@ -45,7 +47,7 @@ function clickInfoButton(e) {$.getJSON('popup/general', {attributes: attributes}).done(respondInfoButton).fail(errorInfoButton);}-function errorInfoButton(data) {+function errorInfoButton() {"use strict";// remove wait cursor$('body').removeClass('waiting');diff --git a/public/js/ff/reports/default/month.js b/public/js/ff/reports/default/month.jsindex 2052997a9b..1c2f08be63 100644--- a/public/js/ff/reports/default/month.js+++ b/public/js/ff/reports/default/month.js@@ -8,6 +8,8 @@* See the LICENSE file for details.*/+/** global: categoryReportUri, budgetReportUri, balanceReportUri, accountChartUri */+$(function () {"use strict";drawChart();diff --git a/public/js/ff/reports/default/multi-year.js b/public/js/ff/reports/default/multi-year.jsindex a6a63a1d3d..1bd49a294d 100644--- a/public/js/ff/reports/default/multi-year.js+++ b/public/js/ff/reports/default/multi-year.js@@ -8,6 +8,8 @@* See the LICENSE file for details.*/+/** global: budgetPeriodReportUri, categoryExpenseUri, categoryIncomeUri, netWorthUri, opChartUri, sumChartUri */+$(function () {"use strict";drawChart();diff --git a/public/js/ff/reports/default/year.js b/public/js/ff/reports/default/year.jsindex 9e521ab4fb..c1eb1070f3 100644--- a/public/js/ff/reports/default/year.js+++ b/public/js/ff/reports/default/year.js@@ -8,6 +8,8 @@* See the LICENSE file for details.*/+/** global: budgetPeriodReportUri, categoryExpenseUri, categoryIncomeUri, netWorthUri, opChartUri, sumChartUri */+$(function () {"use strict";drawChart();diff --git a/public/js/ff/reports/index.js b/public/js/ff/reports/index.jsindex 5033aecef0..67be970157 100644--- a/public/js/ff/reports/index.js+++ b/public/js/ff/reports/index.js@@ -8,12 +8,14 @@* See the LICENSE file for details.*/+/** global: minDate */+$(function () {"use strict";if ($('#inputDateRange').length > 0) {- picker = $('#inputDateRange').daterangepicker(+ var picker = $('#inputDateRange').daterangepicker({locale: {format: 'YYYY-MM-DD',@@ -168,8 +170,12 @@ function readCookie(name) {var ca = document.cookie.split(';');for (var i = 0; i < ca.length; i++) {var c = ca[i];- while (c.charAt(0) === ' ') c = c.substring(1, c.length);- if (c.indexOf(nameEQ) === 0) return decodeURIComponent(c.substring(nameEQ.length, c.length));+ while (c.charAt(0) === ' ') {+ c = c.substring(1, c.length);+ }+ if (c.indexOf(nameEQ) === 0) {+ return decodeURIComponent(c.substring(nameEQ.length, c.length));+ }}return null;}diff --git a/public/js/ff/rules/create-edit.js b/public/js/ff/rules/create-edit.jsindex 889777d7bf..cd36a7b1ad 100644--- a/public/js/ff/rules/create-edit.js+++ b/public/js/ff/rules/create-edit.js@@ -52,14 +52,14 @@ function addNewAction() {function removeTrigger(e) {"use strict";var target = $(e.target);- if(target.prop("tagName") == "I") {+ if (target.prop("tagName") == "I") {target = target.parent();}// remove grand parent:target.parent().parent().remove();// if now at zero, immediatly add one again:- if($('.rule-trigger-tbody tr').length == 0) {+ if ($('.rule-trigger-tbody tr').length == 0) {addNewTrigger();}}@@ -67,42 +67,41 @@ function removeTrigger(e) {function removeAction(e) {"use strict";var target = $(e.target);- if(target.prop("tagName") == "I") {+ if (target.prop("tagName") == "I") {target = target.parent();}// remove grand parent:target.parent().parent().remove();// if now at zero, immediatly add one again:- if($('.rule-action-tbody tr').length == 0) {+ if ($('.rule-action-tbody tr').length == 0) {addNewAction();}}function testRuleTriggers() {- "use strict";-- // Serialize all trigger data- var triggerData = $( ".rule-trigger-tbody" ).find( "input[type=text], input[type=checkbox], select" ).serializeArray();-- // Find a list of existing transactions that match these triggers+ "use strict";++ // Serialize all trigger data+ var triggerData = $(".rule-trigger-tbody").find("input[type=text], input[type=checkbox], select").serializeArray();++ // Find a list of existing transactions that match these triggers$.get('rules/test', triggerData).done(function (data) {- var modal = $( "#testTriggerModal" );- var numTriggers = $( ".rule-trigger-body > tr" ).length;-- // Set title and body- modal.find( ".transactions-list" ).html(data.html);-- // Show warning if appropriate- if( data.warning ) {- modal.find( ".transaction-warning .warning-contents" ).text(data.warning);- modal.find( ".transaction-warning" ).show();- } else {- modal.find( ".transaction-warning" ).hide();- }-- // Show the modal dialog- $( "#testTriggerModal" ).modal();+ var modal = $("#testTriggerModal");++ // Set title and body+ modal.find(".transactions-list").html(data.html);++ // Show warning if appropriate+ if (data.warning) {+ modal.find(".transaction-warning .warning-contents").text(data.warning);+ modal.find(".transaction-warning").show();+ } else {+ modal.find(".transaction-warning").hide();+ }++ // Show the modal dialog+ $("#testTriggerModal").modal();}).fail(function () {alert('Cannot get transactions for given triggers.');});diff --git a/public/js/ff/rules/create.js b/public/js/ff/rules/create.jsindex 739762d228..ffa65be20e 100644--- a/public/js/ff/rules/create.js+++ b/public/js/ff/rules/create.js@@ -8,6 +8,9 @@* See the LICENSE file for details.*/+/** global: triggerCount, actionCount */++$(function () {"use strict";if (triggerCount === 0) {diff --git a/public/js/ff/rules/edit.js b/public/js/ff/rules/edit.jsindex 7ff822a186..893feff138 100644--- a/public/js/ff/rules/edit.js+++ b/public/js/ff/rules/edit.js@@ -8,6 +8,8 @@* See the LICENSE file for details.*/+/** global: triggerCount, actionCount */+$(function () {"use strict";if (triggerCount === 0) {diff --git a/public/js/ff/rules/index.js b/public/js/ff/rules/index.jsindex b9b4045b5c..0fc0ef7371 100644--- a/public/js/ff/rules/index.js+++ b/public/js/ff/rules/index.js@@ -52,7 +52,6 @@ function sortStop(event, ui) {$.each(parent.children(), function (i, v) {var trigger = $(v);var id = trigger.data('id');- var order = i + 1;entries.push(id);});diff --git a/public/js/ff/split/journal/from-store.js b/public/js/ff/split/journal/from-store.jsindex 03ceb49ba5..a614d77d4e 100644--- a/public/js/ff/split/journal/from-store.js+++ b/public/js/ff/split/journal/from-store.js@@ -8,6 +8,8 @@* See the LICENSE file for details.*/+/** global: originalSum, amount, accounting */+var destAccounts = {};var srcAccounts = {};var categories = {};diff --git a/public/js/ff/tags/create.js b/public/js/ff/tags/create.jsindex 77e8224238..b252d00ae9 100644--- a/public/js/ff/tags/create.js+++ b/public/js/ff/tags/create.js@@ -8,6 +8,8 @@* See the LICENSE file for details.*/+/** global: zoomLevel, latitude, longitude, google */+$(function () {"use strict";@@ -60,12 +62,12 @@ function initialize() {Respond to zoom event.*/google.maps.event.addListener(map, 'zoom_changed', function () {- saveZoomLevel(event);+ saveZoomLevel();});/*Maybe place marker?*/- if(doPlaceMarker) {+ if(doPlaceMarker == true) {var myLatlng = new google.maps.LatLng(latitude,longitude);var fakeEvent = {};fakeEvent.latLng = myLatlng;diff --git a/public/js/ff/tags/edit.js b/public/js/ff/tags/edit.jsindex c4f9cd0cfb..53b66933c4 100644--- a/public/js/ff/tags/edit.js+++ b/public/js/ff/tags/edit.js@@ -7,6 +7,7 @@** See the LICENSE file for details.*/+/** global: zoomLevel, latitude, longitude, google */$(function () {"use strict";@@ -60,12 +61,12 @@ function initialize() {Respond to zoom event.*/google.maps.event.addListener(map, 'zoom_changed', function () {- saveZoomLevel(event);+ saveZoomLevel();});/*Maybe place marker?*/- if(doPlaceMarker) {+ if(doPlaceMarker == true) {var myLatlng = new google.maps.LatLng(latitude,longitude);var fakeEvent = {};fakeEvent.latLng = myLatlng;diff --git a/public/js/ff/tags/index.js b/public/js/ff/tags/index.jsindex a24180b4e0..1234a027ba 100644--- a/public/js/ff/tags/index.js+++ b/public/js/ff/tags/index.js@@ -8,6 +8,8 @@* See the LICENSE file for details.*/+/** global: zoomLevel, latitude, longitude, google */+$(function () {"use strict";@@ -60,12 +62,12 @@ function initialize() {Respond to zoom event.*/google.maps.event.addListener(map, 'zoom_changed', function () {- saveZoomLevel(event);+ saveZoomLevel();});/*Maybe place marker?*/- if(doPlaceMarker) {+ if(doPlaceMarker == true) {var myLatlng = new google.maps.LatLng(latitude,longitude);var fakeEvent = {};fakeEvent.latLng = myLatlng;diff --git a/public/js/ff/transactions/create-edit.js b/public/js/ff/transactions/create-edit.jsindex ae827d8983..44796c50bb 100644--- a/public/js/ff/transactions/create-edit.js+++ b/public/js/ff/transactions/create-edit.js@@ -58,19 +58,19 @@ $(document).ready(function () {}- if ($('input[name="description"]').length > 0 && what !== undefined) {+ if ($('input[name="description"]').length > 0 && !(typeof what === "undefined")) {$.getJSON('json/transaction-journals/' + what).done(function (data) {$('input[name="description"]').typeahead({source: data});});}// also for multi input:- if ($('input[name="description[]"]').length > 0 && what !== undefined) {+ if ($('input[name="description[]"]').length > 0 && !(typeof what === "undefined")) {$.getJSON('json/transaction-journals/' + what).done(function (data) {$('input[name="description[]"]').typeahead({source: data});});}// and for the (rare) journal_description:- if ($('input[name="journal_description"]').length > 0 && what !== undefined) {+ if ($('input[name="journal_description"]').length > 0 && !(typeof what === "undefined")) {$.getJSON('json/transaction-journals/' + what).done(function (data) {$('input[name="journal_description"]').typeahead({source: data});});diff --git a/public/js/ff/transactions/create.js b/public/js/ff/transactions/create.jsindex c2e38f6b6d..0440006594 100644--- a/public/js/ff/transactions/create.js+++ b/public/js/ff/transactions/create.js@@ -8,12 +8,14 @@* See the LICENSE file for details.*/+/** global: what, title, breadcrumbs, middleCrumbName, button, piggiesLength, txt */+$(document).ready(function () {"use strict";// respond to switch buttons when// creating stuff:- if (doSwitch) {+ if (doSwitch == true) {updateButtons();updateForm();updateLayout();@@ -35,6 +37,7 @@ function updateForm() {$('input[name="what"]').val(what);switch (what) {+ default:case 'withdrawal':// show source_id and dest_name:$('#source_account_id_holder').show();diff --git a/public/js/ff/transactions/list.js b/public/js/ff/transactions/list.jsindex 7e87446a48..74dc53f24d 100644--- a/public/js/ff/transactions/list.js+++ b/public/js/ff/transactions/list.js@@ -8,6 +8,8 @@* See the LICENSE file for details.*/+/** global: edit_selected_txt, delete_selected_txt */+$(document).ready(function () {"use strict";$('.mass_edit_all').show();