forked from server/soundboard
Simplify tag form
This commit is contained in:
parent
102dd681a0
commit
e9f4f29a87
@ -39,17 +39,11 @@ input {
|
|||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editform input, .tagcontainer {
|
.editform input {
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tagcontainer {
|
.tags li {
|
||||||
background-color: #666;
|
|
||||||
border: 1px solid #999;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tags span {
|
|
||||||
background-color: #333;
|
background-color: #333;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
@ -57,18 +51,6 @@ input {
|
|||||||
padding: 2px 5px 2px 5px;
|
padding: 2px 5px 2px 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tags, .taginput {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.taginput {
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
border-radius: 0;
|
|
||||||
margin: 0 !important;
|
|
||||||
padding: 5px 5px 5px 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.youtube label {
|
.youtube label {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
@ -100,12 +82,12 @@ section {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#reset {
|
.reset {
|
||||||
font-size: 2em;
|
font-size: 2em;
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#reset:hover {
|
.reset:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,7 @@ ready(function() {
|
|||||||
var sections = document.querySelectorAll("section");
|
var sections = document.querySelectorAll("section");
|
||||||
var nav = document.querySelectorAll("nav > a");
|
var nav = document.querySelectorAll("nav > a");
|
||||||
|
|
||||||
|
if (sections.length > 0)
|
||||||
sections[0].style.display = "block";
|
sections[0].style.display = "block";
|
||||||
|
|
||||||
nav.forEach(function(item) {
|
nav.forEach(function(item) {
|
||||||
@ -29,6 +30,7 @@ ready(function() {
|
|||||||
|
|
||||||
var searchfield = document.querySelector("#search");
|
var searchfield = document.querySelector("#search");
|
||||||
|
|
||||||
|
if (searchfield !== null) {
|
||||||
searchfield.addEventListener("keyup", function() {
|
searchfield.addEventListener("keyup", function() {
|
||||||
console.log("Search!");
|
console.log("Search!");
|
||||||
|
|
||||||
@ -46,9 +48,11 @@ ready(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var reset = document.querySelector("#reset");
|
var reset = document.querySelector("#sounds .reset");
|
||||||
|
|
||||||
|
if (reset !== null) {
|
||||||
reset.addEventListener("click", function() {
|
reset.addEventListener("click", function() {
|
||||||
var buttons = document.querySelectorAll(".sound");
|
var buttons = document.querySelectorAll(".sound");
|
||||||
|
|
||||||
@ -58,6 +62,22 @@ ready(function() {
|
|||||||
|
|
||||||
searchfield.value = "";
|
searchfield.value = "";
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var taginputs = document.querySelectorAll(".taginput");
|
||||||
|
|
||||||
|
if (taginputs.length > 0) {
|
||||||
|
taginputs.forEach(function(taginput) {
|
||||||
|
taginput.addEventListener("keydown", function(e) {
|
||||||
|
if (e.target == taginput && (e.which == 13 || e.keyCode == 13)) {
|
||||||
|
e.preventDefault();
|
||||||
|
} else if (e.which == 32 || e.keyCode == 13) {
|
||||||
|
console.log("Space");
|
||||||
|
addTag(e.target);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function hideSections() {
|
function hideSections() {
|
||||||
|
|||||||
@ -10,12 +10,12 @@
|
|||||||
<label for="tags">Tags</label>
|
<label for="tags">Tags</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-cell">
|
<div class="table-cell">
|
||||||
<div class="tagcontainer">
|
<input type="input" name="tags" id="tags" />
|
||||||
<div class="tags"><span>Test</span></div>
|
|
||||||
<input class="taginput" type="input" name="tags" id="tags" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<ul class="tags">
|
||||||
|
<li>Test<span class="reset">⨯</span></li>
|
||||||
|
</ul>
|
||||||
<div class="table-row">
|
<div class="table-row">
|
||||||
<div class="table-cell">
|
<div class="table-cell">
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<section id="sounds">
|
<section id="sounds">
|
||||||
<div><input type="text" id="search" /><span id="reset">⨯</span></div>
|
<div><input type="text" id="search" /><span class="reset">⨯</span></div>
|
||||||
{% for sound in sounds %}
|
{% for sound in sounds %}
|
||||||
<div class="sound{{ ' edit' if edit }}"><a href="{{ '/' + ('edit' if edit else 'play') + '/' + sound | urlencode }}">{{ sound.split('.', 1)[0] }}</a></div>
|
<div class="sound{{ ' edit' if edit }}"><a href="{{ '/' + ('edit' if edit else 'play') + '/' + sound | urlencode }}">{{ sound.split('.', 1)[0] }}</a></div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user