//オブジェクトパーサー(トゥート) function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) { var templete = ''; var actb = localStorage.getItem("action_btns"); var actb='re,rt,fav,qt,del,pin,red'; if(actb){ var actb = actb.split(','); var disp={}; for(var k=0;k' + date(toot.createdAt, datetype) + ''+icon+'' + dis_name + "(@" + toot.user.username + ")"; var notice = noticetext; var memory = localStorage.getItem("notice-mem"); if (popup >= 0 && obj.length < 5 && noticetext != memory) { if (toot.type == "reply") { var replyct=localStorage.getItem("notf-reply_" + acct_id) $(".notf-reply_" + acct_id).text(replyct*1-(-1)); localStorage.setItem("notf-reply_" + acct_id,replyct*1-(-1)) $(".notf-reply_" + acct_id).removeClass("hide") }else if (toot.type == "renote" || toot.type=="quote") { var btct=localStorage.getItem("notf-bt_" + acct_id) $(".notf-bt_" + acct_id).text(btct*1+1); localStorage.setItem("notf-bt_" + acct_id,btct*1-(-1)) $(".notf-bt_" + acct_id).removeClass("hide") }else if (toot.type == "reaction") { var favct=localStorage.getItem("notf-fav_" + acct_id) $(".notf-fav_" + acct_id).text(favct*1-(-1)); localStorage.setItem("notf-fav_" + acct_id,favct*1-(-1)) $(".notf-fav_" + acct_id).removeClass("hide") } var domain = localStorage.getItem("domain_" + acct_id); if(popup>0){ Materialize.toast("["+domain+"]"+escapeHTML(toot.user.name)+what, popup * 1000); } if(native=="yes"){ var electron = require("electron"); var ipc = electron.ipcRenderer; var os = electron.remote.process.platform; var options = { body: toot.user.name+"(" + toot.user.username +")"+what+"\n\n"+$.strip_tags(toot.note.text), icon: toot.user.avatarUrl }; if(os=="darwin"){ var n = new Notification('TheDesk:'+domain, options); }else{ ipc.send('native-notf', ['TheDesk:'+domain,toot.user.name+"(" + toot.user.acct +")"+what+"\n\n"+$.strip_tags(toot.note.text),toot.user.avatarUrl]); } } $(".notf-icon_" + acct_id).addClass("red-text"); localStorage.setItem("notice-mem", noticetext); noticetext = ""; } var if_notf='data-notfIndv="'+acct_id+"_"+toot.id+'"'; var toot = toot.note; var dis_name=escapeHTML(toot.user.name); }else{ var if_notf=""; if (toot.renote) { var rebtxt = lang_parse_btedsimple[lang]; var rticon = "fa-retweet light-blue-text"; var notice = ''+ dis_name + "(@" + toot.user.username + ")
"; var boostback = "shared"; var uniqueid=toot.id; var toot = toot.renote; var dis_name=escapeHTML(toot.user.name); var uniqueid=toot.id; var actemojick=false } else { var uniqueid=toot.id; var notice = ""; var boostback = ""; //ユーザー強調 if(toot.user.host){ var fullname=toot.user.username+"@"+toot.user.host; }else{ var domain = localStorage.getItem("domain_" + acct_id); var fullname=toot.user.username+"@"+domain; } if(useremp){ Object.keys(useremp).forEach(function(key10) { var user = useremp[key10]; if(user==fullname){ boostback = "emphasized"; } }); } } } var id = toot.id; if (mix == "home") { var home = "" var divider = '
'; } else { var home = ""; var divider = '
'; } /* if (toot.account.locked) { var locked = ' '; } else { var locked = ""; } */ if (!toot.app) { if(toot.viaMobile){ var via = 'Mobile'; }else{ var via = 'Unknown'; } } else { var via = toot.app.name; //強調チェック Object.keys(emp).forEach(function(key6) { var cli = emp[key6]; if(cli == via){ boostback = "emphasized"; } }); //ミュートチェック Object.keys(mute).forEach(function(key7) { var cli = mute[key7]; if(cli == via){ boostback = "hide"; } }); } if ((toot.cw || toot.cw=="") && cw) { var content = toot.text; var spoil = escapeHTML(toot.cw); var spoiler = "cw cw_hide_" + toot.id; var api_spoil = "gray"; var spoiler_show = ''+lang_parse_cwshow[lang]+'
'; } else { var ct1 = nl2br(toot.text).split('
').length -2; var ct2 = nl2br(toot.text).split('
').length -2; if(ct1>ct2){ var ct= ct1; }else{ var ct= ct2; } if ((sent < ct && $.mb_strlen($.strip_tags(toot.text)) > 5) || ($.strip_tags(toot.text).length > ltr && $.mb_strlen($.strip_tags(toot.text)) > 5)) { var content = ''+lang_parse_fulltext[lang]+'
' + toot.text var spoil = '' + $.mb_substr($.strip_tags( toot.text), 0, 100) + ''+lang_parse_autofold[lang]+''; var spoiler = "cw cw_hide_" + toot.id; var spoiler_show = ''+lang_parse_more[lang]+'
'; } else { var content = toot.text; if(toot.cw){ var spoil = escapeHTML(toot.cw); }else{ var spoil=""; } var spoiler = ""; var spoiler_show = ""; } } var analyze = ''; var viewer = ""; var hasmedia = ""; var youtube = ""; if(toot.emojis){ var emojick = toot.emojis[0]; }else{ var emojick=false; } //デフォ絵文字 if(content){ //MFM content=content.replace(/^"([^"]+)"$/gmi, '
$1
') content=content.replace(/`(.+)`/gi, '$1') content=content.replace(/(http(s)?:\/\/[\x21-\x7e]+)/gi, '$1') content=content.replace(/\(\(\((.+)\)\)\)/gi, '$1') content=content.replace(/(.+)<\/motion>/gi, '$1') content=content.replace(/\*\*\*([^*]+)\*\*\*/gi, '$1') content=content.replace(/\*\*([^*]+)\*\*/gi, '$1') content=content.replace(/^(.+)\s(検索|search)$/gmi, '
search
') content=content.replace(/\[(.+)\]\($1'); content=twemoji.parse(content); }else{ content=""; } if(dis_name){ dis_name=twemoji.parse(dis_name); }else{ dis_name=""; } if(spoil){ spoil=twemoji.parse(spoil); } if(noticetext){ noticetext=twemoji.parse(noticetext); } if(notice){ notice=twemoji.parse(notice); } var mediack = toot.media[0]; //メディアがあれば var media_ids=""; if (mediack) { hasmedia = "hasmedia"; var cwdt = 100 / toot.media.length; Object.keys(toot.media).forEach(function(key2) { var media = toot.media[key2]; var purl = media.url; media_ids=media_ids+media.id+","; var url = media.url; if (media.isSensitive && nsfw) { var sense = "sensitive" } else { var sense = "" } if(media.type.indexOf("video") !== -1){ viewer = viewer + ''; }else{ viewer = viewer + ''; } }); media_ids = media_ids.slice(0, -1) ; } else { viewer = ""; hasmedia = "nomedia"; } var menck = toot.reply; var mentions = ""; //メンションであれば if (menck) { mentions = '
@' + menck.user.username + '
'; } var tagck = toot.tags[0]; var tags = ""; //タグであれば if (tagck) { Object.keys(toot.tags).forEach(function(key4) { var tag = toot.tags[key4]; var tags = '#' + tag + '#' + tag + ':TL Toot '+ 'Pin '; content=content.replace("#"+tag,tags); }); //tags = '
' + tags + '
'; } //公開範囲を取得 var vis = ""; var visen = toot.visibility; if (visen == "public") { var vis = 'public'; var can_rt = ""; } else if (visen == "home") { var vis = 'lock_open'; var can_rt = ""; } else if (visen == "followers") { var vis = 'people'; var can_rt = ""; } else if (visen == "private") { var vis = 'lock'; var can_rt = ""; } else if (visen == "specified") { var vis = 'mail'; var can_rt = "hide"; } if (toot.user.username == localStorage.getItem("user_" + acct_id)) { var if_mine = ""; var mine_via="type-b"; } else { var if_mine = "hide"; var mine_via=""; } if (toot.myReaction) { var if_fav = " yellow-text"; var fav_app = "faved"; } else { var if_fav = ""; var fav_app = ""; } var if_rt = ""; var rt_app = ""; /* if (toot.reblogged) { var if_rt = "teal-text"; var rt_app = "rted"; } else { var if_rt = ""; var rt_app = ""; } */ //アバター var avatar = toot.user.avatarUrl; //ワードミュート if(wordmute){ Object.keys(wordmute).forEach(function(key8) { var worde = wordmute[key8]; if(worde){ if(worde.tag){ var word=worde.tag; }else{ var word=worde } var regExp = new RegExp( word, "g" ) ; if($.strip_tags(content).match(regExp)){ boostback = "hide by_filter"; } } }); } //ワード強調 if(wordemp){ Object.keys(wordemp).forEach(function(key9) { var word = wordemp[key9]; if(word){ var word=word.tag; var regExp = new RegExp( word, "g" ) ; content=content.replace(regExp,''+word+""); } }); } //Poll var poll=""; if(toot.poll){ var choices=toot.poll.choices; Object.keys(choices).forEach(function(keyc) { var choice = choices[keyc]; if(choice.isVoted){ var myvote=twemoji.parse("✅"); }else{ var myvote=""; } poll=poll+'
'+choice.text+'('+choice.votes+''+myvote+')
'; }); poll='
'+poll+'
'; } //Reactions if(toot.reactionCounts){ if(toot.reactionCounts.like){ var like=toot.reactionCounts.like; var likehide=""; }else{ var like=0; var likehide="hide"; } if(toot.reactionCounts.love){ var love=toot.reactionCounts.love; var lovehide=""; }else{ var love=0; var lovehide="hide"; } if(toot.reactionCounts.laugh){ var laugh=toot.reactionCounts.laugh; var laughhide=""; }else{ var laugh=0; var laughhide="hide"; } if(toot.reactionCounts.hmm){ var hmm=toot.reactionCounts.hmm; var hmmhide=""; }else{ var hmm=0; var hmmhide="hide"; } if(toot.reactionCounts.surprise){ var surprise=toot.reactionCounts.surprise; var suphide=""; }else{ var suphide="hide"; var surprise=0; } if(toot.reactionCounts.congrats){ var congrats=toot.reactionCounts.congrats; var conghide=""; }else{ var congrats=0; var conghide="hide"; } if(toot.reactionCounts.angry){ var angry=toot.reactionCounts.angry; var anghide=""; }else{ var angry=0; var anghide="hide"; } if(toot.reactionCounts.confused){ var confhide=""; var confused=toot.reactionCounts.confused; }else{ var confused=0; var confhide="hide"; } if(toot.reactionCounts.pudding){ var pudding=toot.reactionCounts.pudding; var pudhide=""; }else{ var pudding=0; var pudhide="hide"; } var fullhide=""; }else{ var like=0;var love=0;var laugh=0;var hmm=0;var surprise=0;var congrats=0;var angry=0;var confused=0;var pudding=0; var likehide="hide";var lovehide="hide";var laughhide="hide";var hmmhide="hide";var suphide="hide";var conghide="hide";var anghide="hide";var confhide="hide";var pudhide="hide"; var fullhide="hide"; } if(toot.myReaction){ var reacted=toot.myReaction; }else{ var reacted=""; } content=nl2br(content); if(!content || content==""){ content='This post has no content. It may be media-only, private or deleted.'; } var trans=""; templete = templete + '
' + '
' + notice + home + '
' + '' + '
' + dis_name + ' @' + toot.user.username + '
' + '
' + date(toot.createdAt, datetype) + '' + '
' + '
' + content + '' + spoil + spoiler_show + '' + '' + viewer + '' + '
' + '
'+ '
' + '
'+vis+'
'+ '' + '
' + '
' + '
' + '
' + '
' + '
' +''+trans+ 'via ' + via + ''+ '
' + ''; }); return templete; } //オブジェクトパーサー(ユーザーデータ) function misskeyUserparse(obj, auth, acct_id, tlid, popup) { if(popup > 0 || popup==-1){ }else{ var obj = obj.users; } var templete = ''; var datetype = localStorage.getItem("datetype"); Object.keys(obj).forEach(function(key) { var toot = obj[key]; var locked = ""; if (auth) { var auth = 'person_add'; } else { var auth = ""; } var ftxt=lang_parse_followed[lang]; if(popup > 0 || popup==-1){ var notftext='' + date(toot.createdAt, datetype) + ''+ftxt+'
'; var toot = toot.user; }else{ var notftext=""; } var memory = localStorage.getItem("notice-mem"); if (popup >= 0 && obj.length < 5 && notftext != memory) { Materialize.toast(escapeHTML(toot.name)+":"+ftxt, popup * 1000); $(".notf-icon_" + tlid).addClass("red-text"); localStorage.setItem("notice-mem", notftext); notftext = ""; } if(toot.name){ var dis_name=escapeHTML(toot.name); dis_name=twemoji.parse(dis_name); }else{ var dis_name=toot.name; } templete = templete + '
' + notftext + '
' + '
' + dis_name + '' + ' @' + toot.username + auth +'' + '
' + '
' + '
Follows:' + toot.followingCount + '
Followers:' + toot.followersCount + '
' + '
' + '
' + ''; }); return templete; } function goGoogle(id){ var val=$("#srcbox_"+id).val(); var url="https://google.com/search?q="+val; const { shell } = require('electron'); shell.openExternal(url); }