diff --git a/app/js/platform/first.js b/app/js/platform/first.js
index 2ec21109..53c4e5f1 100644
--- a/app/js/platform/first.js
+++ b/app/js/platform/first.js
@@ -170,4 +170,29 @@ $.mb_substr = function (str, begin, end) {
}
return ret;
};
+//ソートするやつ
+function object_array_sort(data, key, order, fn) {
+ var num_a = -1;
+ var num_b = 1;
+ if (order === 'asc') {
+ num_a = 1;
+ num_b = -1;
+ }
+ data = data.sort(function (a, b) {
+ var x = a[key];
+ var y = b[key];
+ if (x > y) return num_a;
+ if (x < y) return num_b;
+ return 0;
+ });
+ var arrObj = {};
+ for (var i = 0; i < data.length; i++) {
+ arrObj[data[i]['family']] = data[i];
+ }
+ data = [];
+ for (var key in arrObj) {
+ data.push(arrObj[key]);
+ }
+ fn(data);
+}
localStorage.removeItem("errors");
\ No newline at end of file
diff --git a/app/js/post/suggest.js b/app/js/post/suggest.js
index 9468ab65..1ae2a968 100644
--- a/app/js/post/suggest.js
+++ b/app/js/post/suggest.js
@@ -85,16 +85,34 @@ input.addEventListener("focus", function () {
//ハッシュタグ
if (json.hashtags[0] && tag) {
if (tag[1]) {
- var tags = "";
+ var tags = [];
Object.keys(json.hashtags).forEach(function (key4) {
var tag = json.hashtags[key4];
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;
- tags = tags + '
#' +
+ 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 = '
#' +
escapeHTML(tag.name) + ' ' + uses + 'toots'
+ var item = {
+ "uses": uses,
+ "html": tagHTML
+ }
+ tags.push(item)
});
+ var num_a = -1;
+ var num_b = 1;
+ tags = tags.sort(function (a, b) {
+ var x = a["uses"];
+ var y = b["uses"];
+ if (x > y) return num_a;
+ if (x < y) return num_b;
+ return 0;
+ });
+ var ins = ""
+ Object.keys(tags).forEach(function (key7) {
+ ins = ins + tags[key7].html
+ });
+ $("#suggest").html(ins);
$("#right-side").show()
- $("#suggest").html(tags);
$("#poll").addClass("hide")
$("#emoji").addClass("hide")
}