mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Add JSHint stuff. [skip ci]
This commit is contained in:
parent
285b77dcb7
commit
8daccbfbb4
22
.jshintrc
Normal file
22
.jshintrc
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"undef": true,
|
||||||
|
"unused": false,
|
||||||
|
"strict": true,
|
||||||
|
"browser": true,
|
||||||
|
"jquery": true,
|
||||||
|
"devel": true,
|
||||||
|
"globals": [
|
||||||
|
"language",
|
||||||
|
"token",
|
||||||
|
"currencyCode",
|
||||||
|
"$",
|
||||||
|
"token",
|
||||||
|
"accountID",
|
||||||
|
"billID",
|
||||||
|
"currentMonthName",
|
||||||
|
"previousMonthName",
|
||||||
|
"nextMonthName",
|
||||||
|
"everything",
|
||||||
|
"moment"
|
||||||
|
]
|
||||||
|
}
|
@ -1,11 +1,23 @@
|
|||||||
$(function () {
|
/* global $ */
|
||||||
|
|
||||||
|
|
||||||
|
// Return a helper with preserved width of cells
|
||||||
|
var fixHelper = function (e, ui) {
|
||||||
|
"use strict";
|
||||||
|
ui.children().each(function () {
|
||||||
|
$(this).width($(this).width());
|
||||||
|
});
|
||||||
|
return ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
"use strict";
|
||||||
if (typeof(googleLineChart) === "function" && typeof accountID !== 'undefined') {
|
if (typeof(googleLineChart) === "function" && typeof accountID !== 'undefined') {
|
||||||
googleLineChart('chart/account/' + accountID, 'overview-chart');
|
googleLineChart('chart/account/' + accountID, 'overview-chart');
|
||||||
}
|
}
|
||||||
|
|
||||||
// sortable!
|
// sortable!
|
||||||
if (typeof $(".sortable-table tbody").sortable != "undefined") {
|
if (typeof $(".sortable-table tbody").sortable !== "undefined") {
|
||||||
$(".sortable-table tbody").sortable(
|
$(".sortable-table tbody").sortable(
|
||||||
{
|
{
|
||||||
helper: fixHelper,
|
helper: fixHelper,
|
||||||
@ -19,23 +31,14 @@ $(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Return a helper with preserved width of cells
|
|
||||||
var fixHelper = function (e, ui) {
|
|
||||||
ui.children().each(function () {
|
|
||||||
$(this).width($(this).width());
|
|
||||||
});
|
|
||||||
return ui;
|
|
||||||
};
|
|
||||||
|
|
||||||
function sortStop(event, ui) {
|
function sortStop(event, ui) {
|
||||||
|
"use strict";
|
||||||
var current = $(ui.item);
|
var current = $(ui.item);
|
||||||
var thisDate = current.data('date');
|
var thisDate = current.data('date');
|
||||||
var originalBG = current.css('backgroundColor');
|
var originalBG = current.css('backgroundColor');
|
||||||
|
|
||||||
|
|
||||||
if (current.prev().data('date') != thisDate && current.next().data('date') != thisDate) {
|
if (current.prev().data('date') !== thisDate && current.next().data('date') !== thisDate) {
|
||||||
//console.log('False!');
|
|
||||||
//console.log('[' + current.prev().data('date') + '] [' + thisDate + '] [' + current.next().data('date') + ']');
|
|
||||||
// animate something with color:
|
// animate something with color:
|
||||||
current.animate({
|
current.animate({
|
||||||
backgroundColor: "#d9534f"
|
backgroundColor: "#d9534f"
|
||||||
@ -59,10 +62,6 @@ function sortStop(event, ui) {
|
|||||||
|
|
||||||
// do extra animation when done?
|
// do extra animation when done?
|
||||||
$.post('/transaction/reorder', {items: submit, date: thisDate, _token: token});
|
$.post('/transaction/reorder', {items: submit, date: thisDate, _token: token});
|
||||||
console.log(submit);
|
|
||||||
|
|
||||||
//console.log('TRUE!');
|
|
||||||
//console.log('[' + current.prev().data('date') + '] [' + thisDate + '] [' + current.next().data('date') + ']');
|
|
||||||
|
|
||||||
current.animate({
|
current.animate({
|
||||||
backgroundColor: "#5cb85c"
|
backgroundColor: "#5cb85c"
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
$(document).ready(function () {
|
/* global googleComboChart, billID */
|
||||||
|
|
||||||
if (typeof(googleComboChart) === 'function' && typeof(billID) !== 'undefined') {
|
$(document).ready(function () {
|
||||||
googleComboChart('chart/bill/' + billID, 'bill-overview');
|
"use strict";
|
||||||
}
|
if (typeof(googleComboChart) === 'function' && typeof(billID) !== 'undefined') {
|
||||||
}
|
googleComboChart('chart/bill/' + billID, 'bill-overview');
|
||||||
|
}
|
||||||
|
}
|
||||||
);
|
);
|
@ -1,4 +1,7 @@
|
|||||||
|
/* globals $, token, budgetID, repetitionID */
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
"use strict";
|
||||||
updateRanges();
|
updateRanges();
|
||||||
//$('input[type="range"]').change(updateSingleRange);
|
//$('input[type="range"]').change(updateSingleRange);
|
||||||
$('input[type="range"]').on('input', updateSingleRange);
|
$('input[type="range"]').on('input', updateSingleRange);
|
||||||
@ -18,6 +21,7 @@ $(function () {
|
|||||||
|
|
||||||
|
|
||||||
function updateSingleRange(e) {
|
function updateSingleRange(e) {
|
||||||
|
"use strict";
|
||||||
// get some values:
|
// get some values:
|
||||||
var input = $(e.target);
|
var input = $(e.target);
|
||||||
var id = input.data('id');
|
var id = input.data('id');
|
||||||
@ -63,6 +67,7 @@ function updateSingleRange(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateTotal() {
|
function updateTotal() {
|
||||||
|
"use strict";
|
||||||
var sum = 0;
|
var sum = 0;
|
||||||
$('input[type="range"]').each(function (i, v) {
|
$('input[type="range"]').each(function (i, v) {
|
||||||
// get some values:
|
// get some values:
|
||||||
@ -94,7 +99,8 @@ function updateTotal() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateIncome(e) {
|
function updateIncome() {
|
||||||
|
"use strict";
|
||||||
$('#monthlyBudgetModal').empty().load('budgets/income', function () {
|
$('#monthlyBudgetModal').empty().load('budgets/income', function () {
|
||||||
$('#monthlyBudgetModal').modal('show');
|
$('#monthlyBudgetModal').modal('show');
|
||||||
});
|
});
|
||||||
@ -103,6 +109,7 @@ function updateIncome(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRanges() {
|
function updateRanges() {
|
||||||
|
"use strict";
|
||||||
/**
|
/**
|
||||||
* Update all ranges.
|
* Update all ranges.
|
||||||
*/
|
*/
|
||||||
@ -133,8 +140,9 @@ function updateRanges() {
|
|||||||
* Update total sum:
|
* Update total sum:
|
||||||
*/
|
*/
|
||||||
var totalAmount = parseInt($('#totalAmount').data('value'));
|
var totalAmount = parseInt($('#totalAmount').data('value'));
|
||||||
|
var pct;
|
||||||
if (sum <= totalAmount) {
|
if (sum <= totalAmount) {
|
||||||
var pct = sum / totalAmount * 100;
|
pct = sum / totalAmount * 100;
|
||||||
$('#progress-bar-default').css('width', pct + '%');
|
$('#progress-bar-default').css('width', pct + '%');
|
||||||
$('#progress-bar-warning').css('width', '0');
|
$('#progress-bar-warning').css('width', '0');
|
||||||
$('#progress-bar-danger').css('width', '0');
|
$('#progress-bar-danger').css('width', '0');
|
||||||
@ -142,7 +150,7 @@ function updateRanges() {
|
|||||||
} else {
|
} else {
|
||||||
// we gaan er X overheen,
|
// we gaan er X overheen,
|
||||||
|
|
||||||
var pct = totalAmount / sum * 100;
|
pct = totalAmount / sum * 100;
|
||||||
var danger = 100 - pct;
|
var danger = 100 - pct;
|
||||||
var err = 100 - danger;
|
var err = 100 - danger;
|
||||||
$('#progress-bar-default').css('width', 0);
|
$('#progress-bar-default').css('width', 0);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
/* globals $, categoryID */
|
||||||
$(function () {
|
$(function () {
|
||||||
|
"use strict";
|
||||||
if (typeof categoryID !== 'undefined') {
|
if (typeof categoryID !== 'undefined') {
|
||||||
googleColumnChart('chart/category/' + categoryID + '/all', 'all');
|
googleColumnChart('chart/category/' + categoryID + '/all', 'all');
|
||||||
googleColumnChart('chart/category/' + categoryID + '/month', 'month');
|
googleColumnChart('chart/category/' + categoryID + '/month', 'month');
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
/* globals start, end, dateRangeURL, everything, firstDate, moment, currentMonthName, $, previousMonthName, nextMonthName, applyLabel, cancelLabel, toLabel, customRangeLabel, fromLabel, */
|
||||||
$(function () {
|
$(function () {
|
||||||
|
"use strict";
|
||||||
$('.currencySelect').click(currencySelect);
|
$('.currencySelect').click(currencySelect);
|
||||||
|
|
||||||
ranges = {};
|
var ranges = {};
|
||||||
ranges[currentMonthName] = [moment().startOf('month'), moment().endOf('month')];
|
ranges[currentMonthName] = [moment().startOf('month'), moment().endOf('month')];
|
||||||
ranges[previousMonthName] = [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')];
|
ranges[previousMonthName] = [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')];
|
||||||
ranges[nextMonthName] = [moment().add(1, 'month').startOf('month'), moment().add(1, 'month').endOf('month')];
|
ranges[nextMonthName] = [moment().add(1, 'month').startOf('month'), moment().add(1, 'month').endOf('month')];
|
||||||
@ -10,11 +11,6 @@ $(function () {
|
|||||||
|
|
||||||
$('#daterange').daterangepicker(
|
$('#daterange').daterangepicker(
|
||||||
{
|
{
|
||||||
//View::share('currentMonthName', $current);
|
|
||||||
//View::share('previousMonthName', $prev);
|
|
||||||
//View::share('nextMonthName', $next);
|
|
||||||
|
|
||||||
|
|
||||||
ranges: ranges,
|
ranges: ranges,
|
||||||
opens: 'left',
|
opens: 'left',
|
||||||
locale: {
|
locale: {
|
||||||
@ -54,6 +50,7 @@ $(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function currencySelect(e) {
|
function currencySelect(e) {
|
||||||
|
"use strict";
|
||||||
var target = $(e.target);
|
var target = $(e.target);
|
||||||
var symbol = target.data('symbol');
|
var symbol = target.data('symbol');
|
||||||
var code = target.data('code');
|
var code = target.data('code');
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
|
/* globals currencyCode, language, defaultPieChartOptions, defaultLineChartOptions, defaultColumnChartOptions, defaultBarChartOptions, defaultStackedColumnChartOptions, defaultComboChartOptions */
|
||||||
|
/* exported googleLineChart, googleBarChart, googleColumnChart, googleStackedColumnChart, googleComboChart, googlePieChart */
|
||||||
var google = google || {};
|
var google = google || {};
|
||||||
google.load('visualization', '1.1', {'packages': ['corechart', 'bar', 'line'],'language': language });
|
google.load('visualization', '1.1', {'packages': ['corechart', 'bar', 'line'],'language': language });
|
||||||
|
|
||||||
function googleChart(chartType, URL, container, options) {
|
function googleChart(chartType, URL, container, options) {
|
||||||
|
"use strict";
|
||||||
if ($('#' + container).length === 1) {
|
if ($('#' + container).length === 1) {
|
||||||
$.getJSON(URL).success(function (data) {
|
$.getJSON(URL).success(function (data) {
|
||||||
/*
|
/*
|
||||||
Get the data from the JSON
|
Get the data from the JSON
|
||||||
*/
|
*/
|
||||||
gdata = new google.visualization.DataTable(data);
|
var gdata = new google.visualization.DataTable(data);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Format as money
|
Format as money
|
||||||
@ -67,25 +70,32 @@ function googleChart(chartType, URL, container, options) {
|
|||||||
|
|
||||||
|
|
||||||
function googleLineChart(URL, container, options) {
|
function googleLineChart(URL, container, options) {
|
||||||
|
"use strict";
|
||||||
return googleChart('line', URL, container, options);
|
return googleChart('line', URL, container, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function googleBarChart(URL, container, options) {
|
function googleBarChart(URL, container, options) {
|
||||||
|
"use strict";
|
||||||
return googleChart('bar', URL, container, options);
|
return googleChart('bar', URL, container, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
function googleColumnChart(URL, container, options) {
|
function googleColumnChart(URL, container, options) {
|
||||||
|
"use strict";
|
||||||
return googleChart('column', URL, container, options);
|
return googleChart('column', URL, container, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
function googleStackedColumnChart(URL, container, options) {
|
function googleStackedColumnChart(URL, container, options) {
|
||||||
|
"use strict";
|
||||||
return googleChart('stackedColumn', URL, container, options);
|
return googleChart('stackedColumn', URL, container, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
function googleComboChart(URL, container, options) {
|
function googleComboChart(URL, container, options) {
|
||||||
|
"use strict";
|
||||||
return googleChart('combo', URL, container, options);
|
return googleChart('combo', URL, container, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
function googlePieChart(URL, container, options) {
|
function googlePieChart(URL, container, options) {
|
||||||
|
"use strict";
|
||||||
return googleChart('pie', URL, container, options);
|
return googleChart('pie', URL, container, options);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* exported defaultLineChartOptions, defaultBarChartOptions, defaultComboChartOptions, defaultColumnChartOptions, defaultStackedColumnChartOptions, defaultPieChartOptions */
|
||||||
|
|
||||||
var defaultLineChartOptions = {
|
var defaultLineChartOptions = {
|
||||||
curveType: 'function',
|
curveType: 'function',
|
||||||
legend: {
|
legend: {
|
||||||
@ -69,7 +71,7 @@ var defaultBarChartOptions = {
|
|||||||
|
|
||||||
legend: {
|
legend: {
|
||||||
position: 'none'
|
position: 'none'
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var defaultComboChartOptions = {
|
var defaultComboChartOptions = {
|
||||||
@ -127,7 +129,7 @@ var defaultColumnChartOptions = {
|
|||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
position: 'none'
|
position: 'none'
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var defaultStackedColumnChartOptions = {
|
var defaultStackedColumnChartOptions = {
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
$(function () {
|
$(function () {
|
||||||
|
"use strict";
|
||||||
$('#help').click(showHelp);
|
$('#help').click(showHelp);
|
||||||
$(function () {
|
$(function () {
|
||||||
$('[data-toggle="tooltip"]').tooltip()
|
|
||||||
})
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function showHelp(e) {
|
function showHelp(e) {
|
||||||
target = $(e.target);
|
"use strict";
|
||||||
route = target.data('route');
|
var target = $(e.target);
|
||||||
|
var route = target.data('route');
|
||||||
//
|
//
|
||||||
$('#helpBody').html('<i class="fa fa-refresh fa-spin"></i>');
|
$('#helpBody').html('<i class="fa fa-refresh fa-spin"></i>');
|
||||||
$('#helpTitle').html('Please hold...');
|
$('#helpTitle').html('Please hold...');
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* globals google */
|
||||||
google.setOnLoadCallback(drawChart);
|
google.setOnLoadCallback(drawChart);
|
||||||
|
|
||||||
|
|
||||||
@ -12,13 +13,20 @@ function drawChart() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getBoxAmounts() {
|
function getBoxAmounts() {
|
||||||
|
"use strict";
|
||||||
var boxes = ['in', 'out', 'bills-unpaid', 'bills-paid'];
|
var boxes = ['in', 'out', 'bills-unpaid', 'bills-paid'];
|
||||||
for (x in boxes) {
|
for (var x in boxes) {
|
||||||
var box = boxes[x];
|
var box = boxes[x];
|
||||||
$.getJSON('/json/box/' + box).success(function (data) {
|
$.getJSON('/json/box/' + box).success(putData).fail(failData);
|
||||||
$('#box-' + data.box).html(data.amount);
|
|
||||||
}).fail(function () {
|
|
||||||
console.log('Failed to get box!')
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function putData(data) {
|
||||||
|
"use strict";
|
||||||
|
$('#box-' + data.box).html(data.amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
function failData() {
|
||||||
|
"use strict";
|
||||||
|
console.log('Failed to get box!');
|
||||||
|
}
|
@ -1,3 +1,14 @@
|
|||||||
|
// Return a helper with preserved width of cells
|
||||||
|
var fixHelper = function(e, tr) {
|
||||||
|
var $originals = tr.children();
|
||||||
|
var $helper = tr.clone();
|
||||||
|
$helper.children().each(function (index) {
|
||||||
|
// Set helper cell sizes to match the original sizes
|
||||||
|
$(this).width($originals.eq(index).width());
|
||||||
|
});
|
||||||
|
return $helper;
|
||||||
|
};
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
$('.addMoney').on('click', addMoney);
|
$('.addMoney').on('click', addMoney);
|
||||||
$('.removeMoney').on('click', removeMoney);
|
$('.removeMoney').on('click', removeMoney);
|
||||||
@ -31,16 +42,7 @@ $(function () {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Return a helper with preserved width of cells
|
|
||||||
var fixHelper = function(e, tr) {
|
|
||||||
var $originals = tr.children();
|
|
||||||
var $helper = tr.clone();
|
|
||||||
$helper.children().each(function (index) {
|
|
||||||
// Set helper cell sizes to match the original sizes
|
|
||||||
$(this).width($originals.eq(index).width());
|
|
||||||
});
|
|
||||||
return $helper;
|
|
||||||
}
|
|
||||||
|
|
||||||
function addMoney(e) {
|
function addMoney(e) {
|
||||||
var pigID = parseInt($(e.target).data('id'));
|
var pigID = parseInt($(e.target).data('id'));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
if (typeof(google) != 'undefined') {
|
if (typeof(google) !== 'undefined') {
|
||||||
google.setOnLoadCallback(drawChart);
|
google.setOnLoadCallback(drawChart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($('input[name="description"]').length > 0 && what != undefined) {
|
if ($('input[name="description"]').length > 0 && what !== undefined) {
|
||||||
$.getJSON('json/transaction-journals/' + what).success(function (data) {
|
$.getJSON('json/transaction-journals/' + what).success(function (data) {
|
||||||
$('input[name="description"]').typeahead({source: data});
|
$('input[name="description"]').typeahead({source: data});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user