diff --git a/coinmanager/coinc/static/coinc/main.js b/coinmanager/coinc/static/coinc/main.js index 78af51a..28ff891 100644 --- a/coinmanager/coinc/static/coinc/main.js +++ b/coinmanager/coinc/static/coinc/main.js @@ -22,6 +22,67 @@ import { Cookie } from './modules/cookie.mjs'; $(document).ready(function() { + // + // Options + // + + let settings = { + circulation: '', + found_now: true, + found: true, + buy_only: false, + checked: false, + ec: false + } + + // button #advanced_options + $('#show_advanced_options').click(function() { + $('#advanced_options').slideToggle(); + }); + + // checkbox #exists + $('input#exists').change(function() { + + if (this.checked === true) { + + // save settings + settings['circulation'] = $('#circulation').val(); + let checkboxes = $('#found_now, #found, #datetime_now, #buy_only, #checked, #ec') + .map(function() { + return { + [$(this).prop('id')]: $(this).prop('checked') + } + }).get(); + for (let box of checkboxes) { + for (let item in box) { settings[item] = box[item]; } + } + + // disable settings + $('#circulation').val('Auflage'); + $('#found, #buy_only, #checked, #ec').each(function() { + $(this).prop('checked', false); + }); + $('#found, #select_usernames, #datetime_now, #datetime_custom, #circulation, #buy_only, #checked, #ec').each(function() { + $(this).prop('disabled', 'disabled'); + }); + + // checkbox #exists not checked + } else { + + // restore settings + $('#circulation').val(settings['circulation']); + $('#found_now, #found, #datetime_now, #buy_only, #checked, #ec').each(function() { + let setting = $(this).prop('id'); + $(this).prop('checked', settings[setting]); + }); + + // enable settings + $('#found, #select_usernames, #datetime_now, #datetime_custom, #circulation, #buy_only, #checked, #ec').each(function() { + $(this).prop('disabled', ''); + }); + + } + }); function render_login(input_name, input_color) { // manage user login diff --git a/coinmanager/coinc/static/coinc/styles.css b/coinmanager/coinc/static/coinc/styles.css index 41abdc0..454281a 100644 --- a/coinmanager/coinc/static/coinc/styles.css +++ b/coinmanager/coinc/static/coinc/styles.css @@ -123,7 +123,7 @@ td > * { } -td.noexist { +td.exists { background-color: #434343; } @@ -203,3 +203,27 @@ div#username { background-color: rgb(0,0,0); background-color: rgba(0,0,0,0.4); } + +div#advanced_options { + border-top: 1px solid gray; + position: fixed; + left: 0; + bottom: 70px; + width: 100%; + height: 70px; + /*line-height: 70px;*/ + background-color: white; + text-align: center; + z-index: 1; + /*display: none;*/ +} + +div#advanced_options > label { + float: left; + padding: 5px; + margin: 0; +} + +input#circulation { + width: 100px; +} diff --git a/coinmanager/coinc/templates/coinc/username.html b/coinmanager/coinc/templates/coinc/username.html index 3307456..7064eba 100644 --- a/coinmanager/coinc/templates/coinc/username.html +++ b/coinmanager/coinc/templates/coinc/username.html @@ -1,7 +1,28 @@ +
+ + + + + + +
- - + +