Various code cleanup.

This commit is contained in:
James Cole
2017-12-29 09:05:35 +01:00
parent cf66ae61e1
commit 3815f9836f
135 changed files with 1021 additions and 973 deletions

View File

@@ -92,7 +92,6 @@ function storeReconcile() {
transactions: ids,
cleared: cleared,
};
console.log
var uri = overviewUri.replace('%start%', $('input[name="start_date"]').val()).replace('%end%', $('input[name="end_date"]').val());

View File

@@ -18,7 +18,7 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: chartUri, incomeCategoryUri, expenseCategoryUri, expenseBudgetUri */
/** global: chartUri, incomeCategoryUri, expenseCategoryUri, expenseBudgetUri, token */
var fixHelper = function (e, tr) {
"use strict";

View File

@@ -18,6 +18,8 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: updateCheckUri */
$(function () {
"use strict";
@@ -31,7 +33,7 @@ function checkUpdate() {
// do post update check:
$.post(updateCheckUri).done(function (data) {
alert(data.result);
}).fail(function() {
}).fail(function () {
alert('Error while checking.');
});

View File

@@ -18,7 +18,7 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: infoIncomeUri, spent, budgeted, available, currencySymbol, budgetIndexUri, updateIncomeUri, periodStart, periodEnd, budgetAmountUri, accounting */
/** global: infoIncomeUri, token, spent, budgeted, available, currencySymbol, budgetIndexUri, updateIncomeUri, periodStart, periodEnd, budgetAmountUri, accounting */
/**
*
*/
@@ -104,7 +104,7 @@ function updateBudgetedAmounts(e) {
var target = $(e.target);
var id = target.data('id');
var leftCell = $('td[class$="left"][data-id="' + id + '"]');
var link = $('a[data-id="'+id+'"][class="budget-link"]');
var link = $('a[data-id="' + id + '"][class="budget-link"]');
var value = target.val();
var original = target.data('original');
@@ -112,7 +112,7 @@ function updateBudgetedAmounts(e) {
target.prop('disabled', true);
// replace link (for now)
link.attr('href','#');
link.attr('href', '#');
// replace "left" with spinner.
leftCell.empty().html('<i class="fa fa-fw fa-spin fa-spinner"></i>');

View File

@@ -29,40 +29,37 @@
* @param maxwidth
* @returns {Array}
*/
function formatLabel(str, maxwidth){
function formatLabel(str, maxwidth) {
var sections = [];
var words = str.split(" ");
var temp = "";
words.forEach(function(item, index){
if(temp.length > 0)
{
words.forEach(function (item, index) {
if (temp.length > 0) {
var concat = temp + ' ' + item;
if(concat.length > maxwidth){
if (concat.length > maxwidth) {
sections.push(temp);
temp = "";
}
else{
if(index === (words.length-1))
{
else {
if (index === (words.length - 1)) {
sections.push(concat);
return;
}
else{
else {
temp = concat;
return;
}
}
}
if(index === (words.length-1))
{
if (index === (words.length - 1)) {
sections.push(item);
return;
}
if(item.length < maxwidth) {
if (item.length < maxwidth) {
temp = item;
}
else {

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: token */
$(function () {
"use strict";
$('#help').click(showHelp);

View File

@@ -18,7 +18,7 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: langImportSingleError, langImportMultiError, jobStartUrl, langImportTimeOutError, langImportFinished, langImportFatalError */
/** global: job, langImportSingleError, langImportMultiError, jobStartUrl, langImportTimeOutError, langImportFinished, langImportFatalError */
var timeOutId;
var startInterval = 1000;

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: token */
var fixHelper = function (e, tr) {
"use strict";
var $originals = tr.children();

View File

@@ -1,4 +1,3 @@
/*
* month.js
* Copyright (c) 2017 thegrumpydictator@gmail.com
@@ -18,10 +17,10 @@
* 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: spentUri, categoryUri, budgetUri, expenseUri, incomeUri, mainUri */
$(function () {
"use strict";
drawChart();
doubleYChart(mainUri, 'in-out-chart');
loadAjaxPartial('inOutAccounts', spentUri);
loadAjaxPartial('inOutCategory', categoryUri);
@@ -31,9 +30,3 @@ $(function () {
});
function drawChart() {
"use strict";
// month view:
doubleYChart(mainUri, 'in-out-chart');
}

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: startDate, endDate, accountIds */
function loadAjaxPartial(holder, uri) {
"use strict";
$.get(uri).done(function (data) {

View File

@@ -139,7 +139,6 @@ function setOptionalFromCookies() {
$('#inputExpRevAccounts').multiselect(defaultMultiSelect);
}
function catchSubmit() {
@@ -161,7 +160,7 @@ function catchSubmit() {
createCookie('report-categories', categories, 365);
createCookie('report-budgets', budgets, 365);
createCookie('report-tags', tags, 365);
createCookie('report-exp-rev', expRev , 365);
createCookie('report-exp-rev', expRev, 365);
createCookie('report-start', moment(picker.startDate).format("YYYYMMDD"), 365);
createCookie('report-end', moment(picker.endDate).format("YYYYMMDD"), 365);

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: token */
var fixHelper = function (e, tr) {
"use strict";
var $originals = tr.children();

View File

@@ -18,7 +18,7 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: searchQuery,searchUri */
/** global: searchQuery,searchUri,token */

View File

@@ -48,7 +48,7 @@ $(function () {
}).addTo(mymap);
if (doPlaceMarker) {
var marker = L.marker([latitude, longitude]).addTo(mymap);
L.marker([latitude, longitude]).addTo(mymap);
}
}
});

View File

@@ -18,7 +18,7 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: edit_selected_txt, delete_selected_txt */
/** global: edit_selected_txt, delete_selected_txt, token */
/**
*