Add: featured tag

This commit is contained in:
Cutls 2019-09-09 23:26:57 +09:00
parent e04b64a326
commit 286e7956f2
4 changed files with 26 additions and 6 deletions

View File

@ -66,7 +66,7 @@ var idata = {
"misskey.io_post": "Post",
"misskey.io_fav": " reacted your post.",
"misskey.io_bt": " reposted your post.",
"misskey.dev": "misskey.dev",
"misskey.dev": "misskey",
"misskey.dev_name": "misskey.dev",
"misskey.dev_letters": "1024",
"misskey.dev_bbcode": "disabled",

View File

@ -286,10 +286,6 @@ function support() {
templete = '<a onclick="login(\'' + key +
'\')" class="collection-item pointer transparent">' + idata[key + "_name"] + '(' + key + ')</a>';
$("#support").append(templete);
} else if (instance == "misskey") {
templete = '<a onclick="misskeyLogin(\'' + key +
'\')" class="collection-item pointer transparent">' + idata[key + "_name"] + '(' + key + ')</a>';
$("#support").append(templete);
}
});
}

View File

@ -650,9 +650,10 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
if (tagck) {
Object.keys(toot.tags).forEach(function (key4) {
var tag = toot.tags[key4];
var featured = ' <a onclick="tagFeature(\'' + tag.name + '\',' + acct_id +')" class="pointer" title="add it to Featured tags">Feature</a> '
tags = tags + '<span class="hide" data-tag="' + tag.name + '">#' + tag.name + ':<a onclick="tl(\'tag\',\'' + tag.name + '\',' + acct_id +
',\'add\')" class="pointer" title="' + lang.lang_parse_tagTL.replace("{{tag}}", '#' + tag.name) + '">TL</a> <a onclick="brInsert(\'#' + tag.name + '\')" class="pointer" title="' + lang.lang_parse_tagtoot.replace("{{tag}}", '#' + tag.name) + '">Toot</a> ' +
'<a onclick="tagPin(\'' + tag.name + '\')" class="pointer" title="' + lang.lang_parse_tagpin.replace("{{tag}}", '#' + tag.name) + '">Pin</a></span> ';
'<a onclick="tagPin(\'' + tag.name + '\')" class="pointer" title="' + lang.lang_parse_tagpin.replace("{{tag}}", '#' + tag.name) + '">Pin</a>' + featured + '</span> ';
});
tags = '<div style="float:right">' + tags + '</div>';
}

View File

@ -127,4 +127,27 @@ function autoToot(tag) {
brInsert('#' + tag + " ")
}
favTag();
}
//タグをフィーチャー
function tagFeature(name, acct_id){
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_" + acct_id + "_at");
var start = "https://" + domain + "/api/v1/featured_tags"
fetch(start, {
method: 'POST',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
body: JSON.stringify({
name: name
})
}).then(function (response) {
return response.json();
}).catch(function (error) {
return false;
}).then(function (json) {
console.log(json)
M.toast({ html: "Complete: " + escapeHTML(name), displayLength: 3000 })
});
}