mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 18:41:08 +00:00
Cleanup JS
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
drawChart();
|
|
||||||
|
|
||||||
if ($('#inputDateRange').length > 0) {
|
if ($('#inputDateRange').length > 0) {
|
||||||
|
|
||||||
@@ -43,17 +42,9 @@ $(function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.openModal').on('click', openModal);
|
|
||||||
|
|
||||||
$('.date-select').on('click', preSelectDate);
|
$('.date-select').on('click', preSelectDate);
|
||||||
|
|
||||||
$('#report-form').on('submit', catchSubmit);
|
$('#report-form').on('submit', catchSubmit);
|
||||||
|
|
||||||
|
|
||||||
// click open the top X income list:
|
|
||||||
$('#showIncomes').click(showIncomes);
|
|
||||||
// click open the top X expense list:
|
|
||||||
$('#showExpenses').click(showExpenses);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function catchSubmit() {
|
function catchSubmit() {
|
||||||
@@ -102,88 +93,9 @@ function preSelectDate(e) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawChart() {
|
|
||||||
"use strict";
|
|
||||||
if (typeof columnChart !== 'undefined' && typeof year !== 'undefined' && typeof month === 'undefined') {
|
|
||||||
|
|
||||||
columnChart('chart/report/in-out/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds, 'income-expenses-chart');
|
|
||||||
columnChart('chart/report/in-out-sum/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds, 'income-expenses-sum-chart');
|
|
||||||
}
|
|
||||||
if (typeof stackedColumnChart !== 'undefined' && typeof year !== 'undefined' && typeof month === 'undefined') {
|
|
||||||
stackedColumnChart('chart/budget/year/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds, 'budgets');
|
|
||||||
stackedColumnChart('chart/category/spent-in-year/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds, 'categories-spent-in-year');
|
|
||||||
stackedColumnChart('chart/category/earned-in-year/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds, 'categories-earned-in-year');
|
|
||||||
}
|
|
||||||
|
|
||||||
//if (typeof lineChart !== 'undefined' && typeof month !== 'undefined' && typeof reportURL === 'undefined') {
|
|
||||||
// lineChart('/chart/account/month/' + year + '/' + month + shared, 'account-balances-chart');
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (typeof lineChart !== 'undefined' && typeof accountIds !== 'undefined') {
|
|
||||||
lineChart('/chart/account/report/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds, 'account-balances-chart');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function openModal(e) {
|
|
||||||
"use strict";
|
|
||||||
var target = $(e.target).parent();
|
|
||||||
var URL = target.attr('href');
|
|
||||||
|
|
||||||
$.get(URL).success(function (data) {
|
|
||||||
$('#defaultModal').empty().html(data).modal('show');
|
|
||||||
|
|
||||||
}).fail(function () {
|
|
||||||
alert('Could not load data.');
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function showIncomes() {
|
|
||||||
"use strict";
|
|
||||||
if (incomeRestShow) {
|
|
||||||
// hide everything, make button say "show"
|
|
||||||
$('#showIncomes').text(showTheRest);
|
|
||||||
$('.incomesCollapsed').removeClass('in').addClass('out');
|
|
||||||
|
|
||||||
// toggle:
|
|
||||||
incomeRestShow = false;
|
|
||||||
} else {
|
|
||||||
// show everything, make button say "hide".
|
|
||||||
$('#showIncomes').text(hideTheRest);
|
|
||||||
$('.incomesCollapsed').removeClass('out').addClass('in');
|
|
||||||
|
|
||||||
// toggle:
|
|
||||||
incomeRestShow = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function showExpenses() {
|
|
||||||
"use strict";
|
|
||||||
if (expenseRestShow) {
|
|
||||||
// hide everything, make button say "show"
|
|
||||||
$('#showExpenses').text(showTheRestExpense);
|
|
||||||
$('.expenseCollapsed').removeClass('in').addClass('out');
|
|
||||||
|
|
||||||
// toggle:
|
|
||||||
expenseRestShow = false;
|
|
||||||
} else {
|
|
||||||
// show everything, make button say "hide".
|
|
||||||
$('#showExpenses').text(hideTheRestExpense);
|
|
||||||
$('.expenseCollapsed').removeClass('out').addClass('in');
|
|
||||||
|
|
||||||
// toggle:
|
|
||||||
expenseRestShow = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createCookie(name, value, days) {
|
function createCookie(name, value, days) {
|
||||||
|
"use strict";
|
||||||
var expires;
|
var expires;
|
||||||
|
|
||||||
if (days) {
|
if (days) {
|
||||||
@@ -197,6 +109,7 @@ function createCookie(name, value, days) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function readCookie(name) {
|
function readCookie(name) {
|
||||||
|
"use strict";
|
||||||
var nameEQ = encodeURIComponent(name) + "=";
|
var nameEQ = encodeURIComponent(name) + "=";
|
||||||
var ca = document.cookie.split(';');
|
var ca = document.cookie.split(';');
|
||||||
for (var i = 0; i < ca.length; i++) {
|
for (var i = 0; i < ca.length; i++) {
|
||||||
@@ -206,7 +119,3 @@ function readCookie(name) {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function eraseCookie(name) {
|
|
||||||
createCookie(name, "", -1);
|
|
||||||
}
|
|
Reference in New Issue
Block a user