diff --git a/coinmanager/coinc/static/coinc/main.js b/coinmanager/coinc/static/coinc/main.js index 5c6e026..4b1f400 100644 --- a/coinmanager/coinc/static/coinc/main.js +++ b/coinmanager/coinc/static/coinc/main.js @@ -146,17 +146,29 @@ function render_response(data, td, set) { /* add or update marker (and name) if found */ if (set['found'] && set['found_by'] && set['exists']) { div_class = set['found_by']; - $(td).find('div.coin span').html('').html('x'); + $(td).find('div.coin span').html('').html('✔'); /* add/update name */ - if ('name' in data) { - let name = escape_html(data['name']); + if ([201, 202, 203].includes(data['value'])) { let c = String(value).substring(2,3); - let div_special_name = $(td).find('div.special' + c + '_name'); - if (div_special_name.length == 0) { - $(td).append('
' + name + '
'); - } else if (div_special_name.length == 1) { - div_special_name.html(name); + if ('name' in data) { + let name = escape_html(data['name']); + + /* look for div.special123_name */ + let div_special_name = $(td).find('div.special' + c + '_name'); + if (div_special_name.length == 0) { + + /* append div if not found */ + $(td).append('
' + name + '
'); + } else if (div_special_name.length == 1) { + + /* only insert inner html */ + div_special_name.html(name); + } + + /* remove name */ + } else if (!set['exists']) { + $(td).find('div.special' + c + '_name').html(); } } } @@ -258,7 +270,7 @@ $(document).ready(function() { td: this } - if ([201, 202, 203].includes(value)) { + if ([201, 202, 203].includes(value) && data['exists']) { let modal = new Modal('add_coin_name', add_coin_name, args); modal.show(); } else { diff --git a/coinmanager/coinc/static/coinc/styles.css b/coinmanager/coinc/static/coinc/styles.css index 76b8bf1..e2b0f04 100644 --- a/coinmanager/coinc/static/coinc/styles.css +++ b/coinmanager/coinc/static/coinc/styles.css @@ -18,341 +18,447 @@ */ -html, table, tr, td, div { - margin: 0; - padding: 0; -} -a, a:hover, a:active, a:visited { - text-decoration: none; - color: black !important; - cursor: default; - vertical-align: inherit; -} +/* General */ -a.nav-link:hover { - color: white !important; -} - -li { - padding: 0px 5px 5px 0px; -} - -ul.nav { - padding-bottom: 30px; -} - -img.country { - width: 20px; -} - -table { - border-collapse: collapse; - white-space: nowrap; - margin-bottom: 63px !important; -} - -th { - position: sticky; - z-index: 1021; -} - -tr { - height: 40px; -} - -td { - overflow: hidden; - vertical-align: middle; - white-space: nowrap; -} - -thead > tr:first-child > th { - background-image: linear-gradient(0, #9fc5e8, white); - background-position: 100% 100%; - padding: 5px; - text-align: left; - top: 0; -} - -thead > tr:nth-child(2) > th { - background-color: white; - top: 36px; -} - -thead > tr:nth-child(2) > th:after { - content: ''; - position: absolute; - z-index: 1020; - left: 0; - top: -1px; - width: 40px; - height: 42px; - line-height: 40px; - border-top: 1px solid gray; - border-left: 1px solid gray; - border-bottom: 2px solid black; -} - -tr:nth-child(2) > th:nth-child(10):after { content: '201'; } -tr:nth-child(2) > th:nth-child(11):after { content: '202'; } -tr:nth-child(2) > th:nth-child(12):after { content: '203'; } -tr:nth-child(2) > th:last-child:after { border-right: 1px solid gray; } - -thead > tr:nth-child(2) > th, table > tbody > tr > td { - text-align: center; - font-weight: normal; -} - -tbody > tr > td { - background-color: #b7b7b7; - border: 1px solid gray; -} - -tbody > tr > td > div.coin { - position: relative; - z-index: 1000; - height: 40px; - width: 40px; - text-align: inherit; - line-height: 40px; - float: left; -} - -td > * { - vertical-align: middle; - overflow: hidden; -} - -div.found { - position: absolute; - z-index: 1001; - top: 0; - height:40px; - width:40px; - clip-path: polygon(100% 70%, 100% 100%, 70% 100%); -} - -div.three_lines { - font-size: 0.8rem !important; - line-height: 13px !important; -} -div.two_lines { - font-size: 0.9rem !important; - line-height: 20px !important; -} - -div.special1_name, div.special2_name, div.special3_name { - display: none; - height: 40px; - width: 146px; - font-size: 1rem; - font-weight: 400; - line-height: 40px; - color: black; - text-align: left; - word-wrap: anywhere; - word-break: break-all; - white-space: break-spaces; -} - -/* smallest view 12 * 40 = 480px */ -@media (max-width: 654px) { - table { width: 360px; } - tr:nth-child(2) > th { width: 30px; } - tr:nth-child(2) > th:after { width: 30px; } - tbody > tr > td > div.coin { - height: 30px; - width: 30px; - line-height: 30px; - } - div.found { - height: 30px; - width: 30px; - } - tr { height: 30px; } - thead > tr:nth-child(2) > th:after { - height: 32px; - width: 30px; - line-height:30px; - } - thead > tr:nth-child(2) > th, tbody > tr > td { font-size: 0.8rem; } -} - -/* 1st special coin: 11 * 40 + 200 = 640px */ -@media (min-width: 655px) { - table { width: 640px; } - tr:nth-child(2) > th:nth-child(10) { - width: 200px; - text-align: left; - } - tr:nth-child(2) > th:nth-child(10):after { - width: 200px; - padding-left: 5px; - content: 'Sondermünze 1'; - } - div.special1_name { display: block; } -} - -/* 2nd special coin 10 * 40 + 400 = 800px */ -@media (min-width: 815px) { - table { width: 800px; } - tr:nth-child(2) > th:nth-child(11) { - width: 200px; - text-align: left; - } - tr:nth-child(2) > th:nth-child(11):after { - width: 200px; - padding-left: 5px; - content: 'Sondermünze 2'; - } - div.special2_name { display: block; } -} - -/* 3rd special coin 9 * 40 + 600 = 960px */ -@media (min-width: 975px) { - table { width: 960px; } - tr:nth-child(2) > th:nth-child(12) { - width: 200px; - text-align: left; - } - tr:nth-child(2) > th:nth-child(12):after { - width: 200px; - padding-left: 5px; - content: 'Sondermünze 3'; - } - div.special3_name { display: block; } -} - - - -.buy_only { - background-color: #dd7e6b; -} - -.rare { - background-color: #e69138; -} - -.noexist { - color: white; - background-color: #434343; -} - -td.brass, th.brass { - background-color: #ffff99 !important; -} - -td.found { - background-color: white; -} - -td.year { - background-color: white; -} - -td.year-complete { - background-color: #00ff00; -} - -td.spacer { - border: 0; - background-color: white; -} - -.ec { - color: #ff0000; - font-weight: bold; -} - -.checked { - color: #00ff00; - font-weight: bold; -} - -.form-control { - display: inline-block !important; - width: auto; +html, +table, +tr, +td, +div { + margin: 0; + padding: 0; } body > div.container-fluid { - padding: 0; + padding: 0; } -.modal-container { - display: none; - position: fixed; - z-index: 1050; - left: 0; - top: 0; - width: 100%; - height: 100%; - overflow: auto; - background-color: rgb(0,0,0); - background-color: rgba(0,0,0,0.4); +a, +a:hover, +a:active, +a:visited { + text-decoration: none; + color: black !important; + cursor: pointer; + vertical-align: inherit; } /* Controlbar */ + button#begin_edit { - position: fixed; - z-index: 1060; - right: 15px; - bottom: 15px; + position: fixed; + z-index: 1060; + right: 15px; + bottom: 15px; } nav.navbar { - display: none; - position: fixed; - z-index: 1031; - bottom: 0; - width: 100%; - height: 64px; - border-top: 1px solid gray; + display: none; + position: fixed; + z-index: 1031; + bottom: 0; + width: 100%; + height: 64px; + border-top: 1px solid gray; } nav.navbar > div#navbarColor03 > * { - margin: 5px; + margin: 5px; } nav.navbar button { - white-space: nowrap; + white-space: nowrap; } -@media (min-width:540px) { - button.navbar-toggler { +button.navbar_toggler { display: none; - } +} - div#navbarColor03 { - display: flex; - flex-basis: auto; - } +div#navbar_toggler { + line-height: 35px; +} + +.form-control { + display: inline-block !important; + width: auto; +} + +div#navbar_toggler > label { + float: left; + padding-right: 5px; +} + +div#buttons { + display: block; + text-align: right; + width: 100%; } div#advanced_options { - position: fixed; - z-index: 1030; - left: 0; - border-top: 1px solid gray; - bottom: 63px; - width: 100%; - display:none; - background-color: #f8f9fa !important; + position: fixed; + z-index: 1030; + left: 0; + border-top: 1px solid gray; + bottom: 63px; + width: 100%; + display: none; + background-color: #f8f9fa !important; } div#advanced_options > label { - float: left; - padding: 5px; - margin: 0; - height: 44px; - padding-top: 11px; + float: left; + padding: 5px; + margin: 0; + height: 44px; + padding-top: 11px; } div#advanced_options > label:first-child { - padding:5px !important; + padding: 5px !important; } -input#circulation, input#found_on { - width: 100px; +input#circulation, +input#found_on { + width: 100px; } + +a.nav-link:hover { + color: white !important; +} + + +/* modals */ + +div.modal-container { + display: none; + position: fixed; + z-index: 1050; + left: 0; + top: 0; + width: 100%; + height: 100%; + overflow: auto; + background-color: rgb(0, 0, 0); + background-color: rgba(0, 0, 0, 0.4); +} + + +/* country navigation */ + +li { + padding: 0px 5px 5px 0px; +} + +ul.nav { + padding-bottom: 30px; +} + + +/* country table */ + + +/* table head */ + +table { + margin-bottom: 63px; + cursor: default; +} + +th { + position: sticky; + z-index: 1021; +} + +th > img { + max-height: 20px; +} + +tr { + height: 40px; +} + +thead > tr:first-child > th { + background-image: linear-gradient(0, #9fc5e8, white); + background-position: 100% 100%; + padding: 5px; + text-align: left; + top: 0; +} + +thead > tr:nth-child(2) > th { + background-color: white; + top: 40px; + border-bottom: 1px solid gray; +} + +tr:nth-child(2) > th:nth-child(10):after, +tr:nth-child(2) > th:nth-child(11):after, +tr:nth-child(2) > th:nth-child(12):after { + position: absolute; + z-index: 1020; + left: 0; + top: -1px; + width: 40px; + height: 42px; + line-height: 40px; +} + +tr:nth-child(2) > th:nth-child(10):after { + content: '201'; +} + +tr:nth-child(2) > th:nth-child(11):after { + content: '202'; +} + +tr:nth-child(2) > th:nth-child(12):after { + content: '203'; +} + +tr:nth-child(2):after { + content: ''; + position: absolute; + bottom: 0; + left: 0; + width: 100%; + height: 1px; + border-bottom: 1.2px solid gray; +} + + +/* table body */ + +thead > tr:nth-child(2) > th, +table > tbody > tr > td { + text-align: center; + font-weight: normal; +} + +td > * { + vertical-align: middle; + overflow: hidden; +} + + +/* coin background colors */ + +td.coin { + background-color: #cec6ca; + border: 1px solid gray; + font-size: 1.1rem; +} + +.brass { + background-color: #edb453 !important; +} + +.buy_only { + background-color: #af6464 !important; +} + +.rare { + background-color: #dec1a8 !important; +} + +.found { + background-color: white !important; +} + +.year { + background-color: white !important; +} + +.year_complete { + background-color: #00ff00 !important; +} + +.noexist { + border: 0 !important; + background: rgba(0, 0, 0, 0) !important; +} + + +/* coin div text style */ + +.ec { + color: #dc3545; + font-weight: bold; +} + +.checked { + color: #28a745; + font-weight: bold; +} + + +/* spacer tr row in between years */ + +tr.spacer { + border: 0; + background-color: white; +} + +div.coin { + position: relative; + z-index: 1000; + height: 40px; + width: 40px; + text-align: inherit; + line-height: 40px; + float: left; +} + +div.found { + position: absolute; + z-index: 1001; + top: 0; + height: 40px; + width: 40px; + clip-path: polygon(100% 70%, 100% 100%, 70% 100%); +} + + +/* special coins */ + +div.special1_name, +div.special2_name, +div.special3_name { + display: none; + height: 40px; + width: 146px; + font-size: 1rem; + font-weight: 400; + line-height: 40px; + color: black; + text-align: left; + word-wrap: anywhere; + word-break: break-all; + white-space: break-spaces; +} + +div.three_lines { + font-size: 0.8rem !important; + line-height: 13px !important; +} + +div.two_lines { + font-size: 0.9rem !important; + line-height: 20px !important; +} + + +/* device width specific */ + + +/* smallest view 12 * 40 = 480px */ + +@media (max-width: 654px) { + table { + width: 360px; + } + tr:nth-child(2) > th { + width: 30px; + } + tr:nth-child(2) > th:after { + width: 30px; + } + tbody > tr > td > div.coin { + height: 30px; + width: 30px; + line-height: 30px; + } + div.found { + height: 30px; + width: 30px; + } + tr { + height: 30px; + } + tr:nth-child(2) > th:nth-child(10):after, + tr:nth-child(2) > th:nth-child(11):after, + tr:nth-child(2) > th:nth-child(12):after { + height: 32px; + width: 30px; + line-height: 30px; + } + thead > tr:nth-child(2) > th, + tbody > tr > td { + font-size: 0.8rem; + } + thead > tr:nth-child(2) > th { + top: 36px; + } + button.navbar_toggler { + display: block; + float: right + } + div#buttons { + display: none; + } +} + + +/* 1st special coin: 11 * 40 + 200 = 640px */ + +@media (min-width: 655px) { + table { + width: 640px; + } + tr:nth-child(2) > th:nth-child(10) { + width: 200px; + text-align: left; + } + tr:nth-child(2) > th:nth-child(10):after { + width: 200px; + padding-left: 5px; + content: 'Sondermünze 1'; + } + div.special1_name { + display: block; + } +} + + +/* 2nd special coin 10 * 40 + 400 = 800px */ + +@media (min-width: 815px) { + table { + width: 800px; + } + tr:nth-child(2) > th:nth-child(11) { + width: 200px; + text-align: left; + } + tr:nth-child(2) > th:nth-child(11):after { + width: 200px; + padding-left: 5px; + content: 'Sondermünze 2'; + } + div.special2_name { + display: block; + } +} + + +/* 3rd special coin 9 * 40 + 600 = 960px */ + +@media (min-width: 975px) { + table { + width: 960px; + } + tr:nth-child(2) > th:nth-child(12) { + width: 200px; + text-align: left; + } + tr:nth-child(2) > th:nth-child(12):after { + width: 200px; + padding-left: 5px; + content: 'Sondermünze 3'; + } + div.special3_name { + display: block; + } +} + diff --git a/coinmanager/coinc/templates/coinc/controlbar.html b/coinmanager/coinc/templates/coinc/controlbar.html index dbd4935..92c8949 100644 --- a/coinmanager/coinc/templates/coinc/controlbar.html +++ b/coinmanager/coinc/templates/coinc/controlbar.html @@ -1,109 +1,108 @@ - - + + - - -