Trend tag on Astarte was set disabled.
This commit is contained in:
parent
cf587c76e6
commit
0ef0c80ac8
|
@ -3,9 +3,6 @@
|
||||||
function srcToggle() {
|
function srcToggle() {
|
||||||
$("#src-box").toggleClass("hide");
|
$("#src-box").toggleClass("hide");
|
||||||
$("#src-box").toggleClass("show");
|
$("#src-box").toggleClass("show");
|
||||||
if($("#src-box").hasClass("show")){
|
|
||||||
trend();
|
|
||||||
}
|
|
||||||
$("#src-box").css("bottom","40px");
|
$("#src-box").css("bottom","40px");
|
||||||
$("#src-box").css("left",$('#src-tgl').offset().left-$('#src-box').width()/2+"px");
|
$("#src-box").css("left",$('#src-tgl').offset().left-$('#src-box').width()/2+"px");
|
||||||
$('ul.tabs').tabs('select_tab', 'src-sta');
|
$('ul.tabs').tabs('select_tab', 'src-sta');
|
||||||
|
@ -107,53 +104,6 @@ function tootsearch(q){
|
||||||
jQuery("time.timeago").timeago();
|
jQuery("time.timeago").timeago();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function trend(){
|
|
||||||
$("#src-contents").html("");
|
|
||||||
var acct_id = $("#src-acct-sel").val();
|
|
||||||
if(acct_id=="tootsearch"){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var domain = localStorage.getItem("domain_" + acct_id);
|
|
||||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
|
||||||
if (user == "--now") {
|
|
||||||
var user = $('#his-data').attr("user-id");
|
|
||||||
}
|
|
||||||
var start = "https://" + domain + "/api/v1/trends"
|
|
||||||
console.log(start)
|
|
||||||
fetch(start, {
|
|
||||||
method: 'GET',
|
|
||||||
headers: {
|
|
||||||
'content-type': 'application/json',
|
|
||||||
'Authorization': 'Bearer ' + at
|
|
||||||
},
|
|
||||||
}).then(function(response) {
|
|
||||||
return response.json();
|
|
||||||
}).catch(function(error) {
|
|
||||||
//todo(error);
|
|
||||||
console.error(error);
|
|
||||||
}).then(function(json) {
|
|
||||||
var tags = "";
|
|
||||||
Object.keys(json).forEach(function(keye) {
|
|
||||||
var tag = json[keye];
|
|
||||||
var his=tag.history;
|
|
||||||
var max=Math.max.apply(null, [his[0].uses,his[1].uses,his[2].uses,his[3].uses,his[4].uses,his[5].uses,his[6].uses]);
|
|
||||||
var six=50-(his[6].uses/max*50);
|
|
||||||
var five=50-(his[5].uses/max*50);
|
|
||||||
var four=50-(his[4].uses/max*50);
|
|
||||||
var three=50-(his[3].uses/max*50);
|
|
||||||
var two=50-(his[2].uses/max*50);
|
|
||||||
var one=50-(his[1].uses/max*50);
|
|
||||||
var zero=50-(his[0].uses/max*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>'+
|
|
||||||
'</svg><span style="font-size:200%">'+his[0].uses+'</span>toots <a onclick="tl(\'tag\',\'' + tag.name + '\',\'' + acct_id +
|
|
||||||
'\',\'add\')" class="pointer">#' + tag.name + '</a> '+his[0].accounts+lang_src_people[lang];
|
|
||||||
|
|
||||||
$("#src-contents").append(tags);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function graphDraw(tag){
|
function graphDraw(tag){
|
||||||
var tags="";
|
var tags="";
|
||||||
var his=tag.history;
|
var his=tag.history;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user