mirror of
https://github.com/simonmichael/hledger.git
synced 2024-10-06 10:57:30 +03:00
fix datepicker not closing, linting
Added defacto JavaScript linting with eslint. I also included an editor config file to aid common style. (http://editorconfig.org/#example-file)
This commit is contained in:
parent
0c584759e1
commit
e922a4aac5
17
.editorconfig
Normal file
17
.editorconfig
Normal file
@ -0,0 +1,17 @@
|
||||
# EditorConfig is awesome: http://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
# Matches multiple files with brace expansion notation
|
||||
# Set default charset
|
||||
[*.js]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
8
hledger-web/.eslintrc.js
Normal file
8
hledger-web/.eslintrc.js
Normal file
@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
"extends": "eslint:recommended",
|
||||
"root": true,
|
||||
"env": {
|
||||
"browser": true,
|
||||
"jquery": true
|
||||
}
|
||||
};
|
@ -4,23 +4,30 @@
|
||||
// STARTUP
|
||||
|
||||
$(document).ready(function() {
|
||||
// cache the input element as a variable
|
||||
// for minor performance benefits
|
||||
var dateEl = $('#dateWrap');
|
||||
|
||||
// ensure add form always focusses its first field
|
||||
// ensure add form always focuses its first field
|
||||
$('#addmodal')
|
||||
.on('shown.bs.modal', function (e) {
|
||||
.on('shown.bs.modal', function() {
|
||||
addformFocus();
|
||||
})
|
||||
.on('hidden.bs.modal', function() {
|
||||
// close the date picker if open
|
||||
dateEl.datepicker('hide');
|
||||
});
|
||||
|
||||
// show add form if ?add=1
|
||||
if ($.url.param('add')) { addformShow(true); }
|
||||
|
||||
// date picker
|
||||
// http://bootstrap-datepicker.readthedocs.io/en/latest/options.html
|
||||
$('#dateWrap').datepicker({
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
format: 'yyyy-mm-dd'
|
||||
});
|
||||
// date picker
|
||||
// http://bootstrap-datepicker.readthedocs.io/en/latest/options.html
|
||||
dateEl.datepicker({
|
||||
showOnFocus: false,
|
||||
autoclose: true,
|
||||
format: 'yyyy-mm-dd'
|
||||
});
|
||||
|
||||
// sidebar account hover handlers
|
||||
$('#sidebar td a').mouseenter(function(){ $(this).parent().addClass('mouseover'); });
|
||||
@ -45,7 +52,7 @@ $(document).ready(function() {
|
||||
if (window.location.hash && $(window.location.hash)[0]) {
|
||||
$(window.location.hash).addClass('highlighted');
|
||||
}
|
||||
$(window).on('hashchange', function(event) {
|
||||
$(window).on('hashchange', function() {
|
||||
$('.highlighted').removeClass('highlighted');
|
||||
$(window.location.hash).addClass('highlighted');
|
||||
});
|
||||
@ -57,6 +64,7 @@ $(document).ready(function() {
|
||||
//----------------------------------------------------------------------
|
||||
// REGISTER CHART
|
||||
|
||||
//eslint-disable-next-line no-unused-vars
|
||||
function registerChart($container, series) {
|
||||
// https://github.com/flot/flot/blob/master/API.md
|
||||
return $container.plot(
|
||||
|
Loading…
Reference in New Issue
Block a user