Improve: sorting

This commit is contained in:
Cutls 2019-07-29 00:52:12 +09:00
parent 15f428528b
commit 4fa7d07500
2 changed files with 8 additions and 3 deletions

View File

@ -91,7 +91,7 @@ input.addEventListener("focus", function () {
var his = tag.history; var his = tag.history;
var uses = his[0].uses * 1 + his[1].uses * 1 + his[2].uses * 1 + his[3].uses * 1 + his[4].uses * 1 + his[5].uses * 1 + his[6].uses * 1; var uses = his[0].uses * 1 + his[1].uses * 1 + his[2].uses * 1 + his[3].uses * 1 + his[4].uses * 1 + his[5].uses * 1 + his[6].uses * 1;
tagHTML = '<br><a onclick="tagInsert(\'#' + escapeHTML(tag.name) + '\',\'#' + q + '\')" class="pointer">#' + tagHTML = '<br><a onclick="tagInsert(\'#' + escapeHTML(tag.name) + '\',\'#' + q + '\')" class="pointer">#' +
escapeHTML(tag.name) + '</a>&nbsp;' + uses + 'toots' escapeHTML(tag.name) + '</a>&nbsp;' + uses + 'toot(s)'
var item = { var item = {
"uses": uses, "uses": uses,
"html": tagHTML "html": tagHTML
@ -108,8 +108,13 @@ input.addEventListener("focus", function () {
return 0; return 0;
}); });
var ins = "" var ins = ""
var nev = false
Object.keys(tags).forEach(function (key7) { Object.keys(tags).forEach(function (key7) {
ins = ins + tags[key7].html ins = ins + tags[key7].html
if (key7 <= 0 && !nev) {
ins = ins + '<br>'
nev = true
}
}); });
$("#suggest").html(ins); $("#suggest").html(ins);
$("#right-side").show() $("#right-side").show()

View File

@ -177,12 +177,12 @@ function graphDraw(tag, acct_id) {
var zero = 50 - (his[0].uses / max * 50); var zero = 50 - (his[0].uses / max * 50);
if (max === 0) { if (max === 0) {
tags = '<br><br><svg version="1.1" viewbox="0 0 60 50" width="60" height="50">' + tags = '<br><br><svg version="1.1" viewbox="0 0 60 50" width="60" height="50">' +
'</svg><span style="font-size:200%">' + his[0].uses + '</span>toots&nbsp;<a onclick="tl(\'tag\',\'' + escapeHTML(tag.name) + '\',\'' + acct_id + '</svg><span style="font-size:200%">' + his[0].uses + '</span>toot(s)&nbsp;<a onclick="tl(\'tag\',\'' + escapeHTML(tag.name) + '\',\'' + acct_id +
'\',\'add\')" class="pointer">#' + escapeHTML(tag.name) + '</a>&nbsp;' + his[0].accounts + lang.lang_src_people; '\',\'add\')" class="pointer">#' + escapeHTML(tag.name) + '</a>&nbsp;' + his[0].accounts + lang.lang_src_people;
} else { } else {
tags = '<br><br><svg version="1.1" viewbox="0 0 60 50" width="60" height="50">' + tags = '<br><br><svg version="1.1" viewbox="0 0 60 50" width="60" height="50">' +
'<g><path d="M0,' + six + ' L10,' + five + ' 20,' + four + ' 30,' + three + ' 40,' + two + ' 50,' + one + ' 60,' + zero + '" style="stroke: #9e9e9e; stroke-width: 1;fill: none;"></path></g>' + '<g><path d="M0,' + six + ' L10,' + five + ' 20,' + four + ' 30,' + three + ' 40,' + two + ' 50,' + one + ' 60,' + zero + '" style="stroke: #9e9e9e; stroke-width: 1;fill: none;"></path></g>' +
'</svg><span style="font-size:200%">' + his[0].uses + '</span>toots&nbsp;<a onclick="tl(\'tag\',\'' + escapeHTML(tag.name) + '\',\'' + acct_id + '</svg><span style="font-size:200%">' + his[0].uses + '</span>toot&nbsp;<a onclick="tl(\'tag\',\'' + escapeHTML(tag.name) + '\',\'' + acct_id +
'\',\'add\')" class="pointer">#' + escapeHTML(tag.name) + '</a>&nbsp;' + his[0].accounts + lang.lang_src_people; '\',\'add\')" class="pointer">#' + escapeHTML(tag.name) + '</a>&nbsp;' + his[0].accounts + lang.lang_src_people;
} }