From da5de0257fc9c9d8c4c7f589d84ced2ef19b9f04 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 4 Apr 2020 21:01:18 +0200 Subject: stub sdk. add keywords fix. stub users --- public/assets/js/lib/views/users/users.js | 50 +++++++++++++------------------ 1 file changed, 20 insertions(+), 30 deletions(-) (limited to 'public/assets/js/lib/views/users/users.js') diff --git a/public/assets/js/lib/views/users/users.js b/public/assets/js/lib/views/users/users.js index f3c0ef5..cbb0fde 100644 --- a/public/assets/js/lib/views/users/users.js +++ b/public/assets/js/lib/views/users/users.js @@ -17,43 +17,33 @@ var UsersView = View.extend({ }, populate: function(data){ - // console.log(data) - var keywordThreads = {} - data.threadGroups.forEach(kw => { - keywordThreads[kw.keyword] = kw - }) - data.keywords - .map(a => [parseInt((keywordThreads[a.keyword] || {})['sum(`viewed`)']) || 0, a]) - .sort((b,a) => cmp(a[0], b[0])) - .map(a => a[1]) - .forEach(keyword => { - var thread = keywordThreads[keyword.keyword.toLowerCase()] || { - title: '', - } - // { - // keyword: "warez", - // sum(`viewed`): "498", - // id: 701, - // title: "EMS SYNTHI PLUG FOR MAC", - // lastmodified: 1192401724 - // }, - // console.log(keyword, thread) - var viewed = thread['sum(`viewed`)'] - var views = viewed ? hush_views(viewed) : ['',''] - var threadCountNum = thread['count(*)'] - var threadCount = threadCountNum ? hush_threads(threadCountNum) : ['',''] - var dot = privacy_dot(thread.privacy) - var datetime = verbose_date(keyword.createdate) + console.log(data) + // var keywordThreads = {} + // data.threadGroups.forEach(kw => { + // keywordThreads[kw.keyword] = kw + // }) + data.users + // .map(a => [parseInt((keywordThreads[a.keyword] || {})['sum(`viewed`)']) || 0, a]) + // .sort((b,a) => cmp(a[0], b[0])) + // .map(a => a[1]) + .map(user => { + // var user = users[user.username.toLowerCase()] || return + // var viewed = thread['sum(`viewed`)'] + // var views = viewed ? hush_views(viewed) : ['',''] + // var threadCountNum = thread['count(*)'] + // var threadCount = threadCountNum ? hush_threads(threadCountNum) : ['',''] + // "id", "username", "realname", "firstseen", "lastseen", + // "location", "website", "avatar", + var create_datetime = verbose_date(keyword.createdate) var age = get_age(thread.lastmodified) var id = thread.id + get_revision(thread) var t = this.template .replace(/{{keyword}}/g, sanitizeHTML(keyword.keyword)) .replace(/{{id}}/g, id) .replace(/{{username}}/g, keyword.username) - .replace(/{{privacy_dot}}/g, dot) .replace(/{{title}}/g, thread.title) - .replace(/{{date}}/g, datetime[0]) - .replace(/{{time}}/g, datetime[1]) + .replace(/{{create_date}}/g, create_datetime[0]) + .replace(/{{create_time}}/g, create_datetime[1]) .replace(/{{date_class}}/g, carbon_date(thread.lastmodified) ) .replace(/{{views}}/g, views[1]) .replace(/{{threadcount}}/, threadCount[1]) -- cgit v1.2.3-70-g09d2