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
 | // STARTUP
 | ||||||
| 
 | 
 | ||||||
| $(document).ready(function() { | $(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') |   $('#addmodal') | ||||||
|     .on('shown.bs.modal', function (e) { |     .on('shown.bs.modal', function() { | ||||||
|       addformFocus(); |       addformFocus(); | ||||||
|     }) |     }) | ||||||
|  |     .on('hidden.bs.modal', function() { | ||||||
|  |       // close the date picker if open
 | ||||||
|  |       dateEl.datepicker('hide'); | ||||||
|  |     }); | ||||||
| 
 | 
 | ||||||
|   // show add form if ?add=1
 |   // show add form if ?add=1
 | ||||||
|   if ($.url.param('add')) { addformShow(true); } |   if ($.url.param('add')) { addformShow(true); } | ||||||
| 
 | 
 | ||||||
| 	// date picker
 |   // date picker
 | ||||||
| 	// http://bootstrap-datepicker.readthedocs.io/en/latest/options.html
 |   // http://bootstrap-datepicker.readthedocs.io/en/latest/options.html
 | ||||||
| 	$('#dateWrap').datepicker({ |   dateEl.datepicker({ | ||||||
| 		showOnFocus: false, |     showOnFocus: false, | ||||||
| 		autoclose: true, |     autoclose: true, | ||||||
| 		format: 'yyyy-mm-dd' |     format: 'yyyy-mm-dd' | ||||||
| 	}); |   }); | ||||||
| 
 | 
 | ||||||
|   // sidebar account hover handlers
 |   // sidebar account hover handlers
 | ||||||
|   $('#sidebar td a').mouseenter(function(){ $(this).parent().addClass('mouseover'); }); |   $('#sidebar td a').mouseenter(function(){ $(this).parent().addClass('mouseover'); }); | ||||||
| @ -45,7 +52,7 @@ $(document).ready(function() { | |||||||
|   if (window.location.hash && $(window.location.hash)[0]) { |   if (window.location.hash && $(window.location.hash)[0]) { | ||||||
|     $(window.location.hash).addClass('highlighted'); |     $(window.location.hash).addClass('highlighted'); | ||||||
|   } |   } | ||||||
|   $(window).on('hashchange', function(event) { |   $(window).on('hashchange', function() { | ||||||
|     $('.highlighted').removeClass('highlighted'); |     $('.highlighted').removeClass('highlighted'); | ||||||
|     $(window.location.hash).addClass('highlighted'); |     $(window.location.hash).addClass('highlighted'); | ||||||
|   }); |   }); | ||||||
| @ -57,6 +64,7 @@ $(document).ready(function() { | |||||||
| //----------------------------------------------------------------------
 | //----------------------------------------------------------------------
 | ||||||
| // REGISTER CHART
 | // REGISTER CHART
 | ||||||
| 
 | 
 | ||||||
|  | //eslint-disable-next-line no-unused-vars
 | ||||||
| function registerChart($container, series) { | function registerChart($container, series) { | ||||||
|   // https://github.com/flot/flot/blob/master/API.md
 |   // https://github.com/flot/flot/blob/master/API.md
 | ||||||
|   return $container.plot( |   return $container.plot( | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user