From 6e2e488565a9bc6f76287f84b2ce168085e74a80 Mon Sep 17 00:00:00 2001 From: Cutls Date: Sun, 1 Sep 2019 00:02:34 +0900 Subject: [PATCH] Fix: instance actor --- app/js/post/suggest.js | 7 +- app/js/tl/parse.js | 226 +++++++++++++++++++++-------------------- app/js/tl/src.js | 1 - app/view/make/make.js | 4 + 4 files changed, 123 insertions(+), 115 deletions(-) diff --git a/app/js/post/suggest.js b/app/js/post/suggest.js index a829f890..3b407b7a 100644 --- a/app/js/post/suggest.js +++ b/app/js/post/suggest.js @@ -162,8 +162,11 @@ input.addEventListener("focus", function () { Object.keys(json.accounts).forEach(function (key3) { var acct = json.accounts[key3]; if (acct.acct != q) { - accts = accts + '@' + acct.acct + '
'; + //Instance Actorって… + if (acct.username.indexOf(".") < 0) { + accts = accts + '@' + acct.acct + '
'; + } } }); $("#right-side").show() diff --git a/app/js/tl/parse.js b/app/js/tl/parse.js index 550cf074..1b69d7f6 100644 --- a/app/js/tl/parse.js +++ b/app/js/tl/parse.js @@ -930,125 +930,127 @@ function userparse(obj, auth, acct_id, tlid, popup) { } else { var notf = false; } - if (toot.locked) { - var locked = ' '; - } else { - var locked = ""; - } - if (auth == "request") { - var authhtml = 'person_add person_add_disabled'; - } else { - var authhtml = ""; - } - var ftxt = lang.lang_parse_followed; - if (!locale && localStorage.getItem("followlocale_" + acct_id)) { - ftxt = localStorage.getItem("followlocale_" + acct_id); - } - if (popup > 0 || popup == -1 || notf) { - var notftext = ftxt + '
'; - } else { - var notftext = ""; - } - var memory = localStorage.getItem("notice-mem"); - if (popup >= 0 && obj.length < 5 && notftext != memory) { - M.toast({ html: escapeHTML(toot.display_name) + ":" + ftxt, displayLength: popup * 1000 }) - $(".notf-icon_" + tlid).addClass("red-text"); - localStorage.setItem("notice-mem", notftext); - notftext = ""; - var native = localStorage.getItem("nativenotf"); - if (!native) { - native = "yes"; + //Instance Actorって… + if (toot.username.indexOf(".") < 0) { + if (toot.locked) { + var locked = ' '; + } else { + var locked = ""; } - if (native == "yes") { - var os = localStorage.getItem("platform"); - var options = { - body: toot.display_name + "(" + toot.acct + ")" + ftxt, - icon: toot.avatar - }; - var domain = localStorage.getItem("domain_" + acct_id); - if (os == "darwin") { - var n = new Notification('TheDesk:' + domain, options); - } else { - var nativeNotfOpt = [ - 'TheDesk:' + domain, - toot.display_name + "(" + toot.acct + ")" + ftxt, - toot.avatar, - "userdata", - acct_id, - toot.id - ] - postMessage(["nativeNotf", nativeNotfOpt], "*") + if (auth == "request") { + var authhtml = 'person_add person_add_disabled'; + } else { + var authhtml = ""; + } + var ftxt = lang.lang_parse_followed; + if (!locale && localStorage.getItem("followlocale_" + acct_id)) { + ftxt = localStorage.getItem("followlocale_" + acct_id); + } + if (popup > 0 || popup == -1 || notf) { + var notftext = ftxt + '
'; + } else { + var notftext = ""; + } + var memory = localStorage.getItem("notice-mem"); + if (popup >= 0 && obj.length < 5 && notftext != memory) { + M.toast({ html: escapeHTML(toot.display_name) + ":" + ftxt, displayLength: popup * 1000 }) + $(".notf-icon_" + tlid).addClass("red-text"); + localStorage.setItem("notice-mem", notftext); + notftext = ""; + var native = localStorage.getItem("nativenotf"); + if (!native) { + native = "yes"; + } + if (native == "yes") { + var os = localStorage.getItem("platform"); + var options = { + body: toot.display_name + "(" + toot.acct + ")" + ftxt, + icon: toot.avatar + }; + var domain = localStorage.getItem("domain_" + acct_id); + if (os == "darwin") { + var n = new Notification('TheDesk:' + domain, options); + } else { + var nativeNotfOpt = [ + 'TheDesk:' + domain, + toot.display_name + "(" + toot.acct + ")" + ftxt, + toot.avatar, + "userdata", + acct_id, + toot.id + ] + postMessage(["nativeNotf", nativeNotfOpt], "*") + } } } - } - if (toot.display_name) { - var dis_name = escapeHTML(toot.display_name); - } else { - var dis_name = toot.username; - } - //ネイティブ通知 + if (toot.display_name) { + var dis_name = escapeHTML(toot.display_name); + } else { + var dis_name = toot.username; + } + //ネイティブ通知 - if (toot.emojis) { - var actemojick = toot.emojis[0]; - } else { - var actemojick = false; + if (toot.emojis) { + var actemojick = toot.emojis[0]; + } else { + var actemojick = false; + } + //絵文字があれば + if (actemojick) { + Object.keys(toot.emojis).forEach(function (key5) { + var emoji = toot.emojis[key5]; + var shortcode = emoji.shortcode; + var emoji_url = ' :' + shortcode + ': '; + var regExp = new RegExp(":" + shortcode + ":", "g"); + dis_name = dis_name.replace(regExp, emoji_url); + }); + } + if (dis_name) { + dis_name = twemoji.parse(dis_name); + } + if (toot.avatar) { + var avatar = toot.avatar; + } else { + var avatar = "../../img/missing.svg"; + } + if (tlid == "dir" && acct_id == "noauth") { + var udg = '' + } else { + var udg = '' + } + var latest = date(toot.last_status_at, "relative"); + if (toot.last_status_at) { + var latesthtml = '
Last: ' + latest + + '
' + } else { + var latesthtml = "" + } + templete = templete + + '
' + + notftext + + '
' + + '
' + + dis_name + '' + + ' @' + + toot.acct + locked + '' + + '
' + + '
' + + '
' + toot.note.replace(/.+/g, '...') + '
' + + '
' + lang.lang_status_follow + ':' + + toot.following_count + + '
' + lang.lang_status_followers + ':' + toot.followers_count + + '
' + latesthtml + authhtml + + '
' + + '
'; } - //絵文字があれば - if (actemojick) { - Object.keys(toot.emojis).forEach(function (key5) { - var emoji = toot.emojis[key5]; - var shortcode = emoji.shortcode; - var emoji_url = ' :' + shortcode + ': '; - var regExp = new RegExp(":" + shortcode + ":", "g"); - dis_name = dis_name.replace(regExp, emoji_url); - }); - } - if (dis_name) { - dis_name = twemoji.parse(dis_name); - } - if (toot.avatar) { - var avatar = toot.avatar; - } else { - var avatar = "../../img/missing.svg"; - } - if (tlid == "dir" && acct_id == "noauth") { - var udg = '' - } else { - var udg = '' - } - var latest = date(toot.last_status_at, "relative"); - if(toot.last_status_at){ - var latesthtml = '
Last: ' + latest + - '
' - }else{ - var latesthtml = "" - } - templete = templete + - '
' + - notftext + - '
' + - '
' + - dis_name + '' + - ' @' + - toot.acct + locked + '' + - '
' + - '
' + - '
' + toot.note.replace(/.+/g, '...') + '
' + - '
' + lang.lang_status_follow + ':' + - toot.following_count + - '
' + lang.lang_status_followers + ':' + toot.followers_count + - '
' + latesthtml + authhtml + - '
' + - '
'; } - }); return templete; } diff --git a/app/js/tl/src.js b/app/js/tl/src.js index 9e6c3a59..0d081474 100644 --- a/app/js/tl/src.js +++ b/app/js/tl/src.js @@ -75,7 +75,6 @@ function src(mode, offset) { //アカウント if (json.accounts[0]) { var templete = userparse(json.accounts, '', acct_id); - console.log(templete) if(!offset){ $("#src-contents").append("
Accounts
" + templete + '
more...'); }else{ diff --git a/app/view/make/make.js b/app/view/make/make.js index 13a85411..637ba74c 100644 --- a/app/view/make/make.js +++ b/app/view/make/make.js @@ -19,6 +19,10 @@ const pages = ["acct.html", "index.html", "setting.html", "update.html", "settin let langstr = "" for (let n = 0; n < langs.length; n++) { let lang = langs[n] + let targetDir = '../' + lang + if (!fs.existsSync(targetDir)) { + fs.mkdirSync(targetDir); + } langstr = langstr + '' + langsh[n] + '' } for (let i = 0; i < samples.length; i++) {