diff options
| author | Daniel Friesel <derf@finalrewind.org> | 2022-07-17 12:47:06 +0200 | 
|---|---|---|
| committer | Daniel Friesel <derf@finalrewind.org> | 2022-07-17 12:47:06 +0200 | 
| commit | 9f9e38ca3d8277aae0d6c3e00e261daaad5ab3f0 (patch) | |
| tree | 726d939d7abe2abb90c87fb8fbe325121d6cb6fc /public/static/js | |
| parent | 202fa0c66e7dd021c76d846453bf9755b833f27d (diff) | |
decrease contrast of past trains when a certain train is selected
Diffstat (limited to 'public/static/js')
| -rw-r--r-- | public/static/js/collapse.js | 32 | 
1 files changed, 32 insertions, 0 deletions
| diff --git a/public/static/js/collapse.js b/public/static/js/collapse.js index 9763f26..8aed392 100644 --- a/public/static/js/collapse.js +++ b/public/static/js/collapse.js @@ -105,6 +105,38 @@ function dbf_reg_handlers() {  		history.pushState({'page':'traindetail','station':station,'train':trainElem.data('no')}, 'test', '/z/' + trainElem.data('train') + '/' + trainElem.data('station') + suffix);  		dbf_show_moreinfo(trainElem, false);  	}); +	const trainid = $(location).attr('hash').substr(1); +	if (trainid) { +		var found = false; +		$('div.app > ul > li').each(function(index) { +			if (found) { +				return; +			} +			$(this).find('.anchor').each(function() { +				if ($(this).attr('id') == trainid) { +					found = true; +				} +			}); +		}); +		if (found) { +			found = false; +			$('div.app > ul > li').each(function(index) { +				if (found) { +					return; +				} +				$(this).find('.anchor').each(function() { +					if ($(this).attr('id') == trainid) { +						found = true; +					} +				}); +				if (found) { +					$(this).addClass('selected'); +				} else { +					$(this).addClass('past'); +				} +			}); +		} +	}  }  $(function() { | 
