cinera: Handle sorting state separately from UI
Also add user-select: none
This commit is contained in:
parent
d7d27f59b7
commit
3d7add5b66
|
@ -14,7 +14,7 @@ typedef struct
|
||||||
version CINERA_APP_VERSION = {
|
version CINERA_APP_VERSION = {
|
||||||
.Major = 0,
|
.Major = 0,
|
||||||
.Minor = 5,
|
.Minor = 5,
|
||||||
.Patch = 28
|
.Patch = 29
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(matt): Copy in the DB 3 stuff from cinera_working.c
|
// TODO(matt): Copy in the DB 3 stuff from cinera_working.c
|
||||||
|
@ -4388,7 +4388,7 @@ IndexToBuffer(buffers *CollationBuffers) // NOTE(matt): This guy malloc's Collat
|
||||||
" <div id=\"cineraResults\"></div>\n"
|
" <div id=\"cineraResults\"></div>\n"
|
||||||
"\n"
|
"\n"
|
||||||
" <div id=\"cineraIndex\" class=\"%s\">\n"
|
" <div id=\"cineraIndex\" class=\"%s\">\n"
|
||||||
" <div id=\"cineraIndexSort\" data-id=\"chronal\">Sort: Old to New ⏶</div>\n"
|
" <div id=\"cineraIndexSort\">Sort: Old to New ⏶</div>\n"
|
||||||
" <div id=\"cineraIndexEntries\">\n",
|
" <div id=\"cineraIndexEntries\">\n",
|
||||||
StringsDiffer(Config.Theme, "") ? Config.Theme : Config.ProjectID,
|
StringsDiffer(Config.Theme, "") ? Config.Theme : Config.ProjectID,
|
||||||
StringsDiffer(Config.Theme, "") ? Config.Theme : Config.ProjectID);
|
StringsDiffer(Config.Theme, "") ? Config.Theme : Config.ProjectID);
|
||||||
|
|
|
@ -45,6 +45,9 @@
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#cineraIndex #cineraIndexEntries {
|
#cineraIndex #cineraIndexEntries {
|
||||||
|
|
|
@ -9,22 +9,21 @@ if (location.hash && location.hash.length > 0) {
|
||||||
var indexContainer = document.getElementById("cineraIndex");
|
var indexContainer = document.getElementById("cineraIndex");
|
||||||
var indexSort = indexContainer.querySelector("#cineraIndexSort");
|
var indexSort = indexContainer.querySelector("#cineraIndexSort");
|
||||||
var indexEntries = indexContainer.querySelector("#cineraIndexEntries");
|
var indexEntries = indexContainer.querySelector("#cineraIndexEntries");
|
||||||
|
var indexSortChronological = true;
|
||||||
|
|
||||||
indexSort.addEventListener("click", function(ev) {
|
indexSort.addEventListener("click", function(ev) {
|
||||||
switch(this.getAttribute("data-id"))
|
if(indexSortChronological)
|
||||||
{
|
{
|
||||||
case "chronal":
|
this.firstChild.nodeValue = "Sort: New to Old ⏷"
|
||||||
this.setAttribute("data-id", "reverse_chronal");
|
indexEntries.classList.add("sort_reverse");
|
||||||
this.firstChild.nodeValue = "Sort: New to Old ⏷"
|
|
||||||
indexEntries.classList.add("sort_reverse");
|
|
||||||
break;
|
|
||||||
case "reverse_chronal":
|
|
||||||
this.setAttribute("data-id", "chronal");
|
|
||||||
this.firstChild.nodeValue = "Sort: Old to New ⏶"
|
|
||||||
indexEntries.classList.remove("sort_reverse");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
})
|
else
|
||||||
|
{
|
||||||
|
this.firstChild.nodeValue = "Sort: Old to New ⏶"
|
||||||
|
indexEntries.classList.remove("sort_reverse");
|
||||||
|
}
|
||||||
|
indexSortChronological = !indexSortChronological;
|
||||||
|
});
|
||||||
|
|
||||||
var lastQuery = null;
|
var lastQuery = null;
|
||||||
var resultsToRender = [];
|
var resultsToRender = [];
|
||||||
|
|
Loading…
Reference in New Issue