Update add view.

This commit is contained in:
kor 2018-07-24 23:50:04 +12:00
parent bf3c44e567
commit ea525e5692
4 changed files with 129 additions and 39 deletions

View File

@ -4,27 +4,31 @@
--color-main-bg-i: #ddd; /*idle*/ --color-main-bg-i: #ddd; /*idle*/
--color-main-bg-e: #ddd; /*enabled*/ --color-main-bg-e: #ddd; /*enabled*/
--color-content-bg-i: #ccc; /*idle*/
--color-content-bg-e: #bbb; /*enabled*/
--color-menu-bg-i: #000; /*idle*/ --color-menu-bg-i: #000; /*idle*/
--color-menu-bg-e: #000; /*enabled*/ --color-menu-bg-e: #000; /*enabled*/
--color-menu-item-i: #333; /*idle*/
--color-menu-item-e: #999; /*enabled*/
--color-menu-item-a: #ddd; /*ascent*/
--color-content-bg-i: #ccc; /*idle*/
--color-content-bg-e: #bbb; /*enabled*/
--color-content-item-s: #bbb; /*sub*/ --color-content-item-s: #bbb; /*sub*/
--color-content-item-i: #999; /*idle*/ --color-content-item-i: #999; /*idle*/
--color-content-item-e: #666; /*enabled*/ --color-content-item-e: #666; /*enabled*/
--color-content-item-t: #000; /*title*/ --color-content-item-t: #000; /*title*/
--color-content-item-a: #000; /*ascent*/ --color-content-item-a: #000; /*ascent*/
--color-content-image-s: rgba(255, 255, 255, .1); /*sub*/ --color-content-image-s: rgba(255, 255, 255, .1); /*sub*/
--color-content-image-i: rgba(255, 255, 255, .3); /*idle*/ --color-content-image-i: rgba(255, 255, 255, .3); /*idle*/
--color-content-image-e: rgba(255, 255, 255, .5); /*enabled*/ --color-content-image-e: rgba(255, 255, 255, .5); /*enabled*/
--color-content-image-t: #fff; /*title*/ --color-content-image-t: #fff; /*title*/
--color-content-image-a: #fff; /*ascent*/ --color-content-image-a: #fff; /*ascent*/
--color-menu-item-i: #333; /*idle*/ --color-overlay-bg-i: #000; /*idle*/
--color-menu-item-e: #999; /*enabled*/ --color-overlay-bg-e: #111; /*enabled*/
--color-menu-item-a: #ddd; /*ascent*/ --color-overlay-item-s: #111; /*sub*/
--color-overlay-item-i: #222; /*idle*/
--color-overlay-item-e: #333; /*enabled*/
--color-overlay-item-a: #666; /*ascent*/
/* SIZE */ /* SIZE */
--menu-width: 150px; --menu-width: 150px;
@ -154,10 +158,20 @@ body {
float: left; float: left;
} }
.noselect {
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
supported by Chrome and Opera */
}
/* PAGE */ /* PAGE */
.page-overlay { .page-overlay {
/* visual */ /* visual */
background-color: #000; background-color: var(--color-overlay-bg-i);
opacity: 0; opacity: 0;
-webkit-transition: opacity var(--animation-time) linear; -webkit-transition: opacity var(--animation-time) linear;
transition: opacity var(--animation-time) linear; transition: opacity var(--animation-time) linear;
@ -172,27 +186,76 @@ body {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
user-select: none;
} }
.page-overlay .content .row { .page-overlay .content-menu {
/*float: left; width: 100px;
clear: both;*/ float: left;
/*height: 40px;*/ text-align: center;
height: 100%;
padding-top: auto;
padding-bottom: auto;
margin-right: 50px;
border-radius: var(--size-item-corner);
}
.page-overlay .content-menu:hover {
background-color: var(--color-overlay-item-i);
}
.page-overlay .content-menu:hover a {
color: var(--color-overlay-item-a);
}
.page-overlay .content-menu a {
color: var(--color-overlay-item-e);
text-decoration: none;
}
.page-overlay .content-menu a {
}
.page-overlay .content-menu .content-menu-option {
height: 100px;
width: 100px;
display: flex;
align-items: center;
justify-content: center;
}
.page-overlay .content form {
float: left;
}
.page-overlay .content .row .key {
width: 100px;
color: var(--color-overlay-item-e);
color: #000;
float: left;
padding: 9px 7px 10px 0;
text-align: right;
margin-right: 0px;
} }
.page-overlay .content .row input { .page-overlay .content .row input {
padding: 10px; padding: 10px;
width: 400px; width: 400px;
margin-bottom: 10px; margin-bottom: 10px;
background-color: transparent; /*background-color: transparent;*/
background-color: var(--color-overlay-bg-e);
color: #fff; color: #fff;
border-width: 1px; border-width: 0px;
/*border-width: 1px;
border-style: solid; border-style: solid;
border-color: var(--color-menu-item-i); border-color: var(--color-menu-item-i);*/
border-radius: var(--size-item-corner); border-radius: var(--size-item-corner);
} }
.page-overlay .content .row input::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */ .page-overlay .content .row input::placeholder {
opacity: 1; opacity: 1;
color: var(--color-menu-item-i); color: var(--color-menu-item-i);
} }
.page-overlay .content .row input:hover {
/*background-color: var(--color-content-item-a);*/
background-color: var(--color-overlay-item-i);
}
.page-overlay .content .row input:focus {
/*background-color: var(--color-content-item-a);*/
background-color: var(--color-overlay-item-e);
}
/* CONTENT */ /* CONTENT */
.container { .container {

View File

@ -18,7 +18,7 @@
<script src="logic/main.js"></script> <script src="logic/main.js"></script>
</head> </head>
<body> <body>
<div class="page-overlay" id="overlay"></div> <div class="page-overlay noselect" id="overlay"></div>
<div class="menu" id="menu"></div> <div class="menu" id="menu"></div>
<div class="container" id="container"> <div class="container" id="container">
<div class="grid" id="grid"></div> <div class="grid" id="grid"></div>

View File

@ -11,6 +11,12 @@ function Main()
this.db.install(); this.db.install();
this.view = new View(); this.view = new View();
this.view.install(); this.view.install();
var escape = document.getElementById("escape");
escape.onclick = function()
{
main.load(main.queryPrev);
}
} }
this.start = function() this.start = function()
@ -21,7 +27,12 @@ function Main()
this.load = function(target) this.load = function(target)
{ {
this.queryPrev = this.queryCur; document.activeElement.blur();
if (this.queryCur != 'add')
{
this.queryPrev = this.queryCur;
}
target = target.substr(0,1) == "#" ? target.substr(1,target.length-1) : target; target = target.substr(0,1) == "#" ? target.substr(1,target.length-1) : target;
this.queryCur = target.trim(); this.queryCur = target.trim();
@ -47,6 +58,7 @@ document.onkeydown = function(evt)
{ {
evt = evt || window.event; evt = evt || window.event;
var isEscape = false; var isEscape = false;
var isA = false;
if ("key" in evt) if ("key" in evt)
{ {
@ -56,6 +68,7 @@ document.onkeydown = function(evt)
{ {
isEscape = (evt.keyCode == 27); isEscape = (evt.keyCode == 27);
} }
isA = (evt.keyCode == 65);
if (isEscape) if (isEscape)
{ {
@ -64,4 +77,8 @@ document.onkeydown = function(evt)
main.load(main.queryPrev); main.load(main.queryPrev);
} }
} }
else if (isA && main.queryCur != 'add')
{
main.load('add');
}
}; };

View File

@ -13,7 +13,7 @@ function View()
const SETTINGS = { const SETTINGS = {
STATSNUMTAGS: 5, STATSNUMTAGS: 5,
STATSNUMTYPE: 10, STATSNUMTYPE: 10,
WIDEGRIDITEM: false, WIDEGRIDITEM: true,
USEMASONRY: true, USEMASONRY: true,
GRIDITEMIDBASE: 'item', GRIDITEMIDBASE: 'item',
SHOWUPPER: true, SHOWUPPER: true,
@ -59,35 +59,45 @@ function View()
this.setupAdd = function() this.setupAdd = function()
{ {
this.overlay.innerHTML = ''; this.overlay.innerHTML = '';
content += `<div class="content"><form>`; let content = `<div class="content">`
content += this.createFormInput('Title');
content += this.createFormInput('Date');
content += this.createFormInput('Person');
content += this.createFormInput('Source');
content += this.createFormInput('Project'); // ESCAPE
content += this.createFormInput('Type'); content += `<div class="content-menu">`;
content += this.createFormInput('Link'); content += `<a href="javascript:void(0);" id="escape">`;
content += this.createFormInput('Tags'); content += `<div class="content-menu-option">`;
content += this.createFormInput('Note'); content += `<b>Esc</b>`;
content += this.createFormInput('Quote'); content += `</div>`;
content += this.createFormInput('Terms'); content += `</a>`;
content += this.createFormInput('Progress'); content += `</div>`;
// FORM
content += `<form>`;
content += this.createFormInput('TITLE', 'Title');
content += this.createFormInput('DATE', 'Date');
content += this.createFormInput('PERS', 'Person');
content += this.createFormInput('SRCE', 'Source');
content += this.createFormInput('PROJ', 'Project');
content += this.createFormInput('TYPE', 'Type');
content += this.createFormInput('LINK', 'Link');
content += this.createFormInput('TAGS', 'Tags');
content += this.createFormInput('NOTE', 'Note');
content += this.createFormInput('QOTE', 'Quote');
content += this.createFormInput('TERM', 'Terms');
content += this.createFormInput('PROG', 'Progress');
// DONE // DONE
// REVI // REVI
content += `</form>`;
content += `</form></div>`; content += `</div>`;
this.overlay.innerHTML += content; this.overlay.innerHTML += content;
} }
this.createFormInput = function(id) this.createFormInput = function(key, desc)
{ {
return `<div class="row"> return `<div class="row">
<div class="input-field"> <div class="key">${key}</div>
<input placeholder="${id}" id="${id}"> <input placeholder="${desc}" id="${desc}">
</div> </div>`;
</div>`;
} }
this.setOverlay = function(value) this.setOverlay = function(value)