Skip to content

Firefly III: a personal finances manager

Update js [skip ci]

James Cole860a0f790e23
diff --git a/gulpfile.js b/gulpfile.js
index 7cf626734f..14dd43eabf 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -1,3 +1,4 @@
+/* globals require */
var elixir = require('laravel-elixir');
/*
@@ -12,5 +13,6 @@ var elixir = require('laravel-elixir');
*/
elixir(function(mix) {
+ "use strict";
mix.less('app.less');
});
diff --git a/public/js/budgets.js b/public/js/budgets.js
index 0c8f20f43f..e49c874624 100644
--- a/public/js/budgets.js
+++ b/public/js/budgets.js
@@ -53,7 +53,7 @@ function updateSingleRange(e) {
// update the link if relevant:
$('#budget-link-' + id).attr('href', 'budgets/show/' + id + '/' + data.repetition);
});
- if (input.attr('type') == 'number') {
+ if (input.attr('type') === 'number') {
// update the range-input:
$('#budget-range-' + id).val(value);
} else {
@@ -126,13 +126,8 @@ function updateRanges() {
// update small display:
$('#budget-range-display-' + id).text('\u20AC ' + value.toFixed(2));
- // update progress bar (if relevant)
- var barHolder = $('#budget-progress-' + id);
- var spent = parseFloat(barHolder.data('spent'));
-
// send a post to Firefly to update the amount:
- $.post('budgets/amount/' + id, {amount: value, _token: token}).success(function (data) {
- });
+ $.post('budgets/amount/' + id, {amount: value, _token: token});
});
diff --git a/public/js/piggy-banks.js b/public/js/piggy-banks.js
index d34bf49760..4e32a77eee 100644
--- a/public/js/piggy-banks.js
+++ b/public/js/piggy-banks.js
@@ -1,5 +1,8 @@
+/* globals $, googleLineChart, token */
+
// Return a helper with preserved width of cells
-var fixHelper = function(e, tr) {
+var fixHelper = function (e, tr) {
+ "use strict";
var $originals = tr.children();
var $helper = tr.clone();
$helper.children().each(function (index) {
@@ -10,6 +13,7 @@ var fixHelper = function(e, tr) {
};
$(function () {
+ "use strict";
$('.addMoney').on('click', addMoney);
$('.removeMoney').on('click', removeMoney);
@@ -43,8 +47,8 @@ $(function () {
});
-
function addMoney(e) {
+ "use strict";
var pigID = parseInt($(e.target).data('id'));
$('#moneyManagementModal').empty().load('piggy-banks/add/' + pigID, function () {
$('#moneyManagementModal').modal('show');
@@ -54,6 +58,7 @@ function addMoney(e) {
}
function removeMoney(e) {
+ "use strict";
var pigID = parseInt($(e.target).data('id'));
$('#moneyManagementModal').empty().load('piggy-banks/remove/' + pigID, function () {
$('#moneyManagementModal').modal('show');
@@ -62,15 +67,15 @@ function removeMoney(e) {
return false;
}
function stopSorting() {
+ "use strict";
$('.loadSpin').addClass('fa fa-refresh fa-spin');
var order = [];
- $.each($('#sortable>tbody>tr'), function(i,v) {
+ $.each($('#sortable>tbody>tr'), function (i, v) {
var holder = $(v);
var id = holder.data('id');
order.push(id);
});
- $.post('/piggy-banks/sort',{_token: token, order: order}).success(function(data) {
- "use strict";
+ $.post('/piggy-banks/sort', {_token: token, order: order}).success(function () {
$('.loadSpin').removeClass('fa fa-refresh fa-spin');
});
}
\ No newline at end of file
diff --git a/public/js/reports.js b/public/js/reports.js
index dfcbee44a1..36845910f6 100644
--- a/public/js/reports.js
+++ b/public/js/reports.js
@@ -1,9 +1,11 @@
+/* globals expenseRestShow:true, incomeRestShow:true, year, shared, month, hideTheRest, showTheRest, showTheRestExpense, hideTheRestExpense, googleColumnChart, googleLineChart, googleStackedColumnChartg */
if (typeof(google) !== 'undefined') {
google.setOnLoadCallback(drawChart);
}
function drawChart() {
+ "use strict";
googleColumnChart('chart/report/in-out/' + year + shared, 'income-expenses-chart');
googleColumnChart('chart/report/in-out-sum/' + year + shared, 'income-expenses-sum-chart');
@@ -13,16 +15,8 @@ function drawChart() {
googleLineChart('/chart/account/month/' + year + '/' + month + shared, 'account-balances-chart');
}
-$(function () {
- $('.openModal').on('click', openModal);
- // click open the top X income list:
- $('#showIncomes').click(showIncomes);
- // click open the top X expense list:
- $('#showExpenses').click(showExpenses);
-});
-
function openModal(e) {
"use strict";
var target = $(e.target).parent();
@@ -61,6 +55,7 @@ function showIncomes() {
}
function showExpenses() {
+ "use strict";
if (expenseRestShow) {
// hide everything, make button say "show"
$('#showExpenses').text(showTheRestExpense);
@@ -78,4 +73,15 @@ function showExpenses() {
}
return false;
-}
\ No newline at end of file
+}
+
+$(function () {
+ "use strict";
+ $('.openModal').on('click', openModal);
+
+
+ // click open the top X income list:
+ $('#showIncomes').click(showIncomes);
+ // click open the top X expense list:
+ $('#showExpenses').click(showExpenses);
+});
\ No newline at end of file
diff --git a/public/js/tags.js b/public/js/tags.js
index f099ec1ee2..c87f6b8cb7 100644
--- a/public/js/tags.js
+++ b/public/js/tags.js
@@ -1,5 +1,6 @@
+/* globals zoomLevel, token, google, latitude, longitude */
$(function () {
-
+ "use strict";
/*
Hide and show the tag index help.
*/
@@ -47,7 +48,7 @@ function clearLocation() {
}
function initialize() {
-
+ "use strict";
/*
Create new map:
*/
@@ -91,6 +92,7 @@ function saveZoomLevel() {
* @param event
*/
function placeMarker(event) {
+ "use strict";
deleteMarkers();
var marker = new google.maps.Marker({position: event.latLng, map: map});
$('input[name="latitude"]').val(event.latLng.lat());
@@ -105,6 +107,7 @@ function placeMarker(event) {
* Deletes all markers in the array by removing references to them.
*/
function deleteMarkers() {
+ "use strict";
for (var i = 0; i < markers.length; i++) {
markers[i].setMap(null);
}
diff --git a/public/js/transactions.js b/public/js/transactions.js
index 446bde7043..b9cee1ded4 100644
--- a/public/js/transactions.js
+++ b/public/js/transactions.js
@@ -1,8 +1,6 @@
+/* globals what, $ */
$(document).ready(function () {
- if (typeof googleTablePaged != 'undefined') {
- googleTablePaged('table/transactions/' + what, 'transaction-table');
- }
-
+ "use strict";
if ($('input[name="expense_account"]').length > 0) {
$.getJSON('json/expense-accounts').success(function (data) {
$('input[name="expense_account"]').typeahead({source: data});