diff --git a/README.md b/README.md index 28a716ff..093e2ae0 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,18 @@ # TheDesk -TheDesk Minami (19)はVueで書き直します(rewrite-vueブランチ参照)。18までのバージョンはTheDesk Kawaii (20)以降で継続します。 +TheDesk Minami (19)はVueで書き直します(rewrite-vueブランチ参照)。18までのバージョンはTheDesk Kawaii (20)(仮称)以降で継続します。 [![Build Status](https://travis-ci.org/cutls/TheDesk.svg?branch=master)](https://travis-ci.org/cutls/TheDesk) -[![Crowdin](https://d322cqt584bo4o.cloudfront.net/thedesk/localized.svg)](https://translate.thedesk.top/project/thedesk) +[![Crowdin](https://d322cqt584bo4o.cloudfront.net/thedesk/localized.svg)](https://translate.thedesk.top/project/thedesk) +[![code style: prettier](https://flat.badgen.net/badge/code%20style/prettier/pink)](https://github.com/prettier/prettier) +[![PRs Welcome](https://flat.badgen.net/badge/PRs/welcome/green)](https://github.com/cutls/TheDesk/pulls) +[![Version](https://flat.badgen.net/github/release/cutls/TheDesk)](https://github.com/cutls/TheDesk/releases) +[![Download](https://flat.badgen.net/github/assets-dl/cutls/TheDesk)](https://github.com/cutls/TheDesk/releases) +![Contributors](https://flat.badgen.net/github/contributors/cutls/TheDesk) Mastodon/Misskey client for PC(Windows/Linux/macOS) オープンソースSNSマストドン/MisskeyのWindows/Linuxクライアント Download:[TheDesk](https://thedesk.top) -Contact me(bug report...):GitHub Issues, mention to [Cutls@kirishima.cloud](https://kirishima.cloud/@Cutls) or toot with #Desk - -バグレポートなど:GitHub Issuesや[Cutls@kirishima.cloud](https://kirishima.cloud/@Cutls)へのリプ,または#Deskでトゥートして下さい. - ### Contribute/コントリビュート Please make a pull request to ***WIP(before CI)*** brunch diff --git a/app/about.html b/app/about.html index 6c253416..d4867835 100644 --- a/app/about.html +++ b/app/about.html @@ -1,115 +1,124 @@ +
-ここに画像ファイルをドラッグし、画像をクリックしてください。
- -ここに画像ファイルをドラッグし、画像をクリックしてください。
+ +$1<\/blockquote>'); + var bb = bb.replace(/>(.+)$/g, '$1<\/blockquote>'); //spin - var bb=bb.replace(/\[spin\](.+)\[\/spin\]/g,'$1<\/span>'); + var bb = bb.replace(/\[spin\](.+)\[\/spin\]/g, '$1<\/span>'); //pulse - var bb=bb.replace(/\[pulse\](.+)\[\/pulse\]/g,'$1<\/span>'); + var bb = bb.replace(/\[pulse\](.+)\[\/pulse\]/g, '$1<\/span>'); //large - var bb=bb.replace(/\[large=([0-9]{1,2})x\](.+)\[\/large\]/g,'$2<\/span>'); + var bb = bb.replace(/\[large=([0-9]{1,2})x\](.+)\[\/large\]/g, '$2<\/span>'); //vertical - var bb=bb.replace(/\[flip=vertical\](.+)\[\/flip\]/g,'$1<\/span>'); + var bb = bb.replace(/\[flip=vertical\](.+)\[\/flip\]/g, '$1<\/span>'); //horizontal - var bb=bb.replace(/\[flip=horizontal\](.+)\[\/flip\]/g,'$1<\/span>'); + var bb = bb.replace(/\[flip=horizontal\](.+)\[\/flip\]/g, '$1<\/span>'); //b - var bb=bb.replace(/\[b\](.+)\[\/b\]/g,'$1<\/b>'); + var bb = bb.replace(/\[b\](.+)\[\/b\]/g, '$1<\/b>'); //i - var bb=bb.replace(/\[i\](.+)\[\/i\]/g,'$1<\/i>'); + var bb = bb.replace(/\[i\](.+)\[\/i\]/g, '$1<\/i>'); //u - var bb=bb.replace(/\[u\](.+)\[\/u\]/g,'$1<\/u>'); + var bb = bb.replace(/\[u\](.+)\[\/u\]/g, '$1<\/u>'); //s - var bb=bb.replace(/\[s\](.+)\[\/s\]/g,'$1<\/s>'); + var bb = bb.replace(/\[s\](.+)\[\/s\]/g, '$1<\/s>'); //size - var bb=bb.replace(/\[size=([0-9]{1,2})\](.+)\[\/size\]/g,'$2<\/span>'); + var bb = bb.replace(/\[size=([0-9]{1,2})\](.+)\[\/size\]/g, '$2<\/span>'); //colorhex - var bb=bb.replace(/\[colorhex=([A-Fa-f0-9]+)\](.+)\[\/colorhex\]/g,'$2<\/span>'); + var bb = bb.replace(/\[colorhex=([A-Fa-f0-9]+)\](.+)\[\/colorhex\]/g, '$2<\/span>'); //code - var bb=bb.replace(/`(.+)`/g,'$1<\/code>'); + var bb = bb.replace(/`(.+)`/g, '
' + lang.lang_parse_autofold + ''; var spoiler = "cw cw_hide_" + toot.id; var spoiler_show = ''+lang.lang_parse_more+'$1<\/code>'); //head var m; - m=bb.match(/^#{1,6}(.+)$/gm); - if(m){ - for(let i = 0; i < m.length; i++) { - var t=m[i].match(/^#{1,6}(.+)$/); - var indexct='
'+t[1]+' '; - var bb=bb.replace(new RegExp(m[i], ""),indexct); - } + m = bb.match(/^#{1,6}(.+)$/gm); + if (m) { + for (let i = 0; i < m.length; i++) { + var t = m[i].match(/^#{1,6}(.+)$/); + var indexct = '' + t[1] + ' '; + var bb = bb.replace(new RegExp(m[i], ""), indexct); + } } //list(ul) var li; - li=bb.match(/^\- (.+)$/gm); - if(li){ - for(let l = 0; l < li.length; l++) { - var u=li[l].match(/^\- (.+)$/); - var listUl=''+u[1]+' '; - if(l == 0){ - listUl=''+listUl; + li = bb.match(/^\- (.+)$/gm); + if (li) { + for (let l = 0; l < li.length; l++) { + var u = li[l].match(/^\- (.+)$/); + var listUl = '
'; - } - var bb=bb.replace(new RegExp(li[l], ""),listUl); - } } //list(ol) var li; - li=bb.match(/^1\. (.+)$/gm); - if(li){ - for(let l = 0; l < li.length; l++) { - var u=li[l].match(/^1\. (.+)$/); - var listUl='- ' + u[1] + '
'; + if (l == 0) { + listUl = '' + listUl; + } + if (l == li.length - 1) { + listUl = listUl + '
'; + } + var bb = bb.replace(new RegExp(li[l], ""), listUl); } - if(l==li.length-1){ - listUl=listUl+''+u[1]+' '; - if(l === 0){ - listUl=''+listUl; + li = bb.match(/^1\. (.+)$/gm); + if (li) { + for (let l = 0; l < li.length; l++) { + var u = li[l].match(/^1\. (.+)$/); + var listUl = '
'; - } - var bb=bb.replace(new RegExp(li[l], ""),listUl); - } } //img - var bb=bb.replace(/!\[(.+)\]\((https:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)\)/g,''); + var bb = bb.replace(/!\[(.+)\]\((https:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)\)/g, ''); //link - var bb=bb.replace(/\[(.+)\]\((https?:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)\)/g,'$1<\/a>'); - bb=nl2br(bb); - bb=bb.replace(new RegExp("- ' + u[1] + '
'; + if (l === 0) { + listUl = '' + listUl; + } + if (l === li.length - 1) { + listUl = listUl + '
'; + } + var bb = bb.replace(new RegExp(li[l], ""), listUl); } - if(l===li.length-1){ - listUl=listUl+'
", "g"),""); + var bb = bb.replace(/\[(.+)\]\((https?:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)\)/g, '$1<\/a>'); + bb = nl2br(bb); + bb = bb.replace(new RegExp("
", "g"), ""); $("#md-preview").html(bb); - } - //Editで戻る - function previewEdit(){ - $("#preview-field").hide(); - $("#toot-field").show(); - $("#preview-btn").show(); - $("#md-preview").html(""); - } \ No newline at end of file +} +//Editで戻る +function previewEdit() { + $("#preview-field").hide(); + $("#toot-field").show(); + $("#preview-btn").show(); + $("#md-preview").html(""); +} \ No newline at end of file diff --git a/app/js/post/img.js b/app/js/post/img.js index f602874f..6e991976 100644 --- a/app/js/post/img.js +++ b/app/js/post/img.js @@ -2,26 +2,26 @@ var obj = $("body"); var system; //ドラッグスタート -obj.on('dragstart', function(e) { +obj.on('dragstart', function (e) { system = "locked" }); //何もなくファイルが通過 -obj.on('dragend', function(e) { +obj.on('dragend', function (e) { system = ""; }); //ドラッグファイルが画面上に -obj.on('dragenter', function(e) { +obj.on('dragenter', function (e) { if (system != "locked") { $("#drag").css('display', 'flex'); } }); -$("body").on('dragover', function(e) { +$("body").on('dragover', function (e) { e.stopPropagation(); e.preventDefault(); }); //ドロップした -$("body").on('drop', function(e) { +$("body").on('drop', function (e) { if (system != "locked") { $("#drag").css('display', 'none'); e.preventDefault(); @@ -30,7 +30,7 @@ $("body").on('drop', function(e) { } }); //何もなくファイルが通過 -$("#drag").on('dragleave', function(e) { +$("#drag").on('dragleave', function (e) { $("#drag").css('display', 'none'); }); @@ -38,23 +38,23 @@ $("#drag").on('dragleave', function(e) { function pimg(files) { console.table(files); for (i = 0; i < files.length; i++) { - var dot=files[i].path.match(/\.(.+)$/)[1]; - if(dot=="bmp" || dot=="BMP"){ + var dot = files[i].path.match(/\.(.+)$/)[1]; + if (dot == "bmp" || dot == "BMP") { var electron = require("electron"); - var ipc = electron.ipcRenderer; - ipc.send('bmp-image', [files[i].path,i]); - todo(lang.lang_progress); - - }else{ - handleFileUpload(files[i], obj,i); + var ipc = electron.ipcRenderer; + ipc.send('bmp-image', [files[i].path, i]); + todo(lang.lang_progress); + + } else { + handleFileUpload(files[i], obj, i); } } } var electron = require("electron"); var ipc = electron.ipcRenderer; ipc.on('bmp-img-comp', function (event, b64) { - media(b64[0],"image/png",b64[1]); - }); + media(b64[0], "image/png", b64[1]); +}); //ドラッグ・アンド・ドロップを終了 function closedrop() { $("#drag").css('display', 'none'); @@ -67,7 +67,7 @@ function fileselect() { //ファイル読み込み function handleFileUpload(files, obj, no) { var fr = new FileReader(); - fr.onload = function(evt) { + fr.onload = function (evt) { var b64 = evt.target.result; $('#b64-box').val(b64); var ret = media(b64, files["type"], no) @@ -82,26 +82,26 @@ function media(b64, type, no) { var c = "abcdefghijklmnopqrstuvwxyz0123456789"; var cl = c.length; var r = ""; - for(var i=0; i'; + if (json.type.indexOf("image") != -1) { + var html = ''; $('#preview').append(html); } else { $('#preview').append(lang.lang_postimg_previewdis); @@ -138,11 +138,11 @@ function media(b64, type, no) { var img = "no-act"; } if (img != "inline") { - var mediav=$("#media").val(); - var regExp = new RegExp("tmp_"+r, "g"); + var mediav = $("#media").val(); + var regExp = new RegExp("tmp_" + r, "g"); mediav = mediav.replace(regExp, json["id"]); $("#media").val(mediav); - + } if (img == "url") { $("#textarea").val($("#textarea").val() + " " + json["text_url"]) @@ -178,59 +178,59 @@ function toBlob(base64, type) { return blob; } //画像を貼り付けたら… -var element = document.querySelector("#textarea"); -element.addEventListener("paste", function(e){ - if (!e.clipboardData || !e.clipboardData.items) { - return true; - } - // DataTransferItemList に画像が含まれいない場合は終了する +var element = document.querySelector("#textarea"); +element.addEventListener("paste", function (e) { + if (!e.clipboardData || !e.clipboardData.items) { + return true; + } + // DataTransferItemList に画像が含まれいない場合は終了する var imageItems = [...e.clipboardData.items].filter(i => i.type.startsWith('image')); - if (imageItems.length == 0) { + if (imageItems.length == 0) { console.warn("it is not image") - return true; - } + return true; + } - // ファイルとして得る - // DataTransferItem の kind は file なので getAsString ではなく getAsFile を呼ぶ - var imageFile = imageItems[0].getAsFile(); - var imageType = imageItems[0].type; + // ファイルとして得る + // DataTransferItem の kind は file なので getAsString ではなく getAsFile を呼ぶ + var imageFile = imageItems[0].getAsFile(); + var imageType = imageItems[0].type; - // FileReaderで読み込む - var fr = new FileReader(); - fr.onload = function(e) { - // onload内ではe.target.resultにbase64が入っているのであとは煮るなり焼くなり + // FileReaderで読み込む + var fr = new FileReader(); + fr.onload = function (e) { + // onload内ではe.target.resultにbase64が入っているのであとは煮るなり焼くなり var base64 = e.target.result; var mediav = $("#media").val(); - if(mediav){ - var i=mediav.split(",").length; + if (mediav) { + var i = mediav.split(",").length; } - // DataTransferItem の type に mime tipes があるのでそれを使う + // DataTransferItem の type に mime tipes があるのでそれを使う media(base64, imageType, i) - }; - fr.readAsDataURL(imageFile); + }; + fr.readAsDataURL(imageFile); - // 画像以外がペーストされたときのために、元に戻しておく + // 画像以外がペーストされたときのために、元に戻しておく }); //Adobeフォトエディタ -function adobe(){ +function adobe() { var agree = localStorage.getItem("adobeagree"); ipc.send('adobe', agree); } ipc.on('adobeagree', function (event, arg) { - localStorage.setItem("adobeagree",arg); - }); -function deleteImage(key){ - if(!confirm(lang.lang_postimg_delete)){ + localStorage.setItem("adobeagree", arg); +}); +function deleteImage(key) { + if (!confirm(lang.lang_postimg_delete)) { return false; } var media = $("#media").val(); - var arr=media.split(","); - for(var i=0;i '+escapeHTML(choice.text)+'('+choice.votes+''+myvote+')'; + poll = poll + ' ' + escapeHTML(choice.text) + '(' + choice.votes + '' + myvote + ')'; }); - $(".vote_"+json.id).html(poll) - } - } - } + $(".vote_" + json.id).html(poll) + } + } + } } \ No newline at end of file diff --git a/app/js/post/post.js b/app/js/post/post.js index ea66c9c2..978fb538 100644 --- a/app/js/post/post.js +++ b/app/js/post/post.js @@ -1,163 +1,163 @@ -/*投稿系*/ +/*投稿系*/ //投稿 -function sec(){ - var mode=localStorage.getItem("sec"); +function sec() { + var mode = localStorage.getItem("sec"); var acct_id = $("#post-acct-sel").val(); var domain = localStorage.getItem("domain_" + acct_id); - if(~domain.indexOf("kirishima.cloud")>=0 && mode=="local"){ - mode="unlisted"; + if (~domain.indexOf("kirishima.cloud") >= 0 && mode == "local") { + mode = "unlisted"; } - post(null,mode); + post(null, mode); } -function post(mode,postvis) { - if($("#toot-post-btn").prop("disabled")){ +function post(mode, postvis) { + if ($("#toot-post-btn").prop("disabled")) { return false; } var str = $("#textarea").val(); var acct_id = $("#post-acct-sel").val(); localStorage.setItem("last-use", acct_id); var domain = localStorage.getItem("domain_" + acct_id); - if(domain=="theboss.tech"){ - if(~str.indexOf("#")){ - if(str.indexOf("#theboss_tech")=="-1"){ - if(!confirm(lang.lang_post_tagTL)){ + if (domain == "theboss.tech") { + if (~str.indexOf("#")) { + if (str.indexOf("#theboss_tech") == "-1") { + if (!confirm(lang.lang_post_tagTL)) { return false; } } } } - if(domain=="dtp-mstdn.jp"){ - if(~str.indexOf("#")){ - if(str.indexOf("#dtp")=="-1"){ - if(!confirm(lang.lang_post_tagTL)){ + if (domain == "dtp-mstdn.jp") { + if (~str.indexOf("#")) { + if (str.indexOf("#dtp") == "-1") { + if (!confirm(lang.lang_post_tagTL)) { return false; } } } } - if(!localStorage.getItem("cw_sentence")){ - var cw_sent=500; - }else{ - var cw_sent=localStorage.getItem("cw_sentence"); + if (!localStorage.getItem("cw_sentence")) { + var cw_sent = 500; + } else { + var cw_sent = localStorage.getItem("cw_sentence"); } - if(!localStorage.getItem("cw_letters")){ - var cw_ltres=500; - }else{ - var cw_ltres=localStorage.getItem("cw_letters"); + if (!localStorage.getItem("cw_letters")) { + var cw_ltres = 500; + } else { + var cw_ltres = localStorage.getItem("cw_letters"); } - if(domain!="kirishima.cloud"){ - if(mode!="pass" && !$("#cw").hasClass("cw-avail") && (str.length>cw_sent || (str.split("\n").length - 1)>cw_ltres)){ - var electron = require("electron"); - var remote=electron.remote; - var dialog=remote.dialog; - var plus=str.replace(/\n/g,"").slice(0,10)+"..."; - const options = { - type: 'info', - title: lang.lang_post_cwtitle, - message: lang.lang_post_cwtxt+plus, - buttons: [lang.lang_post_btn1,lang.lang_post_btn2, lang.lang_post_btn3] - } - dialog.showMessageBox(options, function(arg) { - if(arg===1){ - $("#cw-text").show(); - $("#cw").addClass("yellow-text"); - $("#cw").addClass("cw-avail"); - $("#cw-text").val(plus); - post("pass"); - }else if(arg===2){ - post("pass"); + if (domain != "kirishima.cloud") { + if (mode != "pass" && !$("#cw").hasClass("cw-avail") && (str.length > cw_sent || (str.split("\n").length - 1) > cw_ltres)) { + var electron = require("electron"); + var remote = electron.remote; + var dialog = remote.dialog; + var plus = str.replace(/\n/g, "").slice(0, 10) + "..."; + const options = { + type: 'info', + title: lang.lang_post_cwtitle, + message: lang.lang_post_cwtxt + plus, + buttons: [lang.lang_post_btn1, lang.lang_post_btn2, lang.lang_post_btn3] } - }) - return false; + dialog.showMessageBox(options, function (arg) { + if (arg === 1) { + $("#cw-text").show(); + $("#cw").addClass("yellow-text"); + $("#cw").addClass("cw-avail"); + $("#cw-text").val(plus); + post("pass"); + } else if (arg === 2) { + post("pass"); + } + }) + return false; + } } -} - if(localStorage.getItem("mode_" + domain)=="misskey"){ + if (localStorage.getItem("mode_" + domain) == "misskey") { misskeyPost(); return; } $(".toot-btn-group").prop("disabled", true); todo("Posting"); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var start = "https://" + domain + "/api/v1/statuses"; var reply = $("#reply").val(); - if(str.indexOf(localStorage.getItem("stable"))==-1){ - str+" #"+localStorage.getItem("stable"); + if (str.indexOf(localStorage.getItem("stable")) == -1) { + str + " #" + localStorage.getItem("stable"); } - var toot={ + var toot = { status: str } - if(reply){ - toot.in_reply_to_id=reply + if (reply) { + toot.in_reply_to_id = reply } var media = $("#media").val(); - if(media){ - toot.media_ids=media.split(","); + if (media) { + toot.media_ids = media.split(","); } if ($("#nsfw").hasClass("nsfw-avail")) { var nsfw = "true"; - toot.sensitive=nsfw; + toot.sensitive = nsfw; } else { var nsfw = "false"; } - if(postvis){ + if (postvis) { var vis = postvis; - }else{ + } else { var vis = $("#vis").text(); } - - if(vis!="inherit" && vis!="local"){ - toot.visibility=vis; - }else if(vis=="local"){ - toot.status=str+"👁️"; + + if (vis != "inherit" && vis != "local") { + toot.visibility = vis; + } else if (vis == "local") { + toot.status = str + "👁️"; } //ここに非公開・未収載タグについてwarn - if(domain!="kirishima.cloud" && domain!="imastodon.net"){ - if(~str.indexOf("#")){ - if(vis == "local" || vis=="unlisted" || vis=="direct" || vis=="private"){ - if(!confirm(lang.lang_post_tagVis)){ - return false; + if (domain != "kirishima.cloud" && domain != "imastodon.net") { + if (~str.indexOf("#")) { + if (vis == "local" || vis == "unlisted" || vis == "direct" || vis == "private") { + if (!confirm(lang.lang_post_tagVis)) { + return false; + } } } } -} if ($("#cw").hasClass("cw-avail")) { var spo = $("#cw-text").val(); cw(); - toot.spoiler_text=spo; + toot.spoiler_text = spo; } else { var spo = ""; } if ($("#sch-box").hasClass("sch-avail")) { - var scheduled=formattimeutc(new Date(Date.parse($("#sch-date").val()))) - console.log("This toot will be posted at:"+scheduled) + var scheduled = formattimeutc(new Date(Date.parse($("#sch-date").val()))) + console.log("This toot will be posted at:" + scheduled) schedule(); - toot.scheduled_at=scheduled; + toot.scheduled_at = scheduled; } else { var scheduled = ""; } - if ($("#poll-sel").val()=="mastodon-poll") { - var options=[]; - $(".mastodon-choice").map(function() { - var choice=$(this).val(); - if(choice!=""){ + if ($("#poll-sel").val() == "mastodon-poll") { + var options = []; + $(".mastodon-choice").map(function () { + var choice = $(this).val(); + if (choice != "") { options.push(choice); } }); - if($("#poll-multiple:checked").val()=="1"){ - var mul=true; - }else{ - var mul=false; + if ($("#poll-multiple:checked").val() == "1") { + var mul = true; + } else { + var mul = false; } - if($("#poll-until:checked").val()=="1"){ - var htt=true; - }else{ - var htt=false; + if ($("#poll-until:checked").val() == "1") { + var htt = true; + } else { + var htt = false; } - var exin=pollCalc(); - if(!exin){ + var exin = pollCalc(); + if (!exin) { todc("Error: Poll expires_in param") } - toot.poll={ + toot.poll = { options: options, expires_in: exin, multiple: mul, @@ -171,7 +171,7 @@ function post(mode,postvis) { httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.responseType = "json"; httpreq.send(JSON.stringify(toot)); - httpreq.onreadystatechange = function() { + httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { var json = httpreq.response; var box = localStorage.getItem("box"); @@ -185,71 +185,71 @@ function post(mode,postvis) { } } } -function misskeyPost(){ +function misskeyPost() { var str = $("#textarea").val(); var acct_id = $("#post-acct-sel").val(); localStorage.setItem("last-use", acct_id); var domain = localStorage.getItem("domain_" + acct_id); $(".toot-btn-group").prop("disabled", true); todo("Posting"); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var start = "https://" + domain + "/api/notes/create"; var reply = $("#reply").val(); - var toot={ + var toot = { text: str } - if(reply){ - if(reply.indexOf("renote")!== -1){ - toot.renoteId=reply.replace("renote_","") - }else{ - toot.replyId=reply + if (reply) { + if (reply.indexOf("renote") !== -1) { + toot.renoteId = reply.replace("renote_", "") + } else { + toot.replyId = reply } } - + var media = $("#media").val(); - if(media){ - toot.mediaIds=media.split(","); + if (media) { + toot.mediaIds = media.split(","); } if ($("#nsfw").hasClass("nsfw-avail")) { var nsfw = "true"; - toot.sensitive=nsfw; + toot.sensitive = nsfw; } else { var nsfw = "false"; } var vis = $("#vis").text(); - if(vis=="unlisted"){ - vis=="home" - }else if(vis=="direct"){ - vis=="specified"; - toot.visibleUserIds=str.match(/@([a-zA-Z0-9_@.-]+)(\s|$)/g).join('').split("@"); + if (vis == "unlisted") { + vis == "home" + } else if (vis == "direct") { + vis == "specified"; + toot.visibleUserIds = str.match(/@([a-zA-Z0-9_@.-]+)(\s|$)/g).join('').split("@"); } - if(vis!="inherit"){ - toot.visibility=vis; + if (vis != "inherit") { + toot.visibility = vis; } if ($("#cw").hasClass("cw-avail")) { var spo = $("#cw-text").val(); cw(); - toot.cw=spo; + toot.cw = spo; } else { var spo = ""; } - toot.i=at; + toot.i = at; var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.responseType = "json"; httpreq.send(JSON.stringify(toot)); - httpreq.onreadystatechange = function() { + httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { - if(str.indexOf(localStorage.getItem("stable"))==-1){ + if (str.indexOf(localStorage.getItem("stable")) == -1) { localStorage.removeItem("stable") } var json = httpreq.response; - console.log(["Success: toot",json]); + console.log(["Success: toot", json]); var box = localStorage.getItem("box"); if (box == "yes") { hide(); - }else if (box == "hide"){ + } else if (box == "hide") { $("body").addClass("mini-post"); $(".mini-btn").text("expand_less"); } @@ -263,8 +263,8 @@ function misskeyPost(){ //クリア(Shift+C) function clear() { $("#textarea").val(""); - if(localStorage.getItem("stable")){ - $("#textarea").val("#"+localStorage.getItem("stable")+" ") + if (localStorage.getItem("stable")) { + $("#textarea").val("#" + localStorage.getItem("stable") + " ") } $("#textarea").attr("placeholder", lang.lang_toot); $("#reply").val(""); @@ -280,7 +280,7 @@ function clear() { $("#cw").removeClass("yellow-text"); $("#cw").removeClass("cw-avail"); $("#cw-text").hide(); - }else{ + } else { $("#cw").addClass("yellow-text"); $("#cw").addClass("cw-avail"); $("#cw-text").show(); @@ -297,13 +297,13 @@ function clear() { $(".toot-btn-group").prop("disabled", false); $("#post-acct-sel").prop("disabled", false); $("#days_poll").val(0); - $("#hours_poll").val(0); + $("#hours_poll").val(0); $("#mins_poll").val(6); - $(".mastodon-choice").map(function() { + $(".mastodon-choice").map(function () { $(this).val(""); }); localStorage.removeItem("image"); - if(localStorage.getItem("mainuse")=="main"){ + if (localStorage.getItem("mainuse") == "main") { $("#post-acct-sel").val(localStorage.getItem("main")); } $('select').material_select(); diff --git a/app/js/post/secure.js b/app/js/post/secure.js index 4c93289a..e45416f1 100644 --- a/app/js/post/secure.js +++ b/app/js/post/secure.js @@ -1,11 +1,11 @@ /*保護系*/ //画像保護 -function nsfw(){ - if($("#nsfw").hasClass("nsfw-avail")){ +function nsfw() { + if ($("#nsfw").hasClass("nsfw-avail")) { $("#nsfw").removeClass("yellow-text"); $("#nsfw").html("visibility_off"); $("#nsfw").removeClass("nsfw-avail"); - }else{ + } else { $("#nsfw").addClass("yellow-text"); $("#nsfw").html("visibility"); $("#nsfw").addClass("nsfw-avail"); @@ -13,7 +13,7 @@ function nsfw(){ } //投稿公開範囲 -function vis(set){ +function vis(set) { $("#vis").text(set); $("#vis-icon").removeClass("red-text"); $("#vis-icon").removeClass("orange-text"); @@ -21,105 +21,105 @@ function vis(set){ $("#vis-icon").removeClass("purple-text"); $("#vis-icon").removeClass("light-blue-text"); $("#vis-icon").removeClass("teal-text"); - if(set=="public"){ + if (set == "public") { $("#vis-icon").text("public"); $("#vis-icon").addClass("purple-text"); - }else if(set=="unlisted"){ + } else if (set == "unlisted") { $("#vis-icon").text("lock_open"); $("#vis-icon").addClass("blue-text"); - }else if(set=="private"){ + } else if (set == "private") { $("#vis-icon").text("lock"); $("#vis-icon").addClass("orange-text"); - }else if(set=="direct"){ + } else if (set == "direct") { $("#vis-icon").text("mail"); $("#vis-icon").addClass("red-text"); - }else if(set=="limited"){ + } else if (set == "limited") { $("#vis-icon").text("group"); $("#vis-icon").addClass("teal-text"); - }else if(set=="local"){ + } else if (set == "local") { $("#vis-icon").text("visibility"); $("#vis-icon").addClass("light-blue-text"); } - var vis=localStorage.getItem("vis"); - if(vis=="memory"){ - var acct_id = $("#post-acct-sel").val(); - localStorage.setItem("vis-memory-"+acct_id,set); - } + var vis = localStorage.getItem("vis"); + if (vis == "memory") { + var acct_id = $("#post-acct-sel").val(); + localStorage.setItem("vis-memory-" + acct_id, set); + } $('.dropdown-button').dropdown('close'); } -function loadVis(){ - var vist = localStorage.getItem("vis"); - if (!vist) { - vis("public"); - } else { - if (vist == "memory") { - var acct_id = $("#post-acct-sel").val(); - var memory = localStorage.getItem("vis-memory-"+acct_id); - if (!memory) { - memory = "public"; - } - vis(memory); - } else if(vist == "useapi") { - var acct_id = $("#post-acct-sel").val(); - var multi = localStorage.getItem("multi"); - var obj = JSON.parse(multi); - var memory = obj[acct_id]["vis"]; - if (!memory) { - memory = "public"; - } - vis(memory); - } else { - vis(vist); +function loadVis() { + var vist = localStorage.getItem("vis"); + if (!vist) { + vis("public"); + } else { + if (vist == "memory") { + var acct_id = $("#post-acct-sel").val(); + var memory = localStorage.getItem("vis-memory-" + acct_id); + if (!memory) { + memory = "public"; } + vis(memory); + } else if (vist == "useapi") { + var acct_id = $("#post-acct-sel").val(); + var multi = localStorage.getItem("multi"); + var obj = JSON.parse(multi); + var memory = obj[acct_id]["vis"]; + if (!memory) { + memory = "public"; + } + vis(memory); + } else { + vis(vist); + } } } loadVis(); //コンテントワーニング -function cw(){ - if($("#cw").hasClass("cw-avail")){ +function cw() { + if ($("#cw").hasClass("cw-avail")) { $("#cw-text").val(); $("#cw-text").hide(); $("#cw").removeClass("yellow-text"); $("#cw").removeClass("cw-avail"); - }else{ + } else { $("#cw-text").show(); $("#cw").addClass("yellow-text"); $("#cw").addClass("cw-avail"); - var cwt=localStorage.getItem("cw-text"); - if(cwt){ + var cwt = localStorage.getItem("cw-text"); + if (cwt) { $("#cw-text").val(cwt); } } } //TLでコンテントワーニングを表示トグル -function cw_show(id){ - $(".cw_hide_"+id).toggleClass("cw"); - $(".cw-long-"+id).toggleClass("hide"); +function cw_show(id) { + $(".cw_hide_" + id).toggleClass("cw"); + $(".cw-long-" + id).toggleClass("hide"); } -$(function() { - $('#cw-text').on('change', function(event) { +$(function () { + $('#cw-text').on('change', function (event) { var acct_id = $("#post-acct-sel").val(); var domain = localStorage.getItem("domain_" + acct_id); - var cwlen=$('#cw-text').val().length; + var cwlen = $('#cw-text').val().length; - if(idata[domain+"_letters"]){ - $("#textarea").attr("data-length", idata[domain+"_letters"]-cwlen) - }else{ - $("#textarea").attr("data-length", 500-cwlen) + if (idata[domain + "_letters"]) { + $("#textarea").attr("data-length", idata[domain + "_letters"] - cwlen) + } else { + $("#textarea").attr("data-length", 500 - cwlen) } - + }); - }); +}); //スケジュール -function schedule(){ - if($("#sch-box").hasClass("sch-avail")){ +function schedule() { + if ($("#sch-box").hasClass("sch-avail")) { $("#sch-box").hide(); $("#sch-box").removeClass("sch-avail"); - }else{ + } else { var date = new Date(); - + $("#sch-box").show(); $("#sch-date").val(formattime(date)); $("#sch-box").addClass("sch-avail"); diff --git a/app/js/post/status.js b/app/js/post/status.js index e68c009c..ea06cab9 100644 --- a/app/js/post/status.js +++ b/app/js/post/status.js @@ -7,7 +7,7 @@ function fav(id, acct_id, remote) { var flag = "favourite"; } var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag; var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); @@ -15,19 +15,19 @@ function fav(id, acct_id, remote) { httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.responseType = "json"; httpreq.send(); - httpreq.onreadystatechange = function() { - if (httpreq.readyState === 4) { - var json = httpreq.response; - if(remote!="remote"){ + httpreq.onreadystatechange = function () { + if (httpreq.readyState === 4) { + var json = httpreq.response; + if (remote != "remote") { //APIのふぁぼカウントがおかしい - if ($("[toot-id=" + id + "] .fav_ct").text() == json.favourites_count){ - if(flag=="unfavourite"){ - var fav=json.favourites_count - 1; - }else{ - var fav=json.favourites_count + 1; + if ($("[toot-id=" + id + "] .fav_ct").text() == json.favourites_count) { + if (flag == "unfavourite") { + var fav = json.favourites_count - 1; + } else { + var fav = json.favourites_count + 1; //var fav = json.favourites_count; } - }else{ + } else { var fav = json.favourites_count; } $("[toot-id=" + id + "] .fav_ct").text(fav); @@ -35,17 +35,17 @@ function fav(id, acct_id, remote) { } else { $("[toot-id=" + id + "] .rt_ct").text(fav); } - if ($("[toot-id=" + id +"]").hasClass("faved")) { - $("[toot-id=" + id +"]").removeClass("faved"); + if ($("[toot-id=" + id + "]").hasClass("faved")) { + $("[toot-id=" + id + "]").removeClass("faved"); $(".fav_" + id).removeClass("yellow-text"); } else { - $("[toot-id=" + id +"]").addClass("faved"); + $("[toot-id=" + id + "]").addClass("faved"); $(".fav_" + id).addClass("yellow-text"); } - }else{ - Materialize.toast(lang.lang_status_favWarn, 1000); - } - } + } else { + Materialize.toast(lang.lang_status_favWarn, 1000); + } + } } } @@ -57,7 +57,7 @@ function rt(id, acct_id, remote) { var flag = "reblog"; } var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag; var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); @@ -65,10 +65,10 @@ function rt(id, acct_id, remote) { httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.responseType = "json"; httpreq.send(); - httpreq.onreadystatechange = function() { + httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { var json = httpreq.response; - console.log(["Success: boost",json]); + console.log(["Success: boost", json]); if (remote != "remote") { $("[toot-id=" + id + "] .fav_ct").text(json.favourites_count); if (!json.reblog) { @@ -97,10 +97,10 @@ function rt(id, acct_id, remote) { } //フォロー -function follow(acct_id,remote) { - if (!acct_id && acct_id!="selector") { +function follow(acct_id, remote) { + if (!acct_id && acct_id != "selector") { var acct_id = $('#his-data').attr("use-acct"); - }else if (acct_id=="selector") { + } else if (acct_id == "selector") { var acct_id = $("#user-acct-sel").val(); } if (!remote && $("#his-data").hasClass("following")) { @@ -111,22 +111,22 @@ function follow(acct_id,remote) { var flagm = "create"; } var id = $("#his-data").attr("user-id"); - if(!remote){ + if (!remote) { var remote = $("#his-data").attr("remote"); } var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(localStorage.getItem("mode_" + domain)=="misskey"){ - var start = "https://" + domain + "/api/following/"+flagm; - var user=$("#his-acct").text(); - var ent={"i":at,"userId":id} - }else if(remote=="true" && flag=="follow"){ + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) == "misskey") { + var start = "https://" + domain + "/api/following/" + flagm; + var user = $("#his-acct").text(); + var ent = { "i": at, "userId": id } + } else if (remote == "true" && flag == "follow") { var start = "https://" + domain + "/api/v1/follows"; - var user=$("#his-acct").text(); - var ent={"uri":user} - }else{ + var user = $("#his-acct").text(); + var ent = { "uri": user } + } else { var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag; - var ent={} + var ent = {} } var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); @@ -134,10 +134,10 @@ function follow(acct_id,remote) { httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.responseType = "json"; httpreq.send(JSON.stringify(ent)); - httpreq.onreadystatechange = function() { + httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { var json = httpreq.response; - console.log(["Success: folllow",json]); + console.log(["Success: folllow", json]); if ($("#his-data").hasClass("following")) { $("#his-data").removeClass("following"); $("#his-follow-btn").text(lang.lang_status_follow); @@ -161,7 +161,7 @@ function block(acct_id) { var flag = "block"; } var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag; var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); @@ -169,7 +169,7 @@ function block(acct_id) { httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.responseType = "json"; httpreq.send(); - httpreq.onreadystatechange = function() { + httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { if ($("#his-data").hasClass("blocking")) { $("#his-data").removeClass("blocking"); @@ -196,14 +196,14 @@ function mute(acct_id) { var flagm = "create"; } var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(localStorage.getItem("mode_" + domain)=="misskey"){ - var start = "https://" + domain + "/api/mute/"+flagm; - var ent={"i":at,"userId":id} - var rq=JSON.stringify(ent); - }else{ + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) == "misskey") { + var start = "https://" + domain + "/api/mute/" + flagm; + var ent = { "i": at, "userId": id } + var rq = JSON.stringify(ent); + } else { var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag; - var rq=""; + var rq = ""; } var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); @@ -211,7 +211,7 @@ function mute(acct_id) { httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.responseType = "json"; httpreq.send(rq); - httpreq.onreadystatechange = function() { + httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { if ($("#his-data").hasClass("muting")) { $("#his-data").removeClass("muting"); @@ -227,17 +227,17 @@ function mute(acct_id) { //投稿削除 function del(id, acct_id) { var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(localStorage.getItem("mode_" + domain)=="misskey"){ + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) == "misskey") { var start = "https://" + domain + "/api/notes/delete"; var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.responseType = "json"; - httpreq.send(JSON.stringify({i:at,noteId:id})); - $("[toot-id=" + id+ "]").hide(); - $("[toot-id=" + id + "]").remove(); - }else{ + httpreq.send(JSON.stringify({ i: at, noteId: id })); + $("[toot-id=" + id + "]").hide(); + $("[toot-id=" + id + "]").remove(); + } else { var start = "https://" + domain + "/api/v1/statuses/" + id; var httpreq = new XMLHttpRequest(); httpreq.open('DELETE', start, true); @@ -246,42 +246,42 @@ function del(id, acct_id) { httpreq.responseType = "json"; httpreq.send(); } - httpreq.onreadystatechange = function() { + httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { } } } //redraft -function redraft(id, acct_id){ - if(confirm(lang.lang_status_redraft)){ +function redraft(id, acct_id) { + if (confirm(lang.lang_status_redraft)) { show(); del(id, acct_id); $("#post-acct-sel").prop("disabled", true); - var medias=$("[toot-id="+id+"]").attr("data-medias"); - var vismode=$("[toot-id="+id+"] .vis-data").attr("data-vis"); + var medias = $("[toot-id=" + id + "]").attr("data-medias"); + var vismode = $("[toot-id=" + id + "] .vis-data").attr("data-vis"); vis(vismode); $("#media").val(medias); - var ct=medias.split(",").length; - $("[toot-id="+id+"] img.toot-img").each(function(i, elem) { - if(i'); } }); - var html=$("[toot-id="+id+"] .toot").html(); - html = html.replace(/^ (.+)<\/p>$/,"$1"); + var html = $("[toot-id=" + id + "] .toot").html(); + html = html.replace(/^
(.+)<\/p>$/, "$1"); html = html.replace(/
/, "\n"); html = html.replace(//, "\n"); html = html.replace(/<\/p>/, "\n"); html = html.replace(//g, "$1"); - html=$.strip_tags(html); - localStorage.setItem("nohide",true); + html = $.strip_tags(html); + localStorage.setItem("nohide", true); show(); $("#textarea").val(html); - var cwtxt=$("[toot-id="+id+"] .cw_text").html(); - if(cwtxt!=""){ - cwtxt=$.strip_tags(cwtxt); + var cwtxt = $("[toot-id=" + id + "] .cw_text").html(); + if (cwtxt != "") { + cwtxt = $.strip_tags(cwtxt); cw(); $("#cw-text").val(cwtxt); } @@ -295,7 +295,7 @@ function pin(id, acct_id) { var flag = "pin"; } var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag; var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); @@ -303,10 +303,10 @@ function pin(id, acct_id) { httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.responseType = "json"; httpreq.send(); - httpreq.onreadystatechange = function() { + httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { var json = httpreq.response; - console.log(["Success: pinned",json]); + console.log(["Success: pinned", json]); if ($("[toot-id=" + id + "]").hasClass("pined")) { $("[toot-id=" + id + "]").removeClass("pined"); $(".pin_" + id).removeClass("blue-text"); @@ -321,7 +321,7 @@ function pin(id, acct_id) { //フォロリク function request(id, flag, acct_id) { var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var start = "https://" + domain + "/api/v1/follow_requests/" + id + "/" + flag; var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); @@ -329,10 +329,10 @@ function request(id, flag, acct_id) { httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.responseType = "json"; httpreq.send(); - httpreq.onreadystatechange = function() { + httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { var json = httpreq.response; - console.log(["Success: request","type:"+flag,json]); + console.log(["Success: request", "type:" + flag, json]); showReq(); } } @@ -344,7 +344,7 @@ function domainblock(add, flag, acct_id) { var acct_id = $('#his-data').attr("use-acct"); } var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var start = "https://" + domain + "/api/v1/domain_blocks" var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); @@ -352,10 +352,10 @@ function domainblock(add, flag, acct_id) { httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.responseType = "json"; httpreq.send(); - httpreq.onreadystatechange = function() { + httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { var json = httpreq.response; - console.log(["Success: domain block",json]); + console.log(["Success: domain block", json]); showDom(); } } @@ -366,24 +366,24 @@ function addDomainblock() { domainblock(domain, 'POST'); } //ユーザー強調 -function empUser(){ +function empUser() { var usr = localStorage.getItem("user_emp"); var obj = JSON.parse(usr); - var id=$("#his-acct").attr("fullname"); - if(!obj){ - var obj=[]; + var id = $("#his-acct").attr("fullname"); + if (!obj) { + var obj = []; obj.push(id); - Materialize.toast(id+lang.lang_status_emphas, 4000); - }else{ + Materialize.toast(id + lang.lang_status_emphas, 4000); + } else { var can; - Object.keys(obj).forEach(function(key) { + Object.keys(obj).forEach(function (key) { var usT = obj[key]; - if(usT!=id && !can){ - can=false; - }else{ - can=true; + if (usT != id && !can) { + can = false; + } else { + can = true; obj.splice(key, 1); - Materialize.toast(id+lang.lang_status_unemphas, 4000); + Materialize.toast(id + lang.lang_status_unemphas, 4000); } }); } @@ -391,16 +391,16 @@ function empUser(){ localStorage.setItem("user_emp", json); } //Endorse -function pinUser(){ - var id=$("#his-data").attr("user-id"); - var acct_id=$("#his-data").attr("use-acct"); +function pinUser() { + var id = $("#his-data").attr("user-id"); + var acct_id = $("#his-data").attr("use-acct"); if ($("#his-end-btn").hasClass("endorsed")) { var flag = "unpin"; } else { var flag = "pin"; } var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag; var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); @@ -408,7 +408,7 @@ function pinUser(){ httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.responseType = "json"; httpreq.send(); - httpreq.onreadystatechange = function() { + httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { var json = httpreq.response; if ($("#his-end-btn").hasClass("endorsed")) { @@ -417,63 +417,63 @@ function pinUser(){ } else { $("#his-end-btn").addClass("endorsed") $("#his-end-btn").text(lang.lang_status_unendorse) - + } } } } //URLコピー -function tootUriCopy(url){ +function tootUriCopy(url) { execCopy(url); Materialize.toast(lang.lang_details_url, 1500); } //他のアカウントで… -function staEx(mode){ - var url=$("#tootmodal").attr("data-url"); +function staEx(mode) { + var url = $("#tootmodal").attr("data-url"); var acct_id = $("#status-acct-sel").val(); var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - var start = "https://" + domain + "/api/v1/search?resolve=true&q="+url + var at = localStorage.getItem("acct_" + acct_id + "_at"); + var start = "https://" + domain + "/api/v1/search?resolve=true&q=" + url fetch(start, { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at } - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - var id=json.statuses[0].id; - if(mode=="rt"){ + }).then(function (json) { + var id = json.statuses[0].id; + if (mode == "rt") { rt(id, acct_id, 'remote') - }else if(mode=="fav"){ + } else if (mode == "fav") { fav(id, acct_id, 'remote') - }else if(mode=="reply"){ + } else if (mode == "reply") { reEx(id) } }); return; } -function toggleAction(id,tlid,acct_id){ - if(tlid=="notf"){ - var tlide="[data-notf="+acct_id+"]"; - }else{ - var tlide="[tlid="+tlid+"]"; +function toggleAction(id, tlid, acct_id) { + if (tlid == "notf") { + var tlide = "[data-notf=" + acct_id + "]"; + } else { + var tlide = "[tlid=" + tlid + "]"; } - if(!$(tlide+" [toot-id="+id+"]").hasClass("ext-mode")){ - $(tlide+" [toot-id="+id+"] .type-a").hide(); - $(tlide+" [toot-id="+id+"] .type-b").show(); - $(tlide+" [toot-id="+id+"]").addClass("ext-mode") - $(tlide+" [toot-id="+id+"] .act-icon").text("expand_less"); - }else{ - $(tlide+" [toot-id="+id+"] .type-b").hide(); - $(tlide+" [toot-id="+id+"] .type-a").show(); - $(tlide+" [toot-id="+id+"]").removeClass("ext-mode") - $(tlide+" [toot-id="+id+"] .act-icon").text("expand_more"); + if (!$(tlide + " [toot-id=" + id + "]").hasClass("ext-mode")) { + $(tlide + " [toot-id=" + id + "] .type-a").hide(); + $(tlide + " [toot-id=" + id + "] .type-b").show(); + $(tlide + " [toot-id=" + id + "]").addClass("ext-mode") + $(tlide + " [toot-id=" + id + "] .act-icon").text("expand_less"); + } else { + $(tlide + " [toot-id=" + id + "] .type-b").hide(); + $(tlide + " [toot-id=" + id + "] .type-a").show(); + $(tlide + " [toot-id=" + id + "]").removeClass("ext-mode") + $(tlide + " [toot-id=" + id + "] .act-icon").text("expand_more"); } - + } \ No newline at end of file diff --git a/app/js/post/suggest.js b/app/js/post/suggest.js index 4e837b67..71bf9c7a 100644 --- a/app/js/post/suggest.js +++ b/app/js/post/suggest.js @@ -7,102 +7,102 @@ var prev_val = input.value; var oldSuggest; var suggest; -input.addEventListener("focus", function() { +input.addEventListener("focus", function () { var acct_id = $("#post-acct-sel").val(); $("#suggest").html(""); window.clearInterval(timer); - timer = window.setInterval(function() { + timer = window.setInterval(function () { var new_val = input.value; - if(new_val==""){ + if (new_val == "") { $("#suggest").html(""); - if($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")){ + if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) { $("#right-side").hide() } return; } if (prev_val != new_val) { var semoji = new_val.match(/:(\S{3,})/); - if(semoji){ + if (semoji) { var obj = JSON.parse(localStorage.getItem("emoji_" + acct_id)); - if(!obj){ - var ehtml=lang.lang_suggest_nodata; - }else{ + if (!obj) { + var ehtml = lang.lang_suggest_nodata; + } else { var num = obj.length; - var ehtml=""; + var ehtml = ""; for (i = 0; i < num; i++) { var emoji = obj[i]; - if ( ~emoji.shortcode.indexOf(semoji[1])) { + if (~emoji.shortcode.indexOf(semoji[1])) { if (emoji) { - ehtml = ehtml+''; + ehtml = ehtml + ''; } } - } + } } - if(ehtml!=""){ + if (ehtml != "") { $("#right-side").show() $("#poll").addClass("hide") $("#emoji").addClass("hide") - }else{ - if($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")){ + } else { + if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) { $("#right-side").hide() } } $("#suggest").html(ehtml); } - + var tag = new_val.match(/#(\S{3,})/); var acct = new_val.match(/@(\S{3,})/); if (tag && tag[1]) { var q = tag[1]; } else if (acct && acct[1]) { var q = acct[1]; - }else { + } else { $("#suggest").html(""); - if($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")){ + if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) { $("#right-side").hide() } return; } var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); suggest = "https://" + domain + "/api/v1/search?q=" + q if (suggest != oldSuggest) { - console.log("Try to get suggest at "+suggest) + console.log("Try to get suggest at " + suggest) fetch(suggest, { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { + }).then(function (json) { if (json.hashtags[0] && tag) { - if(tag[1]){ - var tags = ""; - Object.keys(json.hashtags).forEach(function(key4) { - var tag = json.hashtags[key4]; - if(tag!=q){ - tags = tags + '#' + tag + '
'; - } - }); - $("#right-side").show() - $("#suggest").html("Tags:
" + tags); - $("#poll").addClass("hide") - $("#emoji").addClass("hide") + if (tag[1]) { + var tags = ""; + Object.keys(json.hashtags).forEach(function (key4) { + var tag = json.hashtags[key4]; + if (tag != q) { + tags = tags + '#' + tag + '
'; + } + }); + $("#right-side").show() + $("#suggest").html("Tags:
" + tags); + $("#poll").addClass("hide") + $("#emoji").addClass("hide") } } else if (json.accounts[0] && acct[1]) { var accts = ""; - Object.keys(json.accounts).forEach(function(key3) { + Object.keys(json.accounts).forEach(function (key3) { var acct = json.accounts[key3]; - if(acct.acct!=q){ + if (acct.acct != q) { accts = accts + '@' + acct.acct + '
'; + '\',\'@' + q + '\')" class="pointer">@' + acct.acct + '
'; } }); $("#right-side").show() @@ -110,7 +110,7 @@ input.addEventListener("focus", function() { $("#poll").addClass("hide") $("#emoji").addClass("hide") } else { - if($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")){ + if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) { $("#right-side").hide() } } @@ -122,7 +122,7 @@ input.addEventListener("focus", function() { }, 1000); }, false); -input.addEventListener("blur", function() { +input.addEventListener("blur", function () { window.clearInterval(timer); favTag(); }, false); @@ -133,47 +133,47 @@ function tagInsert(code, del) { } else { var regExp = new RegExp(del, "g"); var now = now.replace(regExp, ""); - selin=selin-del.length; + selin = selin - del.length; } - if(selin>0){ - var before = now.substr(0, selin); - var after = now.substr(selin, now.length); - newt = before + " "+ code+" " + after; - }else{ - newt = code+" "+now; + if (selin > 0) { + var before = now.substr(0, selin); + var after = now.substr(selin, now.length); + newt = before + " " + code + " " + after; + } else { + newt = code + " " + now; } $("#textarea").val(newt); $("#textarea").focus(); - if($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")){ + if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) { $("#right-side").hide() } $("#suggest").html(""); } -function cgNPs(q){ +function cgNPs(q) { suggest = "https://cg.toot.app/api/v1/search/light?q=" + q - if (suggest != oldSuggest) { - console.log("Try to get suggest at "+suggest) - fetch(suggest, { - method: 'GET', - headers: { - 'content-type': 'application/json' - }, - }).then(function(response) { - return response.json(); - }).catch(function(error) { - todo(error); - console.error(error); - }).then(function(json) { - if (json[0]) { - var tags = ""; - Object.keys(json).forEach(function(key4) { - var tag = json[key4]; - tags = tags + '' + escapeHTML(json[key4]) + ' '; - }); - $("#suggest").html("Cinderella NowPlaying:" + tags); - }else{ - $("#suggest").html("Cinderella NowPlaying:Not Found"); - } + if (suggest != oldSuggest) { + console.log("Try to get suggest at " + suggest) + fetch(suggest, { + method: 'GET', + headers: { + 'content-type': 'application/json' + }, + }).then(function (response) { + return response.json(); + }).catch(function (error) { + todo(error); + console.error(error); + }).then(function (json) { + if (json[0]) { + var tags = ""; + Object.keys(json).forEach(function (key4) { + var tag = json[key4]; + tags = tags + '' + escapeHTML(json[key4]) + ' '; }); + $("#suggest").html("Cinderella NowPlaying:" + tags); + } else { + $("#suggest").html("Cinderella NowPlaying:Not Found"); } + }); + } } \ No newline at end of file diff --git a/app/js/post/use-txtbox.js b/app/js/post/use-txtbox.js index b66d6a05..44223d1b 100644 --- a/app/js/post/use-txtbox.js +++ b/app/js/post/use-txtbox.js @@ -1,62 +1,62 @@ /*リプライ*/ -function re(id,ats_cm,acct_id,mode){ +function re(id, ats_cm, acct_id, mode) { clear(); - var ats=ats_cm.split(','); - localStorage.setItem("nohide",true); + var ats = ats_cm.split(','); + localStorage.setItem("nohide", true); show(); $("#reply").val(id); - for(var i=0;i(.+)<\/p>$/)[1]; html = html.replace(/
/, "\n"); html = html.replace(//, "\n"); html = html.replace(/<\/p>/, "\n"); - html=$.strip_tags(html); - $("#textarea").val("\n"+"@"+at+" "+html+"\n"+url); + html = $.strip_tags(html); + $("#textarea").val("\n" + "@" + at + " " + html + "\n" + url); } $("#textarea").focus(); $("#post-acct-sel").val(acct_id); diff --git a/app/js/tl/card.js b/app/js/tl/card.js index dfe32800..fcacbbbc 100644 --- a/app/js/tl/card.js +++ b/app/js/tl/card.js @@ -3,209 +3,208 @@ function additional(acct_id, tlid) { //メンション系 //$(".mention").attr("href", ""); - + $("#timeline-container .mention").addClass("parsed"); - $("#timeline-container .hashtag").each(function(i, elem) { + $("#timeline-container .hashtag").each(function (i, elem) { var tags = $(this).attr("href").match( /https?:\/\/([-a-zA-Z0-9@.]+)\/tags\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/ ); - $(this).attr("href","#"); - if(tags){ - if(tags[2]){ - $(this).attr("onclick",'tagShow(\'' + tags[2] + '\')'); + $(this).attr("href", "#"); + if (tags) { + if (tags[2]) { + $(this).attr("onclick", 'tagShow(\'' + tags[2] + '\')'); } - + } }); - + //トゥートサムネ - $("#timeline_" + tlid + " .toot a:not(.parsed)").each(function(i, elem) { + $("#timeline_" + tlid + " .toot a:not(.parsed)").each(function (i, elem) { var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var card = localStorage.getItem("card_" + tlid); var text = $(this).attr('href'); - if(text){ - if(text.indexOf("twimg.com")=== -1){ + if (text) { + if (text.indexOf("twimg.com") === -1) { var urls = text.match( /https?:\/\/([-a-zA-Z0-9@.]+)\/media\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/ ); } - }else{ - text="" - var urls =[] + } else { + text = "" + var urls = [] } - + //トゥートのURLぽかったら toot = text.match(/https:\/\/([a-zA-Z0-9.-]+)\/@([a-zA-Z0-9_]+)\/([0-9]+)/); - if(toot){ - if(toot[1]){ - $(this).attr("data-acct",acct_id); + if (toot) { + if (toot[1]) { + $(this).attr("data-acct", acct_id); } } if (urls) { $(this).remove(); } else if (!card) { var id = $(this).parents('.cvo').attr("toot-id"); - if(localStorage.getItem("mode_" + domain)=="misskey"){ - var start = "https://" + domain + "/url?url="+text; + if (localStorage.getItem("mode_" + domain) == "misskey") { + var start = "https://" + domain + "/url?url=" + text; fetch(start, { method: 'GET', headers: { 'content-type': 'application/json' }, //body: JSON.stringify({}) - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { + }).then(function (json) { if (json.title) { $("[toot-id=" + id + "] .additional").html( - "URL"+lang.lang_cards_check+":
').length + toot.content.split('
Title:" + escapeHTML(json.title) + "
" + + "URL" + lang.lang_cards_check + ":
Title:" + escapeHTML(json.title) + "
" + escapeHTML(json.description) + ""); $("[toot-id=" + id + "] a:not(.parsed)").addClass("parsed"); $("[toot-id=" + id + "]").addClass("parsed"); } }); } - - }else{ - $(this).attr("title",text); + + } else { + $(this).attr("title", text); } }); - $("i.unparsed").each(function(i, elem) { - var dem=$(this).text(); - var dom=$(this); + $("i.unparsed").each(function (i, elem) { + var dem = $(this).text(); + var dom = $(this); var start = "./js/emoji/emoji-map.json"; var xmlHttpRequest = new XMLHttpRequest(); - xmlHttpRequest.onreadystatechange = function() - { - if( this.readyState === 4 && this.status === 200 ) { - if( this.response){ - var json=this.response; - var emojis=json.emojis; - for (i = 0; i < emojis.length; i++) { - var emojie = emojis[i]; - var regExp = new RegExp(dem, "g"); - if (emojie.emoji.match(regExp)) { - var sc=emojie.name; - var sc="twa-"+sc.replace(/_/g,"-"); - dom.addClass(sc); - dom.text(""); - dom.removeClass("unparsed"); - break; - } - } - } - } - } - xmlHttpRequest.open( 'GET', start, true ); - xmlHttpRequest.responseType = 'json'; - xmlHttpRequest.send( null ); + xmlHttpRequest.onreadystatechange = function () { + if (this.readyState === 4 && this.status === 200) { + if (this.response) { + var json = this.response; + var emojis = json.emojis; + for (i = 0; i < emojis.length; i++) { + var emojie = emojis[i]; + var regExp = new RegExp(dem, "g"); + if (emojie.emoji.match(regExp)) { + var sc = emojie.name; + var sc = "twa-" + sc.replace(/_/g, "-"); + dom.addClass(sc); + dom.text(""); + dom.removeClass("unparsed"); + break; + } + } + } + } + } + xmlHttpRequest.open('GET', start, true); + xmlHttpRequest.responseType = 'json'; + xmlHttpRequest.send(null); }); - - $("#timeline_" + tlid + " .toot:not(:has(a:not(.add-show,.parsed)))").each(function(i, elem) { + + $("#timeline_" + tlid + " .toot:not(:has(a:not(.add-show,.parsed)))").each(function (i, elem) { $(this).parent().find(".add-show").hide(); }); //Markdownイメージビューワー - $("#timeline_" + tlid + " .toot a:not(.img-parsed):has(img)").each(function(i, elem) { - var ilink=$(this).attr("href"); - var id = $(this).parents('.cvo').attr("toot-id"); - $(this).attr("href","#"); - $(this).attr("onclick","imgv('"+id+"','"+i+"')"); - $(this).attr("data-type","image"); - $(this).attr("id",id+"-image-"+i); - $(this).attr("data-url",ilink); - $(this).addClass("img-parsed"); + $("#timeline_" + tlid + " .toot a:not(.img-parsed):has(img)").each(function (i, elem) { + var ilink = $(this).attr("href"); + var id = $(this).parents('.cvo').attr("toot-id"); + $(this).attr("href", "#"); + $(this).attr("onclick", "imgv('" + id + "','" + i + "')"); + $(this).attr("data-type", "image"); + $(this).attr("id", id + "-image-" + i); + $(this).attr("data-url", ilink); + $(this).addClass("img-parsed"); }); } function additionalIndv(tlid, acct_id, id) { - var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - var text = $("[toot-id="+id+"] .toot a").attr('href'); - var urls = text.match( - /https?:\/\/([-a-zA-Z0-9@.]+)\/media\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/ - ); - if (urls) { - $("[toot-id="+id+"] .toot a").remove(); + var domain = localStorage.getItem("domain_" + acct_id); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + var text = $("[toot-id=" + id + "] .toot a").attr('href'); + var urls = text.match( + /https?:\/\/([-a-zA-Z0-9@.]+)\/media\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/ + ); + if (urls) { + $("[toot-id=" + id + "] .toot a").remove(); + } else { + if (localStorage.getItem("mode_" + domain) == "misskey") { + var start = "https://" + domain + "/url?url=" + text; + fetch(start, { + method: 'GET', + headers: { + 'content-type': 'application/json' + }, + //body: JSON.stringify({}) + }).then(function (response) { + return response.json(); + }).catch(function (error) { + todo(error); + console.error(error); + }).then(function (json) { + if (json.title) { + $("[toot-id=" + id + "] .additional").html( + "URL" + lang.lang_cards_check + ":
Title:" + escapeHTML(json.title) + "
" + + escapeHTML(json.description) + ""); + $("[toot-id=" + id + "] a:not(.parsed)").addClass("parsed"); + $("[toot-id=" + id + "]").addClass("parsed"); + } + }); } else { - if(localStorage.getItem("mode_" + domain)=="misskey"){ - var start = "https://" + domain + "/url?url="+text; - fetch(start, { - method: 'GET', - headers: { - 'content-type': 'application/json' - }, - //body: JSON.stringify({}) - }).then(function(response) { - return response.json(); - }).catch(function(error) { - todo(error); - console.error(error); - }).then(function(json) { + var id = $("[toot-id=" + id + "] .toot a").parents('.cvo').attr("toot-id"); + var start = "https://" + domain + "/api/v1/statuses/" + id + "/card"; + fetch(start, { + method: 'GET', + headers: { + 'content-type': 'application/json', + 'Authorization': 'Bearer ' + at + }, + //body: JSON.stringify({}) + }).then(function (response) { + return response.json(); + }).catch(function (error) { + todo(error); + console.error(error); + }).then(function (json) { + //このリンク鳥やんけ、ってとき + if (json.provider_name == "Twitter") { + if (json.image) { + var twiImg = '
'; + } else { + var twiImg = ''; + } + $("[toot-id=" + id + "] .additional").html( + '' + escapeHTML(json.author_name) + ''); + } else if (json.provider_name == "pixiv") { + if (json.image) { + var pxvImg = '
' + escapeHTML(json.description) + twiImg + '
'; + } else { + var pxvImg = ''; + } + $("[toot-id=" + id + "] .additional").html( + '' + escapeHTML(json.author_name) + ''); + } else { if (json.title) { $("[toot-id=" + id + "] .additional").html( - "URL"+lang.lang_cards_check+":
' + escapeHTML(json.title) + pxvImg + '
Title:" + escapeHTML(json.title) + "
" + + "URL" + lang.lang_cards_check + ":
Title:" + escapeHTML(json.title) + "
" + escapeHTML(json.description) + ""); - $("[toot-id=" + id + "] a:not(.parsed)").addClass("parsed"); - $("[toot-id=" + id + "]").addClass("parsed"); } - }); - }else{ - var id = $("[toot-id="+id+"] .toot a").parents('.cvo').attr("toot-id"); - var start = "https://" + domain + "/api/v1/statuses/" + id + "/card"; - fetch(start, { - method: 'GET', - headers: { - 'content-type': 'application/json', - 'Authorization': 'Bearer ' + at - }, - //body: JSON.stringify({}) - }).then(function(response) { - return response.json(); - }).catch(function(error) { - todo(error); - console.error(error); - }).then(function(json) { - //このリンク鳥やんけ、ってとき - if (json.provider_name=="Twitter"){ - if(json.image){ - var twiImg='
'; - }else{ - var twiImg=''; - } - $("[toot-id=" + id + "] .additional").html( - ''+escapeHTML(json.author_name)+''); - }else if (json.provider_name=="pixiv"){ - if(json.image){ - var pxvImg='
'+escapeHTML(json.description)+twiImg+'
'; - }else{ - var pxvImg=''; - } - $("[toot-id=" + id + "] .additional").html( - ''+escapeHTML(json.author_name)+''); - }else{ - if (json.title) { - $("[toot-id=" + id + "] .additional").html( - "URL"+lang.lang_cards_check+":
'+escapeHTML(json.title)+pxvImg+'
Title:" + escapeHTML(json.title) + "
" + - escapeHTML(json.description) + ""); - } - if (json.html) { - $("[toot-id=" + id + "] .additional").html(json.html+'picture_in_picture_alt'); - - } + if (json.html) { + $("[toot-id=" + id + "] .additional").html(json.html + 'picture_in_picture_alt'); + } - if (json.title) { - $("[toot-id=" + id + "] a:not(.parsed)").addClass("parsed"); - $("[toot-id=" + id + "]").addClass("parsed"); - } - }); - } - + } + if (json.title) { + $("[toot-id=" + id + "] a:not(.parsed)").addClass("parsed"); + $("[toot-id=" + id + "]").addClass("parsed"); + } + }); } + + } } //各TL上方のLink[On/Off] @@ -214,11 +213,11 @@ function cardToggle(tlid) { if (!card) { localStorage.setItem("card_" + tlid, "true"); $("#sta-card-" + tlid).text("Off"); - $("#sta-card-" + tlid).css("color",'red'); + $("#sta-card-" + tlid).css("color", 'red'); } else { localStorage.removeItem("card_" + tlid); $("#sta-card-" + tlid).text("On"); - $("#sta-card-" + tlid).css("color",'#009688'); + $("#sta-card-" + tlid).css("color", '#009688'); } } //各TL上方のLink[On/Off]をチェック @@ -226,56 +225,56 @@ function cardCheck(tlid) { var card = localStorage.getItem("card_" + tlid); if (!card) { $("#sta-card-" + tlid).text("On"); - $("#sta-card-" + tlid).css("color",'#009688'); + $("#sta-card-" + tlid).css("color", '#009688'); } else { $("#sta-card-" + tlid).text("Off"); - $("#sta-card-" + tlid).css("color",'red'); + $("#sta-card-" + tlid).css("color", 'red'); } } -function mov(id,tlid,type){ - if(tlid=="notf"){ - var tlide="[data-notf="+acct_id+"]"; - }else if(tlid=="user"){ - var tlide="#his-data"; - }else{ - var tlide="[tlid="+tlid+"]"; +function mov(id, tlid, type) { + if (tlid == "notf") { + var tlide = "[data-notf=" + acct_id + "]"; + } else if (tlid == "user") { + var tlide = "#his-data"; + } else { + var tlide = "[tlid=" + tlid + "]"; } - var mouseover=localStorage.getItem("mouseover"); - if(!mouseover){ - mouseover=""; + var mouseover = localStorage.getItem("mouseover"); + if (!mouseover) { + mouseover = ""; } - if(mouseover=="yes"){ - mouseover="hide"; - }else if(mouseover=="click"){ - if(type=="mv"){ - mouseover=""; - }else{ - mouseover="hide"; + if (mouseover == "yes") { + mouseover = "hide"; + } else if (mouseover == "click") { + if (type == "mv") { + mouseover = ""; + } else { + mouseover = "hide"; } - }else if(mouseover=="no"){ - mouseover=""; + } else if (mouseover == "no") { + mouseover = ""; } - if(mouseover=="hide"){ - $(tlide+" [toot-id="+id+"] .area-actions").toggleClass("hide") - $(tlide+" [toot-id="+id+"] .area-side").toggleClass("hide") + if (mouseover == "hide") { + $(tlide + " [toot-id=" + id + "] .area-actions").toggleClass("hide") + $(tlide + " [toot-id=" + id + "] .area-side").toggleClass("hide") } } -function resetmv(type){ - var mouseover=localStorage.getItem("mouseover"); - if(!mouseover){ - mouseover=""; - }else if(mouseover=="yes"){ - mouseover="hide"; - }else if(mouseover=="no"){ - mouseover=""; - }else if(mouseover=="click" && type!="mv"){ - mouseover="hide"; +function resetmv(type) { + var mouseover = localStorage.getItem("mouseover"); + if (!mouseover) { + mouseover = ""; + } else if (mouseover == "yes") { + mouseover = "hide"; + } else if (mouseover == "no") { + mouseover = ""; + } else if (mouseover == "click" && type != "mv") { + mouseover = "hide"; } - if(mouseover=="hide"){ + if (mouseover == "hide") { $(".area-actions").addClass("hide"); $(".area-side").addClass("hide"); } - + } \ No newline at end of file diff --git a/app/js/tl/datails.js b/app/js/tl/datails.js index 11ac64bc..d0bf290a 100644 --- a/app/js/tl/datails.js +++ b/app/js/tl/datails.js @@ -1,31 +1,31 @@ //トゥートの詳細 function details(id, acct_id, tlid, mode) { - if(mode=="dm"){ + if (mode == "dm") { $(".dm-hide").hide(); - }else{ + } else { $(".dm-hide").show(); } - $(".toot-reset").html(''+lang.lang_details_nodata+''); - var html = $("#timeline_"+tlid+" [toot-id=" + id + "]").html(); + $(".toot-reset").html('' + lang.lang_details_nodata + ''); + var html = $("#timeline_" + tlid + " [toot-id=" + id + "]").html(); $("#toot-this").html(html); $('#tootmodal').modal('open'); var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(localStorage.getItem("mode_" + domain)=="misskey"){ + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) == "misskey") { var start = "https://" + domain + "/api/notes/show"; - var i={ + var i = { method: 'POST', headers: { 'content-type': 'application/json', }, - body:JSON.stringify({ - i:at, - noteId:id + body: JSON.stringify({ + i: at, + noteId: id }) } - }else{ + } else { var start = "https://" + domain + "/api/v1/statuses/" + id; - var i={ + var i = { method: 'GET', headers: { 'content-type': 'application/json', @@ -33,61 +33,61 @@ function details(id, acct_id, tlid, mode) { }, } } - - fetch(start, i).then(function(response) { + + fetch(start, i).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - console.log(["Toot data:",json]); - if(!$("#timeline_"+tlid+" #pub_" + id).length){ + }).then(function (json) { + console.log(["Toot data:", json]); + if (!$("#timeline_" + tlid + " #pub_" + id).length) { var html = parse([json], '', acct_id); $("#toot-this").html(html); jQuery("time.timeago").timeago(); } - if(localStorage.getItem("mode_" + domain)=="misskey"){ - var url="https://"+domain+"/notes/"+json.id; - var scn=json.user.username; - if(!json.user.host){ - var local=true; - }else{ - var local=false; - scn=scn+"@"+host; + if (localStorage.getItem("mode_" + domain) == "misskey") { + var url = "https://" + domain + "/notes/" + json.id; + var scn = json.user.username; + if (!json.user.host) { + var local = true; + } else { + var local = false; + scn = scn + "@" + host; } - var rep=""; - var uid=json.user.id; - if(json._replyIds){ + var rep = ""; + var uid = json.user.id; + if (json._replyIds) { replyTL(json._replyIds[0], acct_id); } - }else{ - var url=json.url - if(json.account.acct==json.account.username){ - var local=true; - }else{ - var local=false; + } else { + var url = json.url + if (json.account.acct == json.account.username) { + var local = true; + } else { + var local = false; } - var scn=json.account.acct; - var uid=json.account.id; + var scn = json.account.acct; + var uid = json.account.id; if (json["in_reply_to_id"]) { replyTL(json["in_reply_to_id"], acct_id); } } $("#toot-this .fav_ct").text(json.favourites_count); $("#toot-this .rt_ct").text(json.reblogs_count); - $("#tootmodal").attr("data-url",url); - $("#tootmodal").attr("data-id",json.id); - if(local){ - $("#tootmodal").attr("data-user",scn+"@"+domain); - }else{ - $("#tootmodal").attr("data-user",scn); + $("#tootmodal").attr("data-url", url); + $("#tootmodal").attr("data-id", json.id); + if (local) { + $("#tootmodal").attr("data-user", scn + "@" + domain); + } else { + $("#tootmodal").attr("data-user", scn); } context(id, acct_id); - var dom=null; - if(!local){ - dom=scn.replace(/.+@/g,''); - }else{ - dom=domain; + var dom = null; + if (!local) { + dom = scn.replace(/.+@/g, ''); + } else { + dom = domain; } beforeToot(id, acct_id, dom); userToot(id, acct_id, uid); @@ -96,37 +96,37 @@ function details(id, acct_id, tlid, mode) { afterFTLToot(id, acct_id, dom); faved(id, acct_id); rted(id, acct_id); - if($("#toot-this div").hasClass("cvo")){ + if ($("#toot-this div").hasClass("cvo")) { $("#toot-this").removeClass("cvo"); - }else{ + } else { $("#toot-this").addClass("cvo"); } - if(!$("#activator").hasClass("active")){ + if (!$("#activator").hasClass("active")) { $('#det-col').collapsible('open', 4); } - + }); } //返信タイムライン function replyTL(id, acct_id) { var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(localStorage.getItem("mode_" + domain)=="misskey"){ + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) == "misskey") { var start = "https://" + domain + "/api/notes/show"; - var i={ + var i = { method: 'POST', headers: { 'content-type': 'application/json', }, - body:JSON.stringify({ - i:at, - noteId:id + body: JSON.stringify({ + i: at, + noteId: id }) } - }else{ + } else { var start = "https://" + domain + "/api/v1/statuses/" + id; - var i={ + var i = { method: 'GET', headers: { 'content-type': 'application/json', @@ -134,65 +134,65 @@ function replyTL(id, acct_id) { }, } } - fetch(start, i).then(function(response) { + fetch(start, i).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - if(localStorage.getItem("filter_"+ acct_id)!="undefined"){ - var mute=getFilterType(JSON.parse(localStorage.getItem("filter_"+ acct_id)),"thread"); - }else{ - var mute=[]; + }).then(function (json) { + if (localStorage.getItem("filter_" + acct_id) != "undefined") { + var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), "thread"); + } else { + var mute = []; } - if(localStorage.getItem("mode_" + domain)=="misskey"){ - var templete = misskeyParse([json], '', acct_id,"","",mute); + if (localStorage.getItem("mode_" + domain) == "misskey") { + var templete = misskeyParse([json], '', acct_id, "", "", mute); $("#toot-after").prepend(templete); $("#toot-after .hide").html(lang.lang_details_filtered); - $("#toot-after .by_filter").css("display","block"); + $("#toot-after .by_filter").css("display", "block"); $("#toot-after .by_filter").removeClass("hide"); - var rep="_replyIds"; + var rep = "_replyIds"; if (json[rep]) { replyTL(json[rep][0], acct_id); } - }else{ - var templete = parse([json], '', acct_id,"","",mute); - if(templete!=""){ + } else { + var templete = parse([json], '', acct_id, "", "", mute); + if (templete != "") { $("#toot-reply .no-data").hide(); } $("#toot-reply").prepend(templete); $("#toot-reply .hide").html(lang.lang_details_filtered); - $("#toot-reply .by_filter").css("display","block"); + $("#toot-reply .by_filter").css("display", "block"); $("#toot-reply .by_filter").removeClass("hide"); - jQuery("time.timeago").timeago(); - var rep="in_reply_to_id"; + jQuery("time.timeago").timeago(); + var rep = "in_reply_to_id"; if (json[rep]) { replyTL(json[rep], acct_id); } } - + }); } //コンテクストってなんですか function context(id, acct_id) { var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(localStorage.getItem("mode_" + domain)=="misskey"){ + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) == "misskey") { var start = "https://" + domain + "/api/notes/conversation"; - var i={ + var i = { method: 'POST', headers: { 'content-type': 'application/json', }, - body:JSON.stringify({ - i:at, - noteId:id + body: JSON.stringify({ + i: at, + noteId: id }) } - }else{ + } else { var start = "https://" + domain + "/api/v1/statuses/" + id + "/context"; - var i={ + var i = { method: 'GET', headers: { 'content-type': 'application/json', @@ -200,82 +200,82 @@ function context(id, acct_id) { }, } } - fetch(start, i).then(function(response) { + fetch(start, i).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - if(localStorage.getItem("mode_" + domain)=="misskey"){ + }).then(function (json) { + if (localStorage.getItem("mode_" + domain) == "misskey") { json.reverse(); - var templete = misskeyParse(json, '', acct_id,"","",[]); + var templete = misskeyParse(json, '', acct_id, "", "", []); $("#toot-reply").html(templete); $("#toot-reply .hide").html(lang.lang_details_filtered); - $("#toot-reply .by_filter").css("display","block"); + $("#toot-reply .by_filter").css("display", "block"); $("#toot-reply .by_filter").removeClass("hide"); jQuery("time.timeago").timeago(); - }else{ - if(localStorage.getItem("filter_"+ acct_id)!="undefined"){ - var mute=getFilterType(JSON.parse(localStorage.getItem("filter_"+ acct_id)),"thread"); - }else{ - var mute=[]; + } else { + if (localStorage.getItem("filter_" + acct_id) != "undefined") { + var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), "thread"); + } else { + var mute = []; } - var templete = parse(json.descendants, '', acct_id,"","",mute); - if(templete!=""){ + var templete = parse(json.descendants, '', acct_id, "", "", mute); + if (templete != "") { $("#toot-after .no-data").hide(); } $("#toot-after").html(templete); $("#toot-after .hide").html(lang.lang_details_filtered); - $("#toot-after .by_filter").css("display","block"); + $("#toot-after .by_filter").css("display", "block"); $("#toot-after .by_filter").removeClass("hide"); jQuery("time.timeago").timeago(); } - + }); } //前のトゥート(Back TL) function beforeToot(id, acct_id, domain) { //var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(localStorage.getItem("mode_" + domain)=="misskey"){ + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) == "misskey") { var start = "https://" + domain + - "/api/notes/local-timeline" + "/api/notes/local-timeline" fetch(start, { method: 'POST', headers: { 'content-type': 'application/json', }, - body:JSON.stringify({ - i:at, - untilID:id + body: JSON.stringify({ + i: at, + untilID: id }) - }).then(function(response) { - return response.json(); - }).catch(function(error) { - todo(error); - console.error(error); - }).then(function(json) { - var templete = misskeyParse(json, 'noauth', acct_id); - $("#toot-before").html(templete); - jQuery("time.timeago").timeago(); - }); - }else{ + }).then(function (response) { + return response.json(); + }).catch(function (error) { + todo(error); + console.error(error); + }).then(function (json) { + var templete = misskeyParse(json, 'noauth', acct_id); + $("#toot-before").html(templete); + jQuery("time.timeago").timeago(); + }); + } else { var start = "https://" + domain + - "/api/v1/timelines/public?local=true&max_id=" + id; + "/api/v1/timelines/public?local=true&max_id=" + id; fetch(start, { method: 'GET', headers: { 'content-type': 'application/json', }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { + }).then(function (json) { var templete = parse(json, 'noauth', acct_id); - if(templete!=""){ + if (templete != "") { $("#toot-before .no-data").hide(); } $("#toot-before").html(templete); @@ -286,31 +286,31 @@ function beforeToot(id, acct_id, domain) { //前のユーザーのトゥート function userToot(id, acct_id, user) { var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(localStorage.getItem("mode_" + domain)=="misskey"){ + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) == "misskey") { var start = "https://" + domain + - "/api/users/notes" + "/api/users/notes" fetch(start, { method: 'POST', headers: { 'content-type': 'application/json', }, - body:JSON.stringify({ - i:at, - untilID:id, - userId:user + body: JSON.stringify({ + i: at, + untilID: id, + userId: user }) - }).then(function(response) { - return response.json(); - }).catch(function(error) { - todo(error); - console.error(error); - }).then(function(json) { - var templete = misskeyParse(json, 'noauth', acct_id); - $("#user-before").html(templete); - jQuery("time.timeago").timeago(); - }); - }else{ + }).then(function (response) { + return response.json(); + }).catch(function (error) { + todo(error); + console.error(error); + }).then(function (json) { + var templete = misskeyParse(json, 'noauth', acct_id); + $("#user-before").html(templete); + jQuery("time.timeago").timeago(); + }); + } else { var start = "https://" + domain + "/api/v1/accounts/" + user + "/statuses?max_id=" + id; fetch(start, { method: 'GET', @@ -318,103 +318,103 @@ function userToot(id, acct_id, user) { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { + }).then(function (json) { var templete = parse(json, '', acct_id); - if(templete!=""){ + if (templete != "") { $("#user-before .no-data").hide(); } $("#user-before").html(templete); jQuery("time.timeago").timeago(); }); } - + } //後のLTL function afterToot(id, acct_id, domain) { //var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - var start = "https://" + domain + + var at = localStorage.getItem("acct_" + acct_id + "_at"); + var start = "https://" + domain + "/api/v1/timelines/public?local=true&min_id=" + id; - fetch(start, { - method: 'GET', - headers: { - 'content-type': 'application/json', - }, - }).then(function(response) { - return response.json(); - }).catch(function(error) { - todo(error); - console.error(error); - }).then(function(json) { - var templete = parse(json, 'noauth', acct_id); - if(templete!=""){ - $("#ltl-after .no-data").hide(); - } - $("#ltl-after").html(templete); - jQuery("time.timeago").timeago(); - }); + fetch(start, { + method: 'GET', + headers: { + 'content-type': 'application/json', + }, + }).then(function (response) { + return response.json(); + }).catch(function (error) { + todo(error); + console.error(error); + }).then(function (json) { + var templete = parse(json, 'noauth', acct_id); + if (templete != "") { + $("#ltl-after .no-data").hide(); + } + $("#ltl-after").html(templete); + jQuery("time.timeago").timeago(); + }); } //後のUTL function afterUserToot(id, acct_id, user) { var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - var start = "https://" + domain + "/api/v1/accounts/" + user + "/statuses?min_id=" + id; - 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 templete = parse(json, '', acct_id); - if(templete!=""){ - $("#user-after .no-data").hide(); - } - $("#user-after").html(templete); - jQuery("time.timeago").timeago(); - }); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + var start = "https://" + domain + "/api/v1/accounts/" + user + "/statuses?min_id=" + id; + 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 templete = parse(json, '', acct_id); + if (templete != "") { + $("#user-after .no-data").hide(); + } + $("#user-after").html(templete); + jQuery("time.timeago").timeago(); + }); } //後のFTL function afterFTLToot(id, acct_id, domain) { //var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - var start = "https://" + domain + + var at = localStorage.getItem("acct_" + acct_id + "_at"); + var start = "https://" + domain + "/api/v1/timelines/public?min_id=" + id; - fetch(start, { - method: 'GET', - headers: { - 'content-type': 'application/json', - }, - }).then(function(response) { - return response.json(); - }).catch(function(error) { - todo(error); - console.error(error); - }).then(function(json) { - var templete = parse(json, 'noauth', acct_id); - if(templete!=""){ - $("#ftl-after .no-data").hide(); - } - $("#ftl-after").html(templete); - jQuery("time.timeago").timeago(); - }); + fetch(start, { + method: 'GET', + headers: { + 'content-type': 'application/json', + }, + }).then(function (response) { + return response.json(); + }).catch(function (error) { + todo(error); + console.error(error); + }).then(function (json) { + var templete = parse(json, 'noauth', acct_id); + if (templete != "") { + $("#ftl-after .no-data").hide(); + } + $("#ftl-after").html(templete); + jQuery("time.timeago").timeago(); + }); } //ふぁぼ一覧 function faved(id, acct_id) { var domain = localStorage.getItem("domain_" + acct_id); - if(localStorage.getItem("mode_" + domain)=="misskey"){ return false; } - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) == "misskey") { return false; } + var at = localStorage.getItem("acct_" + acct_id + "_at"); var start = "https://" + domain + "/api/v1/statuses/" + id + "/favourited_by"; fetch(start, { method: 'GET', @@ -422,14 +422,14 @@ function faved(id, acct_id) { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { + }).then(function (json) { var templete = userparse(json, '', acct_id); - if(templete!=""){ + if (templete != "") { $("#toot-fav .no-data").hide(); } $("#toot-fav").html(templete); @@ -439,8 +439,8 @@ function faved(id, acct_id) { //ブースト一覧 function rted(id, acct_id) { var domain = localStorage.getItem("domain_" + acct_id); - if(localStorage.getItem("mode_" + domain)=="misskey"){ return false; } - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) == "misskey") { return false; } + var at = localStorage.getItem("acct_" + acct_id + "_at"); var start = "https://" + domain + "/api/v1/statuses/" + id + "/reblogged_by"; fetch(start, { method: 'GET', @@ -448,77 +448,77 @@ function rted(id, acct_id) { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { + }).then(function (json) { var templete = userparse(json, '', acct_id); $("#toot-rt").html(templete); }); } //URL等のコピー -function cbCopy(mode){ - var url=$("#tootmodal").attr("data-url"); +function cbCopy(mode) { + var url = $("#tootmodal").attr("data-url"); var urls = url.match(/https?:\/\/([-.a-zA-Z0-9]+)/); - var domain=urls[1]; - if(mode=="emb"){ - var emb=''; + var domain = urls[1]; + if (mode == "emb") { + var emb = ''; execCopy(emb) Materialize.toast(lang.lang_details_embed, 1500); - }else{ - if(execCopy(url)){ + } else { + if (execCopy(url)) { Materialize.toast(lang.lang_details_url, 1500); } - + } } //本文のコピー -function staCopy(id){ - var html=$("[toot-id="+id+"] .toot").html(); - html = html.replace(/^(.+)<\/p>$/,"$1"); +function staCopy(id) { + var html = $("[toot-id=" + id + "] .toot").html(); + html = html.replace(/^
(.+)<\/p>$/, "$1"); html = html.replace(/
/, "\n"); html = html.replace(//, "\n"); html = html.replace(/<\/p>/, "\n"); - console.log("Copy it:\n"+html); + console.log("Copy it:\n" + html); html = html.replace(//g, "$1"); - html=$.strip_tags(html); - if(execCopy(html)){ + html = $.strip_tags(html); + if (execCopy(html)) { Materialize.toast(lang.lang_details_txt, 1500); } - + } //翻訳 -function trans(tar,to){ - var html=$("#toot-this .toot").html(); - if(html.match(/^
(.+)<\/p>$/)){ +function trans(tar, to) { + var html = $("#toot-this .toot").html(); + if (html.match(/^
(.+)<\/p>$/)) { html = html.match(/^
(.+)<\/p>$/)[1]; } html = html.replace(/
/g, "\n"); html = html.replace(//g, "\n"); html = html.replace(/<\/p>/g, "\n"); - html=$.strip_tags(html); - if(~tar.indexOf("zh")){ - tar="zh"; + html = $.strip_tags(html); + if (~tar.indexOf("zh")) { + tar = "zh"; } $("#toot-this .additional").text("Loading...(Powered by Google Translate)"); - var exec='https://script.google.com/macros/s/AKfycbxhwW5tjjop9Irg-y1zr_WsXlCKEzwWG6KuoOt_vVRDfEbRv0c/exec?format=json&text='+encodeURIComponent(html)+'&source='+tar+'&target='+to - console.log("Try to translate from "+tar+" to "+to+" at "+exec); + var exec = 'https://script.google.com/macros/s/AKfycbxhwW5tjjop9Irg-y1zr_WsXlCKEzwWG6KuoOt_vVRDfEbRv0c/exec?format=json&text=' + encodeURIComponent(html) + '&source=' + tar + '&target=' + to + console.log("Try to translate from " + tar + " to " + to + " at " + exec); fetch(exec, { method: 'GET', - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(text) { - $("#toot-this .additional").html(''+text.text+''); + }).then(function (text) { + $("#toot-this .additional").html('' + text.text + ''); }); } //ブラウザで開く -function brws(){ - var url=$("#tootmodal").attr("data-url"); +function brws() { + var url = $("#tootmodal").attr("data-url"); const { shell } = require('electron'); @@ -526,38 +526,38 @@ function brws(){ shell.openExternal(url); } //外部からトゥート開く -function detEx(url,acct_id){ - if(acct_id=="main"){ - acct_id=localStorage.getItem("main"); +function detEx(url, acct_id) { + if (acct_id == "main") { + acct_id = localStorage.getItem("main"); } - var domain = localStorage.getItem("domain_"+acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - var start = "https://" + domain + "/api/v1/search?resolve=true&q="+url + var domain = localStorage.getItem("domain_" + acct_id); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + var start = "https://" + domain + "/api/v1/search?resolve=true&q=" + url fetch(start, { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at } - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - if(!json.statuses){ + }).then(function (json) { + if (!json.statuses) { const { shell } = require('electron'); - + shell.openExternal(url); - }else{ - var id=json.statuses[0].id; + } else { + var id = json.statuses[0].id; $(".loadp").text($(".loadp").attr("href")); $(".loadp").removeClass("loadp"); details(id, acct_id, 0) } - + }); return; } \ No newline at end of file diff --git a/app/js/tl/date.js b/app/js/tl/date.js index 505eb54d..cbc3a329 100644 --- a/app/js/tl/date.js +++ b/app/js/tl/date.js @@ -15,7 +15,7 @@ function date(str, datetype) { } else { var min = date.getMinutes(); } - var sec=null; + var sec = null; if (date.getSeconds() < 10) { sec = "0" + date.getSeconds(); } else { @@ -57,31 +57,31 @@ function date(str, datetype) { //特殊フォーマット(インスタンス情報で利用) function crat(str) { var date = new Date(str); - var mnt=null; - if(date.getMonth()<9){ - mnt="0"+(date.getMonth()+1); - }else{ - mnt=date.getMonth()+1; + var mnt = null; + if (date.getMonth() < 9) { + mnt = "0" + (date.getMonth() + 1); + } else { + mnt = date.getMonth() + 1; } - if(date.getDate()<10){ - var dat="0"+date.getDate(); - }else{ - var dat=date.getDate(); + if (date.getDate() < 10) { + var dat = "0" + date.getDate(); + } else { + var dat = date.getDate(); } - if(date.getHours()<10){ - var hrs="0"+date.getHours(); - }else{ - var hrs=date.getHours(); + if (date.getHours() < 10) { + var hrs = "0" + date.getHours(); + } else { + var hrs = date.getHours(); } - if(date.getMinutes()<10){ - var mns="0"+date.getMinutes(); - }else{ - var mns=date.getMinutes(); + if (date.getMinutes() < 10) { + var mns = "0" + date.getMinutes(); + } else { + var mns = date.getMinutes(); } - if(date.getSeconds()<10){ - var sec="0"+date.getSeconds(); - }else{ - var sec=date.getSeconds(); + if (date.getSeconds() < 10) { + var sec = "0" + date.getSeconds(); + } else { + var sec = date.getSeconds(); } format_str = 'YYYY-MM-DD hh:mm:ss'; format_str = format_str.replace(/YYYY/g, date.getFullYear()); diff --git a/app/js/tl/dm.js b/app/js/tl/dm.js index 92bf4fe0..079dc737 100644 --- a/app/js/tl/dm.js +++ b/app/js/tl/dm.js @@ -1,79 +1,79 @@ //DM(Conv) TL -function dm(acct_id, tlid, type,delc,voice) { +function dm(acct_id, tlid, type, delc, voice) { - var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - var start = "https://" + domain + "/api/v1/conversations"; + var domain = localStorage.getItem("domain_" + acct_id); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + var start = "https://" + domain + "/api/v1/conversations"; fetch(start, { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - var templete = '
'+dmListParse(json, type, acct_id, tlid, "", mute)+''; - localStorage.setItem("lastobj_"+ tlid,json[0].id) - $("#timeline_" + tlid).html(templete); - additional(acct_id, tlid); - jQuery("time.timeago").timeago(); - todc(); - //reload(type, '', acct_id, tlid, data, mute, delc,voice); - $(window).scrollTop(0); - }); - + }).then(function (json) { + var templete = '' + dmListParse(json, type, acct_id, tlid, "", mute) + ''; + localStorage.setItem("lastobj_" + tlid, json[0].id) + $("#timeline_" + tlid).html(templete); + additional(acct_id, tlid); + jQuery("time.timeago").timeago(); + todc(); + //reload(type, '', acct_id, tlid, data, mute, delc,voice); + $(window).scrollTop(0); + }); + } -function dmmore(tlid){ +function dmmore(tlid) { var multi = localStorage.getItem("column"); var obj = JSON.parse(multi); var acct_id = obj[tlid].domain; var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var sid = $("#timeline_" + tlid + " .cvo").last().attr("unique-id"); - var start = "https://" + domain + "/api/v1/conversations?max_id="+sid; - var type="dm"; + var start = "https://" + domain + "/api/v1/conversations?max_id=" + sid; + var type = "dm"; fetch(start, { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - var templete = ''+dmListParse(json, type, acct_id, tlid, "", mute)+''; - $("#timeline_" + tlid).append(templete); - additional(acct_id, tlid); - jQuery("time.timeago").timeago(); - moreloading=false; + }).then(function (json) { + var templete = '' + dmListParse(json, type, acct_id, tlid, "", mute) + ''; + $("#timeline_" + tlid).append(templete); + additional(acct_id, tlid); + jQuery("time.timeago").timeago(); + moreloading = false; }) } //DMオブジェクトパーサー(トゥート) function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) { var templete = ''; - if(obj[0]){ - localStorage.setItem("lastunix_"+ tlid,date(obj[0].created_at, 'unix')); + if (obj[0]) { + localStorage.setItem("lastunix_" + tlid, date(obj[0].created_at, 'unix')); } - + var actb = localStorage.getItem("action_btns"); - var actb='re,rt,fav,qt,del,pin,red'; - if(actb){ + var actb = 're,rt,fav,qt,del,pin,red'; + if (actb) { var actb = actb.split(','); - var disp={}; - for(var k=0;k'; + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">'; var regExp = new RegExp(":" + shortcode + ":", "g"); dis_name = dis_name.replace(regExp, emoji_url); - + }); } - var noticeavatar=""; - var if_notf=""; - var uniqueid=toot.id; - var notice = ""; - var boostback = ""; - //ユーザー強調 - if(toot.account.username!=toot.account.acct){ - var fullname=toot.account.acct; - }else{ - var domain = localStorage.getItem("domain_" + acct_id); - var fullname=toot.account.acct+"@"+domain; - } - if(useremp){ - Object.keys(useremp).forEach(function(key10) { + var noticeavatar = ""; + var if_notf = ""; + var uniqueid = toot.id; + var notice = ""; + var boostback = ""; + //ユーザー強調 + if (toot.account.username != toot.account.acct) { + var fullname = toot.account.acct; + } else { + var domain = localStorage.getItem("domain_" + acct_id); + var fullname = toot.account.acct + "@" + domain; + } + if (useremp) { + Object.keys(useremp).forEach(function (key10) { var user = useremp[key10]; - if(user==fullname){ + if (user == fullname) { boostback = "emphasized"; } }); } - var id = toot.id; - var home = ""; + var id = toot.id; + var home = ""; if (toot.account.locked) { var locked = ' '; } else { @@ -248,25 +248,25 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) { } if (!toot.application) { var via = ''; - viashow="hide"; + viashow = "hide"; } else { var via = escapeHTML(toot.application.name); //強調チェック - Object.keys(emp).forEach(function(key6) { + Object.keys(emp).forEach(function (key6) { var cli = emp[key6]; - if(cli == via){ + if (cli == via) { boostback = "emphasized"; } }); //ミュートチェック - Object.keys(mute).forEach(function(key7) { + Object.keys(mute).forEach(function (key7) { var cli = mute[key7]; - if(cli == via){ + if (cli == via) { boostback = "hide"; } }); } - if(mix=="pinned"){ + if (mix == "pinned") { boostback = "emphasized"; } if (toot.spoiler_text && cw) { @@ -275,19 +275,19 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) { var spoiler = "cw cw_hide_" + toot.id; var api_spoil = "gray"; var spoiler_show = ''+lang.lang_parse_cwshow+'
'; + '\')" class="nex parsed">' + lang.lang_parse_cwshow + '
'; } else { - var ct1 = toot.content.split('
').length -2; - var ct2 = toot.content.split('').length + toot.content.split('
').length -2; - if(ct1>ct2){ var ct= ct1; }else{ var ct= ct2; } + var ct1 = toot.content.split('').length + toot.content.split('
').length - 2; + var ct2 = toot.content.split('').length + toot.content.split('
').length - 2; + if (ct1 > ct2) { var ct = ct1; } else { var ct = ct2; } if ((sent < ct && $.mb_strlen($.strip_tags(toot.content)) > 5) || ($.strip_tags(toot.content).length > ltr && $.mb_strlen($.strip_tags(toot.content)) > 5)) { - var content = ''+lang.lang_parse_fulltext+'
' + toot.content + var content = '' + lang.lang_parse_fulltext + '
' + toot.content var spoil = '' + $.mb_substr($.strip_tags( - toot.content), 0, 100) + - ''+lang.lang_parse_autofold+''; + toot.content), 0, 100) + + '
'; + '\')" class="nex parsed">' + lang.lang_parse_more + '
'; } else { var content = toot.content; var spoil = escapeHTML(toot.spoiler_text); @@ -300,66 +300,66 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) { ); if (urls) { var analyze = ''+lang.lang_parse_url+'
'; + ',\'' + id + '\')" class="add-show pointer">' + lang.lang_parse_url + '
'; } else { var analyze = ''; } var viewer = ""; var hasmedia = ""; var youtube = ""; - if(toot.emojis){ + if (toot.emojis) { var emojick = toot.emojis[0]; - }else{ - var emojick=false; + } else { + var emojick = false; } //絵文字があれば if (emojick) { - Object.keys(toot.emojis).forEach(function(key5) { + Object.keys(toot.emojis).forEach(function (key5) { var emoji = toot.emojis[key5]; var shortcode = emoji.shortcode; var emoji_url = ''; + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">'; var regExp = new RegExp(":" + shortcode + ":", "g"); content = content.replace(regExp, emoji_url); spoil = spoil.replace(regExp, emoji_url); }); } //ニコフレ絵文字 - if(toot.profile_emojis){ + if (toot.profile_emojis) { var nicoemojick = toot.profile_emojis[0]; - }else{ - var nicoemojick=false; + } else { + var nicoemojick = false; } //絵文字があれば if (nicoemojick) { - Object.keys(toot.profile_emojis).forEach(function(keynico) { + Object.keys(toot.profile_emojis).forEach(function (keynico) { var emoji = toot.profile_emojis[keynico]; var shortcode = emoji.shortcode; var emoji_url = ''; + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">'; var regExp = new RegExp(":" + shortcode + ":", "g"); content = content.replace(regExp, emoji_url); spoil = spoil.replace(regExp, emoji_url); }); } //デフォ絵文字 - content=twemoji.parse(content); - if(dis_name){ - dis_name=twemoji.parse(dis_name); + content = twemoji.parse(content); + if (dis_name) { + dis_name = twemoji.parse(dis_name); } - if(spoil){ - spoil=twemoji.parse(spoil); + if (spoil) { + spoil = twemoji.parse(spoil); } var mediack = toot.media_attachments[0]; //メディアがあれば - var media_ids=""; + var media_ids = ""; if (mediack) { hasmedia = "hasmedia"; var cwdt = 100 / toot.media_attachments.length; - Object.keys(toot.media_attachments).forEach(function(key2) { + Object.keys(toot.media_attachments).forEach(function (key2) { var media = toot.media_attachments[key2]; var purl = media.preview_url; - media_ids=media_ids+media.id+","; + media_ids = media_ids + media.id + ","; var url = media.url; if (toot.sensitive && nsfw) { var sense = "sensitive" @@ -370,9 +370,9 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) { acct_id + '\')" id="' + id + '-image-' + key2 + '" data-url="' + url + '" data-type="' + media.type + '" class="img-parsed">'; + ' toot-img pointer" style="width:' + cwdt + '%; height:' + imh + 'px;">'; }); - media_ids = media_ids.slice(0, -1) ; + media_ids = media_ids.slice(0, -1); } else { viewer = ""; hasmedia = "nomedia"; @@ -382,7 +382,7 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) { //メンションであれば if (menck) { mentions = ""; - Object.keys(toot.mentions).forEach(function(key3) { + Object.keys(toot.mentions).forEach(function (key3) { var mention = toot.mentions[key3]; mentions = mentions + '@' + mention.acct + ' '; @@ -393,11 +393,11 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) { var tags = ""; //タグであれば if (tagck) { - Object.keys(toot.tags).forEach(function(key4) { + Object.keys(toot.tags).forEach(function (key4) { var tag = toot.tags[key4]; tags = tags + '#' + tag.name + ':TL Toot '+ - 'Pin '; + ',\'add\')" class="pointer" title="' + lang.lang_parse_tagTL.replace("{{tag}}", '#' + tag.name) + '">TL Toot ' + + 'Pin '; }); tags = '' + tags + ''; } @@ -408,38 +408,38 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) { var avatar = toot.account.avatar_static; } //ワードミュート - if(wordmute){ - Object.keys(wordmute).forEach(function(key8) { + 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 + 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)){ + var regExp = new RegExp(word, "g"); + if ($.strip_tags(content).match(regExp)) { boostback = "hide by_filter"; } } }); } //ワード強調 - if(wordemp){ - Object.keys(wordemp).forEach(function(key9) { + 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,''+escapeHTML(word)+""); + if (word) { + var word = word.tag; + var regExp = new RegExp(word, "g"); + content = content.replace(regExp, '' + escapeHTML(word) + ""); } }); } //日本語じゃない - if(toot.language!="ja"){ - var trans=''; - }else{ - var trans=""; + if (toot.language != "ja") { + var trans = ''; + } else { + var trans = ""; } if (toot.favourited) { var if_fav = " yellow-text"; @@ -450,72 +450,72 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) { } //Cards if (!card && toot.card) { - var cards=toot.card; - if (cards.provider_name=="Twitter"){ - if(cards.image){ - var twiImg='
'; - }else{ - var twiImg=''; - } - analyze=''+escapeHTML(cards.author_name)+''; + var cards = toot.card; + if (cards.provider_name == "Twitter") { + if (cards.image) { + var twiImg = '
'+escapeHTML(cards.description)+twiImg+'
'; + } else { + var twiImg = ''; } - if (cards.title) { - analyze="URL"+lang.lang_cards_check+":
Title:" + escapeHTML(cards.title) + "
" + - escapeHTML(cards.description) + ""; - } - if (cards.html) { - analyze=cards.html+'picture_in_picture_alt'; - } - + analyze = '' + escapeHTML(cards.author_name) + ''; + } + if (cards.title) { + analyze = "URL" + lang.lang_cards_check + ":
' + escapeHTML(cards.description) + twiImg + '
Title:" + escapeHTML(cards.title) + "
" + + escapeHTML(cards.description) + ""; + } + if (cards.html) { + analyze = cards.html + 'picture_in_picture_alt'; + } + } //Ticker - var tickerdom=""; - if(ticker){ - var tickerdata=localStorage.getItem("ticker") - if(tickerdata){ - var tickerdata=JSON.parse(tickerdata); - - var thisdomain=toot.account.acct.split("@"); - if(thisdomain.length>1){ - thisdomain=thisdomain[1]; - } - for( var i=0; i'+escapeHTML(value.name)+''; - break; + var tickerdom = ""; + if (ticker) { + var tickerdata = localStorage.getItem("ticker") + if (tickerdata) { + var tickerdata = JSON.parse(tickerdata); + + var thisdomain = toot.account.acct.split("@"); + if (thisdomain.length > 1) { + thisdomain = thisdomain[1]; } - } - } + for (var i = 0; i < tickerdata.length; i++) { + var value = tickerdata[i]; + if (value.domain == thisdomain) { + var tickerdom = ' ' + escapeHTML(value.name) + ''; + break; + } + } + } } templete = templete + '' + + boostback + ' ' + fav_app + + ' ' + hasmedia + '" toot-id="' + id + '" unique-id="' + uniqueid + '" data-medias="' + media_ids + ' " unixtime="' + date(obj[ + key].created_at, 'unix') + '" ' + if_notf + ' onclick="dmStatus()">' + '' + '' + notice + home + '' + ' ' + + '">' + noticeavatar + '' + - '' + dis_name + '' + '' + + '(' + lang.lang_parse_clickcopyurl + ')">' + date(toot.created_at, datetype) + '' + ''+tickerdom+'' + tickerdom + '' + spoil + "" + spoiler_show + '' + content + '' + '' + viewer + '' + ''+ - ''+ + ',\'' + tlid + '\',\'dm\')" class="pointer waves-effect">' + lang.lang_parse_thread + '' + + '' + ''; }); return templete; diff --git a/app/js/tl/filter.js b/app/js/tl/filter.js index 319ddde6..67d16595 100644 --- a/app/js/tl/filter.js +++ b/app/js/tl/filter.js @@ -3,38 +3,38 @@ function mediaToggle(tlid) { var media = localStorage.getItem("media_" + tlid); if (media) { - localStorage.removeItem("media_" + tlid); + localStorage.removeItem("media_" + tlid); $("#sta-media-" + tlid).text("Off"); - $("#sta-media-" + tlid).css("color",'red'); - $("#timeline_"+tlid).removeClass("media-filter") + $("#sta-media-" + tlid).css("color", 'red'); + $("#timeline_" + tlid).removeClass("media-filter") } else { localStorage.setItem("media_" + tlid, "true"); $("#sta-media-" + tlid).text("On"); - $("#sta-media-" + tlid).css("color",'#009688'); - $("#timeline_"+tlid).addClass("media-filter") + $("#sta-media-" + tlid).css("color", '#009688'); + $("#timeline_" + tlid).addClass("media-filter") } } //各TL上方のBT[BTOnly/BTExc/Off] function ebtToggle(tlid) { var ebt = localStorage.getItem("ebt_" + tlid); - if (ebt=="true") { + if (ebt == "true") { localStorage.setItem("ebt_" + tlid, "but"); $("#sta-bt-" + tlid).text("BT Only"); - $("#sta-bt-" + tlid).css("color",'#ff9800'); - $("#timeline_"+tlid).addClass("except-bt-filter") - $("#timeline_"+tlid).removeClass("bt-filter") - }else if (ebt=="but") { - localStorage.removeItem("ebt_" + tlid); + $("#sta-bt-" + tlid).css("color", '#ff9800'); + $("#timeline_" + tlid).addClass("except-bt-filter") + $("#timeline_" + tlid).removeClass("bt-filter") + } else if (ebt == "but") { + localStorage.removeItem("ebt_" + tlid); $("#sta-bt-" + tlid).text("Off"); - $("#sta-bt-" + tlid).css("color",'red'); - $("#timeline_"+tlid).removeClass("bt-filter") - $("#timeline_"+tlid).removeClass("except-bt-filter") + $("#sta-bt-" + tlid).css("color", 'red'); + $("#timeline_" + tlid).removeClass("bt-filter") + $("#timeline_" + tlid).removeClass("except-bt-filter") } else { localStorage.setItem("ebt_" + tlid, "true"); $("#sta-bt-" + tlid).text("BT Ex"); - $("#sta-bt-" + tlid).css("color",'#009688'); - $("#timeline_"+tlid).addClass("bt-filter") - $("#timeline_"+tlid).removeClass("except-bt-filter") + $("#sta-bt-" + tlid).css("color", '#009688'); + $("#timeline_" + tlid).addClass("bt-filter") + $("#timeline_" + tlid).removeClass("except-bt-filter") } } //各TL上方のMedia[On/Off]をチェック @@ -42,46 +42,46 @@ function mediaCheck(tlid) { var media = localStorage.getItem("media_" + tlid); if (media) { $("#sta-media-" + tlid).text("On"); - $("#sta-media-" + tlid).css("color",'#009688'); - $("#timeline_"+tlid).addClass("media-filter") + $("#sta-media-" + tlid).css("color", '#009688'); + $("#timeline_" + tlid).addClass("media-filter") } else { $("#sta-media-" + tlid).text("Off"); - $("#sta-media-" + tlid).css("color",'red'); - $("#timeline_"+tlid).removeClass("media-filter") + $("#sta-media-" + tlid).css("color", 'red'); + $("#timeline_" + tlid).removeClass("media-filter") } } //各TL上方のBT[On/Off]をチェック function ebtCheck(tlid) { var ebt = localStorage.getItem("ebt_" + tlid); - if (ebt=="true") { + if (ebt == "true") { $("#sta-bt-" + tlid).text("BT Ex"); - $("#sta-bt-" + tlid).css("color",'#009688'); - $("#timeline_"+tlid).addClass("bt-filter") - $("#timeline_"+tlid).removeClass("except-bt-filter") - } else if (ebt=="but") { + $("#sta-bt-" + tlid).css("color", '#009688'); + $("#timeline_" + tlid).addClass("bt-filter") + $("#timeline_" + tlid).removeClass("except-bt-filter") + } else if (ebt == "but") { $("#sta-bt-" + tlid).text("BT Only"); - $("#sta-bt-" + tlid).css("color",'#ff9800'); - $("#timeline_"+tlid).addClass("except-bt-filter") - $("#timeline_"+tlid).removeClass("bt-filter") - } else{ + $("#sta-bt-" + tlid).css("color", '#ff9800'); + $("#timeline_" + tlid).addClass("except-bt-filter") + $("#timeline_" + tlid).removeClass("bt-filter") + } else { $("#sta-bt-" + tlid).text("Off"); - $("#sta-bt-" + tlid).css("color",'red'); - $("#timeline_"+tlid).removeClass("bt-filter") - $("#timeline_"+tlid).removeClass("except-bt-filter") + $("#sta-bt-" + tlid).css("color", 'red'); + $("#timeline_" + tlid).removeClass("bt-filter") + $("#timeline_" + tlid).removeClass("except-bt-filter") } } /* 削除追跡*/ function catchToggle(tlid) { var catchck = localStorage.getItem("catch_" + tlid); if (catchck) { - localStorage.removeItem("catch_" + tlid); + localStorage.removeItem("catch_" + tlid); $("#sta-del-" + tlid).text("Off"); - $("#sta-del-" + tlid).css("color",'red'); - parseColumn(); + $("#sta-del-" + tlid).css("color", 'red'); + parseColumn(); } else { localStorage.setItem("catch_" + tlid, "true"); $("#sta-del-" + tlid).text("On"); - $("#sta-del-" + tlid).css("color",'#009688'); + $("#sta-del-" + tlid).css("color", '#009688'); parseColumn(); } } @@ -89,101 +89,101 @@ function catchCheck(tlid) { var catchck = localStorage.getItem("catch_" + tlid); if (catchck) { $("#sta-del-" + tlid).text("On"); - $("#sta-del-" + tlid).css("color",'#009688'); + $("#sta-del-" + tlid).css("color", '#009688'); } else { $("#sta-del-" + tlid).text("Off"); - $("#sta-del-" + tlid).css("color",'red'); + $("#sta-del-" + tlid).css("color", 'red'); } } -function delreset(tlid){ +function delreset(tlid) { $("[tlid=" + tlid + "] .by_delcatch").hide(); $("[tlid=" + tlid + "] .by_delcatch").remove(); } /*ワードフィルター機能*/ -function filterMenu(){ - $("#left-menu div").removeClass("active"); +function filterMenu() { + $("#left-menu div").removeClass("active"); $("#filterMenu").addClass("active"); $(".menu-content").addClass("hide"); - $("#filter-box").removeClass("hide"); + $("#filter-box").removeClass("hide"); } -function filter(){ +function filter() { $("#filtered-words").html(""); $("#filter-edit-id").val("") - var acct_id = $("#filter-acct-sel").val(); - var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - var start = "https://" + domain + "/api/v1/filters" + var acct_id = $("#filter-acct-sel").val(); + var domain = localStorage.getItem("domain_" + acct_id); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + var start = "https://" + domain + "/api/v1/filters" fetch(start, { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { + }).then(function (json) { if (json) { var filters = ""; - Object.keys(json).forEach(function(key) { + Object.keys(json).forEach(function (key) { var filterword = json[key]; var context = filterword.context.join(','); - filters = filters + escapeHTML(filterword.phrase)+'(for '+context+'):'+lang.lang_edit+'/'+lang.lang_del+'
'+lang.lang_parse_thread+'
'; + filters = filters + escapeHTML(filterword.phrase) + '(for ' + context + '):' + lang.lang_edit + '/' + lang.lang_del + '
'; }); - if(filters==""){ - filters=lang.lang_filter_nodata+"
"; + if (filters == "") { + filters = lang.lang_filter_nodata + "
"; } $("#filtered-words").html(filters); - }else{ - $("#filtered-words").html(lang_filter_nodata); - } + } else { + $("#filtered-words").html(lang_filter_nodata); + } }); } -function filterTime(day,hour,min){ +function filterTime(day, hour, min) { $("#days_filter").val(day) $("#hours_filter").val(hour) $("#mins_filter").val(min) } -function makeNewFilter(){ +function makeNewFilter() { var acct_id = $("#filter-acct-sel").val(); - var phr=$("#filter-add-word").val(); - var cont=[]; - if($("#home_filter:checked").val()){ + var phr = $("#filter-add-word").val(); + var cont = []; + if ($("#home_filter:checked").val()) { cont.push("home"); } - if($("#local_filter:checked").val()){ + if ($("#local_filter:checked").val()) { cont.push("public"); } - if($("#notf_filter:checked").val()){ + if ($("#notf_filter:checked").val()) { cont.push("notifications"); } - if($("#conv_filter:checked").val()){ + if ($("#conv_filter:checked").val()) { cont.push("thread"); } - if(!cont.length){ - $("#filtered-words").html('Error:'+lang.lang_filter_errordegree); + if (!cont.length) { + $("#filtered-words").html('Error:' + lang.lang_filter_errordegree); } - var exc=$("#except_filter:checked").val(); - var who=$("#wholeword_filter:checked").val(); - if(!who){ - who=false; + var exc = $("#except_filter:checked").val(); + var who = $("#wholeword_filter:checked").val(); + if (!who) { + who = false; } - var time=$("#days_filter").val()*24*60*60+$("#hours_filter").val()*60*60+$("#mins_filter").val()*60; - var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if($("#filter-edit-id").val()){ - var start = "https://" + domain + "/api/v1/filters/"+$("#filter-edit-id").val(); - var method="PUT" - }else{ + var time = $("#days_filter").val() * 24 * 60 * 60 + $("#hours_filter").val() * 60 * 60 + $("#mins_filter").val() * 60; + var domain = localStorage.getItem("domain_" + acct_id); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if ($("#filter-edit-id").val()) { + var start = "https://" + domain + "/api/v1/filters/" + $("#filter-edit-id").val(); + var method = "PUT" + } else { var start = "https://" + domain + "/api/v1/filters" - var method="POST" + var method = "POST" } - + var httpreq = new XMLHttpRequest(); httpreq.open(method, start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); @@ -193,21 +193,21 @@ function makeNewFilter(){ phrase: phr, context: cont, irreversible: exc, - whole_word:who, - expires_in:time + whole_word: who, + expires_in: time })); - httpreq.onreadystatechange = function() { + httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { var json = httpreq.response; filter(); filterUpdate(acct_id) $("#filter-add-word").val(""); - $("#home_filter").prop("checked",false); - $("#local_filter").prop("checked",false); - $("#notf_filter").prop("checked",false); - $("#conv_filter").prop("checked",false); - $("#except_filter").prop("checked",false); - $("#wholeword_filter").prop("checked",false); + $("#home_filter").prop("checked", false); + $("#local_filter").prop("checked", false); + $("#notf_filter").prop("checked", false); + $("#conv_filter").prop("checked", false); + $("#except_filter").prop("checked", false); + $("#wholeword_filter").prop("checked", false); $("#days_filter").val("0"); $("#hours_filter").val("0"); $("#mins_filter").val("0"); @@ -216,70 +216,70 @@ function makeNewFilter(){ } } } -function filterEdit(id,acct_id){ - $("#filter-add-word").val(""); - $("#home_filter").prop("checked",false); - $("#local_filter").prop("checked",false); - $("#notf_filter").prop("checked",false); - $("#conv_filter").prop("checked",false); - $("#except_filter").prop("checked",false); - $("#wholeword_filter").prop("checked",false); - $("#days_filter").val("0"); - $("#hours_filter").val("0"); - $("#mins_filter").val("0"); +function filterEdit(id, acct_id) { + $("#filter-add-word").val(""); + $("#home_filter").prop("checked", false); + $("#local_filter").prop("checked", false); + $("#notf_filter").prop("checked", false); + $("#conv_filter").prop("checked", false); + $("#except_filter").prop("checked", false); + $("#wholeword_filter").prop("checked", false); + $("#days_filter").val("0"); + $("#hours_filter").val("0"); + $("#mins_filter").val("0"); $("#add-filter-btn").text(lang.lang_edit); $("#filter-edit-id").val(id); var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - var start = "https://" + domain + "/api/v1/filters/"+id + var at = localStorage.getItem("acct_" + acct_id + "_at"); + var start = "https://" + domain + "/api/v1/filters/" + id fetch(start, { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { + }).then(function (json) { if (json) { - var now = new Date() ; - now = now.getTime() ; - var now = Math.floor(now / 1000 ) ; + var now = new Date(); + now = now.getTime(); + var now = Math.floor(now / 1000); $("#filter-add-word").val(json.phrase); - Object.keys(json.context).forEach(function(key) { + Object.keys(json.context).forEach(function (key) { var context = json.context[key]; - $("[value="+context+"]").prop("checked",true); + $("[value=" + context + "]").prop("checked", true); }); - if(json.irreversible){ - $("#except_filter").prop("checked",true); + if (json.irreversible) { + $("#except_filter").prop("checked", true); } - if(json.whole_word){ - $("#wholeword_filter").prop("checked",true); + if (json.whole_word) { + $("#wholeword_filter").prop("checked", true); } - var expires=date(json.expires_at, 'unix')-now; - var mins=Math.floor(expires/60)%60; - var hours=Math.floor(expires/3600)%24; - var days=Math.floor(expires/3600/24); + var expires = date(json.expires_at, 'unix') - now; + var mins = Math.floor(expires / 60) % 60; + var hours = Math.floor(expires / 3600) % 24; + var days = Math.floor(expires / 3600 / 24); $("#days_filter").val(days); $("#hours_filter").val(hours); $("#mins_filter").val(mins); } }); } -function filterDel(id,acct_id){ +function filterDel(id, acct_id) { var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - var start = "https://" + domain + "/api/v1/filters/"+id; + var at = localStorage.getItem("acct_" + acct_id + "_at"); + var start = "https://" + domain + "/api/v1/filters/" + id; var httpreq = new XMLHttpRequest(); httpreq.open("DELETE", start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.responseType = "json"; httpreq.send(); - httpreq.onreadystatechange = function() { + httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { var json = httpreq.response; filter(); @@ -287,96 +287,96 @@ function filterDel(id,acct_id){ } } } -function getFilter(acct_id){ - var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(localStorage.getItem("mode_" + domain)!="misskey"){ - var start = "https://" + domain + "/api/v1/filters" - 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) { - localStorage.setItem("filter_"+ acct_id ,JSON.stringify(json)); - }); - }else{ - localStorage.setItem("filter_"+ acct_id ,JSON.stringify({})); +function getFilter(acct_id) { + var domain = localStorage.getItem("domain_" + acct_id); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) != "misskey") { + var start = "https://" + domain + "/api/v1/filters" + 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) { + localStorage.setItem("filter_" + acct_id, JSON.stringify(json)); + }); + } else { + localStorage.setItem("filter_" + acct_id, JSON.stringify({})); } } -function getFilterType(json,type){ - if(!json){ +function getFilterType(json, type) { + if (!json) { return []; } - if(type=="local"){ - type="public"; - }else if(type=="list"){ - type="home"; - }else if(type=="notf"){ - type="notifi"; + if (type == "local") { + type = "public"; + } else if (type == "list") { + type = "home"; + } else if (type == "notf") { + type = "notifi"; } - var mutedfilters=[]; - Object.keys(json).forEach(function(key) { + var mutedfilters = []; + Object.keys(json).forEach(function (key) { var filterword = json[key]; var phrases = filterword.phrase; - if(filterword.context.join(",").indexOf(type)!== -1){ + if (filterword.context.join(",").indexOf(type) !== -1) { mutedfilters.push(phrases); } }); return mutedfilters; } -function filterUpdate(acct_id){ +function filterUpdate(acct_id) { var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - var start = "https://" + domain + "/api/v1/filters" + var at = localStorage.getItem("acct_" + acct_id + "_at"); + var start = "https://" + domain + "/api/v1/filters" fetch(start, { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - localStorage.setItem("filter_"+ acct_id ,JSON.stringify(json)); - filterUpdateInternal(json,"home"); - filterUpdateInternal(json,"local"); - filterUpdateInternal(json,"notf"); - filterUpdateInternal(json,"pub"); + }).then(function (json) { + localStorage.setItem("filter_" + acct_id, JSON.stringify(json)); + filterUpdateInternal(json, "home"); + filterUpdateInternal(json, "local"); + filterUpdateInternal(json, "notf"); + filterUpdateInternal(json, "pub"); }); - - + + } -function filterUpdateInternal(json,type){ - var home=getFilterType(json,type); - var wordmute = localStorage.getItem("word_mute"); - if(wordmute){ - var wordmute = JSON.parse(wordmute); - home = home.concat(wordmute); - } - if(home){ - $("[data-acct="+acct_id+"] [data-type="+type+"] .cvo").each(function(i, elem) { - var id=$(elem).attr("toot-id"); - $("[toot-id="+id+"]").removeClass("hide"); - var text=$(elem).find('.toot').html(); - Object.keys(home).forEach(function(key8) { - var word = home[key8]; - var regExp = new RegExp( word, "g" ); - if($.strip_tags(text).match(regExp)){ - $("[toot-id="+id+"]").addClass("hide"); - } - }); +function filterUpdateInternal(json, type) { + var home = getFilterType(json, type); + var wordmute = localStorage.getItem("word_mute"); + if (wordmute) { + var wordmute = JSON.parse(wordmute); + home = home.concat(wordmute); + } + if (home) { + $("[data-acct=" + acct_id + "] [data-type=" + type + "] .cvo").each(function (i, elem) { + var id = $(elem).attr("toot-id"); + $("[toot-id=" + id + "]").removeClass("hide"); + var text = $(elem).find('.toot').html(); + Object.keys(home).forEach(function (key8) { + var word = home[key8]; + var regExp = new RegExp(word, "g"); + if ($.strip_tags(text).match(regExp)) { + $("[toot-id=" + id + "]").addClass("hide"); + } }); - } + }); + } } /* リセット
*/ //通知フィルター -function exclude(key){ - var excludetxt=""; - if($('#exc-reply-'+key+':checked').val()){ - excludetxt="?exclude_types[]=mention" - var reply=true - }else{ - var reply=false; +function exclude(key) { + var excludetxt = ""; + if ($('#exc-reply-' + key + ':checked').val()) { + excludetxt = "?exclude_types[]=mention" + var reply = true + } else { + var reply = false; } - if($('#exc-fav-'+key+':checked').val()){ - if(reply){ - excludetxt=excludetxt+"&exclude_types[]=favourite" - }else{ - excludetxt="?exclude_types[]=favourite" + if ($('#exc-fav-' + key + ':checked').val()) { + if (reply) { + excludetxt = excludetxt + "&exclude_types[]=favourite" + } else { + excludetxt = "?exclude_types[]=favourite" } - var fav=true - }else{ - var fav=false; + var fav = true + } else { + var fav = false; } - if($('#exc-bt-'+key+':checked').val()){ - if(reply || fav){ - excludetxt=excludetxt+"&exclude_types[]=reblog" - }else{ - excludetxt="?exclude_types[]=reblog" + if ($('#exc-bt-' + key + ':checked').val()) { + if (reply || fav) { + excludetxt = excludetxt + "&exclude_types[]=reblog" + } else { + excludetxt = "?exclude_types[]=reblog" } - var bt=true - }else{ - var bt=false; + var bt = true + } else { + var bt = false; } - if($('#exc-follow-'+key+':checked').val()){ - if(reply || bt || fav){ - excludetxt=excludetxt+"&exclude_types[]=follow" - }else{ - excludetxt="?exclude_types[]=follow" + if ($('#exc-follow-' + key + ':checked').val()) { + if (reply || bt || fav) { + excludetxt = excludetxt + "&exclude_types[]=follow" + } else { + excludetxt = "?exclude_types[]=follow" } - var follow=true; - }else{ - var follow=false; + var follow = true; + } else { + var follow = false; } - if($('#exc-poll-'+key+':checked').val()){ - if(reply || bt || fav || follow){ - excludetxt=excludetxt+"&exclude_types[]=poll" - }else{ - excludetxt="?exclude_types[]=poll" + if ($('#exc-poll-' + key + ':checked').val()) { + if (reply || bt || fav || follow) { + excludetxt = excludetxt + "&exclude_types[]=poll" + } else { + excludetxt = "?exclude_types[]=poll" } - }else{ + } else { } - localStorage.setItem("exclude-"+key,excludetxt) + localStorage.setItem("exclude-" + key, excludetxt) parseColumn(); } -function excludeCk(key,target){ - var exc=localStorage.getItem("exclude-"+key); - if(!exc){ +function excludeCk(key, target) { + var exc = localStorage.getItem("exclude-" + key); + if (!exc) { return ""; } - if(~exc.indexOf(target)){ + if (~exc.indexOf(target)) { return "checked" - }else{ + } else { return ""; } } \ No newline at end of file diff --git a/app/js/tl/list.js b/app/js/tl/list.js index 6e5eb977..e2d4bf5e 100644 --- a/app/js/tl/list.js +++ b/app/js/tl/list.js @@ -1,44 +1,44 @@ -function listMenu(){ - $("#left-menu div").removeClass("active"); +function listMenu() { + $("#left-menu div").removeClass("active"); $("#listMenu").addClass("active"); $(".menu-content").addClass("hide"); - $("#list-box").removeClass("hide"); + $("#list-box").removeClass("hide"); $('ul.tabs').tabs('select_tab', 'src-sta'); $("#src-contents").html(""); } -function list(){ - $("#lists-user").html(""); - var acct_id = $("#list-acct-sel").val(); - var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(localStorage.getItem("mode_" + domain)=="misskey"){ +function list() { + $("#lists-user").html(""); + var acct_id = $("#list-acct-sel").val(); + var domain = localStorage.getItem("domain_" + acct_id); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) == "misskey") { var start = "https://" + domain + "/api/users/lists/list" fetch(start, { method: 'POST', body: JSON.stringify({ - i:at + i: at }), - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { + }).then(function (json) { if (json) { var lists = ""; - Object.keys(json).forEach(function(key) { + Object.keys(json).forEach(function (key) { var list = json[key]; - lists = lists + escapeHTML(list.title)+':'+lang.lang_list_show+'
'; + lists = lists + escapeHTML(list.title) + ':' + lang.lang_list_show + '
'; }); $("#lists").html(lists); - }else{ + } else { $("#lists").html(lang.lang_list_nodata); } }); - }else{ + } else { var start = "https://" + domain + "/api/v1/lists" fetch(start, { method: 'GET', @@ -46,196 +46,196 @@ function list(){ 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { + }).then(function (json) { if (json) { var lists = ""; - Object.keys(json).forEach(function(key) { + Object.keys(json).forEach(function (key) { var list = json[key]; - lists = lists + escapeHTML(list.title)+':'+lang.lang_list_show+'/'+lang.lang_list_users+'
'; + lists = lists + escapeHTML(list.title) + ':' + lang.lang_list_show + '/' + lang.lang_list_users + '
'; }); $("#lists").html(lists); - }else{ + } else { $("#lists").html(lang.lang_list_nodata); } }); } } -function makeNewList(){ - var acct_id = $("#list-acct-sel").val(); - var text=$("#list-add").val(); - var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(localStorage.getItem("mode_" + domain)!="misskey"){ - var start = "https://" + domain + "/api/v1/lists" - var httpreq = new XMLHttpRequest(); - httpreq.open('POST', start, true); - httpreq.setRequestHeader('Content-Type', 'application/json'); - httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = "json"; - httpreq.send(JSON.stringify({ - title: text - })); - httpreq.onreadystatechange = function() { - if (httpreq.readyState === 4) { - var json = httpreq.response; - list(); - $("#list-add").val("") +function makeNewList() { + var acct_id = $("#list-acct-sel").val(); + var text = $("#list-add").val(); + var domain = localStorage.getItem("domain_" + acct_id); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) != "misskey") { + var start = "https://" + domain + "/api/v1/lists" + var httpreq = new XMLHttpRequest(); + httpreq.open('POST', start, true); + httpreq.setRequestHeader('Content-Type', 'application/json'); + httpreq.setRequestHeader('Authorization', 'Bearer ' + at); + httpreq.responseType = "json"; + httpreq.send(JSON.stringify({ + title: text + })); + httpreq.onreadystatechange = function () { + if (httpreq.readyState === 4) { + var json = httpreq.response; + list(); + $("#list-add").val("") + } } - } -}else{ - var start = "https://" + domain + "/api/users/lists/create" - var httpreq = new XMLHttpRequest(); - httpreq.open('POST', start, true); - httpreq.setRequestHeader('Content-Type', 'application/json'); - httpreq.responseType = "json"; - httpreq.send(JSON.stringify({ - i:at, - title: text - })); - httpreq.onreadystatechange = function() { - if (httpreq.readyState === 4) { - var json = httpreq.response; - list(); - $("#list-add").val("") + } else { + var start = "https://" + domain + "/api/users/lists/create" + var httpreq = new XMLHttpRequest(); + httpreq.open('POST', start, true); + httpreq.setRequestHeader('Content-Type', 'application/json'); + httpreq.responseType = "json"; + httpreq.send(JSON.stringify({ + i: at, + title: text + })); + httpreq.onreadystatechange = function () { + if (httpreq.readyState === 4) { + var json = httpreq.response; + list(); + $("#list-add").val("") + } } } } +function listShow(id, title, acct_id) { + localStorage.setItem("list_" + id + "_" + acct_id, title); + tl('list', id, acct_id, 'add'); } -function listShow(id,title,acct_id){ - localStorage.setItem("list_"+id+"_"+acct_id,title); - tl('list',id,acct_id,'add'); -} -function listUser(id,acct_id){ - var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - var start = "https://" + domain + "/api/v1/lists/"+id+"/accounts" +function listUser(id, acct_id) { + var domain = localStorage.getItem("domain_" + acct_id); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + var start = "https://" + domain + "/api/v1/lists/" + id + "/accounts" fetch(start, { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { + }).then(function (json) { if (json) { var lists = ""; - var templete = userparse(json,'',acct_id); - if(!json[0]){ - templete=lang.lang_list_nouser; - } + var templete = userparse(json, '', acct_id); + if (!json[0]) { + templete = lang.lang_list_nouser; + } $("#lists-user").html(templete); - }else{ - $("#lists-user").html(lang.lang_list_nouser); - } + } else { + $("#lists-user").html(lang.lang_list_nouser); + } }); } -function hisList(user,acct_id){ - var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(localStorage.getItem("mode_" + domain)!="misskey"){ - var start = "https://" + domain + "/api/v1/lists" - 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) { - if (json) { - var lists = lang.lang_list_add+"
"; - Object.keys(json).forEach(function(key) { - var list = json[key]; - lists = lists + ''+escapeHTML(list.title)+'
'; - }); - $("#his-lists-a").html(lists); - }else{ - $("#his-lists-a").html(lang.lang_list_nodata); - } - }); - var start = "https://" + domain + "/api/v1/accounts/"+user+"/lists" - 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) { - if (json) { - var lists = lang.lang_list_remove+"
"; - Object.keys(json).forEach(function(key) { - var list = json[key]; - lists = lists + ''+escapeHTML(list.title)+'
'; - }); - $("#his-lists-b").html(lists); - }else{ - $("#his-lists-b").html(lang.lang_list_nodata); - } - }); -}else{ - var start = "https://" + domain + "/api/users/lists/list" +function hisList(user, acct_id) { + var domain = localStorage.getItem("domain_" + acct_id); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) != "misskey") { + var start = "https://" + domain + "/api/v1/lists" + 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) { + if (json) { + var lists = lang.lang_list_add + "
"; + Object.keys(json).forEach(function (key) { + var list = json[key]; + lists = lists + '' + escapeHTML(list.title) + '
'; + }); + $("#his-lists-a").html(lists); + } else { + $("#his-lists-a").html(lang.lang_list_nodata); + } + }); + var start = "https://" + domain + "/api/v1/accounts/" + user + "/lists" + 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) { + if (json) { + var lists = lang.lang_list_remove + "
"; + Object.keys(json).forEach(function (key) { + var list = json[key]; + lists = lists + '' + escapeHTML(list.title) + '
'; + }); + $("#his-lists-b").html(lists); + } else { + $("#his-lists-b").html(lang.lang_list_nodata); + } + }); + } else { + var start = "https://" + domain + "/api/users/lists/list" fetch(start, { method: 'POST', body: JSON.stringify({ - i:at + i: at }), - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { + }).then(function (json) { if (json) { var lists = ""; - Object.keys(json).forEach(function(key) { + Object.keys(json).forEach(function (key) { var list = json[key]; - lists = lists + list.title+':'+lang.lang_list_show+'/'+lang.lang_list_add+lang.lang_list_add_misskey+'
'; + lists = lists + list.title + ':' + lang.lang_list_show + '/' + lang.lang_list_add + lang.lang_list_add_misskey + '
'; }); $("#his-lists-a").html(lists); - }else{ + } else { $("#his-lists-a").html(lang.lang_list_nodata); } }); $("#his-lists-b").html(""); + } } -} -function listAdd(id,user,acct_id){ - var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(localStorage.getItem("mode_" + domain)=="misskey"){ +function listAdd(id, user, acct_id) { + var domain = localStorage.getItem("domain_" + acct_id); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) == "misskey") { var start = "https://" + domain + "/api/users/lists/push" - var i={ - i:at, - listId:id, - userId:user + var i = { + i: at, + listId: id, + userId: user } - }else{ - var start = "https://" + domain + "/api/v1/lists/"+id+"/accounts" - var i={ + } else { + var start = "https://" + domain + "/api/v1/lists/" + id + "/accounts" + var i = { account_ids: [user] } } @@ -245,28 +245,28 @@ function listAdd(id,user,acct_id){ httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.responseType = "json"; httpreq.send(JSON.stringify(i)); - httpreq.onreadystatechange = function() { + httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { var json = httpreq.response; - hisList(user,acct_id) + hisList(user, acct_id) } } } -function listRemove(id,user,acct_id){ - var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(localStorage.getItem("mode_" + domain)=="misskey"){ +function listRemove(id, user, acct_id) { + var domain = localStorage.getItem("domain_" + acct_id); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) == "misskey") { var start = "https://" + domain + "/api/users/lists/push" - var method='POST' - var i={ - i:at, - listId:id, - userId:user + var method = 'POST' + var i = { + i: at, + listId: id, + userId: user } - }else{ - var start = "https://" + domain + "/api/v1/lists/"+id+"/accounts" - var method='DELETE' - var i={ + } else { + var start = "https://" + domain + "/api/v1/lists/" + id + "/accounts" + var method = 'DELETE' + var i = { account_ids: [user] } } @@ -276,10 +276,10 @@ function listRemove(id,user,acct_id){ httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.responseType = "json"; httpreq.send(JSON.stringify(i)); - httpreq.onreadystatechange = function() { + httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { var json = httpreq.response; - hisList(user,acct_id) + hisList(user, acct_id) } } } \ No newline at end of file diff --git a/app/js/tl/misskeyparse.js b/app/js/tl/misskeyparse.js index e5fcc35c..9fb01783 100644 --- a/app/js/tl/misskeyparse.js +++ b/app/js/tl/misskeyparse.js @@ -749,10 +749,10 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) { 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 riphide="hide" + 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 riphide = "hide" var fullhide = "hide"; } - if (!addReact && likehide == "hide" && lovehide == "hide" && laughhide == "hide" && hmmhide == "hide" && suphide == "hide" && conghide == "hide" && anghide == "hide" && confhide == "hide" && riphide=="hide") { + if (!addReact && likehide == "hide" && lovehide == "hide" && laughhide == "hide" && hmmhide == "hide" && suphide == "hide" && conghide == "hide" && anghide == "hide" && confhide == "hide" && riphide == "hide") { var fullhide = "hide"; } if (toot.myReaction) { @@ -857,11 +857,11 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) { //オブジェクトパーサー(ユーザーデータ) function misskeyUserparse(obj, auth, acct_id, tlid, popup) { - console.log(["Parse them ",obj]) + console.log(["Parse them ", obj]) if (popup > 0 || popup == -1) { } else { - if(obj.users){ + if (obj.users) { var obj = obj.users; } } @@ -869,10 +869,10 @@ function misskeyUserparse(obj, auth, acct_id, tlid, popup) { var datetype = localStorage.getItem("datetype"); Object.keys(obj).forEach(function (key) { var toot = obj[key]; - if(toot.followee){ - toot=toot.followee - }else if(toot.follower){ - toot=toot.follower + if (toot.followee) { + toot = toot.followee + } else if (toot.follower) { + toot = toot.follower } var locked = ""; if (auth) { @@ -930,15 +930,15 @@ function misskeyUserparse(obj, auth, acct_id, tlid, popup) { } else { var dis_name = toot.username; } - if(toot.followersCount){ - var ferct=toot.followersCount - }else{ - var ferct="unknown" + if (toot.followersCount) { + var ferct = toot.followersCount + } else { + var ferct = "unknown" } - if(toot.followingCount){ - var fingct=toot.followingCount - }else{ - var fingct="unknown" + if (toot.followingCount) { + var fingct = toot.followingCount + } else { + var fingct = "unknown" } templete = templete + '' + ''; }); @@ -879,67 +879,67 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { function userparse(obj, auth, acct_id, tlid, popup) { //独自ロケール var locale = localStorage.getItem("locale"); - if(locale=="yes"){ - var locale=false; + if (locale == "yes") { + var locale = false; } var templete = ''; var datetype = localStorage.getItem("datetype"); - Object.keys(obj).forEach(function(key) { + Object.keys(obj).forEach(function (key) { var toot = obj[key]; - console.log(["Parsing",toot]) - if(!toot.username){ - var raw=toot; - toot=toot.account; - var notf=true; - }else{ - var notf=false; + console.log(["Parsing", toot]) + if (!toot.username) { + var raw = toot; + toot = toot.account; + var notf = true; + } else { + var notf = false; } if (toot.locked) { var locked = ' '; } else { var locked = ""; } - if (auth=="request") { + 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)){ + 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+'' + @@ -973,98 +973,98 @@ function goGoogle(id) { shell.openExternal(url); } -var misskeyws=[] -var misskeywsstate=[] +var misskeyws = [] +var misskeywsstate = [] function connectMisskey(acct_id) { var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var start = "wss://" + domain + - "/streaming?i="+at; + "/streaming?i=" + at; var wsid = misskeyws.length; localStorage.setItem("misskey_wss_" + acct_id, wsid); misskeyws[wsid] = new WebSocket(start); misskeyws[wsid].onopen = function (mess) { - console.table({"tlid":tlid,"type":"Connect Streaming API","domain":domain,"message":[mess]}) - misskeywsstate[wsid]=true + console.table({ "tlid": tlid, "type": "Connect Streaming API", "domain": domain, "message": [mess] }) + misskeywsstate[wsid] = true //$("#notice_icon_" + tlid).removeClass("red-text"); - var send='{"type":"connect","body":{"channel":"main","id":"notf:'+acct_id+'"}}' + var send = '{"type":"connect","body":{"channel":"main","id":"notf:' + acct_id + '"}}' misskeyws[wsid].send(send) } misskeyws[wsid].onmessage = function (mess) { - console.log([domain + ":Receive Streaming API:",data]); - var data=JSON.parse(mess.data) - var obj=data.body.body - - if (data.body.id.indexOf("notf:")!== -1) { + console.log([domain + ":Receive Streaming API:", data]); + var data = JSON.parse(mess.data) + var obj = data.body.body + + if (data.body.id.indexOf("notf:") !== -1) { var obj = JSON.parse(mess.data).body; console.log(obj); var popup = localStorage.getItem("popup"); if (!popup) { popup = 0; } - if(JSON.parse(mess.data).body.type!="follow"){ - + if (JSON.parse(mess.data).body.type != "follow") { + templete = misskeyParse([obj.body], 'notf', acct_id, 'notf', popup); - }else{ + } else { templete = misskeyUserparse([obj.body], 'notf', acct_id, 'notf', popup); } - if(JSON.parse(mess.data).body.type=="reaction"){ + if (JSON.parse(mess.data).body.type == "reaction") { console.log("reaction refresh") - reactRefresh(acct_id,obj.body.note.id) + reactRefresh(acct_id, obj.body.note.id) } - if(!$("div[data-notfIndv=" + acct_id +"_"+obj.body.id+"]").length){ - $("div[data-notf=" + acct_id +"]").prepend(templete); - $("div[data-const=notf_"+acct_id+"]").prepend(templete); + if (!$("div[data-notfIndv=" + acct_id + "_" + obj.body.id + "]").length) { + $("div[data-notf=" + acct_id + "]").prepend(templete); + $("div[data-const=notf_" + acct_id + "]").prepend(templete); } jQuery("time.timeago").timeago(); - }else if (data.body.type == "note") { - var tlid=data.body.id*1 - var multi = localStorage.getItem("column"); - var col = JSON.parse(multi)[tlid]; - if(localStorage.getItem("voice_" + tlid)){ - var voice=true; - }else{ - var voice=false; - } - if (voice) { - say(obj.text) - } - var templete = misskeyParse([obj], col.type, acct_id, tlid, "", mute); - misskeyws[wsid].send(JSON.stringify({ - type: 'sn', - body: { - id: obj.id - } - })) - var pool = localStorage.getItem("pool_" + tlid); - if (pool) { - pool = templete + pool; - } else { - pool = templete - } - localStorage.setItem("pool_" + tlid, pool); - scrollck(); - jQuery("time.timeago").timeago(); - }else if (data.type == "noteUpdated") { - if(data.body.type=="reacted"){ - reactRefresh(acct_id,data.body.id) - }else if(data.body.type=="deleted"){ - $("#pub_"+data.body.id).hide(); - $("#pub_"+data.body.id).remove(); - } - + } else if (data.body.type == "note") { + var tlid = data.body.id * 1 + var multi = localStorage.getItem("column"); + var col = JSON.parse(multi)[tlid]; + if (localStorage.getItem("voice_" + tlid)) { + var voice = true; + } else { + var voice = false; } + if (voice) { + say(obj.text) + } + var templete = misskeyParse([obj], col.type, acct_id, tlid, "", mute); + misskeyws[wsid].send(JSON.stringify({ + type: 'sn', + body: { + id: obj.id + } + })) + var pool = localStorage.getItem("pool_" + tlid); + if (pool) { + pool = templete + pool; + } else { + pool = templete + } + localStorage.setItem("pool_" + tlid, pool); + scrollck(); + jQuery("time.timeago").timeago(); + } else if (data.type == "noteUpdated") { + if (data.body.type == "reacted") { + reactRefresh(acct_id, data.body.id) + } else if (data.body.type == "deleted") { + $("#pub_" + data.body.id).hide(); + $("#pub_" + data.body.id).remove(); + } + + } } misskeyws[wsid].onerror = function (error) { - console.error("Error closing "+tlid); + console.error("Error closing " + tlid); console.error(error); - misskeywsstate[wsid]=false + misskeywsstate[wsid] = false connectMisskey(acct_id) return false; }; misskeyws[wsid].onclose = function () { - console.warn("Closing "+tlid); - misskeywsstate[wsid]=false + console.warn("Closing " + tlid); + misskeywsstate[wsid] = false connectMisskey(acct_id) return false; }; diff --git a/app/js/tl/mix.js b/app/js/tl/mix.js index 63126a0e..77bf0fad 100644 --- a/app/js/tl/mix.js +++ b/app/js/tl/mix.js @@ -1,127 +1,127 @@ //Integrated TL -function mixtl(acct_id, tlid, type,delc,voice) { +function mixtl(acct_id, tlid, type, delc, voice) { localStorage.removeItem("morelock") localStorage.setItem("now", type); todo("Integrated TL Loading...(Local)"); - //まずLocal - var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - var start = "https://" + domain + "/api/v1/timelines/public?local=true"; + //まずLocal + var domain = localStorage.getItem("domain_" + acct_id); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + var start = "https://" + domain + "/api/v1/timelines/public?local=true"; fetch(start, { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(jsonL) { - var start = "https://" + domain + "/api/v1/timelines/home"; - 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(jsonH) { - var homearr=[]; - var timeline = jsonL.concat(jsonH); - timeline.sort(function(a,b){ - if(date(a.created_at,"unix")>=date(b.created_at,"unix")) return -1; - if(date(a.created_at,"unix")'; - break; + var tickerdom = ""; + if (ticker) { + var tickerdata = localStorage.getItem("ticker") + if (tickerdata) { + var tickerdata = JSON.parse(tickerdata); + + var thisdomain = toot.account.acct.split("@"); + if (thisdomain.length > 1) { + thisdomain = thisdomain[1]; } - } - } + for (var i = 0; i < tickerdata.length; i++) { + var value = tickerdata[i]; + if (value.domain == thisdomain) { + var tickerdom = '= date(b.created_at, "unix")) return -1; + if (date(a.created_at, "unix") < date(b.created_at, "unix")) return 1; + return 0; }); - if(type=="integrated"){ + if (type == "integrated") { timeline.splice(20); } - var templete=""; - Object.keys(timeline).forEach(function(key) { - var pkey=key*1+1; - if(pkey 10){ - reconnector(tlid,type,acct_id,data) - }else{ - localStorage.setItem("delete",del*1+1) + if (del > 10) { + reconnector(tlid, type, acct_id, data) + } else { + localStorage.setItem("delete", del * 1 + 1) } - if(delc=="true"){ + if (delc == "true") { $("[toot-id=" + JSON.parse(mess.data).payload + "]").addClass("emphasized"); $("[toot-id=" + JSON.parse(mess.data).payload + "]").addClass("by_delcatch"); - }else{ + } else { $("[toot-id=" + JSON.parse(mess.data).payload + "]").hide(); $("[toot-id=" + JSON.parse(mess.data).payload + "]").remove(); } } else if (type == "update") { localStorage.removeItem("delete"); - if(TLtype=="integrated"){ + if (TLtype == "integrated") { var templete = parse([obj], '', acct_id, tlid); - }else if(TLtype=="plus"){ - if(obj.account.acct==obj.account.username){ - var templete = parse([obj], '', acct_id, tlid,"",mute, "mix"); - }else{ - var templete=""; + } else if (TLtype == "plus") { + if (obj.account.acct == obj.account.username) { + var templete = parse([obj], '', acct_id, tlid, "", mute, "mix"); + } else { + var templete = ""; } } - if($("#timeline_" + tlid +" [toot-id=" + obj.id + "]").length < 1){ - if(voice){ + if ($("#timeline_" + tlid + " [toot-id=" + obj.id + "]").length < 1) { + if (voice) { say(obj.content) - } - var templete = parse([obj], type, acct_id, tlid,"",mute,"mix"); + } + var templete = parse([obj], type, acct_id, tlid, "", mute, "mix"); var pool = localStorage.getItem("pool_" + tlid); if (pool) { pool = templete + pool; @@ -180,148 +180,148 @@ function mixre(acct_id, tlid, TLtype, mute,delc,voice,mode) { pool = templete } localStorage.setItem("pool_" + tlid, pool); - + scrollck(); - + additional(acct_id, tlid); jQuery("time.timeago").timeago(); - }else{ + } else { todo("二重取得発生中"); } } } - websocketLocal[wslid].onerror = function(error) { + websocketLocal[wslid].onerror = function (error) { console.error('WebSocketLocal Error') console.error(error); - if(mode=="error"){ + if (mode == "error") { $("#notice_icon_" + tlid).addClass("red-text"); todo('WebSocket Error ' + error); - }else{ - var errorct=localStorage.getItem("wserror_" + tlid)*1+1; - localStorage.setItem("wserror_" + tlid,errorct); - if(errorct<3){ - reconnector(tlid,TLtype,acct_id,"","error"); + } else { + var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1; + localStorage.setItem("wserror_" + tlid, errorct); + if (errorct < 3) { + reconnector(tlid, TLtype, acct_id, "", "error"); } } }; - websocketLocal[wslid].onclose = function() { + websocketLocal[wslid].onclose = function () { console.warn('WebSocketLocal Closing:' + tlid); - if(mode=="error"){ + if (mode == "error") { $("#notice_icon_" + tlid).addClass("red-text"); todo('WebSocket Closed'); - }else{ - var errorct=localStorage.getItem("wserror_" + tlid)*1+1; - localStorage.setItem("wserror_" + tlid,errorct); - if(errorct<3){ - reconnector(tlid,TLtype,acct_id,"","error"); + } else { + var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1; + localStorage.setItem("wserror_" + tlid, errorct); + if (errorct < 3) { + reconnector(tlid, TLtype, acct_id, "", "error"); } } }; - websocketHome[wshid].onerror = function(error) { - console.error(['WebSocketHome Error',error]) - if(mode=="error"){ + websocketHome[wshid].onerror = function (error) { + console.error(['WebSocketHome Error', error]) + if (mode == "error") { $("#notice_icon_" + tlid).addClass("red-text"); todo('WebSocket Error ' + error); - }else{ - var errorct=localStorage.getItem("wserror_" + tlid)*1+1; - localStorage.setItem("wserror_" + tlid,errorct); - if(errorct<3){ - reconnector(tlid,TLtype,acct_id,"","error"); + } else { + var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1; + localStorage.setItem("wserror_" + tlid, errorct); + if (errorct < 3) { + reconnector(tlid, TLtype, acct_id, "", "error"); } } }; - websocketHome[wshid].onclose = function() { + websocketHome[wshid].onclose = function () { console.warn('WebSocketHome Closing:' + tlid); - if(mode=="error"){ + if (mode == "error") { $("#notice_icon_" + tlid).addClass("red-text"); todo('WebSocket Closed'); - }else{ - var errorct=localStorage.getItem("wserror_" + tlid)*1+1; - localStorage.setItem("wserror_" + tlid,errorct); - if(errorct<3){ - reconnector(tlid,TLtype,acct_id,"","error"); + } else { + var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1; + localStorage.setItem("wserror_" + tlid, errorct); + if (errorct < 3) { + reconnector(tlid, TLtype, acct_id, "", "error"); } } - + }; } //ある程度のスクロールで発火 -function mixmore(tlid,type) { +function mixmore(tlid, type) { var multi = localStorage.getItem("column"); var obj = JSON.parse(multi); var acct_id = obj[tlid].domain; - moreloading=true; + moreloading = true; todo("Integrated TL MoreLoading...(Local)"); var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var sid = $("#timeline_" + tlid + " .cvo").last().attr("unique-id"); - var start = "https://" + domain + "/api/v1/timelines/public?local=true&max_id="+sid; + var start = "https://" + domain + "/api/v1/timelines/public?local=true&max_id=" + sid; fetch(start, { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(jsonL) { - var start = "https://" + domain + "/api/v1/timelines/home?max_id="+sid; - 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(jsonH) { - var homearr=[]; - var timeline = jsonL.concat(jsonH); - timeline.sort(function(a,b){ - if(date(a.created_at,"unix")>date(b.created_at,"unix")) return -1; - if(date(a.created_at,"unix") date(b.created_at, "unix")) return -1; + if (date(a.created_at, "unix") < date(b.created_at, "unix")) return 1; + return 0; + }); + timeline.splice(20); + var templete = ""; + Object.keys(timeline).forEach(function (key) { + var pkey = key * 1 + 1; + if (pkey < 20) { + if (date(timeline[key].created_at, "unix") != date(timeline[pkey].created_at, "unix")) { + if (localStorage.getItem("filter_" + acct_id) != "undefined") { + var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), "mix"); + } else { + var mute = []; } - if(type=="integrated"){ - templete = templete+parse([timeline[key]], '', acct_id, tlid,"",mute,"mix"); - }else if(type=="plus"){ - if(timeline[key].account.acct==timeline[key].account.username){ - templete = templete+parse([timeline[key]], '', acct_id, tlid,"",mute,"mix"); + if (type == "integrated") { + templete = templete + parse([timeline[key]], '', acct_id, tlid, "", mute, "mix"); + } else if (type == "plus") { + if (timeline[key].account.acct == timeline[key].account.username) { + templete = templete + parse([timeline[key]], '', acct_id, tlid, "", mute, "mix"); } } - } - } + } + } - }); - - $("#timeline_" + tlid).append(templete); + }); + + $("#timeline_" + tlid).append(templete); additional(acct_id, tlid); jQuery("time.timeago").timeago(); - moreloading=false; + moreloading = false; todc(); - }); + }); }); - + } diff --git a/app/js/tl/notification.js b/app/js/tl/notification.js index 55ee6390..4f5de095 100644 --- a/app/js/tl/notification.js +++ b/app/js/tl/notification.js @@ -1,144 +1,144 @@ //通知 //取得+Streaming接続 -function notf(acct_id, tlid, sys){ +function notf(acct_id, tlid, sys) { if (sys == "direct") { notfColumn(acct_id, tlid, sys) } else { notfCommon(acct_id, tlid, sys) } } -function notfColumn(acct_id, tlid, sys){ +function notfColumn(acct_id, tlid, sys) { todo("Notifications Loading..."); - var native=localStorage.getItem("nativenotf"); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(!native){ - native="yes"; + var native = localStorage.getItem("nativenotf"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (!native) { + native = "yes"; } var domain = localStorage.getItem("domain_" + acct_id); var httpreq = new XMLHttpRequest(); - if(localStorage.getItem("mode_" + domain)=="misskey"){ - var misskey=true; + if (localStorage.getItem("mode_" + domain) == "misskey") { + var misskey = true; var start = "https://" + domain + "/api/i/notifications"; httpreq.open("POST", start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); - var body=JSON.stringify({ - i:at + var body = JSON.stringify({ + i: at }); - }else{ - var misskey=false; - if(localStorage.getItem("exclude-"+tlid)){ - var exc=localStorage.getItem("exclude-"+tlid); - }else{ - var exc=""; + } else { + var misskey = false; + if (localStorage.getItem("exclude-" + tlid)) { + var exc = localStorage.getItem("exclude-" + tlid); + } else { + var exc = ""; } - var start = "https://" + domain + "/api/v1/notifications"+exc; + var start = "https://" + domain + "/api/v1/notifications" + exc; httpreq.open("GET", start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - var body=""; + var body = ""; } - + httpreq.responseType = "json"; httpreq.send(body); - httpreq.onreadystatechange = function() { + httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { var json = httpreq.response; var max_id = httpreq.getResponseHeader("link"); - if(max_id){ - max_id=max_id.match(/[?&]{1}max_id=([0-9]+)/)[1] + if (max_id) { + max_id = max_id.match(/[?&]{1}max_id=([0-9]+)/)[1] } - if(json[0]){ - var templete=""; - var lastnotf=localStorage.getItem("lastnotf_" + acct_id); - localStorage.setItem("lastnotf_" + acct_id,json[0].id); - Object.keys(json).forEach(function(key) { + if (json[0]) { + var templete = ""; + var lastnotf = localStorage.getItem("lastnotf_" + acct_id); + localStorage.setItem("lastnotf_" + acct_id, json[0].id); + Object.keys(json).forEach(function (key) { var obj = json[key]; - if(lastnotf==obj.id && key>0 && native=="yes"){ - var ct=key; - if(key>14){ - ct="15+"; + if (lastnotf == obj.id && key > 0 && native == "yes") { + var ct = key; + if (key > 14) { + ct = "15+"; } var electron = require("electron"); var ipc = electron.ipcRenderer; var os = electron.remote.process.platform; - var options = { - body: ct+lang.lang_notf_new, - icon: localStorage.getItem("prof_"+acct_id) - }; - if(os=="darwin"){ - var n = new Notification('TheDesk:'+domain, options); - }else{ - ipc.send('native-notf', ['TheDesk:'+domain,ct+lang.lang_notf_new,localStorage.getItem("prof_"+acct_id)]); - } - - } - if(localStorage.getItem("filter_"+ acct_id)!="undefined"){ - var mute=getFilterType(JSON.parse(localStorage.getItem("filter_"+ acct_id)),"notif"); - }else{ - var mute=[]; - } - if(obj.type!="follow"){ - if(misskey){ - templete = templete+misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute); - }else{ - templete = templete+parse([obj], 'notf', acct_id, 'notf', -1, mute); + var options = { + body: ct + lang.lang_notf_new, + icon: localStorage.getItem("prof_" + acct_id) + }; + if (os == "darwin") { + var n = new Notification('TheDesk:' + domain, options); + } else { + ipc.send('native-notf', ['TheDesk:' + domain, ct + lang.lang_notf_new, localStorage.getItem("prof_" + acct_id)]); } - }else{ - if(misskey){ - templete = templete+misskeyUserparse([obj], 'notf', acct_id, 'notf', -1, mute); - }else{ - templete = templete+userparse([obj.account], 'notf', acct_id, 'notf', -1); + + } + if (localStorage.getItem("filter_" + acct_id) != "undefined") { + var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), "notif"); + } else { + var mute = []; + } + if (obj.type != "follow") { + if (misskey) { + templete = templete + misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute); + } else { + templete = templete + parse([obj], 'notf', acct_id, 'notf', -1, mute); } - + } else { + if (misskey) { + templete = templete + misskeyUserparse([obj], 'notf', acct_id, 'notf', -1, mute); + } else { + templete = templete + userparse([obj.account], 'notf', acct_id, 'notf', -1); + } + } }); - templete=templete+''; + templete = templete + ''; $("#timeline_" + tlid).html(templete); $("#landing_" + tlid).hide(); jQuery("time.timeago").timeago(); - } - $("#notf-box").addClass("fetched"); - todc(); + } + $("#notf-box").addClass("fetched"); + todc(); } } - if(!misskey){ - if(localStorage.getItem("streaming_" + acct_id)){ - var wss=localStorage.getItem("streaming_" + acct_id) - }else{ - var wss="wss://"+domain + if (!misskey) { + if (localStorage.getItem("streaming_" + acct_id)) { + var wss = localStorage.getItem("streaming_" + acct_id) + } else { + var wss = "wss://" + domain } var start = wss + "/api/v1/streaming/?stream=user&access_token=" + - at; - }else{ + at; + } else { var start = "wss://" + domain + "/?i=" + - at; + at; } } function notfCommon(acct_id, tlid, sys) { todo("Notifications Loading..."); - var native=localStorage.getItem("nativenotf"); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(!native){ - native="yes"; + var native = localStorage.getItem("nativenotf"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (!native) { + native = "yes"; } var domain = localStorage.getItem("domain_" + acct_id); - if(localStorage.getItem("mode_" + domain)=="misskey"){ - var misskey=true; + if (localStorage.getItem("mode_" + domain) == "misskey") { + var misskey = true; var start = "https://" + domain + "/api/i/notifications"; - var i={ + var i = { method: 'POST', headers: { 'content-type': 'application/json', }, - body:JSON.stringify({ - i:at + body: JSON.stringify({ + i: at }) } - }else{ - var misskey=false; + } else { + var misskey = false; var start = "https://" + domain + "/api/v1/notifications"; - var i={ + var i = { method: 'GET', headers: { 'content-type': 'application/json', @@ -146,231 +146,231 @@ function notfCommon(acct_id, tlid, sys) { }, } } - fetch(start, i).then(function(response) { - console.log("header to get param:"+response.headers.get('link')); + fetch(start, i).then(function (response) { + console.log("header to get param:" + response.headers.get('link')); return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - if(json[0]){ - var templete=""; - var lastnotf=localStorage.getItem("lastnotf_" + acct_id); - localStorage.setItem("lastnotf_" + acct_id,json[0].id); - Object.keys(json).forEach(function(key) { - var obj = json[key]; - if(lastnotf==obj.id && key>0 && native=="yes"){ - var ct=key; - if(key>14){ - ct="15+"; - } - var electron = require("electron"); - var ipc = electron.ipcRenderer; - var os = electron.remote.process.platform; - var options = { - body: ct+lang.lang_notf_new, - icon: localStorage.getItem("prof_"+acct_id) - }; - if(os=="darwin"){ - var n = new Notification('TheDesk:'+domain, options); - }else{ - ipc.send('native-notf', ['TheDesk:'+domain,ct+lang.lang_notf_new,localStorage.getItem("prof_"+acct_id)]); + }).then(function (json) { + if (json[0]) { + var templete = ""; + var lastnotf = localStorage.getItem("lastnotf_" + acct_id); + localStorage.setItem("lastnotf_" + acct_id, json[0].id); + Object.keys(json).forEach(function (key) { + var obj = json[key]; + if (lastnotf == obj.id && key > 0 && native == "yes") { + var ct = key; + if (key > 14) { + ct = "15+"; } - - } - if(localStorage.getItem("filter_"+ acct_id)!="undefined"){ - var mute=getFilterType(JSON.parse(localStorage.getItem("filter_"+ acct_id)),"notif"); - }else{ - var mute=[]; - } - if(obj.type!="follow"){ - if(misskey){ - templete = templete+misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute); - }else{ - templete = templete+parse([obj], 'notf', acct_id, 'notf', -1, mute); + var electron = require("electron"); + var ipc = electron.ipcRenderer; + var os = electron.remote.process.platform; + var options = { + body: ct + lang.lang_notf_new, + icon: localStorage.getItem("prof_" + acct_id) + }; + if (os == "darwin") { + var n = new Notification('TheDesk:' + domain, options); + } else { + ipc.send('native-notf', ['TheDesk:' + domain, ct + lang.lang_notf_new, localStorage.getItem("prof_" + acct_id)]); + } + } - }else{ - if(misskey){ - templete = templete+misskeyUserparse([obj], 'notf', acct_id, 'notf', -1, mute); - }else{ - templete = templete+userparse([obj.account], 'notf', acct_id, 'notf', -1); + if (localStorage.getItem("filter_" + acct_id) != "undefined") { + var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), "notif"); + } else { + var mute = []; } - - } - }); - $("div[data-notf=" + acct_id +"]").html(templete); - $("#landing_" + tlid).hide(); - jQuery("time.timeago").timeago(); + if (obj.type != "follow") { + if (misskey) { + templete = templete + misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute); + } else { + templete = templete + parse([obj], 'notf', acct_id, 'notf', -1, mute); + } + } else { + if (misskey) { + templete = templete + misskeyUserparse([obj], 'notf', acct_id, 'notf', -1, mute); + } else { + templete = templete + userparse([obj.account], 'notf', acct_id, 'notf', -1); + } + + } + }); + $("div[data-notf=" + acct_id + "]").html(templete); + $("#landing_" + tlid).hide(); + jQuery("time.timeago").timeago(); } $("#notf-box").addClass("fetched"); todc(); - notfWS(misskey,acct_id,tlid,domain,at) + notfWS(misskey, acct_id, tlid, domain, at) }); - + } -function notfWS(misskey,acct_id,tlid,domain,at){ - if(!misskey){ - if(localStorage.getItem("streaming_" + acct_id)){ - var wss=localStorage.getItem("streaming_" + acct_id) - }else{ - var wss="wss://"+domain +function notfWS(misskey, acct_id, tlid, domain, at) { + if (!misskey) { + if (localStorage.getItem("streaming_" + acct_id)) { + var wss = localStorage.getItem("streaming_" + acct_id) + } else { + var wss = "wss://" + domain } var start = wss + "/api/v1/streaming/?stream=user&access_token=" + - at; + at; - var wsid = websocketNotf.length; - websocketNotf[acct_id] = new WebSocket(start); - websocketNotf[acct_id].onopen = function(mess) { - console.table({"acct_id":acct_id,"type":"Connect Streaming API(Notf)","domain":domain,"message":[mess]}) - $("i[data-notf=" + acct_id +"]").removeClass("red-text"); + var wsid = websocketNotf.length; + websocketNotf[acct_id] = new WebSocket(start); + websocketNotf[acct_id].onopen = function (mess) { + console.table({ "acct_id": acct_id, "type": "Connect Streaming API(Notf)", "domain": domain, "message": [mess] }) + $("i[data-notf=" + acct_id + "]").removeClass("red-text"); - } - websocketNotf[acct_id].onmessage = function(mess) { - console.log(["Receive Streaming API(Notf):"+acct_id+"("+domain+")",JSON.parse(JSON.parse(mess.data).payload)]); - var popup = localStorage.getItem("popup"); + } + websocketNotf[acct_id].onmessage = function (mess) { + console.log(["Receive Streaming API(Notf):" + acct_id + "(" + domain + ")", JSON.parse(JSON.parse(mess.data).payload)]); + var popup = localStorage.getItem("popup"); if (!popup) { popup = 0; } - var obj = JSON.parse(JSON.parse(mess.data).payload); - var type = JSON.parse(mess.data).event; - if (type == "notification") { - var templete=""; - localStorage.setItem("lastnotf_" + acct_id,obj.id); - if(obj.type!="follow"){ - templete = parse([obj], 'notf', acct_id, 'notf', popup); - }else{ - templete = userparse([obj], 'notf', acct_id, 'notf', popup); + var obj = JSON.parse(JSON.parse(mess.data).payload); + var type = JSON.parse(mess.data).event; + if (type == "notification") { + var templete = ""; + localStorage.setItem("lastnotf_" + acct_id, obj.id); + if (obj.type != "follow") { + templete = parse([obj], 'notf', acct_id, 'notf', popup); + } else { + templete = userparse([obj], 'notf', acct_id, 'notf', popup); + } + if (!$("div[data-notfIndv=" + acct_id + "_" + obj.id + "]").length) { + $("div[data-notf=" + acct_id + "]").prepend(templete); + $("div[data-const=notf_" + acct_id + "]").prepend(templete); + } + jQuery("time.timeago").timeago(); + } else if (type == "delete") { + $("[toot-id=" + obj + "]").hide(); + $("[toot-id=" + obj + "]").remove(); } - if(!$("div[data-notfIndv=" + acct_id +"_"+obj.id+"]").length){ - $("div[data-notf=" + acct_id +"]").prepend(templete); - $("div[data-const=notf_"+acct_id+"]").prepend(templete); - } - jQuery("time.timeago").timeago(); - } else if (type == "delete") { - $("[toot-id=" + obj + "]").hide(); - $("[toot-id=" + obj + "]").remove(); } + websocketNotf[acct_id].onerror = function (error) { + console.error('WebSocket Error ' + error); + notfWS(misskey, acct_id, tlid, domain, at) + }; } - websocketNotf[acct_id].onerror = function(error) { - console.error('WebSocket Error ' + error); - notfWS(misskey,acct_id,tlid,domain,at) - }; -} } //一定のスクロールで発火 function notfmore(tlid) { - console.log({"status":"kicked","status":moreloading}); + console.log({ "status": "kicked", "status": moreloading }); var multi = localStorage.getItem("column"); var obj = JSON.parse(multi); var acct_id = obj[tlid].domain; if (!type) { var type = obj[tlid].type; - }else{ + } else { var data; } var sid = $("#timeline_" + tlid + " .notif-marker").last().attr("data-maxid"); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var domain = localStorage.getItem("domain_" + acct_id); if (sid && !moreloading) { - moreloading=true; - var httpreq = new XMLHttpRequest(); - if(localStorage.getItem("mode_" + domain)=="misskey"){ - var misskey=true; - var start = "https://" + domain + "/api/i/notifications"; - httpreq.open(POST, start, true); - httpreq.setRequestHeader('Content-Type', 'application/json'); - var body=JSON.stringify({ - i:at, - untilID:sid - }); - }else{ - var misskey=false; - if(localStorage.getItem("exclude-"+tlid)){ - var exc=localStorage.getItem("exclude-"+tlid)+"&max_id="+sid; - }else{ - var exc="?max_id="+sid; + moreloading = true; + var httpreq = new XMLHttpRequest(); + if (localStorage.getItem("mode_" + domain) == "misskey") { + var misskey = true; + var start = "https://" + domain + "/api/i/notifications"; + httpreq.open(POST, start, true); + httpreq.setRequestHeader('Content-Type', 'application/json'); + var body = JSON.stringify({ + i: at, + untilID: sid + }); + } else { + var misskey = false; + if (localStorage.getItem("exclude-" + tlid)) { + var exc = localStorage.getItem("exclude-" + tlid) + "&max_id=" + sid; + } else { + var exc = "?max_id=" + sid; + } + var start = "https://" + domain + "/api/v1/notifications" + exc; + httpreq.open("GET", start, true); + httpreq.setRequestHeader('Content-Type', 'application/json'); + httpreq.setRequestHeader('Authorization', 'Bearer ' + at); + var body = ""; } - var start = "https://" + domain + "/api/v1/notifications"+exc; - httpreq.open("GET", start, true); - httpreq.setRequestHeader('Content-Type', 'application/json'); - httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - var body=""; - } - - httpreq.responseType = "json"; - httpreq.send(body); - httpreq.onreadystatechange = function() { - if (httpreq.readyState === 4) { - var json = httpreq.response; - console.log(["More notifications on "+tlid,json]); - var max_id = httpreq.getResponseHeader("link").match(/[?&]{1}max_id=([0-9]+)/)[1]; - if(json[0]){ - var templete=""; - var lastnotf=localStorage.getItem("lastnotf_" + acct_id); - localStorage.setItem("lastnotf_" + acct_id,json[0].id); - Object.keys(json).forEach(function(key) { - var obj = json[key]; - if(localStorage.getItem("filter_"+ acct_id)!="undefined"){ - var mute=getFilterType(JSON.parse(localStorage.getItem("filter_"+ acct_id)),"notif"); - }else{ - var mute=[]; - } - if(obj.type!="follow"){ - if(misskey){ - templete = templete+misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute); - }else{ - templete = templete+parse([obj], 'notf', acct_id, 'notf', -1, mute); + + httpreq.responseType = "json"; + httpreq.send(body); + httpreq.onreadystatechange = function () { + if (httpreq.readyState === 4) { + var json = httpreq.response; + console.log(["More notifications on " + tlid, json]); + var max_id = httpreq.getResponseHeader("link").match(/[?&]{1}max_id=([0-9]+)/)[1]; + if (json[0]) { + var templete = ""; + var lastnotf = localStorage.getItem("lastnotf_" + acct_id); + localStorage.setItem("lastnotf_" + acct_id, json[0].id); + Object.keys(json).forEach(function (key) { + var obj = json[key]; + if (localStorage.getItem("filter_" + acct_id) != "undefined") { + var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), "notif"); + } else { + var mute = []; } - }else{ - if(misskey){ - templete = templete+misskeyUserparse([obj], 'notf', acct_id, 'notf', -1, mute); - }else{ - templete = templete+userparse([obj.account], 'notf', acct_id, 'notf', -1); + if (obj.type != "follow") { + if (misskey) { + templete = templete + misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute); + } else { + templete = templete + parse([obj], 'notf', acct_id, 'notf', -1, mute); + } + } else { + if (misskey) { + templete = templete + misskeyUserparse([obj], 'notf', acct_id, 'notf', -1, mute); + } else { + templete = templete + userparse([obj.account], 'notf', acct_id, 'notf', -1); + } + } - - } - }); - moreloading=false; - templete=templete+''; - $("#timeline_" + tlid).append(templete); - $("#landing_" + tlid).hide(); - jQuery("time.timeago").timeago(); + }); + moreloading = false; + templete = templete + ''; + $("#timeline_" + tlid).append(templete); + $("#landing_" + tlid).hide(); + jQuery("time.timeago").timeago(); } $("#notf-box").addClass("fetched"); todc(); + } } } } -} //通知トグルボタン function notfToggle(acct, tlid) { - if($("#notf-box_" + tlid).hasClass("column-hide")){ - $("#notf-box_" + tlid).css("display","block") + if ($("#notf-box_" + tlid).hasClass("column-hide")) { + $("#notf-box_" + tlid).css("display", "block") $("#notf-box_" + tlid).animate({ 'height': '400px' - },{ - 'duration': 300, - 'complete': function(){ - $("#notf-box_" + tlid).css("overflow-y","scroll") - $("#notf-box_" + tlid).removeClass("column-hide") - } - }); - }else{ - $("#notf-box_" + tlid).css("overflow-y","hidden") + }, { + 'duration': 300, + 'complete': function () { + $("#notf-box_" + tlid).css("overflow-y", "scroll") + $("#notf-box_" + tlid).removeClass("column-hide") + } + }); + } else { + $("#notf-box_" + tlid).css("overflow-y", "hidden") $("#notf-box_" + tlid).animate({ 'height': '0' - },{ - 'duration': 300, - 'complete': function(){ - $("#notf-box_" + tlid).addClass("column-hide") - $("#notf-box_" + tlid).css("display","none") - } - }); + }, { + 'duration': 300, + 'complete': function () { + $("#notf-box_" + tlid).addClass("column-hide") + $("#notf-box_" + tlid).css("display", "none") + } + }); } notfCanceler(acct) } -function notfCanceler(acct){ +function notfCanceler(acct) { $(".notf-reply_" + acct).text(0); localStorage.removeItem("notf-reply_" + acct) $(".notf-reply_" + acct).addClass("hide"); @@ -385,13 +385,13 @@ function notfCanceler(acct){ $(".notf-follow_" + acct).addClass("hide"); $(".notf-icon_" + acct).removeClass("red-text"); } -function allNotfRead(){ +function allNotfRead() { var multi = localStorage.getItem("multi"); if (multi) { var obj = JSON.parse(multi); - Object.keys(obj).forEach(function(key) { - notfCanceler(key) - }); -} + Object.keys(obj).forEach(function (key) { + notfCanceler(key) + }); + } } allNotfRead() \ No newline at end of file diff --git a/app/js/tl/parse.js b/app/js/tl/parse.js index 3e481e07..33ec62de 100644 --- a/app/js/tl/parse.js +++ b/app/js/tl/parse.js @@ -1,31 +1,31 @@ //オブジェクトパーサー(トゥート) function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { var templete = ''; - if(obj[0]){ - if(tlid===1){ - + if (obj[0]) { + if (tlid === 1) { + } - localStorage.setItem("lastunix_"+ tlid,date(obj[0].created_at, 'unix')); + localStorage.setItem("lastunix_" + tlid, date(obj[0].created_at, 'unix')); } - - var actb='re,rt,fav,qt,del,pin,red'; - if(actb){ + + var actb = 're,rt,fav,qt,del,pin,red'; + if (actb) { var actb = actb.split(','); - var disp={}; - for(var k=0;k '; + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">'; var regExp = new RegExp(":" + shortcode + ":", "g"); dis_name = dis_name.replace(regExp, emoji_url); - + }); } - var noticeavatar=""; + var noticeavatar = ""; if (mix == "notf") { if (gif == "yes") { noticeavatar = toot.account.avatar; } else { noticeavatar = toot.account.avatar_static; } - noticeavatar='' + - ''; + noticeavatar = '' + + ''; if (toot.type == "mention") { var what = lang.lang_parse_mentioned; var icon = "fa-share teal-text"; - noticeavatar=""; + noticeavatar = ""; } else if (toot.type == "reblog") { var what = lang.lang_parse_bted; var icon = "fa-retweet light-blue-text"; - if(!locale && localStorage.getItem("bt_" + acct_id)){ + if (!locale && localStorage.getItem("bt_" + acct_id)) { what = localStorage.getItem("bt_" + acct_id); } } else if (toot.type == "favourite") { var what = lang.lang_parse_faved; var icon = "fa-star yellow-text"; - if(!locale && localStorage.getItem("fav_" + acct_id)){ + if (!locale && localStorage.getItem("fav_" + acct_id)) { what = localStorage.getItem("fav_" + acct_id); } } else if (toot.type == "poll") { @@ -236,81 +236,81 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { var icon = "fa-tasks purple-text"; } var noticetext = '' + date(toot.created_at, - datetype) + - '' + date(toot.created_at, + datetype) + + '' + dis_name + "(@" + toot.account.acct + ")"; var notice = noticetext; var memory = localStorage.getItem("notice-mem"); if (popup >= 0 && obj.length < 5 && noticetext != memory) { - if(localStorage.getItem("hasNotfC_" + acct_id)!="true"){ + if (localStorage.getItem("hasNotfC_" + acct_id) != "true") { if (toot.type == "mention") { - 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)) + 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") - var sound=localStorage.getItem("replySound"); - if(sound=="default"){ - var file="../../source/notif3.wav" + var sound = localStorage.getItem("replySound"); + if (sound == "default") { + var file = "../../source/notif3.wav" } - }else if (toot.type == "reblog") { - 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)) + } else if (toot.type == "reblog") { + 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") - var sound=localStorage.getItem("btSound"); - if(sound=="default"){ - var file="../../source/notif2.wav" + var sound = localStorage.getItem("btSound"); + if (sound == "default") { + var file = "../../source/notif2.wav" } - }else if (toot.type == "favourite") { - 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)) + } else if (toot.type == "favourite") { + 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 sound=localStorage.getItem("favSound"); - if(sound=="default"){ - var file="../../source/notif.wav" + var sound = localStorage.getItem("favSound"); + if (sound == "default") { + var file = "../../source/notif.wav" } } } - + var domain = localStorage.getItem("domain_" + acct_id); - if(popup>0){ - Materialize.toast("["+domain+"]"+escapeHTML(toot.account.display_name)+what, popup * 1000); + if (popup > 0) { + Materialize.toast("[" + domain + "]" + escapeHTML(toot.account.display_name) + what, popup * 1000); } //通知音 - if(sound=="c1"){ - var file=localStorage.getItem("custom1"); - }else if(sound=="c2"){ - var file=localStorage.getItem("custom2"); - }else if(sound=="c3"){ - var file=localStorage.getItem("custom3"); - }else if(sound=="c4"){ - var file=localStorage.getItem("custom4"); + if (sound == "c1") { + var file = localStorage.getItem("custom1"); + } else if (sound == "c2") { + var file = localStorage.getItem("custom2"); + } else if (sound == "c3") { + var file = localStorage.getItem("custom3"); + } else if (sound == "c4") { + var file = localStorage.getItem("custom4"); } - if(file){ + if (file) { request = new XMLHttpRequest(); - request.open("GET", file, true); - request.responseType = "arraybuffer"; - request.onload = playSound; - request.send(); + request.open("GET", file, true); + request.responseType = "arraybuffer"; + request.onload = playSound; + request.send(); } - if(native=="yes"){ + if (native == "yes") { var electron = require("electron"); var ipc = electron.ipcRenderer; var os = electron.remote.process.platform; var options = { - body: toot.account.display_name+"(" + toot.account.acct +")"+what+"\n\n"+$.strip_tags(toot.status.content), + body: toot.account.display_name + "(" + toot.account.acct + ")" + what + "\n\n" + $.strip_tags(toot.status.content), icon: toot.account.avatar - }; - if(os=="darwin"){ - var n = new Notification('TheDesk:'+domain, options); - }else{ + }; + if (os == "darwin") { + var n = new Notification('TheDesk:' + domain, options); + } else { ipc.send('native-notf', [ - 'TheDesk:'+domain, - toot.account.display_name+"(" + toot.account.acct +")"+what+"\n\n"+$.strip_tags(toot.status.content), + 'TheDesk:' + domain, + toot.account.display_name + "(" + toot.account.acct + ")" + what + "\n\n" + $.strip_tags(toot.status.content), toot.account.avatar, "toot", acct_id, @@ -318,91 +318,91 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { ]); } } - if(localStorage.getItem("hasNotfC_" + acct_id)!="true"){ + if (localStorage.getItem("hasNotfC_" + acct_id) != "true") { $(".notf-icon_" + acct_id).addClass("red-text"); } localStorage.setItem("notice-mem", noticetext); noticetext = ""; } - var if_notf='data-notfIndv="'+acct_id+"_"+toot.id+'"'; + var if_notf = 'data-notfIndv="' + acct_id + "_" + toot.id + '"'; var toot = toot.status; - var dis_name=escapeHTML(toot.account.display_name); - if(toot.account.emojis){ + var dis_name = escapeHTML(toot.account.display_name); + if (toot.account.emojis) { var actemojick = toot.account.emojis[0]; - }else{ - var actemojick=false; + } else { + var actemojick = false; } - //絵文字があれば - if (actemojick) { - Object.keys(toot.account.emojis).forEach(function(key5) { - var emoji = toot.account.emojis[key5]; - var shortcode = emoji.shortcode; - var emoji_url = ''; - var regExp = new RegExp(":" + shortcode + ":", "g"); - dis_name = dis_name.replace(regExp, emoji_url); - }); - } - }else{ - var if_notf=""; + //絵文字があれば + if (actemojick) { + Object.keys(toot.account.emojis).forEach(function (key5) { + var emoji = toot.account.emojis[key5]; + var shortcode = emoji.shortcode; + var emoji_url = ''; + var regExp = new RegExp(":" + shortcode + ":", "g"); + dis_name = dis_name.replace(regExp, emoji_url); + }); + } + } else { + var if_notf = ""; if (toot.reblog) { if (gif == "yes") { noticeavatar = toot.account.avatar; } else { noticeavatar = toot.account.avatar_static; } - noticeavatar='' + - ''; + noticeavatar = '' + + ''; var rebtxt = lang.lang_parse_btedsimple; var rticon = "fa-retweet light-blue-text"; - if(localStorage.getItem("domain_" + acct_id)=="imastodon.net" && !locale){ + if (localStorage.getItem("domain_" + acct_id) == "imastodon.net" && !locale) { rebtxt = ":「わかるわ」"; - }else if(localStorage.getItem("domain_" + acct_id)=="mstdn.osaka" && !locale){ + } else if (localStorage.getItem("domain_" + acct_id) == "mstdn.osaka" && !locale) { rebtxt = "がしばいた"; } - var notice = ''+ dis_name + "(@" + toot.account.acct + + var notice = '' + dis_name + "(@" + toot.account.acct + ")
"; - var boostback = "shared"; - var uniqueid=toot.id; + var boostback = "shared"; + var uniqueid = toot.id; var toot = toot.reblog; - var dis_name=escapeHTML(toot.account.display_name); - if(toot.account.emojis){ + var dis_name = escapeHTML(toot.account.display_name); + if (toot.account.emojis) { var actemojick = toot.account.emojis[0]; - }else{ - var uniqueid=toot.id; - var actemojick=false; + } else { + var uniqueid = toot.id; + var actemojick = false; + } + //絵文字があれば + if (actemojick) { + Object.keys(toot.account.emojis).forEach(function (key5) { + var emoji = toot.account.emojis[key5]; + var shortcode = emoji.shortcode; + var emoji_url = ''; + var regExp = new RegExp(":" + shortcode + ":", "g"); + dis_name = dis_name.replace(regExp, emoji_url); + }); } - //絵文字があれば - if (actemojick) { - Object.keys(toot.account.emojis).forEach(function(key5) { - var emoji = toot.account.emojis[key5]; - var shortcode = emoji.shortcode; - var emoji_url = ''; - var regExp = new RegExp(":" + shortcode + ":", "g"); - dis_name = dis_name.replace(regExp, emoji_url); - }); - } } else { - var uniqueid=toot.id; + var uniqueid = toot.id; var notice = ""; var boostback = "unshared"; //ユーザー強調 - if(toot.account.username!=toot.account.acct){ - var fullname=toot.account.acct; - }else{ + if (toot.account.username != toot.account.acct) { + var fullname = toot.account.acct; + } else { var domain = localStorage.getItem("domain_" + acct_id); - var fullname=toot.account.acct+"@"+domain; + var fullname = toot.account.acct + "@" + domain; } - if(useremp){ - Object.keys(useremp).forEach(function(key10) { - var user = useremp[key10]; - if(user==fullname){ - boostback = "emphasized"; - } + if (useremp) { + Object.keys(useremp).forEach(function (key10) { + var user = useremp[key10]; + if (user == fullname) { + boostback = "emphasized"; + } }); } } @@ -422,25 +422,25 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { } if (!toot.application) { var via = ''; - viashow="hide"; + viashow = "hide"; } else { var via = escapeHTML(toot.application.name); //強調チェック - Object.keys(emp).forEach(function(key6) { + Object.keys(emp).forEach(function (key6) { var cli = emp[key6]; - if(cli == via){ + if (cli == via) { boostback = "emphasized"; } }); //ミュートチェック - Object.keys(mute).forEach(function(key7) { + Object.keys(mute).forEach(function (key7) { var cli = mute[key7]; - if(cli == via){ + if (cli == via) { boostback = "hide"; } }); } - if(mix=="pinned"){ + if (mix == "pinned") { boostback = "emphasized"; } if (toot.spoiler_text && cw) { @@ -449,19 +449,19 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { var spoiler = "cw cw_hide_" + toot.id; var api_spoil = "gray"; var spoiler_show = ''+lang.lang_parse_cwshow+'
'; + '\')" class="nex parsed">' + lang.lang_parse_cwshow + '
'; } else { - var ct1 = toot.content.split('').length + toot.content.split('
').length -2; - var ct2 = toot.content.split('').length + toot.content.split('
').length -2; - if(ct1>ct2){ var ct= ct1; }else{ var ct= ct2; } + var ct1 = toot.content.split('').length + toot.content.split('
').length - 2; + var ct2 = toot.content.split('').length + toot.content.split('
').length - 2; + if (ct1 > ct2) { var ct = ct1; } else { var ct = ct2; } if ((sent < ct && $.mb_strlen($.strip_tags(toot.content)) > 5) || ($.strip_tags(toot.content).length > ltr && $.mb_strlen($.strip_tags(toot.content)) > 5)) { - var content = ''+lang.lang_parse_fulltext+'
' + toot.content + var content = '' + lang.lang_parse_fulltext + '
' + toot.content var spoil = '' + $.mb_substr($.strip_tags( - toot.content), 0, 100) + - ''+lang.lang_parse_autofold+''; + toot.content), 0, 100) + + '' + lang.lang_parse_autofold + ''; var spoiler = "cw cw_hide_" + toot.id; var spoiler_show = ''+lang.lang_parse_more+'
'; + '\')" class="nex parsed">' + lang.lang_parse_more + '
'; } else { var content = toot.content; var spoil = escapeHTML(toot.spoiler_text); @@ -474,7 +474,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { ); if (urls) { var analyze = ''+lang.lang_parse_url+'
'; + ',\'' + id + '\')" class="add-show pointer">' + lang.lang_parse_url + '
'; } else { var analyze = ''; } @@ -482,51 +482,51 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { var hasmedia = ""; var youtube = ""; //Poll - var poll=""; - if(toot.poll){ - var choices=toot.poll.options; - if(toot.poll.voted){ - var myvote=lang.lang_parse_voted; - var result_hide=""; - }else{ - var myvote=''+lang.lang_parse_vote+'
'; - if(choices[0].votes_count===0 || choices[0].votes_count>0){ - myvote=myvote+''+lang.lang_parse_unvoted+""; + var poll = ""; + if (toot.poll) { + var choices = toot.poll.options; + if (toot.poll.voted) { + var myvote = lang.lang_parse_voted; + var result_hide = ""; + } else { + var myvote = '' + lang.lang_parse_vote + '
'; + if (choices[0].votes_count === 0 || choices[0].votes_count > 0) { + myvote = myvote + '' + lang.lang_parse_unvoted + ""; } - var result_hide="hide"; + var result_hide = "hide"; } - if(toot.poll.expired){ - var ended=lang.lang_parse_endedvote; - }else{ - var ended=date(toot.poll.expires_at, datetype); + if (toot.poll.expired) { + var ended = lang.lang_parse_endedvote; + } else { + var ended = date(toot.poll.expires_at, datetype); } - Object.keys(choices).forEach(function(keyc) { + Object.keys(choices).forEach(function (keyc) { var choice = choices[keyc]; - if(!toot.poll.voted && !toot.poll.expired){ - var votesel='voteSelMastodon(\''+acct_id+'\',\''+toot.poll.id+'\','+keyc+','+toot.poll.multiple+')'; - var voteclass="pointer waves-effect waves-light"; - }else{ - var votesel=""; - var voteclass=""; + if (!toot.poll.voted && !toot.poll.expired) { + var votesel = 'voteSelMastodon(\'' + acct_id + '\',\'' + toot.poll.id + '\',' + keyc + ',' + toot.poll.multiple + ')'; + var voteclass = "pointer waves-effect waves-light"; + } else { + var votesel = ""; + var voteclass = ""; } - poll=poll+''+escapeHTML(choice.title)+'('+choice.votes_count+')'; + poll = poll + '' + escapeHTML(choice.title) + '(' + choice.votes_count + ')'; }); - poll=''+poll+myvote+'' + - ended+ ''; + poll = '' + poll + myvote + '' + + ended + ''; } - if(toot.emojis){ + if (toot.emojis) { var emojick = toot.emojis[0]; - }else{ - var emojick=false; + } else { + var emojick = false; } //絵文字があれば if (emojick) { - Object.keys(toot.emojis).forEach(function(key5) { + Object.keys(toot.emojis).forEach(function (key5) { var emoji = toot.emojis[key5]; var shortcode = emoji.shortcode; var emoji_url = ''; + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">'; var regExp = new RegExp(":" + shortcode + ":", "g"); content = content.replace(regExp, emoji_url); spoil = spoil.replace(regExp, emoji_url); @@ -534,18 +534,18 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { }); } //ニコフレ絵文字 - if(toot.profile_emojis){ + if (toot.profile_emojis) { var nicoemojick = toot.profile_emojis[0]; - }else{ - var nicoemojick=false; + } else { + var nicoemojick = false; } //絵文字があれば(nico) if (nicoemojick) { - Object.keys(toot.profile_emojis).forEach(function(keynico) { + Object.keys(toot.profile_emojis).forEach(function (keynico) { var emoji = toot.profile_emojis[keynico]; var shortcode = emoji.shortcode; var emoji_url = ''; + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">'; var regExp = new RegExp(":" + shortcode + ":", "g"); content = content.replace(regExp, emoji_url); spoil = spoil.replace(regExp, emoji_url); @@ -553,68 +553,68 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { }); } //デフォ絵文字 - content=twemoji.parse(content); - if(dis_name){ - dis_name=twemoji.parse(dis_name); + content = twemoji.parse(content); + if (dis_name) { + dis_name = twemoji.parse(dis_name); } - if(spoil){ - spoil=twemoji.parse(spoil); + if (spoil) { + spoil = twemoji.parse(spoil); } - if(noticetext){ - noticetext=twemoji.parse(noticetext); + if (noticetext) { + noticetext = twemoji.parse(noticetext); } - if(notice){ - notice=twemoji.parse(notice); + if (notice) { + notice = twemoji.parse(notice); } - if(poll){ - poll=twemoji.parse(poll); + if (poll) { + poll = twemoji.parse(poll); } var mediack = toot.media_attachments[0]; //メディアがあれば - var media_ids=""; + var media_ids = ""; if (mediack) { hasmedia = "hasmedia"; var cwdt = 100 / toot.media_attachments.length; - Object.keys(toot.media_attachments).forEach(function(key2) { + Object.keys(toot.media_attachments).forEach(function (key2) { var media = toot.media_attachments[key2]; var purl = media.preview_url; - media_ids=media_ids+media.id+","; + media_ids = media_ids + media.id + ","; var url = media.url; - var nsfwmes="" + var nsfwmes = "" if (toot.sensitive && nsfw) { var sense = "sensitive" - var blur=media.blurhash - if(blur){ - nsfwmes=''+lang.lang_parse_nsfw+'' - purl=parseBlur(blur) - var sense="" + var blur = media.blurhash + if (blur) { + nsfwmes = '' + lang.lang_parse_nsfw + '' + purl = parseBlur(blur) + var sense = "" } } else { var sense = "" - var blur=null + var blur = null } - if(media.pleroma){ - if(media.pleroma.mime_type.indexOf("video") !== -1){ + if (media.pleroma) { + if (media.pleroma.mime_type.indexOf("video") !== -1) { viewer = viewer + ''; + acct_id + ')" id="' + id + '-image-' + key2 + '" data-url="' + url + + '" data-type="video" class="img-parsed">' + escapeHTML(value.name) + ''; + break; + } + } + } } //Quote - if(toot.quote){ - poll=poll+'' + if (toot.quote) { + poll = poll + ''+escapeHTML(toot.quote.account.display_name)+''+toot.quote.content+'' } templete = templete + '' + escapeHTML(toot.quote.account.display_name) + '' + toot.quote.content + '' + + ' ' + hasmedia + ' ' + animecss + '" toot-id="' + id + '" unique-id="' + uniqueid + '" data-medias="' + media_ids + ' " unixtime="' + date(obj[ + key].created_at, 'unix') + '" ' + if_notf + ' onmouseover="mov(\'' + toot.id + '\',\'' + tlid + '\',\'mv\')" onclick="mov(\'' + toot.id + '\',\'' + tlid + '\',\'cl\')" onmouseout="resetmv(\'mv\')">' + '' + '' + notice + home + '' + ' ' + + '">' + noticeavatar + '' + - '' + dis_name + '' + '' + + '(' + lang.lang_parse_clickcopyurl + ')">' + date(toot.created_at, datetype) + '' + ''+tickerdom+'' + tickerdom + '' + spoil + "" + spoiler_show + '' + content + '' + poll + @@ -827,44 +827,44 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { '' + analyze + '' + '' + mentions + tags + '' + - ''+ - '' + - ''+vis+''+ - '' + - '' + - '' + + '' + + '' + trans + + 'via ' + via + - ''+ - '' + vis + '' + + '' + + '' + + '' + - '' + - '' + - '' + + '' + - '' + - '' + + '' - +'' + + ''+trans+ - 'via ' + + ')" class="waves-effect waves-dark btn-flat" style="padding:0" title="' + lang.lang_parse_redraft + '">redo' + - '' + + '' + + '' + + '' + '
'; - }else{ - var notftext=""; + 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) { - Materialize.toast(escapeHTML(toot.display_name)+":"+ftxt, popup * 1000); - $(".notf-icon_" + tlid).addClass("red-text"); - localStorage.setItem("notice-mem", notftext); - notftext = ""; - var native=localStorage.getItem("nativenotf"); - if(!native){ - native="yes"; + if (popup >= 0 && obj.length < 5 && notftext != memory) { + Materialize.toast(escapeHTML(toot.display_name) + ":" + ftxt, 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"){ + if (native == "yes") { var electron = require("electron"); var ipc = electron.ipcRenderer; var os = electron.remote.process.platform; var options = { - body: toot.display_name+"(" + toot.acct +")"+ftxt, + 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 domain = localStorage.getItem("domain_" + acct_id); + if (os == "darwin") { + var n = new Notification('TheDesk:' + domain, options); + } else { ipc.send('native-notf', [ - 'TheDesk:'+domain, - toot.display_name+"(" + toot.acct +")"+ftxt, + 'TheDesk:' + domain, + toot.display_name + "(" + toot.acct + ")" + ftxt, toot.avatar, "userdata", acct_id, @@ -947,56 +947,56 @@ function userparse(obj, auth, acct_id, tlid, popup) { ]); } } - } - 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 (actemojick) { - Object.keys(toot.emojis).forEach(function(key5) { - var emoji = toot.emojis[key5]; - var shortcode = emoji.shortcode; - var emoji_url = ''; - 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 (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 (actemojick) { + Object.keys(toot.emojis).forEach(function (key5) { + var emoji = toot.emojis[key5]; + var shortcode = emoji.shortcode; + var emoji_url = ''; + 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"; + } + templete = templete + '' + '' + notftext + '' + + .acct + '">' + '' + dis_name + '' + ' ' + + toot.acct + locked + '' + '' + '' + authhtml + '' + '' + ''; @@ -1006,61 +1006,61 @@ function userparse(obj, auth, acct_id, tlid, popup) { } //クライアントダイアログ function client(name) { - if(name!="Unknown"){ - //聞く - var electron = require("electron"); - var remote=electron.remote; - var dialog=remote.dialog; - const options = { - type: 'info', - title: lang.lang_parse_clientop, - message: name+lang.lang_parse_clienttxt, - buttons: [lang.lang_parse_clientno,lang.lang_parse_clientemp, lang.lang_parse_clientmute] - } - dialog.showMessageBox(options, function(arg) { - if(arg===1){ - var cli = localStorage.getItem("client_emp"); - var obj = JSON.parse(cli); - if(!obj){ - var obj=[]; - obj.push(name); - Materialize.toast(escapeHTML(name)+lang.lang_status_emphas, 2000); - }else{ - var can; - Object.keys(obj).forEach(function(key) { - var cliT = obj[key]; - if(cliT!=name && !can){ - can=false; - }else{ - can=true; - obj.splice(key, 1); - Materialize.toast(escapeHTML(name)+lang.lang_status_unemphas, 2000); + if (name != "Unknown") { + //聞く + var electron = require("electron"); + var remote = electron.remote; + var dialog = remote.dialog; + const options = { + type: 'info', + title: lang.lang_parse_clientop, + message: name + lang.lang_parse_clienttxt, + buttons: [lang.lang_parse_clientno, lang.lang_parse_clientemp, lang.lang_parse_clientmute] + } + dialog.showMessageBox(options, function (arg) { + if (arg === 1) { + var cli = localStorage.getItem("client_emp"); + var obj = JSON.parse(cli); + if (!obj) { + var obj = []; + obj.push(name); + Materialize.toast(escapeHTML(name) + lang.lang_status_emphas, 2000); + } else { + var can; + Object.keys(obj).forEach(function (key) { + var cliT = obj[key]; + if (cliT != name && !can) { + can = false; + } else { + can = true; + obj.splice(key, 1); + Materialize.toast(escapeHTML(name) + lang.lang_status_unemphas, 2000); + } + }); + if (!can) { + obj.push(name); + Materialize.toast(escapeHTML(name) + lang.lang_status_emphas, 2000); + } else { + + } + } + var json = JSON.stringify(obj); + localStorage.setItem("client_emp", json); + } else if (arg === 2) { + var cli = localStorage.getItem("client_mute"); + var obj = JSON.parse(cli); + if (!obj) { + obj = []; } - }); - if(!can){ obj.push(name); - Materialize.toast(escapeHTML(name)+lang.lang_status_emphas, 2000); - }else{ - + var json = JSON.stringify(obj); + localStorage.setItem("client_mute", json); + Materialize.toast(escapeHTML(name) + lang.lang_parse_mute, 2000); + } else { + return; } - } - var json = JSON.stringify(obj); - localStorage.setItem("client_emp", json); - }else if(arg===2){ - var cli = localStorage.getItem("client_mute"); - var obj = JSON.parse(cli); - if(!obj){ - obj=[]; - } - obj.push(name); - var json = JSON.stringify(obj); - localStorage.setItem("client_mute", json); - Materialize.toast(escapeHTML(name)+lang.lang_parse_mute, 2000); - }else{ - return; - } - parseColumn(); - }) - -} + parseColumn(); + }) + + } } \ No newline at end of file diff --git a/app/js/tl/poll.js b/app/js/tl/poll.js index 041e06fe..0340c853 100644 --- a/app/js/tl/poll.js +++ b/app/js/tl/poll.js @@ -1,17 +1,17 @@ //アンケートのトグル function pollToggle() { - if ($("#poll").hasClass("hide")) { + if ($("#poll").hasClass("hide")) { $("#right-side").show() - $("#poll").removeClass("hide") - } else { + $("#poll").removeClass("hide") + } else { $("#right-side").hide() $("#emoji").addClass("hide") - $("#poll").addClass("hide") - } + $("#poll").addClass("hide") + } } -function pollProviderCk(){ +function pollProviderCk() { $(".poll-provider").addClass("hide"); - $("#"+$("#poll-sel").val()).removeClass("hide"); + $("#" + $("#poll-sel").val()).removeClass("hide"); } /* function pollAddtime(num){ @@ -21,98 +21,98 @@ function pollAddtime(num){ pollCalc(); } */ -function pollCalc(){ - var days=$("#days_poll").val(); - var hrs=$("#hours_poll").val(); - var mins=$("#mins_poll").val(); - console.log("Poll calc:"+days*86400+hrs*3600+mins*60) - return days*86400+hrs*3600+mins*60; +function pollCalc() { + var days = $("#days_poll").val(); + var hrs = $("#hours_poll").val(); + var mins = $("#mins_poll").val(); + console.log("Poll calc:" + days * 86400 + hrs * 3600 + mins * 60) + return days * 86400 + hrs * 3600 + mins * 60; } //Vote -function voteSelMastodon(acct_id,id,to,mul){ - if($('.vote_'+acct_id+'_'+id+'_'+to).hasClass("sel")){ - $('.vote_'+acct_id+'_'+id+'_'+to).css("background-color","transparent") - $('.vote_'+acct_id+'_'+id+'_'+to).removeClass("sel"); - }else{ - if(!mul){ - $('.vote_'+acct_id+'_'+id+' div' ).each(function(i, elem) { - if(i==to){ - $(this).css("background-color","var(--emphasized)"); +function voteSelMastodon(acct_id, id, to, mul) { + if ($('.vote_' + acct_id + '_' + id + '_' + to).hasClass("sel")) { + $('.vote_' + acct_id + '_' + id + '_' + to).css("background-color", "transparent") + $('.vote_' + acct_id + '_' + id + '_' + to).removeClass("sel"); + } else { + if (!mul) { + $('.vote_' + acct_id + '_' + id + ' div').each(function (i, elem) { + if (i == to) { + $(this).css("background-color", "var(--emphasized)"); $(this).addClass("sel"); - }else{ - $(this).css("background-color","transparent") + } else { + $(this).css("background-color", "transparent") $(this).removeClass("sel"); } }); - }else{ - $('.vote_'+acct_id+'_'+id+'_'+to).css("background-color","var(--emphasized)") - $('.vote_'+acct_id+'_'+id+'_'+to).addClass("sel"); + } else { + $('.vote_' + acct_id + '_' + id + '_' + to).css("background-color", "var(--emphasized)") + $('.vote_' + acct_id + '_' + id + '_' + to).addClass("sel"); } } - + } -function voteMastodon(acct_id,id){ - var choice=[]; - $('.vote_'+acct_id+'_'+id+' div' ).each(function(i, elem) { - if($(this).hasClass("sel")){ - choice.push(i+""); +function voteMastodon(acct_id, id) { + var choice = []; + $('.vote_' + acct_id + '_' + id + ' div').each(function (i, elem) { + if ($(this).hasClass("sel")) { + choice.push(i + ""); } }); var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - var start = "https://" + domain + "/api/v1/polls/"+id+"/votes"; - if(localStorage.getItem("mode_" + domain)=="misskey"){ + var at = localStorage.getItem("acct_" + acct_id + "_at"); + var start = "https://" + domain + "/api/v1/polls/" + id + "/votes"; + if (localStorage.getItem("mode_" + domain) == "misskey") { return false; } - var httpreq = new XMLHttpRequest(); - httpreq.open('POST', start, true); + var httpreq = new XMLHttpRequest(); + httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.responseType = "json"; - httpreq.send(JSON.stringify({choices:choice})); - httpreq.onreadystatechange = function() { - voteMastodonrefresh(acct_id,id) - } + httpreq.send(JSON.stringify({ choices: choice })); + httpreq.onreadystatechange = function () { + voteMastodonrefresh(acct_id, id) + } } -function showResult(acct_id,id){ - $('.vote_'+acct_id+'_'+id+'_result').toggleClass("hide") +function showResult(acct_id, id) { + $('.vote_' + acct_id + '_' + id + '_result').toggleClass("hide") } -function voteMastodonrefresh(acct_id,id){ +function voteMastodonrefresh(acct_id, id) { var datetype = localStorage.getItem("datetype"); if (!datetype) { - datetype = "absolute"; - } + datetype = "absolute"; + } var httpreqd = new XMLHttpRequest(); var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - var start = "https://" + domain + "/api/v1/polls/"+id; - httpreqd.open('GET', start, true); - httpreqd.setRequestHeader('Content-Type', 'application/json'); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + var start = "https://" + domain + "/api/v1/polls/" + id; + httpreqd.open('GET', start, true); + httpreqd.setRequestHeader('Content-Type', 'application/json'); httpreqd.responseType = 'json'; - httpreqd.send(JSON.stringify({i:at,noteId:id})); - httpreqd.onreadystatechange = function() { - if (httpreqd.readyState == 4) { + httpreqd.send(JSON.stringify({ i: at, noteId: id })); + httpreqd.onreadystatechange = function () { + if (httpreqd.readyState == 4) { var json = httpreqd.response; - console.log(["Refresh vote",json]); - if(!json){ + console.log(["Refresh vote", json]); + if (!json) { return false; } - var poll=""; - var choices=json.options; - var myvote=lang.lang_parse_voted; - var result_hide=""; - Object.keys(choices).forEach(function(keyc) { - var choice = choices[keyc]; - if(!json.voted){ - votesel='voteSelMastodon(\''+acct_id+'\',\''+json.id+'\','+keyc+','+json.multiple+')'; - } - poll=poll+'Follows:' + toot.following_count + 'Followers:' + toot.followers_count + - '' + authhtml+ + ''+escapeHTML(choice.title)+'('+choice.votes_count+')'; - }); - poll=poll+myvote+'' + - date(json.expires_at, datetype) + ''; - $('.vote_'+acct_id+'_'+json.id).html(poll) - } - } + var poll = ""; + var choices = json.options; + var myvote = lang.lang_parse_voted; + var result_hide = ""; + Object.keys(choices).forEach(function (keyc) { + var choice = choices[keyc]; + if (!json.voted) { + votesel = 'voteSelMastodon(\'' + acct_id + '\',\'' + json.id + '\',' + keyc + ',' + json.multiple + ')'; + } + poll = poll + '' + escapeHTML(choice.title) + '(' + choice.votes_count + ')'; + }); + poll = poll + myvote + '' + + date(json.expires_at, datetype) + ''; + $('.vote_' + acct_id + '_' + json.id).html(poll) + } + } } \ No newline at end of file diff --git a/app/js/tl/speech.js b/app/js/tl/speech.js index d057c473..a1f86c9e 100644 --- a/app/js/tl/speech.js +++ b/app/js/tl/speech.js @@ -1,38 +1,38 @@ -$voise = null; - $voiseName = lang.lang_speech; - $voices = speechSynthesis.getVoices(); - $synthes = new SpeechSynthesisUtterance(); - $voise = $.grep($voices, function(n, i){return n.name == $voiseName})[0]; - $synthes.voice = $voise; // 音声の設定 - localStorage.removeItem("voicebank"); - speechSynthesis.cancel() - if(!localStorage.getItem("voice_vol")){ - localStorage.setItem("voice_vol",1) - } - $synthes.rate=localStorage.getItem("voice_speed"); - $synthes.pitch=localStorage.getItem("voice_pitch"); - $synthes.volume=localStorage.getItem("voice_vol"); -function say(msgr){ - msg=voiceParse(msgr); - var voice=localStorage.getItem("voicebank"); - var obj = JSON.parse(voice); - if(!obj){ - var json = JSON.stringify([msg]); - localStorage.setItem("voicebank", json); - }else{ - obj.push([msg]); - var json = JSON.stringify(obj); - localStorage.setItem("voicebank", json); - } - +$voise = null; +$voiseName = lang.lang_speech; +$voices = speechSynthesis.getVoices(); +$synthes = new SpeechSynthesisUtterance(); +$voise = $.grep($voices, function (n, i) { return n.name == $voiseName })[0]; +$synthes.voice = $voise; // 音声の設定 +localStorage.removeItem("voicebank"); +speechSynthesis.cancel() +if (!localStorage.getItem("voice_vol")) { + localStorage.setItem("voice_vol", 1) } -$repeat = setInterval(function() { - if(!speechSynthesis.speaking){ - var voice=localStorage.getItem("voicebank"); - if(voice){ +$synthes.rate = localStorage.getItem("voice_speed"); +$synthes.pitch = localStorage.getItem("voice_pitch"); +$synthes.volume = localStorage.getItem("voice_vol"); +function say(msgr) { + msg = voiceParse(msgr); + var voice = localStorage.getItem("voicebank"); + var obj = JSON.parse(voice); + if (!obj) { + var json = JSON.stringify([msg]); + localStorage.setItem("voicebank", json); + } else { + obj.push([msg]); + var json = JSON.stringify(obj); + localStorage.setItem("voicebank", json); + } + +} +$repeat = setInterval(function () { + if (!speechSynthesis.speaking) { + var voice = localStorage.getItem("voicebank"); + if (voice) { var obj = JSON.parse(voice); - if(obj[0]){ - $synthes.text = obj[0]; + if (obj[0]) { + $synthes.text = obj[0]; speechSynthesis.speak($synthes); obj.splice(0, 1); var json = JSON.stringify(obj); @@ -41,68 +41,68 @@ $repeat = setInterval(function() { } } }, 300); -function voiceParse(msg){ +function voiceParse(msg) { msg = $.strip_tags(msg); msg = msg.replace(/#/g, ""); msg = msg.replace(/'/g, ""); msg = msg.replace(/"/g, ""); msg = msg.replace(/https?:\/\/[a-zA-Z0-9./-@_=?%&-]+/g, ""); - return msg; + return msg; } function voiceToggle(tlid) { - var voiceck = localStorage.getItem("voice_" + tlid); - if (voiceck) { + var voiceck = localStorage.getItem("voice_" + tlid); + if (voiceck) { localStorage.removeItem("voice_" + tlid); speechSynthesis.cancel() - $("#sta-voice-" + tlid).text("Off"); - $("#sta-voice-" + tlid).css("color",'red'); + $("#sta-voice-" + tlid).text("Off"); + $("#sta-voice-" + tlid).css("color", 'red'); parseColumn(); - } else { - localStorage.setItem("voice_" + tlid, "true"); - $("#sta-voice-" + tlid).text("On"); - $("#sta-voice-" + tlid).css("color",'#009688'); - parseColumn(); - } + } else { + localStorage.setItem("voice_" + tlid, "true"); + $("#sta-voice-" + tlid).text("On"); + $("#sta-voice-" + tlid).css("color", '#009688'); + parseColumn(); + } } function voiceCheck(tlid) { var voiceck = localStorage.getItem("voice_" + tlid); - if (voiceck) { - $("#sta-voice-" + tlid).text("On"); - $("#sta-voice-" + tlid).css("color",'#009688'); - } else { - $("#sta-voice-" + tlid).text("Off"); - $("#sta-voice-" + tlid).css("color",'red'); - } + if (voiceck) { + $("#sta-voice-" + tlid).text("On"); + $("#sta-voice-" + tlid).css("color", '#009688'); + } else { + $("#sta-voice-" + tlid).text("Off"); + $("#sta-voice-" + tlid).css("color", 'red'); + } } -function voicePlay(){ - if(speechSynthesis.speaking){ +function voicePlay() { + if (speechSynthesis.speaking) { speechSynthesis.cancel() - }else{ - $synthes.text = $("#voicetxt").val(); - $synthes.rate = $("#voicespeed").val()/10; - $synthes.pitch = $("#voicepitch").val()/50; - $synthes.volume = $("#voicevol").val()/100; + } else { + $synthes.text = $("#voicetxt").val(); + $synthes.rate = $("#voicespeed").val() / 10; + $synthes.pitch = $("#voicepitch").val() / 50; + $synthes.volume = $("#voicevol").val() / 100; speechSynthesis.speak($synthes); } } -function voiceSettings(){ - localStorage.setItem("voice_speed", $("#voicespeed").val()/10); - localStorage.setItem("voice_pitch", $("#voicepitch").val()/50); - localStorage.setItem("voice_vol", $("#voicevol").val()/100); +function voiceSettings() { + localStorage.setItem("voice_speed", $("#voicespeed").val() / 10); + localStorage.setItem("voice_pitch", $("#voicepitch").val() / 50); + localStorage.setItem("voice_vol", $("#voicevol").val() / 100); Materialize.toast(lang.lang_speech_refresh, 3000); } -function voiceSettingLoad(){ - var speed=localStorage.getItem("voice_speed"); - var pitch=localStorage.getItem("voice_pitch"); - var vol=localStorage.getItem("voice_vol"); - if(speed){ - $("#voicespeed").val(speed*10); +function voiceSettingLoad() { + var speed = localStorage.getItem("voice_speed"); + var pitch = localStorage.getItem("voice_pitch"); + var vol = localStorage.getItem("voice_vol"); + if (speed) { + $("#voicespeed").val(speed * 10); } - if(pitch){ - $("#voicepitch").val(pitch*50); + if (pitch) { + $("#voicepitch").val(pitch * 50); } - if(vol){ - $("#voicevol").val(vol*100); + if (vol) { + $("#voicevol").val(vol * 100); } } \ No newline at end of file diff --git a/app/js/tl/src.js b/app/js/tl/src.js index 0cf98a60..e3b980cc 100644 --- a/app/js/tl/src.js +++ b/app/js/tl/src.js @@ -4,7 +4,7 @@ function searchMenu() { $("#left-menu div").removeClass("active"); $("#searchMenu").addClass("active"); $(".menu-content").addClass("hide"); - $("#src-box").removeClass("hide"); + $("#src-box").removeClass("hide"); $('ul.tabs').tabs('select_tab', 'src-sta'); $("#src-contents").html(""); } @@ -14,178 +14,178 @@ function src(mode) { $("#src-contents").html(""); var q = $("#src").val(); var acct_id = $("#src-acct-sel").val(); - if(acct_id=="tootsearch"){ + if (acct_id == "tootsearch") { tsAdd(q) return false; } localStorage.setItem("last-use", acct_id); var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var m = q.match(/^#(.+)$/); - if(m){q=m[1];} + if (m) { q = m[1]; } if (user == "--now") { var user = $('#his-data').attr("user-id"); } - if(!mode){ + if (!mode) { var start = "https://" + domain + "/api/v2/search?q=" + q - }else{ + } else { var start = "https://" + domain + "/api/v1/search?q=" + q } - console.log("Try to search at "+start) + console.log("Try to search at " + start) fetch(start, { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { src("v1") return false; - }).then(function(json) { - console.log(["Search",json]); + }).then(function (json) { + console.log(["Search", json]); //ハッシュタグ if (json.hashtags[0]) { var tags = ""; - Object.keys(json.hashtags).forEach(function(key4) { + Object.keys(json.hashtags).forEach(function (key4) { var tag = json.hashtags[key4]; - if(mode){ + if (mode) { tags = tags + '#' + escapeHTML(tag) + '
'; - }else{ - tags=tags+graphDraw(tag); + '\',\'add\')" class="pointer">#' + escapeHTML(tag) + '
'; + } else { + tags = tags + graphDraw(tag); } - + }); $("#src-contents").append("Tags
" + tags); } //トゥート if (json.statuses[0]) { - var templete = parse(json.statuses,'',acct_id); + var templete = parse(json.statuses, '', acct_id); $("#src-contents").append("Mentions
" + templete); } //アカウント if (json.accounts[0]) { - var templete = userparse(json.accounts,'',acct_id); + var templete = userparse(json.accounts, '', acct_id); $("#src-contents").append("Accounts
" + templete); } jQuery("time.timeago").timeago(); }); } -function tsAdd(q){ - var add = { - domain: acct_id, - type: "tootsearch", - data: q - }; - var multi = localStorage.getItem("column"); - var obj = JSON.parse(multi); - localStorage.setItem("card_" + obj.length,"true"); - obj.push(add); - var json = JSON.stringify(obj); - localStorage.setItem("column", json); - parseColumn(); +function tsAdd(q) { + var add = { + domain: acct_id, + type: "tootsearch", + data: q + }; + var multi = localStorage.getItem("column"); + var obj = JSON.parse(multi); + localStorage.setItem("card_" + obj.length, "true"); + obj.push(add); + var json = JSON.stringify(obj); + localStorage.setItem("column", json); + parseColumn(); } -function tootsearch(tlid,q){ +function tootsearch(tlid, q) { var start = "https://tootsearch.chotto.moe/api/v1/search?from=0&sort=created_at%3Adesc&q=" + q - console.log("Toot srrach at "+start) - $("#notice_" + tlid).text("tootsearch("+q+")"); + console.log("Toot srrach at " + start) + $("#notice_" + tlid).text("tootsearch(" + q + ")"); $("#notice_icon_" + tlid).text("search"); fetch(start, { method: 'GET', headers: { 'content-type': 'application/json' }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(raw) { - var templete=""; - var json=raw.hits.hits; - var max_id = raw["hits"].length; - for(var i=0;i'; - } - $("#timeline_" + tlid).html(templete); - - jQuery("time.timeago").timeago(); - }); -} -function moreTs(tlid,q){ - var sid = $("#timeline_" + tlid + " .ts-marker").last().attr("data-maxid"); - moreloading=true; - var start = "https://tootsearch.chotto.moe/api/v1/search?from="+sid+"&sort=created_at%3Adesc&q=" + q - $("#notice_" + tlid).text("tootsearch("+q+")"); - $("#notice_icon_" + tlid).text("search"); - fetch(start, { - method: 'GET', - headers: { - 'content-type': 'application/json' - }, - }).then(function(response) { - return response.json(); - }).catch(function(error) { - todo(error); - console.error(error); - }).then(function(raw) { - var templete=""; - var json=raw.hits.hits; - var max_id = raw["hits"].length; - for(var i=0;i '; - } - $("#timeline_" + tlid).append(templete); - - jQuery("time.timeago").timeago(); - }); -} -function graphDraw(tag){ - var tags=""; - 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); - if(max===0){ - tags = '
'+his[0].uses+'toots #' + escapeHTML(tag.name) + ' '+his[0].accounts+lang.lang_src_people; - }else{ - tags = '
'+his[0].uses+'toots #' + escapeHTML(tag.name) + ' '+his[0].accounts+lang.lang_src_people; + var lastid = toot.uri; } - + if (!templete) { + templete = lang.lang_details_nodata; + } else { + templete = templete + ''; + } + $("#timeline_" + tlid).html(templete); + + jQuery("time.timeago").timeago(); + }); +} +function moreTs(tlid, q) { + var sid = $("#timeline_" + tlid + " .ts-marker").last().attr("data-maxid"); + moreloading = true; + var start = "https://tootsearch.chotto.moe/api/v1/search?from=" + sid + "&sort=created_at%3Adesc&q=" + q + $("#notice_" + tlid).text("tootsearch(" + q + ")"); + $("#notice_icon_" + tlid).text("search"); + fetch(start, { + method: 'GET', + headers: { + 'content-type': 'application/json' + }, + }).then(function (response) { + return response.json(); + }).catch(function (error) { + todo(error); + console.error(error); + }).then(function (raw) { + var templete = ""; + var json = raw.hits.hits; + var max_id = raw["hits"].length; + for (var i = 0; i < json.length; i++) { + var toot = json[i]["_source"]; + if (lastid != toot.uri) { + if (toot && toot.account) { + templete = templete + parse([toot], "noauth", null, tlid, 0, [], "tootsearch") + } + } + var lastid = toot.uri; + } + if (!templete) { + templete = lang.lang_details_nodata; + } else { + templete = templete + ''; + } + $("#timeline_" + tlid).append(templete); + + jQuery("time.timeago").timeago(); + }); +} +function graphDraw(tag) { + var tags = ""; + 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); + if (max === 0) { + tags = '
' + his[0].uses + 'toots #' + escapeHTML(tag.name) + ' ' + his[0].accounts + lang.lang_src_people; + } else { + tags = '
' + his[0].uses + 'toots #' + escapeHTML(tag.name) + ' ' + his[0].accounts + lang.lang_src_people; + } + return tags; } /* diff --git a/app/js/tl/tag.js b/app/js/tl/tag.js index 9c1efd42..d5f8240c 100644 --- a/app/js/tl/tag.js +++ b/app/js/tl/tag.js @@ -1,35 +1,35 @@ //タグ表示 -if(location.search){ - var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/); - var mode=m[1]; - var codex=m[2]; - if(mode=="tag"){ - var acct_id=localStorage.getItem("main"); - tl('tag',decodeURI(codex),acct_id,'add'); - } +if (location.search) { + var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/); + var mode = m[1]; + var codex = m[2]; + if (mode == "tag") { + var acct_id = localStorage.getItem("main"); + tl('tag', decodeURI(codex), acct_id, 'add'); + } } //よく使うタグ -function tagShow(tag){ - $("[data-tag="+decodeURI(tag)+"]").toggleClass("hide"); +function tagShow(tag) { + $("[data-tag=" + decodeURI(tag) + "]").toggleClass("hide"); } //タグ追加 -function tagPin(tag){ +function tagPin(tag) { var tags = localStorage.getItem("tag"); - if(!tags){ - var obj=[]; - }else{ + if (!tags) { + var obj = []; + } else { var obj = JSON.parse(tags); } var can; - Object.keys(obj).forEach(function(key) { + Object.keys(obj).forEach(function (key) { var tagT = obj[key]; - if(tagT==tag){ - can=true; - }else{ - can=false; + if (tagT == tag) { + can = true; + } else { + can = false; } }); - if(!can){ + if (!can) { obj.push(tag); } var json = JSON.stringify(obj); @@ -45,86 +45,86 @@ function tagRemove(key) { localStorage.setItem("tag", json); favTag(); } -function favTag(){ +function favTag() { $("#taglist").html(""); var tagarr = localStorage.getItem("tag"); - if(!tagarr){ - var obj=[]; - }else{ + if (!tagarr) { + var obj = []; + } else { var obj = JSON.parse(tagarr); } - var tags=""; - var nowPT=localStorage.getItem("stable") - Object.keys(obj).forEach(function(key) { + var tags = ""; + var nowPT = localStorage.getItem("stable") + Object.keys(obj).forEach(function (key) { var tag = obj[key]; - if(nowPT!=tag){ - console.log("stable tags:"+nowPT+"/"+tag); - var ptt=lang.lang_tags_realtime; - var nowon=""; - }else{ - var ptt=lang.lang_tags_unrealtime; - var nowon="("+lang.lang_tags_realtime+")"; + if (nowPT != tag) { + console.log("stable tags:" + nowPT + "/" + tag); + var ptt = lang.lang_tags_realtime; + var nowon = ""; + } else { + var ptt = lang.lang_tags_unrealtime; + var nowon = "(" + lang.lang_tags_realtime + ")"; } - tag=escapeHTML(tag); - tags = tags + '#' + tag + ''+nowon+' TL Toot '+ - ''+ptt+' '+lang.lang_del+' '; + tag = escapeHTML(tag); + tags = tags + '#' + tag + '' + nowon + ' TL Toot ' + + '' + ptt + ' ' + lang.lang_del + ' '; }); - if(obj.length>0){ + if (obj.length > 0) { $("#taglist").append("My Tags:" + tags); - }else{ + } else { $("#taglist").append(""); } } -function trendTag(){ +function trendTag() { $(".trendtag").remove(); - var domain="imastodon.net" - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var domain = "imastodon.net" + var at = localStorage.getItem("acct_" + acct_id + "_at"); var start = "https://" + domain + "/api/v1/trend_tags" - 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) { - if (json) { - var tags=""; - json=json.score; - Object.keys(json).forEach(function(tag) { - tag=escapeHTML(tag); + 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) { + if (json) { + var tags = ""; + json = json.score; + Object.keys(json).forEach(function (tag) { + tag = escapeHTML(tag); tags = tags + '#' + tag + ' TL Toot '; - }); - $("#taglist").append('アイマストドントレンドタグrefresh:' + tags+''); - trendintervalset() - }else{ + }); + $("#taglist").append('アイマストドントレンドタグrefresh:' + tags + ''); + trendintervalset() + } else { $("#taglist").html(""); } }); - + } -function trendintervalset(){ +function trendintervalset() { setTimeout(trendTag, 6000000); } -function tagTL(a,b,c,d){ +function tagTL(a, b, c, d) { var acct_id = $("#post-acct-sel").val(); - tl(a,b,acct_id,d); + tl(a, b, acct_id, d); } -function autoToot(tag){ - tag=escapeHTML(tag) - var nowPT=localStorage.getItem("stable") - if(nowPT==tag){ +function autoToot(tag) { + tag = escapeHTML(tag) + var nowPT = localStorage.getItem("stable") + if (nowPT == tag) { localStorage.removeItem("stable"); - Materialize.toast(lang.lang_tags_unrealtime,3000); - }else{ - localStorage.setItem("stable",tag); - Materialize.toast(lang.lang_tags_tagwarn.replace("{{tag}}" ,tag).replace("{{tag}}" ,tag),3000); - brInsert('#' + tag+" ") + Materialize.toast(lang.lang_tags_unrealtime, 3000); + } else { + localStorage.setItem("stable", tag); + Materialize.toast(lang.lang_tags_tagwarn.replace("{{tag}}", tag).replace("{{tag}}", tag), 3000); + brInsert('#' + tag + " ") } favTag(); } \ No newline at end of file diff --git a/app/js/tl/tl.js b/app/js/tl/tl.js index 41df6054..534fadec 100644 --- a/app/js/tl/tl.js +++ b/app/js/tl/tl.js @@ -124,14 +124,14 @@ function tl(type, data, acct_id, tlid, delc, voice, mode) { }; } - console.log(["Try to get timeline of "+tlid,start]) + console.log(["Try to get timeline of " + tlid, start]) fetch(start, i).then(function (response) { return response.json(); }).catch(function (error) { todo(error); console.error(error); }).then(function (json) { - console.log(["Result of getting timeline of "+tlid,json]) + console.log(["Result of getting timeline of " + tlid, json]) $("#landing_" + tlid).hide(); if (localStorage.getItem("filter_" + acct_id) != "undefined") { var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), type); @@ -216,11 +216,11 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) { localStorage.setItem("wss_" + tlid, wsid); websocket[wsid] = new WebSocket(start); websocket[wsid].onopen = function (mess) { - console.table({"tlid":tlid,"type":"Connect Streaming API"+type,"domain":domain,"message":[mess]}) + console.table({ "tlid": tlid, "type": "Connect Streaming API" + type, "domain": domain, "message": [mess] }) $("#notice_icon_" + tlid).removeClass("red-text"); } websocket[wsid].onmessage = function (mess) { - console.log([tlid + ":Receive Streaming API:",JSON.parse(mess.data)]); + console.log([tlid + ":Receive Streaming API:", JSON.parse(mess.data)]); if (misskey) { if (JSON.parse(mess.data).type == "note") { var obj = JSON.parse(mess.data).body; @@ -310,7 +310,7 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) { return false; }; websocket[wsid].onclose = function () { - console.warn("Closing "+tlid); + console.warn("Closing " + tlid); if (mode == "error") { $("#notice_icon_" + tlid).addClass("red-text"); todo('WebSocket Closed'); @@ -440,7 +440,7 @@ function moreload(type, tlid) { } //TL差分取得 function tlDiff(type, data, acct_id, tlid, delc, voice, mode) { - console.log("Get diff of TL"+tlid) + console.log("Get diff of TL" + tlid) var multi = localStorage.getItem("column"); var obj = JSON.parse(multi); var acct_id = obj[tlid].domain; @@ -533,7 +533,7 @@ function tlDiff(type, data, acct_id, tlid, delc, voice, mode) { todo(error); console.error(error); }).then(function (json) { - console.log(["Result diff of TL"+tlid,json]); + console.log(["Result diff of TL" + tlid, json]); if (misskey) { var templete = misskeyParse(json, '', acct_id, tlid, "", mute); } else { @@ -557,12 +557,12 @@ function tlCloser() { Object.keys(websocket).forEach(function (tlid) { if (websocketOld[tlid]) { websocketOld[tlid].close(); - console.log("%c Close Streaming API: Old" + tlid,"color:blue"); + console.log("%c Close Streaming API: Old" + tlid, "color:blue"); } if (websocket[0]) { console.log(websocket[0]); websocket[tlid].close(); - console.log("%c Close Streaming API:" + tlid,"color:blue"); + console.log("%c Close Streaming API:" + tlid, "color:blue"); } }); @@ -570,7 +570,7 @@ function tlCloser() { Object.keys(websocketHome).forEach(function (tlid) { if (websocketHome[tlid]) { websocketHome[tlid].close(); - console.log("%c Close Streaming API:Integrated Home" + tlid,"color:blue"); + console.log("%c Close Streaming API:Integrated Home" + tlid, "color:blue"); } }); @@ -578,7 +578,7 @@ function tlCloser() { Object.keys(websocketLocal).forEach(function (tlid) { if (websocketLocal[tlid]) { websocketLocal[tlid].close(); - console.log("%c Close Streaming API:Integrated Local" + tlid,"color:blue"); + console.log("%c Close Streaming API:Integrated Local" + tlid, "color:blue"); } }); @@ -586,17 +586,17 @@ function tlCloser() { Object.keys(websocketNotf).forEach(function (tlid) { if (websocketNotf[tlid]) { websocketNotf[tlid].close(); - console.log("%c Close Streaming API:Notf" + tlid,"color:blue"); + console.log("%c Close Streaming API:Notf" + tlid, "color:blue"); } }); Object.keys(misskeyws).forEach(function (tlid) { if (misskeyws[tlid]) { misskeyws[tlid].close(); - console.log("%c Close Streaming API:Misskey" + tlid,"color:blue"); + console.log("%c Close Streaming API:Misskey" + tlid, "color:blue"); } }); - misskeyws={} + misskeyws = {} } //TLのタイトル @@ -782,7 +782,7 @@ function strAliveInt() { setTimeout(strAlive, 10000); } function reconnector(tlid, type, acct_id, data, mode) { - console.log("%c Reconnector:" + mode+"(timeline"+tlid+")","color:pink") + console.log("%c Reconnector:" + mode + "(timeline" + tlid + ")", "color:pink") if (type == "mix" || type == "integrated" || type == "plus") { if (localStorage.getItem("voice_" + tlid)) { var voice = true; diff --git a/app/js/ui/img.js b/app/js/ui/img.js index 1fe91b74..cefd0cda 100644 --- a/app/js/ui/img.js +++ b/app/js/ui/img.js @@ -6,25 +6,25 @@ function imgv(id, key, acct_id) { $('#imgmodal').attr('src', '../../img/loading.svg'); var murl = $("#" + id + "-image-" + key).attr("data-url"); var type = $("#" + id + "-image-" + key).attr("data-type"); - $("#imagemodal").attr("data-id",id); - $("#imagemodal").attr("data-acct",acct_id); - $(document).ready(function() { + $("#imagemodal").attr("data-id", id); + $("#imagemodal").attr("data-acct", acct_id); + $(document).ready(function () { if (type == "image") { $('#imagemodal').modal('open'); - xhr = new XMLHttpRequest; + xhr = new XMLHttpRequest; xhr.open('GET', murl, true); xhr.addEventListener('progress', function (event) { - if (event.lengthComputable) { - var total=event.total; - var now=event.loaded; - var per=now/total*100; - $("#imgprog").text(Math.floor(per)); - } + if (event.lengthComputable) { + var total = event.total; + var now = event.loaded; + var per = now / total * 100; + $("#imgprog").text(Math.floor(per)); + } }, false); xhr.addEventListener('loadend', function (event) { - var total=event.total; - var now=event.loaded; - var per=now/total*100; + var total = event.total; + var now = event.loaded; + var per = now / total * 100; $("#imgprog").text(Math.floor(per)); }, false); xhr.send(); @@ -40,37 +40,37 @@ function imgv(id, key, acct_id) { } var element = new Image(); var width; - element.onload = function() { + element.onload = function () { var width = element.naturalWidth; var height = element.naturalHeight; var windowH = $(window).height(); var windowW = $(window).width(); - $("#imagemodal").css("bottom","0") - $("#imagemodal img").css("width","auto") - if(heightwindowW*0.8){ - $("#imagemodal").css("width","80vw") - $("#imagemodal img").css("width","100%") - var heightS=windowW*0.8/width*height; - $("#imagemodal").css("height",heightS+60+"px") - }else{ - $("#imagemodal").css("width",width+"px") + $("#imagemodal").css("bottom", "0") + $("#imagemodal img").css("width", "auto") + if (height < windowH) { + $("#imagemodal").css("height", height + 60 + "px") + $("#imagemodal img").css("height", "100%") + if (width > windowW * 0.8) { + $("#imagemodal").css("width", "80vw") + $("#imagemodal img").css("width", "100%") + var heightS = windowW * 0.8 / width * height; + $("#imagemodal").css("height", heightS + 60 + "px") + } else { + $("#imagemodal").css("width", width + "px") } - }else{ - $("#imagemodal img").css("width","auto") - var widthS=windowH/height*width; - if(widthS windowW*0.8){ - $("#imagemodal").css("width","80vw") - $("#imagemodal img").css("width","100%") - var heightS=windowW*0.8/width*height; - $("#imagemodal").css("height",heightS+60+"px") - }else{ - $("#imagemodal").css("width",width+"px") - } - }else{ - $("#imagemodal img").css("width","auto") - var widthS=windowH/height*width; - if(widthS windowW * 0.8) { + $("#imagemodal").css("width", "80vw") + $("#imagemodal img").css("width", "100%") + var heightS = windowW * 0.8 / width * height; + $("#imagemodal").css("height", heightS + 60 + "px") + } else { + $("#imagemodal").css("width", width + "px") + } + } else { + $("#imagemodal img").css("width", "auto") + var widthS = windowH / height * width; + if (widthS < windowW) { + $("#imagemodal").css("width", widthS + "px") + } else { + $("#imagemodal").css("width", "100vw") + } + + $("#imagemodal").css("height", "100vh") + $("#imagemodal img").css("height", "calc(100vh - 60px)") + } + } + if ($("#" + id + "-image-" + (key * 1 + 1)).length === 0) { + $("#image-next").prop("disabled", true); + } else { + $("#image-next").prop("disabled", false); + } + if ($("#" + id + "-image-" + (key * 1 - 1)).length === 0) { + $("#image-prev").prop("disabled", true); + } else { + $("#image-prev").prop("disabled", false); + } + element.src = murl; + + }); } } //ズームボタン(z:倍率) function zoom(z) { var wdth = $('#imagewrap img').width(); var wdth = wdth * z; - $('#imagewrap img').css("width", wdth+"px"); + $('#imagewrap img').css("width", wdth + "px"); var hgt = $('#imagewrap img').height(); var hgt = hgt * z; - $('#imagewrap img').css("height", hgt+"px"); + $('#imagewrap img').css("height", hgt + "px"); } //スマホ対応ドラッグ移動システム -(function() { - $.fn.dragScroll = function() { +(function () { + $.fn.dragScroll = function () { var target = this; - $(this).mousedown(function(event) { + $(this).mousedown(function (event) { $(this) .data('down', true) .data('x', event.clientX) @@ -201,7 +201,7 @@ function zoom(z) { 'cursor': 'move' }); // ウィンドウから外れてもイベント実行 - $(document).mousemove(function(event) { + $(document).mousemove(function (event) { if ($(target).data('down') == true) { // スクロール target.scrollLeft($(target).data('scrollLeft') + $(target).data('x') - @@ -210,10 +210,10 @@ function zoom(z) { event.clientY); return false; // 文字列選択を抑止 } - }).mouseup(function(event) { + }).mouseup(function (event) { $(target).data('down', false); }); - $(this).on('touchstart', function(event) { + $(this).on('touchstart', function (event) { $(this) .data('down', true) .data('x', getX(event)) @@ -225,7 +225,7 @@ function zoom(z) { 'overflow': 'hidden', // スクロールバー非表示 'cursor': 'move' }); //指が触れたか検知 - $(this).on('touchmove', function(event) { + $(this).on('touchmove', function (event) { if ($(target).data('down') === true) { // スクロール target.scrollLeft($(target).data('scrollLeft') + $(target).data('x') - @@ -233,9 +233,9 @@ function zoom(z) { target.scrollTop($(target).data('scrollTop') + $(target).data('y') - getY(event)); return false; // 文字列選択を抑止 - } else {} + } else { } }); //指が動いたか検知 - $(this).on('touchend', function(event) { + $(this).on('touchend', function (event) { $(target).data('down', false); }); @@ -252,7 +252,7 @@ function getY(event) { } //マウスホイールで拡大 var element = document.getElementById("imagemodal"); -element.onmousewheel = function(e) { +element.onmousewheel = function (e) { var delta = e.wheelDelta; if (delta > 0) { zoom(1.1) @@ -262,31 +262,31 @@ element.onmousewheel = function(e) { } //当該トゥート -function detFromImg(){ - var id=$("#imagemodal").attr("data-id"); - var acct_id=$("#imagemodal").attr("data-acct"); +function detFromImg() { + var id = $("#imagemodal").attr("data-id"); + var acct_id = $("#imagemodal").attr("data-acct"); $('#imagemodal').modal('close'); - details(id,acct_id); + details(id, acct_id); } //画像保存 -function dlImg(){ - var url=$("#imgmodal").attr("src"); +function dlImg() { + var url = $("#imgmodal").attr("src"); var electron = require("electron"); var ipc = electron.ipcRenderer; - if(localStorage.getItem("savefolder")){ - var save=localStorage.getItem("savefolder"); - }else{ - var save=""; + if (localStorage.getItem("savefolder")) { + var save = localStorage.getItem("savefolder"); + } else { + var save = ""; } - ipc.send('general-dl', [url,save,false]); + ipc.send('general-dl', [url, save, false]); ipc.on('general-dl-prog', function (event, arg) { - console.log("Progress: "+arg); + console.log("Progress: " + arg); }) ipc.on('general-dl-message', function (event, arg) { - var argC=arg.replace(/\\/g,"\\\\")+"\\\\."; - Materialize.toast(lang.lang_img_DLDone+arg+'', 5000); + var argC = arg.replace(/\\/g, "\\\\") + "\\\\."; + Materialize.toast(lang.lang_img_DLDone + arg + '', 5000); }) } -function openFinder(dir){ +function openFinder(dir) { ipc.send('open-finder', dir); } \ No newline at end of file diff --git a/app/js/ui/layout.js b/app/js/ui/layout.js index 6ac39bd1..be7507e8 100644 --- a/app/js/ui/layout.js +++ b/app/js/ui/layout.js @@ -11,55 +11,55 @@ function addColumnMenu() { $("#left-menu div").removeClass("active"); $("#addColumnMenu").addClass("active"); $(".menu-content").addClass("hide"); - $("#add-box").removeClass("hide"); + $("#add-box").removeClass("hide"); addselCk() } -$('.type').click(function() { +$('.type').click(function () { $(".type").removeClass("active"); $(this).addClass("active"); $("#type-sel").val($(this).attr("data-type")) }) //最初、カラム変更時に発火 function parseColumn(dontclose) { - console.log("%c Parse column","color:red;font-size:125%"); + console.log("%c Parse column", "color:red;font-size:125%"); var size = localStorage.getItem("size"); if (size) { $("#timeline-container").css("font-size", size + "px"); $(".toot-reset").css("font-size", size + "px"); $(".cont-series").css("font-size", size + "px"); } - if(localStorage.getItem("menu-done")){ + if (localStorage.getItem("menu-done")) { $("#fukidashi").addClass("hide") } - if(!dontclose){ + if (!dontclose) { tlCloser(); } var multi = localStorage.getItem("multi"); if (multi) { var obj = JSON.parse(multi); - + var templete; - Object.keys(obj).forEach(function(key) { + Object.keys(obj).forEach(function (key) { var acct = obj[key]; localStorage.setItem("name_" + key, acct.name); localStorage.setItem("user_" + key, acct.user); localStorage.setItem("user-id_" + key, acct.id); localStorage.setItem("prof_" + key, acct.prof); localStorage.setItem("domain_" + key, acct.domain); - localStorage.setItem("acct_"+ key + "_at", acct.at); + localStorage.setItem("acct_" + key + "_at", acct.at); notf(key, 0); ckdb(key); //フィルターデータ読もう getFilter(key); var domain = localStorage.getItem("domain_" + key); - if(localStorage.getItem("mode_" + domain)=="misskey"){ + if (localStorage.getItem("mode_" + domain) == "misskey") { localStorage.removeItem("misskey_wss_" + key) connectMisskey(key) } }); } - var acctlist=obj; + var acctlist = obj; console.table(obj); /*var xed=localStorage.getItem("xed"); if(xed){ @@ -79,223 +79,223 @@ function parseColumn(dontclose) { if ($("#timeline-container").length) { $("#timeline-container").html(""); } - var basekey=0; - for(var key=0;key '+ - ' '+ - ' '+ - ' '+ - ' '+ - '
'; - }else if(acct.type=="home"){ - var exclude='Off'+lang.lang_layout_excludingbt+'
'; - }else{ - var exclude=""; - } - if(!acct.left_fold){ - basekey=key; - var basehtml = ''; - $("#timeline-container").append(basehtml); - var left_hold='view_agenda'+lang.lang_layout_leftFold+'
'; - }else{ - var left_hold='view_column'+lang.lang_layout_leftUnfold+'
'; - } - if(key===0){ - left_hold=''; - } - if(localStorage.getItem("mode_" + localStorage.getItem("domain_" + acct.domain))=="misskey"){ - var isMisRed="" - exclude="" - var if_misskey_hide="hide" - }else{ - var isMisRed="red-text" - var if_misskey_hide="" - } - var html=''; + return html; } -function unstreamingTL(type,key,basekey,insert,icnsert,left_fold,css,animecss,q){ - if(!left_fold){ - var basehtml = ''; +function unstreamingTL(type, key, basekey, insert, icnsert, left_fold, css, animecss, q) { + if (!left_fold) { + var basehtml = ''; $("#timeline-container").append(basehtml); - var left_hold='view_agenda'+lang.lang_layout_leftFold+' '+ - ''+exclude+left_hold+'perm_mediaOn'+lang.lang_layout_mediafil +'
linkOn'+lang.lang_layout_linkana +'
hearingOn'+lang.lang_layout_tts +'TL
low_priority'+lang.lang_layout_reconnect+'
'+lang.lang_layout_headercolor +'' - $('#timeline_box_' + basekey + '_parentBox').append(html); - localStorage.removeItem("pool_" + key); - if (acct.data) { - var data = acct.data; + unstreamingTL(acct.type, key, basekey, insert, icnsert, acct.left_fold, css, animecss, acct.data); } else { - var data = ""; - } - if(localStorage.getItem("catch_" + key)){ - var delc="true"; - }else{ - var delc="false"; - } + var width = localStorage.getItem("width"); + if (width) { + var css = " min-width:" + width + "px;" + } + var anime = localStorage.getItem("animation"); + if (anime == "yes" || !anime) { + var animecss = "box-anime"; + } else { + var animecss = ""; + } + if (acct.type == "notf") { + var exclude = lang.lang_excluded + ':'+lang.lang_layout_nodata +'
' + + ' ' + + ' ' + + ' ' + + ' ' + + '
'; + } else if (acct.type == "home") { + var exclude = 'Off' + lang.lang_layout_excludingbt + '
'; + } else { + var exclude = ""; + } + if (!acct.left_fold) { + basekey = key; + var basehtml = ''; + $("#timeline-container").append(basehtml); + var left_hold = 'view_agenda' + lang.lang_layout_leftFold + '
'; + } else { + var left_hold = 'view_column' + lang.lang_layout_leftUnfold + '
'; + } + if (key === 0) { + left_hold = ''; + } + if (localStorage.getItem("mode_" + localStorage.getItem("domain_" + acct.domain)) == "misskey") { + var isMisRed = "" + exclude = "" + var if_misskey_hide = "hide" + } else { + var isMisRed = "red-text" + var if_misskey_hide = "" + } + var html = ''+ - ' ' + + '' + exclude + left_hold + 'perm_mediaOn' + lang.lang_layout_mediafil + '
linkOn' + lang.lang_layout_linkana + '
hearingOn' + lang.lang_layout_tts + 'TL
low_priority' + lang.lang_layout_reconnect + '
' + lang.lang_layout_headercolor + '' + $('#timeline_box_' + basekey + '_parentBox').append(html); + localStorage.removeItem("pool_" + key); + if (acct.data) { + var data = acct.data; + } else { + var data = ""; + } + if (localStorage.getItem("catch_" + key)) { + var delc = "true"; + } else { + var delc = "false"; + } - if(localStorage.getItem("voice_" + key)){ - var voice=true; - }else{ - var voice=false; - } - tl(acct.type, data, acct.domain, key, delc,voice,""); - cardCheck(key); - ebtCheck(key); - mediaCheck(key); - catchCheck(key); - voiceCheck(key); + if (localStorage.getItem("voice_" + key)) { + var voice = true; + } else { + var voice = false; + } + tl(acct.type, data, acct.domain, key, delc, voice, ""); + cardCheck(key); + ebtCheck(key); + mediaCheck(key); + catchCheck(key); + voiceCheck(key); } } var box = localStorage.getItem("box"); if (box == "absolute") { setTimeout(show, 1000); } - if(localStorage.getItem("reverse")){ + if (localStorage.getItem("reverse")) { $("#bottom").removeClass("reverse"); $(".leftside").removeClass("reverse"); } - if(localStorage.getItem("sec") && localStorage.getItem("sec")!="nothing"){ + if (localStorage.getItem("sec") && localStorage.getItem("sec") != "nothing") { secvis(localStorage.getItem("sec")); } favTag(); var cw = localStorage.getItem("always-cw"); if (cw == "yes") { - if(!$("#cw").hasClass("cw-avail")){ + if (!$("#cw").hasClass("cw-avail")) { $("#cw-text").show(); $("#cw").addClass("yellow-text"); $("#cw").addClass("cw-avail"); - var cwt=localStorage.getItem("cw-text"); - if(cwt){ + var cwt = localStorage.getItem("cw-text"); + if (cwt) { $("#cw-text").val(cwt); } } } } -function checkStr(type, data, acct_id, key, delc,voice){ - if($('#notice_icon_' + key).hasClass("red-text") && type!="notf" && type!="mix"){ +function checkStr(type, data, acct_id, key, delc, voice) { + if ($('#notice_icon_' + key).hasClass("red-text") && type != "notf" && type != "mix") { goTop(key); - tlDiff(type, data, acct_id, key, delc,voice,""); - }else{ + tlDiff(type, data, acct_id, key, delc, voice, ""); + } else { goTop(key); } } //セカンダリートゥートボタン -function secvis(set){ - if(set=="public"){ +function secvis(set) { + if (set == "public") { $("#toot-sec-icon").text("public"); $("#toot-sec-btn").addClass("purple"); - }else if(set=="unlisted"){ + } else if (set == "unlisted") { $("#toot-sec-icon").text("lock_open"); $("#toot-sec-btn").addClass("blue"); - }else if(set=="private"){ + } else if (set == "private") { $("#toot-sec-icon").text("lock"); $("#toot-sec-btn").addClass("orange"); - }else if(set=="direct"){ + } else if (set == "direct") { $("#toot-sec-icon").text("mail"); $("#toot-sec-btn").addClass("red"); - }else if(set=="limited"){ + } else if (set == "limited") { $("#toot-sec-icon").text("group"); $("#toot-sec-btn").addClass("teal"); - }else if(set=="local"){ + } else if (set == "local") { $("#toot-sec-icon").text("visibility"); $("#toot-sec-btn").addClass("light-blue"); } @@ -306,12 +306,12 @@ function addColumn() { var acct = $("#add-acct-sel").val(); localStorage.setItem("last-use", acct); var type = $("#type-sel").val(); - if(acct=="noauth"){ - acct=$("#noauth-url").val(); - type="noauth" - }else if(acct=="webview"){ - acct=""; - type="webview" + if (acct == "noauth") { + acct = $("#noauth-url").val(); + type = "noauth" + } else if (acct == "webview") { + acct = ""; + type = "webview" } var add = { domain: acct, @@ -319,38 +319,38 @@ function addColumn() { }; var multi = localStorage.getItem("column"); var obj = JSON.parse(multi); - if(!obj){ - var leng=0; + if (!obj) { + var leng = 0; var json = JSON.stringify([add]); localStorage.setItem("column", json); - }else{ - var leng=obj.length; + } else { + var leng = obj.length; obj.push(add); var json = JSON.stringify(obj); localStorage.setItem("column", json); } - + parseColumn(); } -function addselCk(){ +function addselCk() { var acct = $("#add-acct-sel").val(); - var domain=localStorage.getItem("domain_" + acct); - if(acct=="webview"){ + var domain = localStorage.getItem("domain_" + acct); + if (acct == "webview") { $("#auth").addClass("hide"); $("#noauth").addClass("hide"); $("#webview-add").removeClass("hide"); - }else if(acct=="noauth"){ + } else if (acct == "noauth") { $("#auth").addClass("hide"); $("#noauth").removeClass("hide"); $("#webview-add").addClass("hide"); - }else{ + } else { $("#auth").removeClass("hide"); $("#noauth").addClass("hide"); $("#webview-add").addClass("hide"); } - if(domain=="knzk.me" || domain=="mstdn.y-zu.org"){ - $("#type-sel").append(''); - }else{ + if (domain == "knzk.me" || domain == "mstdn.y-zu.org") { + $("#type-sel").append(''); + } else { $("#direct-add").remove(); } } @@ -365,11 +365,11 @@ function removeColumn(tlid) { var ipc = electron.ipcRenderer; ipc.send('column-del', ""); ipc.on('column-del-reply', function (event, arg) { - if(arg===1){ + if (arg === 1) { localStorage.removeItem("card_" + tlid); obj.splice(tlid, 1); - for(var i=0;i' + lang.lang_layout_nodata + 'Default Red'+ - 'Pink'+ - 'Purple'+ - 'Deep-purple'+ - 'Indigo'+ - 'Blue'+ - 'Light-blue'+ - 'Cyan'+ - 'Teal'+ - 'Green'+ - 'Light-green'+ - 'Lime'+ - 'Yellow'+ - 'Amber'+ - 'Orange'+ - 'Deep-orange'+ - 'Brown'+ - 'Grey'+ - 'Blue-grey'+ - 'Black'+ - 'White'; - $("#picker_"+key).html(temp); +function colorpicker(key) { + temp = + 'Default' + + 'Red' + + 'Pink' + + 'Purple' + + 'Deep-purple' + + 'Indigo' + + 'Blue' + + 'Light-blue' + + 'Cyan' + + 'Teal' + + 'Green' + + 'Light-green' + + 'Lime' + + 'Yellow' + + 'Amber' + + 'Orange' + + 'Deep-orange' + + 'Brown' + + 'Grey' + + 'Blue-grey' + + 'Black' + + 'White'; + $("#picker_" + key).html(temp); } -function coloradd(key,bg,txt){ +function coloradd(key, bg, txt) { var col = localStorage.getItem("column"); var o = JSON.parse(col); - var obj=o[key]; - obj.background=bg; - obj.text=txt; - o[key]=obj; + var obj = o[key]; + obj.background = bg; + obj.text = txt; + o[key] = obj; var json = JSON.stringify(o); localStorage.setItem("column", json); - if(txt=="def"){ - $("#menu_"+key).css("background-color",""); - $("#menu_"+key).css("color",""); - }else{ - $("#menu_"+key).css('background-color','#'+bg); - if(txt=="black"){ - var bghex="000000"; - var ichex="9e9e9e" - }else if(txt=="white"){ - var bghex="ffffff"; - var ichex="eeeeee" - } - $("#menu_"+key+" .nex").css('color','#'+ichex); - $("#menu_"+key).css('color','#'+bghex); + if (txt == "def") { + $("#menu_" + key).css("background-color", ""); + $("#menu_" + key).css("color", ""); + } else { + $("#menu_" + key).css('background-color', '#' + bg); + if (txt == "black") { + var bghex = "000000"; + var ichex = "9e9e9e" + } else if (txt == "white") { + var bghex = "ffffff"; + var ichex = "eeeeee" + } + $("#menu_" + key + " .nex").css('color', '#' + ichex); + $("#menu_" + key).css('color', '#' + bghex); } } //禁断のTwitter -function webviewParse(url,key,insert,icnsert,css){ +function webviewParse(url, key, insert, icnsert, css) { var html = ''; - + '" style="' + css + '"> '+ - ' ' + + ''+lang.lang_layout_headercolor +'' + lang.lang_layout_headercolor + '
'; - }else{ - var left_hold='view_column'+lang.lang_layout_leftUnfold+'
'; + var left_hold = 'view_agenda' + lang.lang_layout_leftFold + '
'; + } else { + var left_hold = 'view_column' + lang.lang_layout_leftUnfold + '
'; } - var html='") + for (var i = 0; i < arg.length; i++) { + var font = arg[i]; + $("#fonts").append(' '+ - '' + var html = ''+lang.lang_layout_nodata +''; - $("#mute-cli").append(templete); - }); + var templete; + Object.keys(obj).forEach(function (key) { + var cli = obj[key]; + var list = key * 1 + 1; + templete = ' ' + + '' $('#timeline_box_' + basekey + '_parentBox').append(html); - tootsearch(key,q); + tootsearch(key, q); cardCheck(key); ebtCheck(key); mediaCheck(key); @@ -507,18 +507,18 @@ function unstreamingTL(type,key,basekey,insert,icnsert,left_fold,css,animecss,q) voiceCheck(key); return true; } -function leftFoldSet(key){ +function leftFoldSet(key) { var multi = localStorage.getItem("column"); var obj = JSON.parse(multi); - obj[key].left_fold=true; + obj[key].left_fold = true; var json = JSON.stringify(obj); localStorage.setItem("column", json); parseColumn(); } -function leftFoldRemove(key){ +function leftFoldRemove(key) { var multi = localStorage.getItem("column"); var obj = JSON.parse(multi); - obj[key].left_fold=false; + obj[key].left_fold = false; var json = JSON.stringify(obj); localStorage.setItem("column", json); parseColumn(); diff --git a/app/js/ui/menu.js b/app/js/ui/menu.js index 0c46ae93..17dbb91a 100644 --- a/app/js/ui/menu.js +++ b/app/js/ui/menu.js @@ -1,55 +1,56 @@ -function menu(){ - localStorage.setItem("menu-done",true); - $("#fukidashi").addClass("hide") - if(!$("#menu").hasClass("appear")){ - $("#menu").addClass("appear") - var left=localStorage.getItem("menu-left"); - if(left>$('body').width()-$('#menu').width()){ - left=$('body').width()-$('#menu').width(); - }else if(left<0){ - left=0; - } - var top=localStorage.getItem("menu-top"); - if(top>$('body').height()-$('#menu').height()){ - top=$('body').height()-$('#menu').height(); - }else if(top<0){ - top=0; - } - $('#menu').css("left",left+"px") - $('#menu').css("top",top+"px") - $('#menu').fadeIn(); - $("#menu-bar").html("TheDesk "+localStorage.getItem("ver")); - $(".menu-content").addClass("hide"); - $("#add-box").removeClass("hide"); - $("#left-menu div").removeClass("active"); - $("#addColumnMenu").addClass("active"); - }else{ - $('#menu').fadeOut() - $("#menu").removeClass("appear") +function menu() { + localStorage.setItem("menu-done", true); + $("#fukidashi").addClass("hide") + if (!$("#menu").hasClass("appear")) { + $("#menu").addClass("appear") + var left = localStorage.getItem("menu-left"); + if (left > $('body').width() - $('#menu').width()) { + left = $('body').width() - $('#menu').width(); + } else if (left < 0) { + left = 0; } - + var top = localStorage.getItem("menu-top"); + if (top > $('body').height() - $('#menu').height()) { + top = $('body').height() - $('#menu').height(); + } else if (top < 0) { + top = 0; + } + $('#menu').css("left", left + "px") + $('#menu').css("top", top + "px") + $('#menu').fadeIn(); + $("#menu-bar").html("TheDesk " + localStorage.getItem("ver")); + $(".menu-content").addClass("hide"); + $("#add-box").removeClass("hide"); + $("#left-menu div").removeClass("active"); + $("#addColumnMenu").addClass("active"); + } else { + $('#menu').fadeOut() + $("#menu").removeClass("appear") + } + } -$(function() { - $( "#menu" ).draggable({handle: "#menu-bar", - stop: function() { - var left=$('#menu').offset().left; - if(left>$('body').width()-$('#menu').width()){ - left=$('body').width()-$('#menu').width(); - }else if(left<0){ - left=0; +$(function () { + $("#menu").draggable({ + handle: "#menu-bar", + stop: function () { + var left = $('#menu').offset().left; + if (left > $('body').width() - $('#menu').width()) { + left = $('body').width() - $('#menu').width(); + } else if (left < 0) { + left = 0; } - var top=$('#menu').offset().top; - if(top>$('body').height()-$('#menu').height()){ - top=$('body').height()-$('#menu').height(); - }else if(top<0){ - top=0; + var top = $('#menu').offset().top; + if (top > $('body').height() - $('#menu').height()) { + top = $('body').height() - $('#menu').height(); + } else if (top < 0) { + top = 0; } - localStorage.setItem("menu-left",left); - localStorage.setItem("menu-top",top); - } - }); + localStorage.setItem("menu-left", left); + localStorage.setItem("menu-top", top); + } }); -function help(){ - const {shell} = require('electron'); - shell.openExternal("https://docs.thedesk.top"); +}); +function help() { + const { shell } = require('electron'); + shell.openExternal("https://docs.thedesk.top"); } \ No newline at end of file diff --git a/app/js/ui/pip.js b/app/js/ui/pip.js index 39cd7505..44bc43c1 100644 --- a/app/js/ui/pip.js +++ b/app/js/ui/pip.js @@ -1,30 +1,30 @@ -function pip(id){ +function pip(id) { $("#pip-content").html($("[toot-id=" + id + "] .additional").html()); $("#pip").removeClass("hide"); } -function endPip(){ +function endPip() { $("#pip-content").html(""); $("#pip").addClass("hide"); } -function pipHoriz(){ - if($("#pip").hasClass("pip-left")){ +function pipHoriz() { + if ($("#pip").hasClass("pip-left")) { $("#pip").removeClass("pip-left"); $(".pip-horiz").text("chevron_left"); $("#pip").addClass("pip-right"); - }else{ + } else { $("#pip").addClass("pip-left"); $("#pip").removeClass("pip-right"); $(".pip-horiz").text("chevron_right"); } } -function pipVert(){ - if($("#pip").hasClass("pip-top")){ +function pipVert() { + if ($("#pip").hasClass("pip-top")) { $("#pip").removeClass("pip-top"); $("#pip").addClass("pip-bottom"); $(".pip-vert").text("expand_less"); - }else{ + } else { $("#pip").addClass("pip-top"); $("#pip").removeClass("pip-bottom"); $(".pip-vert").text("expand_more"); diff --git a/app/js/ui/post-box.js b/app/js/ui/post-box.js index 7c57328e..4d80f459 100644 --- a/app/js/ui/post-box.js +++ b/app/js/ui/post-box.js @@ -13,9 +13,9 @@ function hide() { //最小化 function mini() { $("body").toggleClass("mini-post"); - if($("body").hasClass("mini-post")){ + if ($("body").hasClass("mini-post")) { $(".mini-btn").text("expand_less"); - }else{ + } else { $(".mini-btn").text("expand_more"); } } @@ -23,51 +23,52 @@ function mini() { function show() { $("#post-box").addClass("appear") $("#textarea").focus(); - console.log("show"+localStorage.getItem("postbox-left")); - var left=localStorage.getItem("postbox-left"); - if(left>$('body').width()-$('#post-box').width()){ - left=$('body').width()-$('#post-box').width(); - }else if(left<0){ - left=0; + console.log("show" + localStorage.getItem("postbox-left")); + var left = localStorage.getItem("postbox-left"); + if (left > $('body').width() - $('#post-box').width()) { + left = $('body').width() - $('#post-box').width(); + } else if (left < 0) { + left = 0; } - var top=localStorage.getItem("postbox-top"); - if(top>$('body').height()-$('#post-box').height()){ - top=$('body').height()-$('#post-box').height(); - }else if(top<0){ - top=0; + var top = localStorage.getItem("postbox-top"); + if (top > $('body').height() - $('#post-box').height()) { + top = $('body').height() - $('#post-box').height(); + } else if (top < 0) { + top = 0; } - $('#post-box').css("left",left+"px") - $('#post-box').css("top",top+"px") + $('#post-box').css("left", left + "px") + $('#post-box').css("top", top + "px") $('#post-box').fadeIn(); } -$(function() { - $( "#post-box" ).draggable({handle: "#post-bar", - stop: function() { - var left=$('#post-box').offset().left; - if(left>$('body').width()-$('#post-box').width()){ - left=$('body').width()-$('#post-box').width(); - }else if(left<0){ - left=0; - } - var top=$('#post-box').offset().top; - if(top>$('body').height()-$('#post-box').height()){ - top=$('body').height()-$('#post-box').height(); - }else if(top<0){ - top=0; - } - localStorage.setItem("postbox-left",left); - localStorage.setItem("postbox-top",top); - } - }); +$(function () { + $("#post-box").draggable({ + handle: "#post-bar", + stop: function () { + var left = $('#post-box').offset().left; + if (left > $('body').width() - $('#post-box').width()) { + left = $('body').width() - $('#post-box').width(); + } else if (left < 0) { + left = 0; + } + var top = $('#post-box').offset().top; + if (top > $('body').height() - $('#post-box').height()) { + top = $('body').height() - $('#post-box').height(); + } else if (top < 0) { + top = 0; + } + localStorage.setItem("postbox-left", left); + localStorage.setItem("postbox-top", top); + } + }); }); //コード受信 -if(location.search){ +if (location.search) { var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/); - var mode=m[1]; - var codex=m[2]; - if(mode=="share"){ + var mode = m[1]; + var codex = m[2]; + if (mode == "share") { console.log(codex); $('textarea').focus(); $("#textarea").val(decodeURI(codex)); @@ -76,27 +77,27 @@ if(location.search){ $(".mini-btn").text("expand_less"); } } -$('#posttgl').click(function(e) { - if(!$('#post-box').hasClass("appear")){ +$('#posttgl').click(function (e) { + if (!$('#post-box').hasClass("appear")) { show(); - }else{ + } else { hide(); } }); -$("#timeline-container,#group").click(function(e) { +$("#timeline-container,#group").click(function (e) { - if(localStorage.getItem("box")!="absolute"){ - if($('#post-box').hasClass("appear") && !localStorage.getItem("nohide")){ + if (localStorage.getItem("box") != "absolute") { + if ($('#post-box').hasClass("appear") && !localStorage.getItem("nohide")) { hide(); } } localStorage.removeItem("nohide") }); -$('#textarea,#cw-text').focusout(function(e) { - localStorage.setItem("nohide",true) - var countup = function(){ +$('#textarea,#cw-text').focusout(function (e) { + localStorage.setItem("nohide", true) + var countup = function () { localStorage.removeItem("nohide") - } + } //setTimeout(remove, 100); }); \ No newline at end of file diff --git a/app/js/ui/radio.js b/app/js/ui/radio.js index 3e27f149..cff54bba 100644 --- a/app/js/ui/radio.js +++ b/app/js/ui/radio.js @@ -1,39 +1,39 @@ var r = document.getElementById("radio"); -function Rtoggle(){ - if($("#radio").hasClass("play")){ +function Rtoggle() { + if ($("#radio").hasClass("play")) { Rstop(); - }else{ + } else { $("#radio-view").toggleClass("hide"); $("#radio-view").toggleClass("show"); $("#radio-input").addClass("hide"); } } -function Rplay(url,name){ - $("#radio").attr('src',url); +function Rplay(url, name) { + $("#radio").attr('src', url); r.load(); r.play(); $("#radio").addClass("play"); $("#radio-btn").addClass("teal-text"); - $("#radio-sta").html("' + lang.lang_layout_nodata + '
Now Playing:"+name); + $("#radio-sta").html("
Now Playing:" + name); } -function Rstop(){ - $("#radio").attr("src",""); +function Rstop() { + $("#radio").attr("src", ""); r.pause(); $("#radio").removeClass("play"); $("#radio-btn").removeClass("teal-text"); $("#radio-sta").html(""); } -function Ryourself(){ +function Ryourself() { $("#radio-input").removeClass("hide"); $("#radio-view").addClass("hide"); } -function Rselect(){ +function Rselect() { $("#radio-input").addClass("hide"); $("#radio-view").removeClass("hide"); } -function Rinput(){ - var url=$("#radio-url").val(); - Rplay(url,url) +function Rinput() { + var url = $("#radio-url").val(); + Rplay(url, url) } /* diff --git a/app/js/ui/scroll.js b/app/js/ui/scroll.js index 7437887d..04f5cba6 100644 --- a/app/js/ui/scroll.js +++ b/app/js/ui/scroll.js @@ -1,13 +1,13 @@ //スクロールで続きを読む function scrollevent() { - $(".tl-box").scroll(function() { + $(".tl-box").scroll(function () { scrollck(); }); } scrollevent(); function scrollck() { - $(".tl-box").each(function(i, elem) { + $(".tl-box").each(function (i, elem) { var tlid = $(this).attr('tlid'); //一番上ならためていた新しいトゥートを表示 if ($(this).scrollTop() === 0) { @@ -18,9 +18,9 @@ function scrollck() { localStorage.removeItem("pool_" + tlid); } //自動リフレッシュ - if( $("#timeline_" + tlid+" .cvo").length > 30 ){ - for(var i=30;i<$("#timeline_" + tlid +" .cvo").length;i++){ - $("#timeline_" + tlid +" .cvo").eq(i).remove(); + if ($("#timeline_" + tlid + " .cvo").length > 30) { + for (var i = 30; i < $("#timeline_" + tlid + " .cvo").length; i++) { + $("#timeline_" + tlid + " .cvo").eq(i).remove(); } } } @@ -28,22 +28,22 @@ function scrollck() { var scrt = $(this).find(".tl").height() - $(window).height(); var scr = $(this).scrollTop(); if (scr > scrt) { - console.log("kicked more loading:"+tlid); + console.log("kicked more loading:" + tlid); moreload('', tlid); } }); } -function goTop(id){ - if ($("#timeline_box_"+id+"_box .tl-box").scrollTop() > 500){ - $("#timeline_box_"+id+"_box .tl-box").scrollTop(500) +function goTop(id) { + if ($("#timeline_box_" + id + "_box .tl-box").scrollTop() > 500) { + $("#timeline_box_" + id + "_box .tl-box").scrollTop(500) } - $("#timeline_box_"+id+"_box .tl-box").animate({scrollTop:0}); + $("#timeline_box_" + id + "_box .tl-box").animate({ scrollTop: 0 }); } -function goColumn(key){ +function goColumn(key) { $("#sort-box").addClass("hide"); $("#sort-box").removeClass("show"); - if($('[tlid='+key+']').length){ - $("#timeline-container").animate({scrollLeft:$("#timeline-container").scrollLeft()+$('[tlid='+key+']').offset().left}); + if ($('[tlid=' + key + ']').length) { + $("#timeline-container").animate({ scrollLeft: $("#timeline-container").scrollLeft() + $('[tlid=' + key + ']').offset().left }); } } \ No newline at end of file diff --git a/app/js/ui/settings.js b/app/js/ui/settings.js index d3bbe8d3..607b272a 100644 --- a/app/js/ui/settings.js +++ b/app/js/ui/settings.js @@ -1,17 +1,17 @@ //設定(setting.html)で読む var envView = new Vue({ el: '#envView', - data: {config:envConstruction}, + data: { config: envConstruction }, methods: { - complete: function (i,val) { - var ls=envView.config[i].storage; + complete: function (i, val) { + var ls = envView.config[i].storage; Materialize.toast("Complete", 3000); - if(!val){ - var id=envView.config[i].id; - var val=$("#"+id).val() + if (!val) { + var id = envView.config[i].id; + var val = $("#" + id).val() } - localStorage.setItem(ls,val) - if(ls=="ha"){ + localStorage.setItem(ls, val) + if (ls == "ha") { hardwareAcceleration(val) } return true @@ -20,32 +20,32 @@ var envView = new Vue({ }); var tlView = new Vue({ el: '#tlView', - data: {config:tlConstruction}, + data: { config: tlConstruction }, methods: { - complete: function (i,val) { - var ls=tlView.config[i].storage; - if(!val){ - var id=tlView.config[i].id; - var val=$("#"+id).val() + complete: function (i, val) { + var ls = tlView.config[i].storage; + if (!val) { + var id = tlView.config[i].id; + var val = $("#" + id).val() } Materialize.toast("Complete", 3000); - localStorage.setItem(ls,val) + localStorage.setItem(ls, val) return true } } }); var postView = new Vue({ el: '#postView', - data: {config:postConstruction,kirishima:localStorage.getItem('kirishima')}, + data: { config: postConstruction, kirishima: localStorage.getItem('kirishima') }, methods: { - complete: function (i,val) { - var ls=postView.config[i].storage; + complete: function (i, val) { + var ls = postView.config[i].storage; Materialize.toast("Complete", 3000); - if(!val){ - var id=postView.config[i].id; - var val=$("#"+id).val() + if (!val) { + var id = postView.config[i].id; + var val = $("#" + id).val() } - localStorage.setItem(ls,val) + localStorage.setItem(ls, val) return true } } @@ -53,32 +53,32 @@ var postView = new Vue({ //設定ボタン押した。 function settings() { var cd = $("[name=theme]:checked").val(); - var ct = $("[for="+cd+"]").html(); - if(cd=="custom" && !$("#custom-sel-sel").val()){ + var ct = $("[for=" + cd + "]").html(); + if (cd == "custom" && !$("#custom-sel-sel").val()) { var theme = localStorage.getItem("theme"); if (!theme) { var theme = "white"; } $("#" + theme).prop("checked", true); - }else{ + } else { if (cd != localStorage.getItem("theme")) { - Materialize.toast(lang.lang_setting_theme.replace("{{set}}" ,ct), 3000); + Materialize.toast(lang.lang_setting_theme.replace("{{set}}", ct), 3000); } //テーマはこの場で設定 themes(cd); localStorage.setItem("theme", cd); } var fontd = $("#font").val(); - if(fontd){ + if (fontd) { if (fontd != localStorage.getItem("font")) { - Materialize.toast(lang.lang_setting_font.replace("{{set}}" ,fontd), 3000); + Materialize.toast(lang.lang_setting_font.replace("{{set}}", fontd), 3000); } localStorage.setItem("font", fontd); themes(); - }else{ - if(localStorage.getItem("font")){ + } else { + if (localStorage.getItem("font")) { localStorage.removeItem("font"); - Materialize.toast(lang.lang_setting_font.replace("{{set}}" ,lang.lang_setting_default), 3000); + Materialize.toast(lang.lang_setting_font.replace("{{set}}", lang.lang_setting_default), 3000); themes(); } } @@ -86,31 +86,31 @@ function settings() { //読み込み時の設定ロード function load() { - var max=envView.config.length; - for(var i=0;i' + list + - '.' + - escapeHTML(cli) + ' ' + list + + '.' + + escapeHTML(cli) + ''; + $("#mute-cli").append(templete); + }); + } } -} -function cliMuteDel(key){ +function cliMuteDel(key) { var cli = localStorage.getItem("client_mute"); var obj = JSON.parse(cli); obj.splice(key, 1); @@ -161,113 +161,113 @@ function cliMuteDel(key){ climute(); } -function wordmute(){ +function wordmute() { var word = localStorage.getItem("word_mute"); var obj = JSON.parse(word); $('#wordmute').material_chip({ data: obj, - }); + }); } -function wordmuteSave(){ - var word=$('#wordmute').material_chip('data'); +function wordmuteSave() { + var word = $('#wordmute').material_chip('data'); var json = JSON.stringify(word); localStorage.setItem("word_mute", json); } -function wordemp(){ +function wordemp() { var word = localStorage.getItem("word_emp"); var obj = JSON.parse(word); $('#wordemp').material_chip({ data: obj, }); } -function wordempSave(){ - var word=$('#wordemp').material_chip('data'); +function wordempSave() { + var word = $('#wordemp').material_chip('data'); var json = JSON.stringify(word); localStorage.setItem("word_emp", json); } -function notftest(){ - var electron = require("electron"); - var ipc = electron.ipcRenderer; - var os = electron.remote.process.platform; - var options = { - body: lang.lang_setting_notftest+'('+lang.lang_setting_notftestprof+')', - icon: localStorage.getItem("prof_0") - }; - if(os=="darwin"){ - var n = new Notification('TheDesk'+lang.lang_setting_notftest, options); - }else{ - ipc.send('native-notf', ['TheDesk'+lang.lang_setting_notftest,lang.lang_setting_notftest+'('+lang.lang_setting_notftestprof+')',localStorage.getItem('prof_0'),"",""]); - } - -} -function oks(no){ - var txt=$("#oks-"+no).val(); - localStorage.setItem("oks-"+no, txt); - Materialize.toast(lang.lang_setting_ksref, 3000); -} -function oksload(){ - if(localStorage.getItem("oks-1")){$("#oks-1").val(localStorage.getItem("oks-1"))} - if(localStorage.getItem("oks-2")){$("#oks-2").val(localStorage.getItem("oks-2"))} - if(localStorage.getItem("oks-3")){$("#oks-3").val(localStorage.getItem("oks-3"))} -} -function changelang(lang){ +function notftest() { var electron = require("electron"); var ipc = electron.ipcRenderer; - ipc.send('lang',lang); + var os = electron.remote.process.platform; + var options = { + body: lang.lang_setting_notftest + '(' + lang.lang_setting_notftestprof + ')', + icon: localStorage.getItem("prof_0") + }; + if (os == "darwin") { + var n = new Notification('TheDesk' + lang.lang_setting_notftest, options); + } else { + ipc.send('native-notf', ['TheDesk' + lang.lang_setting_notftest, lang.lang_setting_notftest + '(' + lang.lang_setting_notftestprof + ')', localStorage.getItem('prof_0'), "", ""]); + } + +} +function oks(no) { + var txt = $("#oks-" + no).val(); + localStorage.setItem("oks-" + no, txt); + Materialize.toast(lang.lang_setting_ksref, 3000); +} +function oksload() { + if (localStorage.getItem("oks-1")) { $("#oks-1").val(localStorage.getItem("oks-1")) } + if (localStorage.getItem("oks-2")) { $("#oks-2").val(localStorage.getItem("oks-2")) } + if (localStorage.getItem("oks-3")) { $("#oks-3").val(localStorage.getItem("oks-3")) } +} +function changelang(lang) { + var electron = require("electron"); + var ipc = electron.ipcRenderer; + ipc.send('lang', lang); ipc.on('langres', function (event, arg) { - location.href="../"+lang+"/setting.html" + location.href = "../" + lang + "/setting.html" }); } -function exportSettings(){ - if(!confirm(lang.lang_setting_exportwarn)){ +function exportSettings() { + if (!confirm(lang.lang_setting_exportwarn)) { return false; } var electron = require("electron"); - var remote=electron.remote; - var dialog=remote.dialog; + var remote = electron.remote; + var dialog = remote.dialog; var ipc = electron.ipcRenderer; dialog.showSaveDialog(null, { title: 'Export', properties: ['openFile', 'createDirectory'], defaultPath: "export.thedeskconfigv2" }, (savedFiles) => { - if(!savedFiles){ + if (!savedFiles) { return false; } - var exp={}; + var exp = {}; //Accounts var multi = localStorage.getItem("multi"); var acct = JSON.parse(multi); - exp.accts=acct; + exp.accts = acct; //Columns var multi = localStorage.getItem("column"); var column = JSON.parse(multi); - exp.columns=column; + exp.columns = column; //Themes - var config={}; - config.theme=localStorage.getItem("theme"); + var config = {}; + config.theme = localStorage.getItem("theme"); //Other configs - var max=envView.config.length; - for(var i=0;i{ - if(!fileNames){ + if (!fileNames) { return false; } ipc.send('import', fileNames[0]); ipc.on('config', function (event, arg) { var obj = JSON.parse(arg); - if(obj){ + if (obj) { localStorage.clear(); - localStorage.setItem("multi",JSON.stringify(obj.accts)); - for(var key=0;key { - localStorage.setItem("savefolder",fileNames[0]); + localStorage.setItem("savefolder", fileNames[0]); }); } -function font(){ +function font() { var electron = require("electron"); var ipc = electron.ipcRenderer; ipc.send('fonts', []); ipc.on('font-list', function (event, arg) { $("#fonts").removeClass("hide"); - for( var i=0; i '+font.family+" ' + font.family + "") } }); } -function insertFont(name){ +function insertFont(name) { $("#font").val(name); } -$(".color-picker").each(function(i, elem) { - pickerDefine(i,"fff"); +$(".color-picker").each(function (i, elem) { + pickerDefine(i, "fff"); }); -function pickerDefine(i,color){ +function pickerDefine(i, color) { var pickr = new Pickr({ - el: '#color-picker'+i, + el: '#color-picker' + i, default: color, showAlways: true, appendToBody: true, @@ -459,70 +459,50 @@ function pickerDefine(i,color){ } }, strings: { - save: 'Save', // Default for save button - clear: 'Clear' // Default for clear button + save: 'Save', // Default for save button + clear: 'Clear' // Default for clear button } - }); - pickr.on('change', (...args) => { - var rgb='rgb('+args[0].toRGBA()[0]+','+args[0].toRGBA()[1]+','+args[0].toRGBA()[2]+')'; - $("#color-picker"+i+"_value").val(rgb) - }); + }); + pickr.on('change', (...args) => { + var rgb = 'rgb(' + args[0].toRGBA()[0] + ',' + args[0].toRGBA()[1] + ',' + args[0].toRGBA()[2] + ')'; + $("#color-picker" + i + "_value").val(rgb) + }); } -function customComp(){ - var nameC=$("#custom_name").val(); - if(!nameC){return false;} - var descC=$("#custom_desc").val(); - var primaryC=$("#color-picker0_value").val(); - if(!primaryC){primaryC="rgb(255,255,255)"} - var secondaryC=$("#color-picker1_value").val(); - if(!secondaryC){secondaryC="rgb(255,255,255)"} - var textC=$("#color-picker2_value").val(); - if(!textC){textC="rgb(255,255,255)"} - var accentC=$("#color-picker3_value").val(); - if(!accentC){accentC="rgb(255,255,255)"} +function customComp() { + var nameC = $("#custom_name").val(); + if (!nameC) { return false; } + var descC = $("#custom_desc").val(); + var primaryC = $("#color-picker0_value").val(); + if (!primaryC) { primaryC = "rgb(255,255,255)" } + var secondaryC = $("#color-picker1_value").val(); + if (!secondaryC) { secondaryC = "rgb(255,255,255)" } + var textC = $("#color-picker2_value").val(); + if (!textC) { textC = "rgb(255,255,255)" } + var accentC = $("#color-picker3_value").val(); + if (!accentC) { accentC = "rgb(255,255,255)" } var multi = localStorage.getItem("multi"); - var my=JSON.parse(multi)[0].name; - var id=$("#custom-edit-sel").val(); - if(id=="add_new"){ - id=makeCID(); + var my = JSON.parse(multi)[0].name; + var id = $("#custom-edit-sel").val(); + if (id == "add_new") { + id = makeCID(); } - var json={ + var json = { "name": nameC, "author": my, "desc": descC, "base": $("[name=direction]:checked").val(), "vars": { - "primary": primaryC, - "secondary": secondaryC, - "text": textC + "primary": primaryC, + "secondary": secondaryC, + "text": textC }, "props": { "TheDeskAccent": accentC }, "id": id - } - $("#custom_json").val(JSON.stringify(json)); - themes(); - $("#custom_name").val(""); - $("#custom_desc").val(""); - $("#dark").prop("checked", true); - $("#custom_json").val(""); - $("#color-picker0-wrap").html('') - $("#color-picker1-wrap").html('') - $("#color-picker2-wrap").html('') - $("#color-picker3-wrap").html('') - $("#color-picker0_value").val(""); - $("#color-picker1_value").val(""); - $("#color-picker2_value").val(""); - $("#color-picker3_value").val(""); - pickerDefine(0,"fff"); - pickerDefine(1,"fff"); - pickerDefine(2,"fff"); - pickerDefine(3,"fff"); - ipc.send('theme-json-create', JSON.stringify(json)); -} -function deleteIt(){ - var id=$("#custom-sel-sel").val(); + } + $("#custom_json").val(JSON.stringify(json)); + themes(); $("#custom_name").val(""); $("#custom_desc").val(""); $("#dark").prop("checked", true); @@ -535,40 +515,60 @@ function deleteIt(){ $("#color-picker1_value").val(""); $("#color-picker2_value").val(""); $("#color-picker3_value").val(""); - pickerDefine(0,"fff"); - pickerDefine(1,"fff"); - pickerDefine(2,"fff"); - pickerDefine(3,"fff"); + pickerDefine(0, "fff"); + pickerDefine(1, "fff"); + pickerDefine(2, "fff"); + pickerDefine(3, "fff"); + ipc.send('theme-json-create', JSON.stringify(json)); +} +function deleteIt() { + var id = $("#custom-sel-sel").val(); + $("#custom_name").val(""); + $("#custom_desc").val(""); + $("#dark").prop("checked", true); + $("#custom_json").val(""); + $("#color-picker0-wrap").html('') + $("#color-picker1-wrap").html('') + $("#color-picker2-wrap").html('') + $("#color-picker3-wrap").html('') + $("#color-picker0_value").val(""); + $("#color-picker1_value").val(""); + $("#color-picker2_value").val(""); + $("#color-picker3_value").val(""); + pickerDefine(0, "fff"); + pickerDefine(1, "fff"); + pickerDefine(2, "fff"); + pickerDefine(3, "fff"); ipc.on('theme-json-delete-complete', function (event, args) { ctLoad() }); ipc.send('theme-json-delete', id); } -function ctLoad(){ +function ctLoad() { ipc.send('theme-json-list', ""); ipc.on('theme-json-list-response', function (event, args) { - var templete=""; - Object.keys(args).forEach(function(key) { + var templete = ""; + Object.keys(args).forEach(function (key) { var theme = args[key]; - var themeid=theme.id - templete = templete+''; + var themeid = theme.id + templete = templete + ''; }); - if(args[0]){ - localStorage.setItem("customtheme-id",args[0].id) + if (args[0]) { + localStorage.setItem("customtheme-id", args[0].id) } $("#custom-sel-sel").html(templete); - templete=''+templete; + templete = '' + templete; $("#custom-edit-sel").html(templete); $('select').material_select('update'); }); } -function customSel(){ - var id=$("#custom-sel-sel").val(); - localStorage.setItem("customtheme-id",id) +function customSel() { + var id = $("#custom-sel-sel").val(); + localStorage.setItem("customtheme-id", id) } -function custom(){ - var id=$("#custom-edit-sel").val(); - if(id=="add_new"){ +function custom() { + var id = $("#custom-edit-sel").val(); + if (id == "add_new") { $("#custom_name").val(""); $("#custom_desc").val(""); $("#dark").prop("checked", true); @@ -581,51 +581,51 @@ function custom(){ $("#color-picker1_value").val(""); $("#color-picker2_value").val(""); $("#color-picker3_value").val(""); - pickerDefine(0,"fff"); - pickerDefine(1,"fff"); - pickerDefine(2,"fff"); - pickerDefine(3,"fff"); + pickerDefine(0, "fff"); + pickerDefine(1, "fff"); + pickerDefine(2, "fff"); + pickerDefine(3, "fff"); $("#delTheme").addClass("disabled") - }else{ + } else { $("#delTheme").removeClass("disabled") ipc.send('theme-json-request', id); ipc.on('theme-json-response', function (event, args) { $("#custom_name").val(args.name); $("#custom_desc").val(args.desc); - $("#"+args.base).prop("checked", true); + $("#" + args.base).prop("checked", true); $("#color-picker0-wrap").html('') - pickerDefine(0,rgbToHex(args.vars.primary)) + pickerDefine(0, rgbToHex(args.vars.primary)) $("#color-picker0_value").val(args.vars.primary); $("#color-picker1-wrap").html('') - pickerDefine(1,rgbToHex(args.vars.secondary)) + pickerDefine(1, rgbToHex(args.vars.secondary)) $("#color-picker1_value").val(args.vars.secondary); $("#color-picker2-wrap").html('') $("#color-picker2_value").val(args.vars.text); - pickerDefine(2,rgbToHex(args.vars.text)) - if(args.props){ - if(args.props.TheDeskAccent){ - var accent=args.props.TheDeskAccent; - }else{ - var accent=args.vars.secondary; + pickerDefine(2, rgbToHex(args.vars.text)) + if (args.props) { + if (args.props.TheDeskAccent) { + var accent = args.props.TheDeskAccent; + } else { + var accent = args.vars.secondary; } - }else{ - var accent=args.vars.secondary; + } else { + var accent = args.vars.secondary; } $("#color-picker3-wrap").html('') - pickerDefine(3,rgbToHex(accent)) + pickerDefine(3, rgbToHex(accent)) $("#custom_json").val(JSON.stringify(args)); }); } } -function customImp(){ - var json=$("#custom_import").val(); - if(JSON5.parse(json)){ +function customImp() { + var json = $("#custom_import").val(); + if (JSON5.parse(json)) { ipc.send('theme-json-create', json); - }else{ + } else { alert("Error") } } -function hardwareAcceleration(had){ +function hardwareAcceleration(had) { ipc.send('ha', had); } @@ -633,32 +633,32 @@ ipc.on('theme-json-create-complete', function (event, args) { $("#custom_import").val(""); ctLoad() }); -function customSound(key){ +function customSound(key) { var electron = require("electron"); - var remote=electron.remote; - var dialog=remote.dialog; + var remote = electron.remote; + var dialog = remote.dialog; dialog.showOpenDialog(null, { title: 'Custom sound', properties: ['openFile'], filters: [ - {name: 'Audio', extensions: ['mp3','aac','wav','flac','m4a']}, - {name: 'All', extensions: ['*']}, + { name: 'Audio', extensions: ['mp3', 'aac', 'wav', 'flac', 'm4a'] }, + { name: 'All', extensions: ['*'] }, ] }, (fileNames) => { - localStorage.setItem("custom"+key,fileNames[0]); + localStorage.setItem("custom" + key, fileNames[0]); $("#c1-file").text(fileNames[0]) }); } -window.onload = function() { +window.onload = function () { //最初に読む -load(); -climute(); -wordmute(); -wordemp(); -checkSpotify(); -voiceSettingLoad(); -oksload(); -npprovider(); -ctLoad() - }; + load(); + climute(); + wordmute(); + wordemp(); + checkSpotify(); + voiceSettingLoad(); + oksload(); + npprovider(); + ctLoad() +}; diff --git a/app/js/ui/sort.js b/app/js/ui/sort.js index 204d50c8..b79d5c8d 100644 --- a/app/js/ui/sort.js +++ b/app/js/ui/sort.js @@ -1,43 +1,43 @@ //ソートデータ読み込み -function sortload(){ +function sortload() { var col = localStorage.getItem("column"); - if (col) { - var obj = JSON.parse(col); + if (col) { + var obj = JSON.parse(col); + } + Object.keys(obj).forEach(function (key) { + var acct = obj[key]; + var flag = "false"; + if (localStorage.getItem("card_" + key) == "true") { + flag = "true" } - Object.keys(obj).forEach(function(key) { - var acct = obj[key]; - var flag="false"; - if(localStorage.getItem("card_" + key)=="true"){ - flag="true" - } - var insert=""; + var insert = ""; - if(acct.background){ - if(acct.text=="def"){ - - }else{ - if(acct.text=="black"){ - var txhex="000000"; - }else if(acct.text=="white"){ - var txhex="ffffff"; - } - insert=' style="background-color:#'+acct.background+'; color: #'+txhex+'" '; + if (acct.background) { + if (acct.text == "def") { + + } else { + if (acct.text == "black") { + var txhex = "000000"; + } else if (acct.text == "white") { + var txhex = "ffffff"; + } + insert = ' style="background-color:#' + acct.background + '; color: #' + txhex + '" '; } } - var user=localStorage.getItem("user_" + acct.domain); - var domain=localStorage.getItem("domain_" + acct.domain); - if(!user || !domain){ - var acctdata=""; - }else{ - var acctdata=user+"@"+domain; - } - - var html=''; - $("#sort").append(html); - }); - drag(); + var user = localStorage.getItem("user_" + acct.domain); + var domain = localStorage.getItem("domain_" + acct.domain); + if (!user || !domain) { + var acctdata = ""; + } else { + var acctdata = user + "@" + domain; + } + + var html = ' '+icon(acct.type)+''+cap(acct.type, escapeHTML(acct.data),acct.domain)+''+acctdata+''; + $("#sort").append(html); + }); + drag(); } //TLのタイトル @@ -56,47 +56,47 @@ function Scap(type, data) { return "Notification" } else if (type == "mix") { return "Integrated" - }else if (type == "webview") { + } else if (type == "webview") { return "Twitter" - }else if (type == "tootsearch") { + } else if (type == "tootsearch") { return "tootsearch(" + data + ")" - }else{ - console.error("unknown timeline type: "+type); + } else { + console.error("unknown timeline type: " + type); } } //jquery-ui依存 -function drag(){ +function drag() { $('#sort').sortable(); $('#sort').disableSelection(); } //ソート指定 -function sort(){ - var arr=[]; - var flags=[]; - $(".drag-content").each(function(i, elem) { - var id=$(this).attr("data-id"); - var flag=$(this).attr("data-flag"); +function sort() { + var arr = []; + var flags = []; + $(".drag-content").each(function (i, elem) { + var id = $(this).attr("data-id"); + var flag = $(this).attr("data-flag"); arr.push(id) flags.push(flag); }); var col = localStorage.getItem("column"); var obj = JSON.parse(col); - var newobj=[]; - for(i=0;i ' + icon(acct.type) + '' + cap(acct.type, escapeHTML(acct.data), acct.domain) + '' + acctdata + '0) { return false; } - ipc.send('itunes', ""); - ipc.once('itunes-np', function (event, arg) { + ipc.send('itunes', ""); + ipc.once('itunes-np', function (event, arg) { if (arg.cmd) { - console.error(arg); - return; + console.error(arg); + return; } console.table(arg); - var content=localStorage.getItem("np-temp"); - if(!content || content=="" || content=="null"){ - var content="#NowPlaying {song} / {album} / {artist}\n{url}"; + var content = localStorage.getItem("np-temp"); + if (!content || content == "" || content == "null") { + var content = "#NowPlaying {song} / {album} / {artist}\n{url}"; } - var flag=localStorage.getItem("artwork"); - var remote=electron.remote; - var platform=remote.process.platform; - if(platform=="win32"){ - if(flag && arg.path){ - media(arg.path,"image/png","new"); + var flag = localStorage.getItem("artwork"); + var remote = electron.remote; + var platform = remote.process.platform; + if (platform == "win32") { + if (flag && arg.path) { + media(arg.path, "image/png", "new"); } - }else if(platform=="darwin"){ - if(flag && arg.existsArtwork){ - media(arg.artworks[0].data,"image/png","new"); + } else if (platform == "darwin") { + if (flag && arg.existsArtwork) { + media(arg.artworks[0].data, "image/png", "new"); } } var regExp = new RegExp("{song}", "g"); @@ -161,61 +161,61 @@ function nowplaying(mode){ var regExp = new RegExp("{composer}", "g"); content = content.replace(regExp, arg.composer); var regExp = new RegExp("{hz}", "g"); - content = content.replace(regExp, arg.sampleRate/1000+"kHz"); + content = content.replace(regExp, arg.sampleRate / 1000 + "kHz"); var regExp = new RegExp("{lyricist}", "g"); content = content.replace(regExp, ""); var regExp = new RegExp("{bpm}", "g"); content = content.replace(regExp, ""); var regExp = new RegExp("{bitRate}", "g"); - content = content.replace(regExp, arg.bitRate+"kbps"); + content = content.replace(regExp, arg.bitRate + "kbps"); var regExp = new RegExp("{genre}", "g"); content = content.replace(regExp, arg.genre); $("#textarea").val(content); - }) + }) } - + } -function spotifySave(){ - var temp=$("#np-temp").val(); +function spotifySave() { + var temp = $("#np-temp").val(); localStorage.setItem("np-temp", temp); Materialize.toast(lang.lang_spotify_np, 3000); } -function npprovider(){ +function npprovider() { var provd = $("[name=npp]:checked").val(); - if(!provd){ + if (!provd) { if (localStorage.getItem("np_provider")) { - $("[value="+localStorage.getItem("np_provider")+"]").prop("checked", true); - }else{ + $("[value=" + localStorage.getItem("np_provider") + "]").prop("checked", true); + } else { $("[value=AIMP]").prop("checked", true); localStorage.setItem("np_provider", "AIMP"); } - }else{ + } else { if (provd != localStorage.getItem("np_provider")) { - Materialize.toast(lang.lang_setting_npprovide.replace("{{set}}" ,provd), 3000); + Materialize.toast(lang.lang_setting_npprovide.replace("{{set}}", provd), 3000); } localStorage.setItem("np_provider", provd); var electron = require("electron"); var ipc = electron.ipcRenderer; - ipc.send('itunes', ["set",provd]); + ipc.send('itunes', ["set", provd]); } } -if(location.search){ +if (location.search) { var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/); - var mode=m[1]; - var codex=m[2]; - if(mode=="spotify"){ - var coder=codex.split(":"); + var mode = m[1]; + var codex = m[2]; + if (mode == "spotify") { + var coder = codex.split(":"); localStorage.setItem("spotify", coder[0]); localStorage.setItem("spotify-refresh", coder[1]); - }else{ - + } else { + } - + } -$("#npbtn").click(function() { +$("#npbtn").click(function () { nowplaying('spotify'); }); -$("#npbtn").bind('contextmenu', function() { +$("#npbtn").bind('contextmenu', function () { nowplaying('itunes'); return false; }); \ No newline at end of file diff --git a/app/js/ui/theme.js b/app/js/ui/theme.js index ca5b65d0..0d550e56 100644 --- a/app/js/ui/theme.js +++ b/app/js/ui/theme.js @@ -2,9 +2,9 @@ function themes(theme) { if (!theme) { var theme = localStorage.getItem("theme"); - if(!theme){ - var theme="black"; - localStorage.setItem("theme","black"); + if (!theme) { + var theme = "black"; + localStorage.setItem("theme", "black"); } } $("html").removeClass("indigotheme"); @@ -12,15 +12,15 @@ function themes(theme) { $("html").removeClass("browntheme"); $("html").removeClass("blacktheme"); $("html").removeClass("customtheme"); - $("html").addClass(theme+"theme"); + $("html").addClass(theme + "theme"); var font = localStorage.getItem("font"); - if(font){ - $("html").css("font-family",font); - }else{ - $("html").css("font-family",""); + if (font) { + $("html").css("font-family", font); + } else { + $("html").css("font-family", ""); } - if(theme=="custom"){ - if(localStorage.getItem("customtheme-id")){ + if (theme == "custom") { + if (localStorage.getItem("customtheme-id")) { ipc.send('theme-css-request', localStorage.getItem("customtheme-id")); } } diff --git a/app/js/ui/tips.js b/app/js/ui/tips.js index 6c253b15..35dbbd2d 100644 --- a/app/js/ui/tips.js +++ b/app/js/ui/tips.js @@ -1,201 +1,200 @@ //左下のメッセージ -var todcTrigger=null; -function todo(mes){ +var todcTrigger = null; +function todo(mes) { clearInterval(todcTrigger); $('#message').text(mes); $('#message').fadeIn(); - todcTrigger=setTimeout(todc, 4000); + todcTrigger = setTimeout(todc, 4000); } -function todc(){ +function todc() { $('#message').fadeOut(); } //reverse -function bottomReverse(){ +function bottomReverse() { $("#bottom").toggleClass("reverse"); $(".leftside").toggleClass("reverse"); - if($("#bottom").hasClass("reverse")){ + if ($("#bottom").hasClass("reverse")) { localStorage.removeItem("reverse") - }else{ - localStorage.setItem("reverse","true") + } else { + localStorage.setItem("reverse", "true") } } -function tips(mode){ +function tips(mode) { var electron = require("electron"); var ipc = electron.ipcRenderer; ipc.send('endmem', ""); clearInterval(clockint); clearInterval(spotStart); - if(mode=="ver"){ + if (mode == "ver") { tipsToggle() - $("#tips-text").html('TheDesk '+localStorage.getItem("ver")+'[supervisor_account1+]') - localStorage.setItem("tips","ver") - }else if(mode=="clock"){ + $("#tips-text").html('TheDesk ' + localStorage.getItem("ver") + '[supervisor_account1+]') + localStorage.setItem("tips", "ver") + } else if (mode == "clock") { tipsToggle() - localStorage.setItem("tips","clock") + localStorage.setItem("tips", "clock") clock() - }else if(mode=="memory"){ + } else if (mode == "memory") { tipsToggle() - localStorage.setItem("tips","memory") + localStorage.setItem("tips", "memory") startmem(); - }else if(mode=="trend"){ + } else if (mode == "trend") { tipsToggle() - localStorage.setItem("tips","trend") + localStorage.setItem("tips", "trend") trendTagonTip() - }else if(mode=="spotify"){ + } else if (mode == "spotify") { tipsToggle() - localStorage.setItem("tips","spotify") - var json=nowplaying("spotifytips") + localStorage.setItem("tips", "spotify") + var json = nowplaying("spotifytips") spotifytips(json) } } //メモリ -function startmem(){ +function startmem() { var electron = require("electron"); var ipc = electron.ipcRenderer; ipc.send('startmem', ""); ipc.on('memory', function (event, arg) { - var use=arg[0]; - var cpu=arg[1]; - var total=arg[2] - $("#tips-text").html(escapeHTML(cpu)+"
Memory:"+Math.floor(use/1024/1024/102.4)/10+"/"+Math.floor(total/1024/1024/102.4)/10+"GB("+Math.floor(use/total*100)+"%)") + var use = arg[0]; + var cpu = arg[1]; + var total = arg[2] + $("#tips-text").html(escapeHTML(cpu) + "
Memory:" + Math.floor(use / 1024 / 1024 / 102.4) / 10 + "/" + Math.floor(total / 1024 / 1024 / 102.4) / 10 + "GB(" + Math.floor(use / total * 100) + "%)") }) } //トレンドタグ -function trendTagonTip(){ - $(".trendtag").remove(); - var domain="imastodon.net" - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - var start = "https://" + domain + "/api/v1/trend_tags" +function trendTagonTip() { + $(".trendtag").remove(); + var domain = "imastodon.net" + var at = localStorage.getItem("acct_" + acct_id + "_at"); + var start = "https://" + domain + "/api/v1/trend_tags" fetch(start, { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { + }).then(function (json) { if (json) { - var tags=""; - json=json.score; - Object.keys(json).forEach(function(tag) { - tags = tags + '#' + escapeHTML(tag) + ' TL Toot
'; - }); - $("#tips-text").html('トレンドタグrefresh:'); - trendTagonTipInterval() - }else{ - $("#tips-text").html(""); - } - }); - + var tags = ""; + json = json.score; + Object.keys(json).forEach(function (tag) { + tags = tags + '#' + escapeHTML(tag) + ' TL Toot
' + tags+'
'; + }); + $("#tips-text").html('トレンドタグrefresh:'); + trendTagonTipInterval() + } else { + $("#tips-text").html(""); + } + }); + } //Spotify -function spotifytips(){ - var start = "https://thedesk.top/now-playing?at="+localStorage.getItem("spotify")+"&rt="+localStorage.getItem("spotify-refresh"); - var at = localStorage.getItem("spotify"); - if(at){ - fetch(start, { - method: 'GET', - headers: { - 'content-type': 'application/json' - } - }).then(function(response) { - return response.json(); - }).catch(function(error) { - todo(error); - console.error(error); - }).then(function(json) { - var ms=json.progress_ms; - var last=1000-ms%1000; - var item=json.item; - var img=item.album.images[0].url; - var artisttxt=""; - for(i=0;i
' + tags + '0){ - artisttxt=artisttxt+","+item.artists[i].name; - }else{ - artisttxt=item.artists[0].name; +function spotifytips() { + var start = "https://thedesk.top/now-playing?at=" + localStorage.getItem("spotify") + "&rt=" + localStorage.getItem("spotify-refresh"); + var at = localStorage.getItem("spotify"); + if (at) { + fetch(start, { + method: 'GET', + headers: { + 'content-type': 'application/json' + } + }).then(function (response) { + return response.json(); + }).catch(function (error) { + todo(error); + console.error(error); + }).then(function (json) { + var ms = json.progress_ms; + var last = 1000 - ms % 1000; + var item = json.item; + var img = item.album.images[0].url; + var artisttxt = ""; + for (i = 0; i < item.artists.length; i++) { + if (i > 0) { + artisttxt = artisttxt + "," + item.artists[i].name; + } else { + artisttxt = item.artists[0].name; } } - artisttxt=escapeHTML(artisttxt); + artisttxt = escapeHTML(artisttxt); sleep(last); - var tms=item.duration_ms; - var per=ms/item.duration_ms*100; - ms=ms/1000; - tms=tms/1000; - var s=Math.round(ms)%60; - if(s<10){ - s="0"+s; + var tms = item.duration_ms; + var per = ms / item.duration_ms * 100; + ms = ms / 1000; + tms = tms / 1000; + var s = Math.round(ms) % 60; + if (s < 10) { + s = "0" + s; } - var m=(Math.round(ms)-Math.round(ms)%60)/60; - var ts=Math.round(tms)%60; - if(ts<10){ - ts="0"+ts; + var m = (Math.round(ms) - Math.round(ms) % 60) / 60; + var ts = Math.round(tms) % 60; + if (ts < 10) { + ts = "0" + ts; } - var tm=(Math.round(tms)-Math.round(tms)%60)/60; - $("#tips-text").html(' refresh'+escapeHTML(item.name)+''+artisttxt+''+m+':'+s+'/'+tm+":"+ts+''); - spotint=setInterval(spotStart, 1000); - }); - }else{ - alert(lang.lang_spotify_acct); - } -} -function spotStart(){ - var total=$(".spotify-prog").attr("data-total"); - var s=$(".spotify-prog").attr("data-s"); - var news=s*1+1; - var per=news*100000/total; - var ns=news%60; - var nm=(news-ns)/60; - if(ns<10){ - ns="0"+ns; + var tm = (Math.round(tms) - Math.round(tms) % 60) / 60; + $("#tips-text").html('refresh' + escapeHTML(item.name) + '' + artisttxt + '' + m + ':' + s + '/' + tm + ":" + ts + ''); + spotint = setInterval(spotStart, 1000); + }); + } else { + alert(lang.lang_spotify_acct); } - if(per>=100){ +} +function spotStart() { + var total = $(".spotify-prog").attr("data-total"); + var s = $(".spotify-prog").attr("data-s"); + var news = s * 1 + 1; + var per = news * 100000 / total; + var ns = news % 60; + var nm = (news - ns) / 60; + if (ns < 10) { + ns = "0" + ns; + } + if (per >= 100) { clearInterval(spotStart); spotifytips() - }else{ + } else { $("#spot-m").text(nm); $("#spot-s").text(ns); - } - $(".spotify-prog").attr("data-s",news); - $(".spotify-prog").css("width",per+"%"); + } + $(".spotify-prog").attr("data-s", news); + $(".spotify-prog").css("width", per + "%"); } -function trendTagonTipInterval(){ - setTimeout(trendTagonTip, 6000000); +function trendTagonTipInterval() { + setTimeout(trendTagonTip, 6000000); } //時計 var clockint; -function clock(){ - var now=new Date(); - var last=1000-now.getTime()%1000; +function clock() { + var now = new Date(); + var last = 1000 - now.getTime() % 1000; sleep(last); - clockint=setInterval(clockStart, 1000); + clockint = setInterval(clockStart, 1000); } -function clockStart(){ +function clockStart() { var nowTime = new Date(); // 現在日時を得る var nowHour = nowTime.getHours(); // 時を抜き出す - if(nowHour<10){nowHour="0"+nowHour } - var nowMin = nowTime.getMinutes(); // 分を抜き出す - if(nowMin<10){nowMin="0"+nowMin } - var nowSec = nowTime.getSeconds(); // 秒を抜き出す - if(nowSec<10){nowSec="0"+nowSec } - var msg = nowTime.getFullYear()+"/"+(nowTime.getMonth()+1)+"/"+nowTime.getDate()+''+nowHour + ":" + nowMin + ":" + nowSec+""; + if (nowHour < 10) { nowHour = "0" + nowHour } + var nowMin = nowTime.getMinutes(); // 分を抜き出す + if (nowMin < 10) { nowMin = "0" + nowMin } + var nowSec = nowTime.getSeconds(); // 秒を抜き出す + if (nowSec < 10) { nowSec = "0" + nowSec } + var msg = nowTime.getFullYear() + "/" + (nowTime.getMonth() + 1) + "/" + nowTime.getDate() + '' + nowHour + ":" + nowMin + ":" + nowSec + ""; $("#tips-text").html(msg); } function sleep(waitMsec) { var startMsec = new Date(); while (new Date() - startMsec < waitMsec); } -function tipsToggle(){ +function tipsToggle() { $("#tips").toggleClass("hide"); $("#tips-menu").toggleClass("hide"); } -if(localStorage.getItem("tips")){ +if (localStorage.getItem("tips")) { tips(localStorage.getItem("tips")); } - \ No newline at end of file diff --git a/app/js/userdata/his-data.js b/app/js/userdata/his-data.js index ade42f22..d7226cc7 100644 --- a/app/js/userdata/his-data.js +++ b/app/js/userdata/his-data.js @@ -5,11 +5,11 @@ function utl(user, more, acct_id) { var acct_id = $('#his-data').attr("use-acct"); } var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); if (user == "--now") { var user = $('#his-data').attr("user-id"); } - if(localStorage.getItem("mode_" + domain)!="misskey"){ + if (localStorage.getItem("mode_" + domain) != "misskey") { if (more) { var sid = $("#his-tl .cvo").last().attr("toot-id"); var plus = "?max_id=" + sid; @@ -18,49 +18,49 @@ function utl(user, more, acct_id) { } var start = "https://" + domain + "/api/v1/accounts/" + user + "/statuses" + plus; - var i={ + var i = { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at } } - }else{ - var req={i:at} + } else { + var req = { i: at } if (more) { var sid = $("#his-tl .cvo").last().attr("toot-id"); - req.maxId=sid; + req.maxId = sid; } - req.userId=user; + req.userId = user; var start = "https://" + domain + "/api/users/notes" - var i={ + var i = { method: 'POST', headers: { 'content-type': 'application/json', }, - body:JSON.stringify(req) + body: JSON.stringify(req) } } - fetch(start, i).then(function(response) { + fetch(start, i).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - if(localStorage.getItem("mode_" + domain)=="misskey"){ + }).then(function (json) { + if (localStorage.getItem("mode_" + domain) == "misskey") { var templete = misskeyParse(json, '', acct_id, 'user'); - }else{ + } else { var templete = parse(json, '', acct_id, 'user'); } - if(!json[0]){ - templete=lang.lang_details_nodata+"
"; + if (!json[0]) { + templete = lang.lang_details_nodata + "
"; } if (more) { $("#his-tl-contents").append(templete); } else { - if(localStorage.getItem("mode_" + domain)!="misskey"){ - pinutl(templete,user, acct_id) - }else{ + if (localStorage.getItem("mode_" + domain) != "misskey") { + pinutl(templete, user, acct_id) + } else { $("#his-tl-contents").html(templete); } } @@ -68,16 +68,16 @@ function utl(user, more, acct_id) { }); } //ピン留めTL -function pinutl(before,user, acct_id) { +function pinutl(before, user, acct_id) { if (!acct_id) { var acct_id = $('#his-data').attr("use-acct"); } var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); if (user == "--now") { var user = $('#his-data').attr("user-id"); } - var plus = "?pinned=1"; + var plus = "?pinned=1"; var start = "https://" + domain + "/api/v1/accounts/" + user + "/statuses" + plus fetch(start, { @@ -86,17 +86,17 @@ function pinutl(before,user, acct_id) { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - var templete = parse(json, 'pinned', acct_id,'user'); - if(!json[0]){ - templete=""; + }).then(function (json) { + var templete = parse(json, 'pinned', acct_id, 'user'); + if (!json[0]) { + templete = ""; } - $("#his-tl-contents").html(templete+before); + $("#his-tl-contents").html(templete + before); jQuery("time.timeago").timeago(); }); } @@ -107,26 +107,26 @@ function flw(user, more, acct_id) { var acct_id = $('#his-data').attr("use-acct"); } var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); if (user == "--now") { var user = $('#his-data').attr("user-id"); } - if(localStorage.getItem("mode_" + domain)=="misskey"){ - var req={i:at} + if (localStorage.getItem("mode_" + domain) == "misskey") { + var req = { i: at } if (more) { var sid = $("#his-follow-list .cvo").last().attr("user-id"); - req.maxId=sid; + req.maxId = sid; } - req.userId=user; + req.userId = user; var start = "https://" + domain + "/api/users/following" - var i={ + var i = { method: 'POST', headers: { 'content-type': 'application/json', }, - body:JSON.stringify(req) + body: JSON.stringify(req) } - }else{ + } else { if (more) { var sid = $("#his-follow-list .cvo").last().attr("user-id"); var plus = "?max_id=" + sid; @@ -135,7 +135,7 @@ function flw(user, more, acct_id) { } var start = "https://" + domain + "/api/v1/accounts/" + user + "/following" + plus - var i={ + var i = { method: 'GET', headers: { 'content-type': 'application/json', @@ -143,19 +143,19 @@ function flw(user, more, acct_id) { } } } - fetch(start,i).then(function(response) { + fetch(start, i).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - if(localStorage.getItem("mode_" + domain)=="misskey"){ - var templete = misskeyUserparse(json,'',acct_id); - }else{ - var templete = userparse(json,'',acct_id); + }).then(function (json) { + if (localStorage.getItem("mode_" + domain) == "misskey") { + var templete = misskeyUserparse(json, '', acct_id); + } else { + var templete = userparse(json, '', acct_id); } - if(templete==""){ - templete=lang.lang_details_nodata+"
"; + if (templete == "") { + templete = lang.lang_details_nodata + "
"; } if (more) { $("#his-follow-list-contents").append(templete); @@ -173,26 +173,26 @@ function fer(user, more, acct_id) { var acct_id = $('#his-data').attr("use-acct"); } var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); if (user == "--now") { var user = $('#his-data').attr("user-id"); } - if(localStorage.getItem("mode_" + domain)=="misskey"){ - var req={i:at} + if (localStorage.getItem("mode_" + domain) == "misskey") { + var req = { i: at } if (more) { var sid = $("#his-follower-list .cvo").last().attr("user-id"); - req.maxId=sid; + req.maxId = sid; } - req.userId=user; + req.userId = user; var start = "https://" + domain + "/api/users/followers" - var i={ + var i = { method: 'POST', headers: { 'content-type': 'application/json', }, - body:JSON.stringify(req) + body: JSON.stringify(req) } - }else{ + } else { if (more) { var sid = $("#his-follower-list .cvo").last().attr("user-id"); var plus = "?max_id=" + sid; @@ -201,7 +201,7 @@ function fer(user, more, acct_id) { } var start = "https://" + domain + "/api/v1/accounts/" + user + "/followers" + plus - var i={ + var i = { method: 'GET', headers: { 'content-type': 'application/json', @@ -209,19 +209,19 @@ function fer(user, more, acct_id) { } } } - fetch(start, i).then(function(response) { + fetch(start, i).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - if(localStorage.getItem("mode_" + domain)=="misskey"){ - var templete = misskeyUserparse(json,'',acct_id); - }else{ - var templete = userparse(json,'',acct_id); + }).then(function (json) { + if (localStorage.getItem("mode_" + domain) == "misskey") { + var templete = misskeyUserparse(json, '', acct_id); + } else { + var templete = userparse(json, '', acct_id); } - if(templete==""){ - templete=lang.lang_details_nodata+"
"; + if (templete == "") { + templete = lang.lang_details_nodata + "
"; } if (more) { $("#his-follower-list-contents").append(templete); @@ -239,8 +239,8 @@ function showFav(more, acct_id) { var acct_id = $('#his-data').attr("use-acct"); } var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(localStorage.getItem("mode_" + domain)!="misskey"){ + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) != "misskey") { if (more) { var sid = $("#his-fav-list .cvo").last().attr("toot-id"); var plus = "?max_id=" + sid; @@ -248,42 +248,42 @@ function showFav(more, acct_id) { var plus = ""; } var start = "https://" + domain + "/api/v1/favourites" + plus - var i={ + var i = { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at } } - }else{ - var req={i:at} + } else { + var req = { i: at } if (more) { var sid = $("#his-fav-list .cvo").last().attr("toot-id"); - req.maxId=sid; + req.maxId = sid; } var start = "https://" + domain + "/api/i/favorites" - var i={ + var i = { method: 'POST', headers: { 'content-type': 'application/json', }, - body:JSON.stringify(req) - } + body: JSON.stringify(req) + } } - - fetch(start, i).then(function(response) { + + fetch(start, i).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - if(localStorage.getItem("mode_" + domain)!="misskey"){ - var templete = parse(json, '', acct_id,'user'); - }else{ - var templete = misskeyParse(json, '', acct_id,'user'); + }).then(function (json) { + if (localStorage.getItem("mode_" + domain) != "misskey") { + var templete = parse(json, '', acct_id, 'user'); + } else { + var templete = misskeyParse(json, '', acct_id, 'user'); } - if(!json[0]){ - templete=lang.lang_details_nodata+"
"; + if (!json[0]) { + templete = lang.lang_details_nodata + "
"; } if (more) { $("#his-fav-list-contents").append(templete); @@ -300,22 +300,22 @@ function showMut(more, acct_id) { var acct_id = $('#his-data').attr("use-acct"); } var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(localStorage.getItem("mode_" + domain)=="misskey"){ - var req={i:at} + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) == "misskey") { + var req = { i: at } if (more) { var sid = $("#his-muting-list .cvo").last().attr("user-id"); - req.maxId=sid; + req.maxId = sid; } var start = "https://" + domain + "/api/mute/list" - var i={ + var i = { method: 'POST', headers: { 'content-type': 'application/json', }, - body:JSON.stringify(req) + body: JSON.stringify(req) } - }else{ + } else { if (more) { var sid = $("#his-muting-list .cvo").last().attr("user-id"); var plus = "?max_id=" + sid; @@ -323,7 +323,7 @@ function showMut(more, acct_id) { var plus = ""; } var start = "https://" + domain + "/api/v1/mutes" + plus - var i={ + var i = { method: 'GET', headers: { 'content-type': 'application/json', @@ -331,17 +331,17 @@ function showMut(more, acct_id) { } } } - - fetch(start,i).then(function(response) { + + fetch(start, i).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - if(!json[0]){ - templete=lang.lang_details_nodata+"
"; + }).then(function (json) { + if (!json[0]) { + templete = lang.lang_details_nodata + "
"; } - var templete = userparse(json,'',acct_id); + var templete = userparse(json, '', acct_id); if (more) { $("#his-muting-list-contents").append(templete); } else { @@ -357,11 +357,11 @@ function showBlo(more, acct_id) { var acct_id = $('#his-data').attr("use-acct"); } var domain = localStorage.getItem("domain_" + acct_id); - if(localStorage.getItem("mode_" + domain)=="misskey"){ - $("#his-blocking-list-contents").html(lang.lang_hisdata_notonmisskey+"
"); + if (localStorage.getItem("mode_" + domain) == "misskey") { + $("#his-blocking-list-contents").html(lang.lang_hisdata_notonmisskey + "
"); return false; } - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); if (more) { var sid = $("#his-blocking-list .cvo").last().attr("user-id"); var plus = "?max_id=" + sid; @@ -375,16 +375,16 @@ function showBlo(more, acct_id) { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - if(!json[0]){ - templete=lang.lang_details_nodata+"
"; + }).then(function (json) { + if (!json[0]) { + templete = lang.lang_details_nodata + "
"; } - var templete = userparse(json,'',acct_id); + var templete = userparse(json, '', acct_id); if (more) { $("#his-blocking-list-contents").append(templete); } else { @@ -396,27 +396,27 @@ function showBlo(more, acct_id) { //フォロリクリスト function showReq(more, acct_id) { - + if (!acct_id) { var acct_id = $('#his-data').attr("use-acct"); } var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - if(localStorage.getItem("mode_" + domain)=="misskey"){ - var req={i:at} + var at = localStorage.getItem("acct_" + acct_id + "_at"); + if (localStorage.getItem("mode_" + domain) == "misskey") { + var req = { i: at } if (more) { var sid = $("#his-request-list .cvo").last().attr("user-id"); - req.maxId=sid; + req.maxId = sid; } var start = "https://" + domain + "/following/requests/list" - var i={ + var i = { method: 'POST', headers: { 'content-type': 'application/json', }, - body:JSON.stringify(req) + body: JSON.stringify(req) } - }else{ + } else { if (more) { var sid = $("#his-request-list .cvo").last().attr("user-id"); var plus = "?max_id=" + sid; @@ -424,7 +424,7 @@ function showReq(more, acct_id) { var plus = ""; } var start = "https://" + domain + "/api/v1/follow_requests" + plus - var i={ + var i = { method: 'GET', headers: { 'content-type': 'application/json', @@ -432,21 +432,21 @@ function showReq(more, acct_id) { } } } - fetch(start,i).then(function(response) { + fetch(start, i).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - - if(localStorage.getItem("mode_" + domain)!="misskey"){ - var templete = userparse(json, "request",acct_id); - }else{ - var templete = misskeyUserparse(json, true,acct_id); + }).then(function (json) { + + if (localStorage.getItem("mode_" + domain) != "misskey") { + var templete = userparse(json, "request", acct_id); + } else { + var templete = misskeyUserparse(json, true, acct_id); } - - if(!json[0]){ - templete=lang.lang_details_nodata+"
"; + + if (!json[0]) { + templete = lang.lang_details_nodata + "
"; } if (more) { $("#his-request-list-contents").append(templete); @@ -463,11 +463,11 @@ function showDom(more, acct_id) { var acct_id = $('#his-data').attr("use-acct"); } var domain = localStorage.getItem("domain_" + acct_id); - if(localStorage.getItem("mode_" + domain)=="misskey"){ - $("#his-domain-list-contents").html(lang.lang_hisdata_notonmisskey+"
"); + if (localStorage.getItem("mode_" + domain) == "misskey") { + $("#his-domain-list-contents").html(lang.lang_hisdata_notonmisskey + "
"); return false; } - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); if (more) { var sid = $("#his-domain-list .cvo").last().attr("user-id"); var plus = "?max_id=" + sid; @@ -482,17 +482,17 @@ function showDom(more, acct_id) { 'Authorization': 'Bearer ' + at }, //body: JSON.stringify({}) - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { + }).then(function (json) { var templete = ""; - if(!json[0]){ - templete=lang.lang_details_nodata+"
"; + if (!json[0]) { + templete = lang.lang_details_nodata + "
"; } - Object.keys(json).forEach(function(key) { + Object.keys(json).forEach(function (key) { var domain = json[key]; templete = templete + domain + '"); + if (localStorage.getItem("mode_" + domain) == "misskey") { + $("#his-follow-recom-contents").html(lang.lang_hisdata_notonmisskey + "
"); return false; } - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); if (more) { var sid = $("#his-follow-recom-list .cvo").last().attr("user-id"); var plus = "?max_id=" + sid; @@ -532,19 +532,19 @@ function showFrl(more, acct_id) { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { - $("#his-follow-recom-contents").html(lang.lang_details_nodata+"("+lang.lang_hisdata_frcreq+")
"); + }).catch(function (error) { + $("#his-follow-recom-contents").html(lang.lang_details_nodata + "(" + lang.lang_hisdata_frcreq + ")
"); console.error(error); - }).then(function(json) { - if(!json[0]){ + }).then(function (json) { + if (!json[0]) { console.warn("No suggestions(recommend) data"); - templete=lang.lang_details_nodata+"("+lang.lang_hisdata_frcwarn+")
"; - }else{ - var templete = userparse(json,'',acct_id); + templete = lang.lang_details_nodata + "(" + lang.lang_hisdata_frcwarn + ")
"; + } else { + var templete = userparse(json, '', acct_id); } - + if (more) { $("#his-follow-recom-contents").append(templete); } else { @@ -561,37 +561,37 @@ function udAdd(start) { 'Accept': 'application/json' }, //body: JSON.stringify({}) - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - var fields=json.attachment; - for(var i=0;i'+escapeHTML(fields[i].signatureAlgorithm)+':'+escapeHTML(fields[i].name)+''; - }else{ - var html=''+escapeHTML(fields[i].signatureAlgorithm)+':'+escapeHTML(fields[i].name)+''; + }).then(function (json) { + var fields = json.attachment; + for (var i = 0; i < fields.length; i++) { + if (fields[i].type == "IdentityProof") { + if (fields[i].signatureAlgorithm == "keybase") { + var html = '' + escapeHTML(fields[i].signatureAlgorithm) + ':' + escapeHTML(fields[i].name) + ''; + } else { + var html = '' + escapeHTML(fields[i].signatureAlgorithm) + ':' + escapeHTML(fields[i].name) + ''; } $("#his-proof-prof").append(html) } } }); - fetch("https://notestock.osa-p.net/api/v1/isstock.json?id="+start.replace("@","users/"), { + fetch("https://notestock.osa-p.net/api/v1/isstock.json?id=" + start.replace("@", "users/"), { method: 'GET', headers: { 'Accept': 'application/json' }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - if(json.user.public_view){ - var html='Notestock'; + }).then(function (json) { + if (json.user.public_view) { + var html = 'Notestock'; $("#his-proof-prof").append(html) } }); @@ -601,43 +601,43 @@ function udAdd(start) { //ユーザーマッチングリスト function showMat() { - + $("#his-matching-list-contents").html(lang.lang_hisdata_taketime); - var full=$("#his-acct").attr("fullname"); - var acct_id=$("#his-data").attr("use-acct"); - full=full.split("@"); - var start = "https://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-filtered-api.cgi?"+full[1]+"+" + full[0]; + var full = $("#his-acct").attr("fullname"); + var acct_id = $("#his-data").attr("use-acct"); + full = full.split("@"); + var start = "https://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-filtered-api.cgi?" + full[1] + "+" + full[0]; fetch(start, { method: 'GET', headers: { 'content-type': 'application/json' }, //body: JSON.stringify({}) - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - var templete=""; - Object.keys(json).forEach(function(key) { + }).then(function (json) { + var templete = ""; + Object.keys(json).forEach(function (key) { var user = json[key]; templete = templete + - ' ' + - '' + - ''; + '' + - '' + - ' ' + - ' ' + - '' + - '' + - '' + + '' + + ''; }); - $("#his-matching-list").css("height",$("#his-float-data").height()-$("#his-basic-prof").height()-$("#his-des").height()-$("#his-plus-action").height()+"px"); + $("#his-matching-list").css("height", $("#his-float-data").height() - $("#his-basic-prof").height() - $("#his-des").height() - $("#his-plus-action").height() + "px"); $("#his-matching-list-contents").html(templete); }); } diff --git a/app/js/userdata/prof-edit.js b/app/js/userdata/prof-edit.js index cc8cbab0..17d0e1e1 100644 --- a/app/js/userdata/prof-edit.js +++ b/app/js/userdata/prof-edit.js @@ -4,7 +4,7 @@ function profedit() { var acct_id = $('#his-data').attr("use-acct"); todo("Updating..."); var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var start = "https://" + domain + "/api/v1/accounts/update_credentials"; var name = $("#his-name-val").val(); var des = $("#his-des-val").val(); @@ -17,7 +17,7 @@ function profedit() { display_name: name, note: des, })); - httpreq.onreadystatechange = function() { + httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { $('#his-data').modal('close'); todc(); @@ -35,13 +35,13 @@ function imgChange(imgfile, target) { } var file = imgfile.files[0]; var fr = new FileReader(); - fr.onload = function(evt) { + fr.onload = function (evt) { var b64 = this.result; var blob = toBlob(b64, 'image/png'); var fd = new FormData(); fd.append(target, blob); var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var start = "https://" + domain + "/api/v1/accounts/update_credentials"; var httpreq = new XMLHttpRequest(); httpreq.open('PATCH', start, true); @@ -49,7 +49,7 @@ function imgChange(imgfile, target) { httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.responseType = "json"; httpreq.send(fd); - httpreq.onreadystatechange = function() { + httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { var json = httpreq.response; $('#his-data').modal('close'); diff --git a/app/js/userdata/showOnTL.js b/app/js/userdata/showOnTL.js index f1e21884..70981c4c 100644 --- a/app/js/userdata/showOnTL.js +++ b/app/js/userdata/showOnTL.js @@ -1,47 +1,47 @@ //ユーザーデータ表示 localStorage.removeItem("history"); //コード受信 -if(location.search){ +if (location.search) { var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/); - var mode=m[1]; - var codex=m[2]; - if(mode=="user"){ - udgEx(codex,'main'); + var mode = m[1]; + var codex = m[2]; + if (mode == "user") { + udgEx(codex, 'main'); } } -function udgEx(user,acct_id){ - if(user=="selector"){ +function udgEx(user, acct_id) { + if (user == "selector") { user = $("#his-acct").attr('fullname'); } - if(acct_id=="selector"){ + if (acct_id == "selector") { acct_id = $("#user-acct-sel").val(); } - if(acct_id=="main"){ + if (acct_id == "main") { acct_id = localStorage.getItem("main"); } - console.log("Get user data of "+user); + console.log("Get user data of " + user); var domain = localStorage.getItem("domain_" + acct_id); - if(localStorage.getItem("mode_" + domain)=="misskey"){ return false; } - var at = localStorage.getItem("acct_"+ acct_id + "_at"); - var start = "https://" + domain + "/api/v1/search?resolve=true&q="+user + if (localStorage.getItem("mode_" + domain) == "misskey") { return false; } + var at = localStorage.getItem("acct_" + acct_id + "_at"); + var start = "https://" + domain + "/api/v1/search?resolve=true&q=" + user fetch(start, { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at } - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { - if(json.accounts){ - var id=json.accounts[0].id; - udg(id,acct_id); - }else{ - var url="https://"+user.split('@')[1]+"/@"+user.split('@')[0]; - const {shell} = require('electron'); + }).then(function (json) { + if (json.accounts) { + var id = json.accounts[0].id; + udg(id, acct_id); + } else { + var url = "https://" + user.split('@')[1] + "/@" + user.split('@')[0]; + const { shell } = require('electron'); shell.openExternal(url); } }); @@ -50,15 +50,15 @@ function udgEx(user,acct_id){ function udg(user, acct_id) { reset(); if (!user) { - user = localStorage.getItem("user-id_"+acct_id); + user = localStorage.getItem("user-id_" + acct_id); } todo("User Data Loading..."); var domain = localStorage.getItem("domain_" + acct_id); - if(localStorage.getItem("mode_" + domain)=="misskey"){ + if (localStorage.getItem("mode_" + domain) == "misskey") { misskeyUdg(user, acct_id) return; } - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var start = "https://" + domain + "/api/v1/accounts/" + user; fetch(start, { method: 'GET', @@ -66,141 +66,141 @@ function udg(user, acct_id) { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { + }).then(function (json) { //一つ前のユーザーデータ - if (!localStorage.getItem("history")){ - $("#his-history-btn").prop("disabled",true); - }else{ - $("#his-history-btn").prop("disabled",false); + if (!localStorage.getItem("history")) { + $("#his-history-btn").prop("disabled", true); + } else { + $("#his-history-btn").prop("disabled", false); $('#his-data').attr("history", localStorage.getItem("history")); } //moved設定時 if (json.moved) { Materialize.toast( - lang.lang_showontl_movetxt+'', 4000) + lang.lang_showontl_movetxt + '', 4000) } - $('#his-data').modal('open'); - $('#his-data').attr("user-id", user); - $('#his-data').attr("use-acct", acct_id); - if(json.username!=json.acct){ - //Remote - $('#his-data').attr("remote", "true"); - var fullname=json.acct; - }else{ - $('#his-data').attr("remote", "false"); - var fullname=json.acct+"@"+domain; - } - utl(json.id, '', acct_id); - flw(json.id, '', acct_id); - fer(json.id, '', acct_id); - var dis_name=escapeHTML(json.display_name); - dis_name=twemoji.parse(dis_name); + $('#his-data').modal('open'); + $('#his-data').attr("user-id", user); + $('#his-data').attr("use-acct", acct_id); + if (json.username != json.acct) { + //Remote + $('#his-data').attr("remote", "true"); + var fullname = json.acct; + } else { + $('#his-data').attr("remote", "false"); + var fullname = json.acct + "@" + domain; + } + utl(json.id, '', acct_id); + flw(json.id, '', acct_id); + fer(json.id, '', acct_id); + var dis_name = escapeHTML(json.display_name); + dis_name = twemoji.parse(dis_name); - var note=json.note; - if(json.emojis){ - var actemojick = json.emojis[0]; - }else{ - var actemojick=false; - } - //絵文字があれば - if (actemojick) { - Object.keys(json.emojis).forEach(function(key5) { - var emoji = json.emojis[key5]; - var shortcode = emoji.shortcode; - var emoji_url = ''; - var regExp = new RegExp(":" + shortcode + ":", "g"); - dis_name = dis_name.replace(regExp, emoji_url); - note = note.replace(regExp, emoji_url); - }); - } - //noteの解析 - //var tags = '#$1'; - //var mens = '@$1'; - //note=note.replace(/#(\S+)/gi, tags) - //note=note.replace(/\s@([a-zA-Z_0-9@.-]+)/gi, mens) - $("#his-name").html(dis_name); - $("#his-acct").text(json.acct); - $("#his-acct").attr("fullname",fullname); - $("#his-prof").attr("src", json.avatar); - $('#his-data').css('background-image', 'url(' + json.header + ')'); - $("#his-sta").text(json.statuses_count); - $("#his-follow").text(json.following_count); - var flerc=json.followers_count; - if(flerc<0){ - flerc="-"; - } - $("#his-follower").text(flerc); - $("#his-since").text(crat(json.created_at)); - $("#his-openin").attr("data-href", json.url); - if(json.fields){ - if(json.fields.length>0){ - note=note+'' + + '' + + ' ' + + ' ' + + '' + + '' + + '' - for(var i=0;i
' + $("#his-des").html(twemoji.parse(note)); + } else { $("#his-des").html(twemoji.parse(note)); } - if(json.bot){ - $("#his-bot").html(lang.lang_showontl_botacct); - } - $("#his-des").attr("data-acct",acct_id); - $('#his-data').css('background-size', 'cover'); - $("#his-data .tab-content").css("height",$("#his-float-timeline").height()-70+"px") - localStorage.setItem("history" , user); - //自分の時 - if (json.acct == localStorage.getItem("user_"+acct_id)) { - showFav('', acct_id); - showBlo('', acct_id); - showMut('', acct_id); - showDom('', acct_id); - showReq('', acct_id); - showFrl('', acct_id); - $("#his-name-val").val(json.display_name); - if(json.fields.length>0){ - if(json.fields[0]){$("#his-f1-name").val(json.fields[0].name); $("#his-f1-val").val($.strip_tags(json.fields[0].value));} - if(json.fields[1]){$("#his-f2-name").val(json.fields[1].name); $("#his-f2-val").val($.strip_tags(json.fields[1].value));} - if(json.fields[2]){$("#his-f3-name").val(json.fields[2].name); $("#his-f3-val").val($.strip_tags(json.fields[2].value));} - if(json.fields[3]){$("#his-f4-name").val(json.fields[3].name); $("#his-f4-val").val($.strip_tags(json.fields[3].value));} - } - var des = json.note; - des = des.replace(/'+twemoji.parse(escapeHTML(fname))+' '+twemoji.parse(fval)+' '; + var note = json.note; + if (json.emojis) { + var actemojick = json.emojis[0]; + } else { + var actemojick = false; + } + //絵文字があれば + if (actemojick) { + Object.keys(json.emojis).forEach(function (key5) { + var emoji = json.emojis[key5]; + var shortcode = emoji.shortcode; + var emoji_url = ''; + var regExp = new RegExp(":" + shortcode + ":", "g"); + dis_name = dis_name.replace(regExp, emoji_url); + note = note.replace(regExp, emoji_url); + }); + } + //noteの解析 + //var tags = '#$1'; + //var mens = '@$1'; + //note=note.replace(/#(\S+)/gi, tags) + //note=note.replace(/\s@([a-zA-Z_0-9@.-]+)/gi, mens) + $("#his-name").html(dis_name); + $("#his-acct").text(json.acct); + $("#his-acct").attr("fullname", fullname); + $("#his-prof").attr("src", json.avatar); + $('#his-data').css('background-image', 'url(' + json.header + ')'); + $("#his-sta").text(json.statuses_count); + $("#his-follow").text(json.following_count); + var flerc = json.followers_count; + if (flerc < 0) { + flerc = "-"; + } + $("#his-follower").text(flerc); + $("#his-since").text(crat(json.created_at)); + $("#his-openin").attr("data-href", json.url); + if (json.fields) { + if (json.fields.length > 0) { + note = note + '' + for (var i = 0; i < json.fields.length; i++) { + var fname = json.fields[i].name; + var fval = json.fields[i].value; + if (json.fields[i].verified_at) { + var when = lang.lang_showontl_verified + ":" + crat(json.fields[i].verified_at); + var color = "rgba(121,189,154,.25);" + } else { + var when = ""; + var color = "inherit" } - note=note+'
' - $("#his-des").html(twemoji.parse(note)); - }else{ - $("#his-des").html(twemoji.parse(note)); + note = note + ''; } - }else{ + note = note + ' ' + twemoji.parse(escapeHTML(fname)) + ' ' + twemoji.parse(fval) + '
/g, "\n") - des = $.strip_tags(des); - $("#his-des-val").val(des); - $("#his-follow-btn").hide(); - $("#his-block-btn").hide(); - $("#his-mute-btn").hide(); - $("#his-notf-btn").hide(); - $("#his-domain-btn").hide(); - $("#his-emp-btn").hide(); - $(".only-my-data").show(); - $(".only-his-data").hide(); - } else { - relations(user, acct_id); - $(".only-my-data").hide(); - $(".only-his-data").show(); + } else { + $("#his-des").html(twemoji.parse(note)); + } + if (json.bot) { + $("#his-bot").html(lang.lang_showontl_botacct); + } + $("#his-des").attr("data-acct", acct_id); + $('#his-data').css('background-size', 'cover'); + $("#his-data .tab-content").css("height", $("#his-float-timeline").height() - 70 + "px") + localStorage.setItem("history", user); + //自分の時 + if (json.acct == localStorage.getItem("user_" + acct_id)) { + showFav('', acct_id); + showBlo('', acct_id); + showMut('', acct_id); + showDom('', acct_id); + showReq('', acct_id); + showFrl('', acct_id); + $("#his-name-val").val(json.display_name); + if (json.fields.length > 0) { + if (json.fields[0]) { $("#his-f1-name").val(json.fields[0].name); $("#his-f1-val").val($.strip_tags(json.fields[0].value)); } + if (json.fields[1]) { $("#his-f2-name").val(json.fields[1].name); $("#his-f2-val").val($.strip_tags(json.fields[1].value)); } + if (json.fields[2]) { $("#his-f3-name").val(json.fields[2].name); $("#his-f3-val").val($.strip_tags(json.fields[2].value)); } + if (json.fields[3]) { $("#his-f4-name").val(json.fields[3].name); $("#his-f4-val").val($.strip_tags(json.fields[3].value)); } } + var des = json.note; + des = des.replace(/
/g, "\n") + des = $.strip_tags(des); + $("#his-des-val").val(des); + $("#his-follow-btn").hide(); + $("#his-block-btn").hide(); + $("#his-mute-btn").hide(); + $("#his-notf-btn").hide(); + $("#his-domain-btn").hide(); + $("#his-emp-btn").hide(); + $(".only-my-data").show(); + $(".only-his-data").hide(); + } else { + relations(user, acct_id); + $(".only-my-data").hide(); + $(".only-his-data").show(); + } todc(); //外部データ取得(死かもしれないので) udAdd(json.url); @@ -209,15 +209,15 @@ function udg(user, acct_id) { function misskeyUdg(user, acct_id) { reset(); if (!user) { - user = localStorage.getItem("user-id_"+acct_id); + user = localStorage.getItem("user-id_" + acct_id); } todo("User Data Loading..."); var domain = localStorage.getItem("domain_" + acct_id); - if(localStorage.getItem("mode_" + domain)!="misskey"){ + if (localStorage.getItem("mode_" + domain) != "misskey") { udg(user, acct_id) return; } - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var start = "https://" + domain + "/api/users/show"; fetch(start, { method: 'POST', @@ -225,113 +225,113 @@ function misskeyUdg(user, acct_id) { 'content-type': 'application/json', }, body: JSON.stringify({ - i:at, - userId:user + i: at, + userId: user }) - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { + }).then(function (json) { //一つ前のユーザーデータ - if (!localStorage.getItem("history")){ - $("#his-history-btn").prop("disabled",true); - }else{ - $("#his-history-btn").prop("disabled",false); + if (!localStorage.getItem("history")) { + $("#his-history-btn").prop("disabled", true); + } else { + $("#his-history-btn").prop("disabled", false); $('#his-data').attr("history", localStorage.getItem("history")); } - $('#his-data').modal('open'); - $('#his-data').attr("user-id", user); - $('#his-data').attr("use-acct", acct_id); - if(json.host){ - //Remote - $('#his-data').attr("remote", "false"); - var fullname=json.username+"@"+json.host; - }else{ - $('#his-data').attr("remote", "false"); - var fullname=json.acct+"@"+domain; - } - utl(json.id, '', acct_id); - flw(json.id, '', acct_id); - fer(json.id, '', acct_id); - if(json.name){ - var dis_name=escapeHTML(json.name); - dis_name=twemoji.parse(dis_name); - }else{ - var dis_name=json.name - } - $("#his-name").html(dis_name); - $("#his-acct").text(json.username); - $("#his-acct").attr("fullname",fullname); - $("#his-prof").attr("src", json.avatarUrl); - $('#his-data').css('background-image', 'url(' + json.bannerUrl + ')'); - $("#his-sta").text(json.notesCount); - $("#his-follow").text(json.followingCount); - $("#his-follower").text(json.followersCount); - $("#his-since").text(crat(json.createdAt)); - var note=escapeHTML(json.description); - $("#his-des").html(twemoji.parse(note)); - if(json.isCat){ - $("#his-bot").html("Cat"+twemoji.parse("😺")); - } - $('#his-data').css('background-size', 'cover'); - localStorage.setItem("history" , user); - //自分の時 - if (json.username == localStorage.getItem("user_"+acct_id) && !json.host) { - //showFav('', acct_id); - //showMut('', acct_id); - //showReq('', acct_id); - showFrl('', acct_id); - $("#his-name-val").val(json.name); - var des = json.note; - des = nl2br(des) - des = $.strip_tags(des); - $("#his-des-val").val(des); - $("#his-follow-btn").hide(); - $("#his-block-btn").hide(); - $("#his-mute-btn").hide(); - $("#his-notf-btn").hide(); - $("#his-domain-btn").hide(); - $("#his-emp-btn").hide(); - $(".only-my-data").show(); - $(".only-his-data").hide(); + $('#his-data').modal('open'); + $('#his-data').attr("user-id", user); + $('#his-data').attr("use-acct", acct_id); + if (json.host) { + //Remote + $('#his-data').attr("remote", "false"); + var fullname = json.username + "@" + json.host; + } else { + $('#his-data').attr("remote", "false"); + var fullname = json.acct + "@" + domain; + } + utl(json.id, '', acct_id); + flw(json.id, '', acct_id); + fer(json.id, '', acct_id); + if (json.name) { + var dis_name = escapeHTML(json.name); + dis_name = twemoji.parse(dis_name); + } else { + var dis_name = json.name + } + $("#his-name").html(dis_name); + $("#his-acct").text(json.username); + $("#his-acct").attr("fullname", fullname); + $("#his-prof").attr("src", json.avatarUrl); + $('#his-data').css('background-image', 'url(' + json.bannerUrl + ')'); + $("#his-sta").text(json.notesCount); + $("#his-follow").text(json.followingCount); + $("#his-follower").text(json.followersCount); + $("#his-since").text(crat(json.createdAt)); + var note = escapeHTML(json.description); + $("#his-des").html(twemoji.parse(note)); + if (json.isCat) { + $("#his-bot").html("Cat" + twemoji.parse("😺")); + } + $('#his-data').css('background-size', 'cover'); + localStorage.setItem("history", user); + //自分の時 + if (json.username == localStorage.getItem("user_" + acct_id) && !json.host) { + //showFav('', acct_id); + //showMut('', acct_id); + //showReq('', acct_id); + showFrl('', acct_id); + $("#his-name-val").val(json.name); + var des = json.note; + des = nl2br(des) + des = $.strip_tags(des); + $("#his-des-val").val(des); + $("#his-follow-btn").hide(); + $("#his-block-btn").hide(); + $("#his-mute-btn").hide(); + $("#his-notf-btn").hide(); + $("#his-domain-btn").hide(); + $("#his-emp-btn").hide(); + $(".only-my-data").show(); + $(".only-his-data").hide(); + } else { + if (json.isFollowing) { + //自分がフォローしている + $("#his-data").addClass("following"); + $("#his-follow-btn").text(lang.lang_status_unfollow); + hisList(user, acct_id); } else { - if (json.isFollowing) { - //自分がフォローしている - $("#his-data").addClass("following"); - $("#his-follow-btn").text(lang.lang_status_unfollow); - hisList(user,acct_id); - }else{ - $("#his-follow-btn").text(lang.lang_status_follow); - } - if (json.isFollowed) { - //フォローされてる - $("#his-relation").text(lang.lang_showontl_followed); - } - $("#his-block-btn").hide(); - if (json.isMuted) { - $("#his-data").addClass("muting"); - $("#his-mute-btn").text(lang.lang_status_unmute); - }else{ - $("#his-mute-btn").text(lang.lang_status_mute); - } - $(".only-my-data").hide(); - $(".only-his-data").show(); + $("#his-follow-btn").text(lang.lang_status_follow); } + if (json.isFollowed) { + //フォローされてる + $("#his-relation").text(lang.lang_showontl_followed); + } + $("#his-block-btn").hide(); + if (json.isMuted) { + $("#his-data").addClass("muting"); + $("#his-mute-btn").text(lang.lang_status_unmute); + } else { + $("#his-mute-btn").text(lang.lang_status_mute); + } + $(".only-my-data").hide(); + $(".only-his-data").show(); + } todc(); }); } //一つ前のユーザーデータ表示 -function historyShow(){ - var acct_id=$('#his-data').attr("use-acct"); - var user=$('#his-data').attr("history"); +function historyShow() { + var acct_id = $('#his-data').attr("use-acct"); + var user = $('#his-data').attr("history"); udg(user, acct_id, "true") } //選択アカウントのプロフ -function profShow(){ +function profShow() { var acct_id = $("#post-acct-sel").val(); - var user = localStorage.getItem("user-id_"+acct_id); + var user = localStorage.getItem("user-id_" + acct_id); udg(user, acct_id) hide(); } @@ -339,7 +339,7 @@ function profShow(){ //FF関係取得 function relations(user, acct_id) { var domain = localStorage.getItem("domain_" + acct_id); - var at = localStorage.getItem("acct_"+ acct_id + "_at"); + var at = localStorage.getItem("acct_" + acct_id + "_at"); var start = "https://" + domain + "/api/v1/accounts/relationships?id=" + user; fetch(start, { method: 'GET', @@ -347,20 +347,20 @@ function relations(user, acct_id) { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, - }).then(function(response) { + }).then(function (response) { return response.json(); - }).catch(function(error) { + }).catch(function (error) { todo(error); console.error(error); - }).then(function(json) { + }).then(function (json) { var json = json[0]; console.log(json); if (json.following) { //自分がフォローしている $("#his-data").addClass("following"); $("#his-follow-btn").text(lang.lang_status_unfollow); - hisList(user,acct_id); - }else{ + hisList(user, acct_id); + } else { $("#his-follow-btn").text(lang.lang_status_follow); } if (json.followed_by) { @@ -370,37 +370,37 @@ function relations(user, acct_id) { if (json.blocking) { $("#his-data").addClass("blocking"); $("#his-block-btn").text(lang.lang_status_unblock); - }else{ + } else { $("#his-block-btn").text(lang.lang_status_block); } if (json.muting) { $("#his-data").addClass("muting"); $("#his-mute-btn").text(lang.lang_status_unmute); - }else{ + } else { $("#his-mute-btn").text(lang.lang_status_mute); } if (json.muting_notifications) { $("#his-data").addClass("mutingNotf"); - $("#his-notf-btn").text(lang.lang_showontl_notf+lang.lang_status_unmute); - }else{ - $("#his-notf-btn").text(lang.lang_showontl_notf+lang.lang_status_mute); + $("#his-notf-btn").text(lang.lang_showontl_notf + lang.lang_status_unmute); + } else { + $("#his-notf-btn").text(lang.lang_showontl_notf + lang.lang_status_mute); } if (json.domain_blocking) { $("#his-data").addClass("blockingDom"); - $("#his-domain-btn").text(lang.lang_showontl_domain+lang.lang_status_unblock); - }else{ - $("#his-domain-btn").text(lang.lang_showontl_domain+lang.lang_status_block); + $("#his-domain-btn").text(lang.lang_showontl_domain + lang.lang_status_unblock); + } else { + $("#his-domain-btn").text(lang.lang_showontl_domain + lang.lang_status_block); } //Endorsed - if(json.endorsed){ + if (json.endorsed) { $("#his-end-btn").addClass("endorsed"); $("#his-end-btn").text(lang.lang_status_unendorse) - }else{ + } else { $("#his-end-btn").removeClass("endorsed"); $("#his-end-btn").text(lang.lang_status_endorse) } //Blocked - if(json.blocked_by){ + if (json.blocked_by) { $("#his-float-timeline").hide(); $("#his-float-blocked").show(); $("#his-follow-btn").hide() @@ -408,9 +408,9 @@ function relations(user, acct_id) { }); } -function profbrws(){ - const {shell} = require('electron'); - var url=$("#his-openin").attr("data-href") +function profbrws() { + const { shell } = require('electron'); + var url = $("#his-openin").attr("data-href") shell.openExternal(url); } //オールリセット @@ -420,7 +420,7 @@ function hisclose() { $('#his-data').attr("history", ""); localStorage.removeItem("history"); } -function reset(){ +function reset() { $(".tab-content:eq(0)").show(); $(".tab-content:gt(0)").hide(); $(".active-back").removeClass("active-back"); @@ -451,8 +451,8 @@ function reset(){ $("#his-follow-btn").text(lang.lang_status_follow); $("#his-mute-btn").text(lang.lang_status_mute); $("#his-block-btn").text(lang.lang_status_block); - $("#his-notf-btn").text(lang.lang_showontl_notf+lang.lang_status_mute); - $("#his-domain-btn").text(lang.lang_showontl_domain+lang.lang_status_block); + $("#his-notf-btn").text(lang.lang_showontl_notf + lang.lang_status_mute); + $("#his-domain-btn").text(lang.lang_showontl_domain + lang.lang_status_block); $("#his-relation").text(""); $(".cont-series").html(""); $("#domainblock").val(""); @@ -470,10 +470,10 @@ function reset(){ $("#his-float-blocked").hide(); $("#his-proof-prof").html("") } -$('#my-data-nav .custom-tab').on('click',function(){ - var target=$(this).find("a").attr("go"); +$('#my-data-nav .custom-tab').on('click', function () { + var target = $(this).find("a").attr("go"); $("#my-data-nav .custom-tab").removeClass("active-back"); $(this).addClass("active-back"); $(target).show(); - $(".tab-content:not("+target+")").hide(); + $(".tab-content:not(" + target + ")").hide(); }); \ No newline at end of file diff --git a/app/main.js b/app/main.js index 03544790..76c59fbb 100644 --- a/app/main.js +++ b/app/main.js @@ -1,6 +1,6 @@ -var dir='file://' + __dirname; -var base=dir + '/view/'; +var dir = 'file://' + __dirname; +var base = dir + '/view/'; // Electronのモジュール const electron = require("electron"); const fs = require("fs"); @@ -10,7 +10,7 @@ const dl = require('./main/dl.js'); const img = require('./main/img.js'); const np = require('./main/np.js'); const systemFunc = require('./main/system.js'); -const Menu=electron.Menu +const Menu = electron.Menu const join = require('path').join; // アプリケーションをコントロールするモジュール const app = electron.app; @@ -20,13 +20,13 @@ const BrowserWindow = electron.BrowserWindow; let mainWindow; var info_path = join(app.getPath("userData"), "window-size.json"); var max_info_path = join(app.getPath("userData"), "max-window-size.json"); -var lang_path=join(app.getPath("userData"), "language"); -var ha_path=join(app.getPath("userData"), "hardwareAcceleration"); -try{ +var lang_path = join(app.getPath("userData"), "language"); +var ha_path = join(app.getPath("userData"), "hardwareAcceleration"); +try { fs.readFileSync(ha_path, 'utf8'); app.disableHardwareAcceleration() console.log("disabled: HA"); -}catch{ +} catch{ console.log("enabled: HA"); } var window_size; @@ -50,7 +50,7 @@ try { }; // デフォルトバリュー } -function isFile(file){ +function isFile(file) { try { fs.statSync(file); return true @@ -59,114 +59,114 @@ function isFile(file){ } } // 全てのウィンドウが閉じたら終了 -app.on('window-all-closed', function() { +app.on('window-all-closed', function () { if (process.platform != 'darwin') { - electron.session.defaultSession.clearCache(() => {}) + electron.session.defaultSession.clearCache(() => { }) app.quit(); } }); // macOSでウィンドウを閉じた後に再度開けるようにする -app.on('activate', function() { +app.on('activate', function () { if (mainWindow == null) { createWindow(); } }); function createWindow() { - if(isFile(lang_path)) { + if (isFile(lang_path)) { console.log("exist"); var lang = fs.readFileSync(lang_path, 'utf8'); } else { - var langs=app.getLocale(); + var langs = app.getLocale(); console.log(langs); - if(~langs.indexOf("ja")){ - lang="ja"; - }else{ - lang="en"; + if (~langs.indexOf("ja")) { + lang = "ja"; + } else { + lang = "en"; } fs.mkdir(app.getPath("userData"), function (err) { - fs.writeFileSync(lang_path,lang); + fs.writeFileSync(lang_path, lang); }); } console.log(app.getLocale()); - console.log("launch:"+lang); + console.log("launch:" + lang); // メイン画面の表示。ウィンドウの幅、高さを指定できる - var platform=process.platform; - var bit=process.arch; - if(platform=="linux"){ - var arg={width:window_size.width,height:window_size.height,x:window_size.x,y:window_size.y,icon: __dirname + '/desk.png'} - }else if(platform=="win32"){ - var arg={width:window_size.width,height:window_size.height,x:window_size.x,y:window_size.y,simpleFullscreen:true} - }else if(platform=="darwin"){ - var arg={width:window_size.width,height:window_size.height,x:window_size.x,y:window_size.y,simpleFullscreen:true} + var platform = process.platform; + var bit = process.arch; + if (platform == "linux") { + var arg = { width: window_size.width, height: window_size.height, x: window_size.x, y: window_size.y, icon: __dirname + '/desk.png' } + } else if (platform == "win32") { + var arg = { width: window_size.width, height: window_size.height, x: window_size.x, y: window_size.y, simpleFullscreen: true } + } else if (platform == "darwin") { + var arg = { width: window_size.width, height: window_size.height, x: window_size.x, y: window_size.y, simpleFullscreen: true } } mainWindow = new BrowserWindow(arg); - electron.session.defaultSession.clearCache(() => {}) - if(process.argv){ - if(process.argv[1]){ + electron.session.defaultSession.clearCache(() => { }) + if (process.argv) { + if (process.argv[1]) { var m = process.argv[1].match(/([a-zA-Z0-9]+)\/\?[a-zA-Z-0-9]+=(.+)/); - if(m){ - var mode=m[1]; - var code=m[2]; - var plus='?mode='+mode+'&code='+code; - }else{ - var plus=""; + if (m) { + var mode = m[1]; + var code = m[2]; + var plus = '?mode=' + mode + '&code=' + code; + } else { + var plus = ""; } - }else{ - var plus=""; + } else { + var plus = ""; } - }else{ - var plus=""; + } else { + var plus = ""; } - mainWindow.loadURL(base+lang+'/index.html'+plus); - if(!window_size.x && !window_size.y){ + mainWindow.loadURL(base + lang + '/index.html' + plus); + if (!window_size.x && !window_size.y) { mainWindow.center(); } - if(window_size.max){ + if (window_size.max) { mainWindow.maximize(); } // ウィンドウが閉じられたらアプリも終了 - mainWindow.on('closed', function() { + mainWindow.on('closed', function () { electron.ipcMain.removeAllListeners(); mainWindow = null; }); - mainWindow.on('close', function() { - if( - max_window_size.width==mainWindow.getBounds().width && - max_window_size.height==mainWindow.getBounds().height && - max_window_size.x==mainWindow.getBounds().x && - max_window_size.y==mainWindow.getBounds().y - ){ - var size={width:mainWindow.getBounds().width,height:mainWindow.getBounds().height,x:mainWindow.getBounds().x,y:mainWindow.getBounds().y,max:true} - }else{ - var size={width:mainWindow.getBounds().width,height:mainWindow.getBounds().height,x:mainWindow.getBounds().x,y:mainWindow.getBounds().y} + mainWindow.on('close', function () { + if ( + max_window_size.width == mainWindow.getBounds().width && + max_window_size.height == mainWindow.getBounds().height && + max_window_size.x == mainWindow.getBounds().x && + max_window_size.y == mainWindow.getBounds().y + ) { + var size = { width: mainWindow.getBounds().width, height: mainWindow.getBounds().height, x: mainWindow.getBounds().x, y: mainWindow.getBounds().y, max: true } + } else { + var size = { width: mainWindow.getBounds().width, height: mainWindow.getBounds().height, x: mainWindow.getBounds().x, y: mainWindow.getBounds().y } } fs.writeFileSync(info_path, JSON.stringify(size)); }); - mainWindow.on('maximize', function() { + mainWindow.on('maximize', function () { fs.writeFileSync(max_info_path, JSON.stringify(mainWindow.getBounds())); }); - - var platform=process.platform; - var bit=process.arch; - if(platform=="darwin"){ - Menu.setApplicationMenu(Menu.buildFromTemplate(language.template(lang,mainWindow,false,dir))); + + var platform = process.platform; + var bit = process.arch; + if (platform == "darwin") { + Menu.setApplicationMenu(Menu.buildFromTemplate(language.template(lang, mainWindow, false, dir))); } //CSS css.css(mainWindow); //アップデータとダウンロード - dl.dl(mainWindow,lang_path,base); + dl.dl(mainWindow, lang_path, base); //画像選択と画像処理 - img.img(mainWindow,dir); + img.img(mainWindow, dir); //NowPlaying np.TheDeskNowPlaying(mainWindow); //その他system - systemFunc.system(mainWindow,dir,lang); + systemFunc.system(mainWindow, dir, lang); } // Electronの初期化完了後に実行 app.on('ready', createWindow); -var onError = function(err,response){ - console.error(err,response); +var onError = function (err, response) { + console.error(err, response); }; app.setAsDefaultProtocolClient('thedesk') diff --git a/app/main/css.js b/app/main/css.js index a36e91b1..c9e446dd 100644 --- a/app/main/css.js +++ b/app/main/css.js @@ -8,11 +8,11 @@ function css(mainWindow) { const join = require('path').join; var customcss = join(app.getPath("userData"), "custom.css"); - ipc.on('custom-css-create', function(e, arg) { + ipc.on('custom-css-create', function (e, arg) { fs.writeFileSync(customcss, arg); mainWindow.webContents.send('custom-css-create-complete', ""); }) - ipc.on('custom-css-request', function(e, arg) { + ipc.on('custom-css-request', function (e, arg) { try { var css = fs.readFileSync(customcss, 'utf8'); } catch (e) { @@ -20,7 +20,7 @@ function css(mainWindow) { } mainWindow.webContents.send('custom-css-response', css); }) - ipc.on('theme-json-create', function(e, arg) { + ipc.on('theme-json-create', function (e, arg) { var themecss = join(app.getPath("userData"), JSON5.parse(arg)["id"] + ".thedesktheme"); fs.writeFileSync(themecss, JSON.stringify(JSON5.parse(arg))); @@ -30,19 +30,19 @@ function css(mainWindow) { mainWindow.webContents.send('theme-json-create-complete', "error"); } }) - ipc.on('theme-json-delete', function(e, arg) { + ipc.on('theme-json-delete', function (e, arg) { var themecss = join(app.getPath("userData"), arg + ".thedesktheme"); console.log(themecss); - fs.unlink(themecss, function(err) { + fs.unlink(themecss, function (err) { mainWindow.webContents.send('theme-json-delete-complete', ""); }); }) - ipc.on('theme-json-request', function(e, arg) { + ipc.on('theme-json-request', function (e, arg) { var themecss = join(app.getPath("userData"), arg + ".thedesktheme"); var json = JSON.parse(fs.readFileSync(themecss, 'utf8')); mainWindow.webContents.send('theme-json-response', json); }) - ipc.on('theme-css-request', function(e, arg) { + ipc.on('theme-css-request', function (e, arg) { var themecss = join(app.getPath("userData"), arg + ".thedesktheme"); try { var json = JSON.parse(fs.readFileSync(themecss, 'utf8')); @@ -82,10 +82,10 @@ function css(mainWindow) { } }) - ipc.on('theme-json-list', function(e, arg) { - fs.readdir(app.getPath("userData"), function(err, files) { + ipc.on('theme-json-list', function (e, arg) { + fs.readdir(app.getPath("userData"), function (err, files) { if (err) throw err; - var fileList = files.filter(function(file) { + var fileList = files.filter(function (file) { var tfile = join(app.getPath("userData"), file); return fs.statSync(tfile).isFile() && /.*\.thedesktheme$/.test(tfile); //絞り込み }) diff --git a/app/main/dl.js b/app/main/dl.js index e5d1436c..ecbafad2 100644 --- a/app/main/dl.js +++ b/app/main/dl.js @@ -1,38 +1,38 @@ -function dl(mainWindow,lang_path,base) { - const electron = require("electron"); - const shell=electron.shell; +function dl(mainWindow, lang_path, base) { + const electron = require("electron"); + const shell = electron.shell; const fs = require("fs"); - const {download} = require('electron-dl'); - const BrowserWindow = electron.BrowserWindow; - const dialog = electron.dialog; + const { download } = require('electron-dl'); + const BrowserWindow = electron.BrowserWindow; + const dialog = electron.dialog; var updatewin = null; - var ipc = electron.ipcMain; - const app = electron.app; - const join = require('path').join; - ipc.on('update', function(e, x, y) { - - var platform = process.platform; - var bit = process.arch; - if (platform != "others") { - updatewin = new BrowserWindow({ - width: 600, - height: 400, - "transparent": false, // ウィンドウの背景を透過 - "frame": false, // 枠の無いウィンドウ - "resizable": false, - "modal": true - }); - var lang = fs.readFileSync(lang_path, 'utf8'); - updatewin.loadURL(base + lang + '/update.html'); + var ipc = electron.ipcMain; + const app = electron.app; + const join = require('path').join; + ipc.on('update', function (e, x, y) { - return "true" - } else { - return false; - } - }) - //アプデDL + var platform = process.platform; + var bit = process.arch; + if (platform != "others") { + updatewin = new BrowserWindow({ + width: 600, + height: 400, + "transparent": false, // ウィンドウの背景を透過 + "frame": false, // 枠の無いウィンドウ + "resizable": false, + "modal": true + }); + var lang = fs.readFileSync(lang_path, 'utf8'); + updatewin.loadURL(base + lang + '/update.html'); + + return "true" + } else { + return false; + } + }) + //アプデDL ipc.on('download-btn', (e, args) => { - + var platform = process.platform; var bit = process.arch; dialog.showSaveDialog(null, { @@ -66,18 +66,18 @@ function dl(mainWindow,lang_path,base) { } function dl(url, file, dir) { - + updatewin.webContents.send('mess', "ダウンロードを開始します。"); const opts = { directory: dir, openFolderWhenDone: true, - onProgress: function(e) { + onProgress: function (e) { updatewin.webContents.send('prog', e); }, saveAs: false }; download(BrowserWindow.getFocusedWindow(), - url, opts) + url, opts) .then(dl => { updatewin.webContents.send('mess', "ダウンロードが完了しました。"); app.quit(); @@ -86,7 +86,7 @@ function dl(mainWindow,lang_path,base) { .catch(console.error); } ipc.on('general-dl', (e, args) => { - + var name = ""; var platform = process.platform; var bit = process.arch; @@ -103,21 +103,21 @@ function dl(mainWindow,lang_path,base) { directory: dir, filename: name, openFolderWhenDone: false, - onProgress: function(e) { + onProgress: function (e) { mainWindow.webContents.send('general-dl-prog', e); }, saveAs: false }; download(BrowserWindow.getFocusedWindow(), - args[0], opts) + args[0], opts) .then(dl => { mainWindow.webContents.send('general-dl-message', dir); }) .catch(console.error); - }); - ipc.on('open-finder', (e, folder) => { - + }); + ipc.on('open-finder', (e, folder) => { + shell.showItemInFolder(folder) - }); + }); } exports.dl = dl; diff --git a/app/main/img.js b/app/main/img.js index eb473c6f..fa73dc8f 100644 --- a/app/main/img.js +++ b/app/main/img.js @@ -1,4 +1,4 @@ -function img(mainWindow,dir){ +function img(mainWindow, dir) { const electron = require("electron"); const dialog = electron.dialog; const fs = require("fs"); @@ -6,66 +6,66 @@ function img(mainWindow,dir){ var ipc = electron.ipcMain; const BrowserWindow = electron.BrowserWindow; ipc.on('file-select', (e, args) => { - + dialog.showOpenDialog(null, { properties: ['openFile', 'multiSelections'], title: '添付ファイルを選択', defaultPath: '.', filters: [ - {name: 'メディアファイル', extensions: ['jpg', 'png', 'gif', 'bmp', 'jpeg','mp4','webm']}, - {name: '画像', extensions: ['jpg', 'png', 'gif', 'bmp', 'jpeg']}, - {name: '動画', extensions: ['mp4','webm']}, - {name: '全てのファイル', extensions: ['*']} + { name: 'メディアファイル', extensions: ['jpg', 'png', 'gif', 'bmp', 'jpeg', 'mp4', 'webm'] }, + { name: '画像', extensions: ['jpg', 'png', 'gif', 'bmp', 'jpeg'] }, + { name: '動画', extensions: ['mp4', 'webm'] }, + { name: '全てのファイル', extensions: ['*'] } ] }, (fileNames) => { - if(!fileNames){ + if (!fileNames) { return false; } - for(var i=0;i{ - - if(!arg){ - const options = { - type: 'info', - title: 'Adobeフォトエディタ', - message: "「許可」または「永続的に許可」をクリックするとTheDeskとAdobeで情報を共有します。\n次のウィンドウを開いている時以外は一切提供しません。", - buttons: ['拒否', '許可','永続的に許可'] - } - dialog.showMessageBox(options, function(index) { - if(index===2){ - mainWindow.webContents.send('adobeagree', "true"); - } - if(index>0){ - adobeWindow(); - } - }) - }else{ - adobeWindow(); + + if (!arg) { + const options = { + type: 'info', + title: 'Adobeフォトエディタ', + message: "「許可」または「永続的に許可」をクリックするとTheDeskとAdobeで情報を共有します。\n次のウィンドウを開いている時以外は一切提供しません。", + buttons: ['拒否', '許可', '永続的に許可'] + } + dialog.showMessageBox(options, function (index) { + if (index === 2) { + mainWindow.webContents.send('adobeagree', "true"); + } + if (index > 0) { + adobeWindow(); + } + }) + } else { + adobeWindow(); } - }); - function adobeWindow(){ - var window = new BrowserWindow({ - width: 1000, - height: 750 - }); - window.loadURL(dir + '/adobe.html'); - } - ipc.on('bmp-image', (e, args) => { - - var m = args[0].match(/(.+)\\(.+)\.(.+)$/); - Jimp.read(args[0], function (err, lenna) { - if (err) throw err; - lenna.getBase64(Jimp.MIME_PNG, function (err, src) { - mainWindow.webContents.send('bmp-img-comp', [src,args[1]]); - }); - }); - -}); + }); + function adobeWindow() { + var window = new BrowserWindow({ + width: 1000, + height: 750 + }); + window.loadURL(dir + '/adobe.html'); + } + ipc.on('bmp-image', (e, args) => { + + var m = args[0].match(/(.+)\\(.+)\.(.+)$/); + Jimp.read(args[0], function (err, lenna) { + if (err) throw err; + lenna.getBase64(Jimp.MIME_PNG, function (err, src) { + mainWindow.webContents.send('bmp-img-comp', [src, args[1]]); + }); + }); + + }); } exports.img = img; \ No newline at end of file diff --git a/app/main/language.js b/app/main/language.js index 94c3279f..4b964d4f 100644 --- a/app/main/language.js +++ b/app/main/language.js @@ -1,85 +1,90 @@ // Create the Application's main menu -function templete(lang,mainWindow,packaged,dir){ +function templete(lang, mainWindow, packaged, dir) { const electron = require("electron"); const app = electron.app; const BrowserWindow = electron.BrowserWindow; - const dict={ - "application":{ - "ja":"アプリケーション", - "en":"Application" + const dict = { + "application": { + "ja": "アプリケーション", + "en": "Application" }, - "about":{ - "ja":"TheDeskについて", - "en":"About TheDesk" + "about": { + "ja": "TheDeskについて", + "en": "About TheDesk" }, - "quit":{ - "ja":"終了", - "en":"Quit" + "quit": { + "ja": "終了", + "en": "Quit" }, - "edit":{ - "ja":"編集", - "en":"Edit" + "edit": { + "ja": "編集", + "en": "Edit" }, - "undo":{ - "ja":"元に戻す", - "en":"Undo" + "undo": { + "ja": "元に戻す", + "en": "Undo" }, - "redo":{ - "ja":"やり直す", - "en":"Redo" + "redo": { + "ja": "やり直す", + "en": "Redo" }, - "cut":{ - "ja":"切り取り", - "en":"Cut" + "cut": { + "ja": "切り取り", + "en": "Cut" }, - "copy":{ - "ja":"コピー", - "en":"Copy" + "copy": { + "ja": "コピー", + "en": "Copy" }, - "paste":{ - "ja":"貼り付け", - "en":"Paste" + "paste": { + "ja": "貼り付け", + "en": "Paste" }, - "selall":{ - "ja":"すべて選択", - "en":"Select All" + "selall": { + "ja": "すべて選択", + "en": "Select All" }, - "view":{ - "ja":"表示", - "en":"View" + "view": { + "ja": "表示", + "en": "View" }, - "reload":{ - "ja":"再読み込み", - "en":"Reload" + "reload": { + "ja": "再読み込み", + "en": "Reload" }, - "window":{ - "ja":"ウィンドウ", - "en":"Window" + "window": { + "ja": "ウィンドウ", + "en": "Window" }, - "minimun":{ - "ja":"最小化", - "en":"Minimarize" + "minimun": { + "ja": "最小化", + "en": "Minimarize" }, - "close":{ - "ja":"閉じる", - "en":"Close" + "close": { + "ja": "閉じる", + "en": "Close" } } const menu = [{ label: dict.application[lang], submenu: [ - { label: dict.about[lang], click: function() { - var ver=app.getVersion() - var window = new BrowserWindow({width: 300, height: 460, - "transparent": false, // ウィンドウの背景を透過 - "frame": false, // 枠の無いウィンドウ - "resizable": false }); - window.loadURL(dir + '/about.html?ver='+ver); - } }, + { + label: dict.about[lang], click: function () { + var ver = app.getVersion() + var window = new BrowserWindow({ + width: 300, height: 460, + "transparent": false, // ウィンドウの背景を透過 + "frame": false, // 枠の無いウィンドウ + "resizable": false + }); + window.loadURL(dir + '/about.html?ver=' + ver); + } + }, { type: "separator" }, - { label: dict.quit[lang], accelerator: "Command+Q", click: function() { app.quit(); }} - - ]}, { + { label: dict.quit[lang], accelerator: "Command+Q", click: function () { app.quit(); } } + + ] + }, { label: dict.edit[lang], submenu: [ { label: dict.undo[lang], accelerator: "CmdOrCtrl+Z", selector: "undo:" }, @@ -89,57 +94,58 @@ function templete(lang,mainWindow,packaged,dir){ { label: dict.copy[lang], accelerator: "CmdOrCtrl+C", selector: "copy:" }, { label: dict.paste[lang], accelerator: "CmdOrCtrl+V", selector: "paste:" }, { label: dict.selall[lang], accelerator: "CmdOrCtrl+A", selector: "selectAll:" } - ]},{ + ] + }, { label: dict.view[lang], submenu: [ { label: 'Toggle Developer Tools', accelerator: 'Alt+Command+I', - click: function() { if(!packaged){mainWindow.toggleDevTools();} } - }, - { - label: dict.reload[lang], - accelerator: 'CmdOrCtrl+R', - click: function() { mainWindow.webContents.send('reload', " "); } - } + click: function () { if (!packaged) { mainWindow.toggleDevTools(); } } + }, + { + label: dict.reload[lang], + accelerator: 'CmdOrCtrl+R', + click: function () { mainWindow.webContents.send('reload', " "); } + } ] - }, - { + }, + { label: dict.window[lang], role: 'window', submenu: [ - { + { label: dict.minimun[lang], accelerator: 'CmdOrCtrl+M', role: 'minimize' - }, - { + }, + { label: dict.close[lang], accelerator: 'CmdOrCtrl+W', role: 'close' - }, - ] - } + }, + ] + } ]; return menu; } -function delsel(lang){ - const dict={ - "delete":{ - "ja":"カラム削除", - "en":"Delete this column" +function delsel(lang) { + const dict = { + "delete": { + "ja": "カラム削除", + "en": "Delete this column" }, - "mess":{ - "ja":"カラムを削除しますか?(すべてのカラムのリンク解析がOFFになります。)", - "en":"Delete this column(URL analyzes of all windows will be disabled.)" + "mess": { + "ja": "カラムを削除しますか?(すべてのカラムのリンク解析がOFFになります。)", + "en": "Delete this column(URL analyzes of all windows will be disabled.)" }, - "yes":{ - "ja":"はい", - "en":"Yes" + "yes": { + "ja": "はい", + "en": "Yes" }, - "no":{ - "ja":"いいえ", - "en":"No" + "no": { + "ja": "いいえ", + "en": "No" } } const options = { @@ -147,8 +153,8 @@ function delsel(lang){ title: dict.delete[lang], message: dict.mess[lang], buttons: [dict.no[lang], dict.yes[lang]] - } - return options; + } + return options; } exports.template = templete; diff --git a/app/main/np.js b/app/main/np.js index 43668da6..758d9f01 100644 --- a/app/main/np.js +++ b/app/main/np.js @@ -1,4 +1,4 @@ -function np(mainWindow){ +function np(mainWindow) { const electron = require("electron"); const join = require('path').join; const app = electron.app; @@ -7,65 +7,65 @@ function np(mainWindow){ ipc.on('itunes', async (e, args) => { //Verified on Windows console.log("Access"); - if(args[0]=="set"){ - var {NowPlaying,PlayerName} = require("nowplaying-node"); - var nppath=join(app.getPath("userData"), "nowplaying"); + if (args[0] == "set") { + var { NowPlaying, PlayerName } = require("nowplaying-node"); + var nppath = join(app.getPath("userData"), "nowplaying"); var npProvider; try { npProvider = args[1]; } catch (e) { - npProvider="AIMP"; + npProvider = "AIMP"; } var myAIMP = new NowPlaying({ fetchCover: true, player: PlayerName[npProvider], }); fs.writeFileSync(nppath, npProvider); - }else{ - var platform=process.platform; - var bit=process.arch; - if(platform=="darwin"){ - try { - const nowplaying = require("itunes-nowplaying-mac"); - const value = await nowplaying.getRawData(); - mainWindow.webContents.send('itunes-np', value); - } catch (error) { - // エラーを返す - console.error(error); - mainWindow.webContents.send('itunes-np', error); - } - }else{ - var {NowPlaying,PlayerName} = require("nowplaying-node"); - var nppath=join(app.getPath("userData"), "nowplaying"); + } else { + var platform = process.platform; + var bit = process.arch; + if (platform == "darwin") { + try { + const nowplaying = require("itunes-nowplaying-mac"); + const value = await nowplaying.getRawData(); + mainWindow.webContents.send('itunes-np', value); + } catch (error) { + // エラーを返す + console.error(error); + mainWindow.webContents.send('itunes-np', error); + } + } else { + var { NowPlaying, PlayerName } = require("nowplaying-node"); + var nppath = join(app.getPath("userData"), "nowplaying"); var npProvider; try { npProvider = fs.readFileSync(nppath, 'utf8'); } catch (e) { - npProvider="AIMP"; + npProvider = "AIMP"; } var myAIMP = new NowPlaying({ fetchCover: true, player: PlayerName[npProvider], }); myAIMP.update(); - var path=myAIMP.getCoverPath(); - if(path){ + var path = myAIMP.getCoverPath(); + if (path) { var bin = fs.readFileSync(path, 'base64'); - }else{ - var bin=false; + } else { + var bin = false; } - - var value={ - win:true, - name:myAIMP.getTitle(), - artist:myAIMP.getArtist(), - album:myAIMP.getAlbum(), - path:bin + + var value = { + win: true, + name: myAIMP.getTitle(), + artist: myAIMP.getArtist(), + album: myAIMP.getAlbum(), + path: bin } mainWindow.webContents.send('itunes-np', value); } - } - + } + }); } exports.TheDeskNowPlaying = np; \ No newline at end of file diff --git a/app/main/system.js b/app/main/system.js index db6387ee..8d06cc1b 100644 --- a/app/main/system.js +++ b/app/main/system.js @@ -1,6 +1,6 @@ function system(mainWindow, dir, lang) { - const electron = require("electron"); - const app = electron.app; + const electron = require("electron"); + const app = electron.app; const join = require('path').join; var Jimp = require("jimp"); const fs = require("fs"); @@ -11,15 +11,15 @@ function system(mainWindow, dir, lang) { const BrowserWindow = electron.BrowserWindow; const dialog = electron.dialog; const os = require('os') - const language=require("../main/language.js"); - ipc.on('native-notf', function(e, args) { - + const language = require("../main/language.js"); + ipc.on('native-notf', function (e, args) { + var platform = process.platform; var bit = process.arch; if (platform == "win32") { const notifier = require('node-notifier') var tmp_imge = tmp_img; - Jimp.read(args[2], function(err, lenna) { + Jimp.read(args[2], function (err, lenna) { if (!err && lenna) { lenna.write(tmp_img); var tmp_imge = tmp_img; @@ -27,49 +27,49 @@ function system(mainWindow, dir, lang) { var tmp_imge = ""; } notifier.notify({ - appID: "top.thedesk", - message: args[1], - title: args[0], - icon: tmp_imge, - sound: false, - wait: true, - }, - function(err, response) { + appID: "top.thedesk", + message: args[1], + title: args[0], + icon: tmp_imge, + sound: false, + wait: true, + }, + function (err, response) { console.log(err, response) }); }); } }); //言語 - ipc.on('lang', function(e, arg) { - - console.log("set:" + arg); - fs.writeFileSync(lang_path, arg); - mainWindow.webContents.send('langres', ""); - }) - //ハードウェアアクセラレーションの無効化 - ipc.on('ha', function(e, arg) { - + ipc.on('lang', function (e, arg) { + + console.log("set:" + arg); + fs.writeFileSync(lang_path, arg); + mainWindow.webContents.send('langres', ""); + }) + //ハードウェアアクセラレーションの無効化 + ipc.on('ha', function (e, arg) { + if (arg == "true") { fs.writeFileSync(ha_path, arg); } else { - fs.unlink(ha_path, function(err) {}); + fs.unlink(ha_path, function (err) { }); } app.relaunch() app.exit() }) ipc.on('quit', (e, args) => { - + app.quit(); }); ipc.on('about', (e, args) => { - + about(); }); function about() { - + var ver = app.getVersion() var window = new BrowserWindow({ width: 300, @@ -82,15 +82,15 @@ function system(mainWindow, dir, lang) { return "true" } ipc.on('column-del', (e, args) => { - + console.log(lang); var options = language.delsel(lang) - dialog.showMessageBox(options, function(index) { + dialog.showMessageBox(options, function (index) { mainWindow.webContents.send('column-del-reply', index); }) }); - ipc.on('nano', function(e, x, y) { - + ipc.on('nano', function (e, x, y) { + var nano_info_path = join(app.getPath("userData"), "nano-window-position.json"); var window_pos; @@ -110,7 +110,7 @@ function system(mainWindow, dir, lang) { nanowindow.setAlwaysOnTop(true); nanowindow.setPosition(window_pos[0], window_pos[1]); - nanowindow.on('close', function() { + nanowindow.on('close', function () { fs.writeFileSync(nano_info_path, JSON.stringify(nanowindow.getPosition())); }); return true; @@ -149,7 +149,7 @@ function system(mainWindow, dir, lang) { num_b = -1; } - data = data.sort(function(a, b) { + data = data.sort(function (a, b) { var x = a[key]; var y = b[key]; if (x > y) return num_a; @@ -173,7 +173,7 @@ function system(mainWindow, dir, lang) { ipc.on('fonts', (e, arg) => { const fm = require('font-manager'); var fonts = fm.getAvailableFontsSync(); - object_array_sort(fonts, 'family', 'asc', function(fonts_sorted) { + object_array_sort(fonts, 'family', 'asc', function (fonts_sorted) { mainWindow.webContents.send('font-list', fonts_sorted); }); }); diff --git a/app/nano.html b/app/nano.html index 930193eb..c8162430 100644 --- a/app/nano.html +++ b/app/nano.html @@ -1,214 +1,242 @@ + - - - - - TheDesk Nano - + + + + +TheDesk Nano + + - - - -
-- --
- + + + +
++ ++
+ - - - - - - - - - - + + + + + + + + + \ No newline at end of file + templete = ''; + $("#post-acct-sel").append(templete); + }); + function mov() { + return false; + } + function resetmv() { + return false; + } + function post() { + var acct_id = $("#post-acct-sel").val(); + var domain = localStorage.getItem("domain_" + acct_id); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + var start = "https://" + domain + "/api/v1/statuses"; + var str = $("#textarea").val(); + var toot = { + status: str + } + var vis = loadVis(acct_id) + toot.visibility = vis; + var httpreq = new XMLHttpRequest(); + httpreq.open('POST', start, true); + httpreq.setRequestHeader('Content-Type', 'application/json'); + httpreq.setRequestHeader('Authorization', 'Bearer ' + at); + httpreq.responseType = "json"; + httpreq.send(JSON.stringify(toot)); + httpreq.onreadystatechange = function () { + if (httpreq.readyState === 4) { + $("#textarea").val(""); + } + } + } + function loadVis(acct_id) { + var vist = localStorage.getItem("vis"); + console.log(vist); + if (!vist) { + return "public"; + } else { + if (vist == "memory") { + var memory = localStorage.getItem("vis-memory-" + acct_id); + if (!memory) { + memory = "public"; + } + return memory; + } else if (vist == "server") { + var multi = localStorage.getItem("multi"); + var obj = JSON.parse(multi); + var memory = obj[acct_id]["vis"]; + if (!memory) { + memory = "public"; + } + return memory; + } else { + return vist; + } + } + } + \ No newline at end of file diff --git a/app/view/en/acct.html b/app/view/en/acct.html index efdbe7df..c1724830 100644 --- a/app/view/en/acct.html +++ b/app/view/en/acct.html @@ -1,83 +1,122 @@ + -Account Manager - TheDesk - - - - - - - - - - - +Account Manager - TheDesk + + + + + + + + + + + + - - - - - - - - - --Add an account
---- -- - - Uncheck it to skip pasiting code.(login to Mastodon on Windows or macOS) (Recommended: pcheck)
- -
- -
-
+ + + + + + + + + -- Supports - --@@ -154,14 +161,15 @@visibility_off - public + public CW photo_library tag_faces - more_vert + more_vert clear@@ -176,13 +184,15 @@
Post at
2.7.0~ Minimum time gap:5min(clock on the server may not be accurate.)
- +-
- Adjust status privacy
+- Adjust status privacy +
- (Public)
@@ -228,8 +238,9 @@- +@@ -398,12 +409,12 @@ class="fas fa-share">- +- +@@ -449,8 +460,8 @@@@ -524,9 +540,11 @@
@@ -471,10 +482,12 @@ people→- - people← + people←
- - account_box + account_box
- list @@ -486,20 +499,23 @@ block
- - voice_over_off + voice_over_off
- - languageblock + languageblock
- create
- - how_to_reg + how_to_reg
- - recent_actors + recent_actors
Follow to add this user to lists.@@ -536,17 +554,20 @@- +- +- +@@ -741,7 +766,8 @@@@ -567,7 +588,8 @@- +
Change avataor: @@ -580,7 +602,8 @@- +@@ -686,7 +709,8 @@ Amazon Wish List@@ -720,7 +744,8 @@ class="material-icons">view_headlineList
- Give me Amazon Gift Card:web-pro@cutls.com
+ Give me Amazon Gift Card:web-pro@cutls.com
Kyash
filter_listFilter-help_outlineHelp+help_outlineHelprefreshReload TLpeople_outlineLocal-people_outlineperm_media +people_outlineperm_mediaLocal(Media)@@ -751,7 +777,8 @@languageFederated-languageperm_media+languageperm_mediaFederated(Media)@@ -761,7 +788,8 @@merge_typeIntegrated(Local/Home)-merge_typereply+merge_typereplyLTL+Reply+BT@@ -791,8 +819,8 @@--@@ -836,7 +865,8 @@+ List -@@ -915,7 +945,8 @@ settings - remove_from_queue + remove_from_queue apps diff --git a/app/view/en/setting.html b/app/view/en/setting.html index c487fc07..99e12e4c 100644 --- a/app/view/en/setting.html +++ b/app/view/en/setting.html @@ -22,6 +22,7 @@ input { max-height: 50px !important } + .pcr-result { height: 1rem !important; } @@ -157,11 +158,11 @@+ List -Accent
Background of boosts -- -- +Accent
Background of boosts ++ ++Change Custom sound
-Custom 1
-Custom 2
-Custom 3
-Custom 4
+Custom 1
+Custom 2
+Custom 3
+Custom 4
- diff --git a/app/view/en/setting.vue.js b/app/view/en/setting.vue.js index 58b4e065..b351c5db 100644 --- a/app/view/en/setting.vue.js +++ b/app/view/en/setting.vue.js @@ -1,552 +1,552 @@ -var yesno=[ +var yesno = [ { - text:"Yes", - value:"yes" - },{ - text:"No", - value:"no" + text: "Yes", + value: "yes" + }, { + text: "No", + value: "no" } ]; -var sound=[ +var sound = [ { - text:"None", - value:"none" - },{ - text:"Default", - value:"default" - },{ - text:"Custom 1", - value:"c1" - },{ - text:"Custom 2", - value:"c2" - },{ - text:"Custom 3", - value:"c3" - },{ - text:"Custom 4", - value:"c4" + text: "None", + value: "none" + }, { + text: "Default", + value: "default" + }, { + text: "Custom 1", + value: "c1" + }, { + text: "Custom 2", + value: "c2" + }, { + text: "Custom 3", + value: "c3" + }, { + text: "Custom 4", + value: "c4" } ]; -var envConstruction=[ +var envConstruction = [ { - id:"popup", - storage:"popup", - checkbox:false, - doubleText:false, - setValue:0, - width:50, - text:{ - head:"Popup notification(on Windows)", - desc:'Hide to set "0"', - after:"sec" + id: "popup", + storage: "popup", + checkbox: false, + doubleText: false, + setValue: 0, + width: 50, + text: { + head: "Popup notification(on Windows)", + desc: 'Hide to set "0"', + after: "sec" } - },{ - id:"notf", - storage:"nativenotf", - checkbox:true, - setValue:"yes", - text:{ - head:"Native notification", - desc:"This does not work on Windows Portable ver.", - checkbox:yesno + }, { + id: "notf", + storage: "nativenotf", + checkbox: true, + setValue: "yes", + text: { + head: "Native notification", + desc: "This does not work on Windows Portable ver.", + checkbox: yesno } - },{ - id:"width", - storage:"width", - checkbox:false, - doubleText:false, - width:50, - setValue:300, - text:{ - head:"Minimum width of columns", - desc:"Scroll bar will be shown when your window size is more than ammounts of columns.", - after:"px above" + }, { + id: "width", + storage: "width", + checkbox: false, + doubleText: false, + width: 50, + setValue: 300, + text: { + head: "Minimum width of columns", + desc: "Scroll bar will be shown when your window size is more than ammounts of columns.", + after: "px above" } - },{ - id:"fixwidth", - storage:"fixwidth", - checkbox:false, - doubleText:false, - setValue:300, - width:50, - text:{ - head:"Minimum width of TweetDeck browser", - desc:"", - after:"px above" + }, { + id: "fixwidth", + storage: "fixwidth", + checkbox: false, + doubleText: false, + setValue: 300, + width: 50, + text: { + head: "Minimum width of TweetDeck browser", + desc: "", + after: "px above" } - },{ - id:"size", - storage:"size", - checkbox:false, - doubleText:false, - width:50, - setValue:13, - text:{ - head:"Font size", - desc:'13px(absolute value)', - after:"px" + }, { + id: "size", + storage: "size", + checkbox: false, + doubleText: false, + width: 50, + setValue: 13, + text: { + head: "Font size", + desc: '13px(absolute value)', + after: "px" } - },{ - id:"ha", - storage:"ha", - checkbox:true, - setValue:false, - text:{ - head:"Disable hardware acceleration", - desc:"Auto restarted", - checkbox:[ + }, { + id: "ha", + storage: "ha", + checkbox: true, + setValue: false, + text: { + head: "Disable hardware acceleration", + desc: "Auto restarted", + checkbox: [ { - text:"Yes", - value:"true" - },{ - text:"No", - value:"false" + text: "Yes", + value: "true" + }, { + text: "No", + value: "false" } ] } } ]; -var tlConstruction=[ +var tlConstruction = [ { - id:"time", - storage:"datetype", - checkbox:true, - setValue:"absolute", - text:{ - head:"Time format", - desc:'Relative format:"1 minutes ago","3 days ago"
Absolute format:"23:25:21","2017/12/30 23:59:00"
Mixed format:toots posted today are relative-format, others are absolute-format.', - checkbox:[ + id: "time", + storage: "datetype", + checkbox: true, + setValue: "absolute", + text: { + head: "Time format", + desc: 'Relative format:"1 minutes ago","3 days ago"
Absolute format:"23:25:21","2017/12/30 23:59:00"
Mixed format:toots posted today are relative-format, others are absolute-format.', + checkbox: [ { - text:"Relative", - value:"relative" - },{ - text:"Absolute", - value:"absolute" - },{ - text:"Both relative and absolute", - value:"double" - },{ - text:"Mixed", - value:"medium" + text: "Relative", + value: "relative" + }, { + text: "Absolute", + value: "absolute" + }, { + text: "Both relative and absolute", + value: "double" + }, { + text: "Mixed", + value: "medium" } ] } - },{ - id:"ul", - storage:"locale", - checkbox:true, - setValue:"yes", - text:{ - head:"Server's unique locale", - desc:"This value is available on some Japanese servers", - checkbox:yesno + }, { + id: "ul", + storage: "locale", + checkbox: true, + setValue: "yes", + text: { + head: "Server's unique locale", + desc: "This value is available on some Japanese servers", + checkbox: yesno } - },{ - id:"nsfw", - storage:"nsfw", - checkbox:true, - setValue:"yes", - text:{ - head:"Hide NSFW pictures", - desc:"Strong blur effect", - checkbox:yesno + }, { + id: "nsfw", + storage: "nsfw", + checkbox: true, + setValue: "yes", + text: { + head: "Hide NSFW pictures", + desc: "Strong blur effect", + checkbox: yesno } - },{ - id:"cw", - storage:"cw", - checkbox:true, - setValue:"yes", - text:{ - head:"Hide CW contents", - desc:"", - checkbox:yesno + }, { + id: "cw", + storage: "cw", + checkbox: true, + setValue: "yes", + text: { + head: "Hide CW contents", + desc: "", + checkbox: yesno } - },{ - id:"rp", - storage:"replyct", - checkbox:true, - setValue:"hidden", - text:{ - head:"Reply counter style", - desc:"", - checkbox:[ + }, { + id: "rp", + storage: "replyct", + checkbox: true, + setValue: "hidden", + text: { + head: "Reply counter style", + desc: "", + checkbox: [ { - text:"Show 1+ if the replies are more than 1.", - value:"hidden" - },{ - text:"Show 1+ if the replies are more than 1.", - value:"all" + text: "Show 1+ if the replies are more than 1.", + value: "hidden" + }, { + text: "Show 1+ if the replies are more than 1.", + value: "all" } ] } - },{ - id:"gif", - storage:"gif", - checkbox:true, - setValue:"yes", - text:{ - head:"Animated GIF images animation", - desc:"", - checkbox:yesno + }, { + id: "gif", + storage: "gif", + checkbox: true, + setValue: "yes", + text: { + head: "Animated GIF images animation", + desc: "", + checkbox: yesno } - },{ - id:"tag", - storage:"tag-range", - checkbox:true, - setValue:"local", - text:{ - head:"Tag TL Search", - desc:"", - checkbox:[ + }, { + id: "tag", + storage: "tag-range", + checkbox: true, + setValue: "local", + text: { + head: "Tag TL Search", + desc: "", + checkbox: [ { - text:"Use federated network", - value:"all" - },{ - text:"Use local network", - value:"local" + text: "Use federated network", + value: "all" + }, { + text: "Use local network", + value: "local" } ] } - },{ - id:"via", - storage:"viashow", - checkbox:true, - setValue:"no", - text:{ - head:"Show via", - desc:"", - checkbox:yesno + }, { + id: "via", + storage: "viashow", + checkbox: true, + setValue: "no", + text: { + head: "Show via", + desc: "", + checkbox: yesno } - },{ - id:"mov", - storage:"mouseover", - checkbox:true, - setValue:"no", - text:{ - head:"Hide action buttons without mouseover", - desc:"You may feel 'mouseover' is unconfortable:(", - checkbox:[ + }, { + id: "mov", + storage: "mouseover", + checkbox: true, + setValue: "no", + text: { + head: "Hide action buttons without mouseover", + desc: "You may feel 'mouseover' is unconfortable:(", + checkbox: [ { - text:"Mouseover to show", - value:"yes" - },{ - text:"Click to show", - value:"click" - },{ - text:"No", - value:"no" + text: "Mouseover to show", + value: "yes" + }, { + text: "Click to show", + value: "click" + }, { + text: "No", + value: "no" } ] } - },{ - id:"notfm", - storage:"setasread", - checkbox:true, - setValue:"yes", - text:{ - head:"Show Notification marker, red colored bell and counter(if you show a notification column.)", - desc:"", - checkbox:yesno + }, { + id: "notfm", + storage: "setasread", + checkbox: true, + setValue: "yes", + text: { + head: "Show Notification marker, red colored bell and counter(if you show a notification column.)", + desc: "", + checkbox: yesno } - },{ - checkbox:false, - doubleText:true, - data:[ + }, { + checkbox: false, + doubleText: true, + data: [ { - id:"sentence", - storage:"sentence", - width:50, - setValue:500, - text:{after:"lines above or"} - },{ - id:"letters", - storage:"letters", - width:50, - setValue:7000, - text:{after:"letters above"} + id: "sentence", + storage: "sentence", + width: 50, + setValue: 500, + text: { after: "lines above or" } + }, { + id: "letters", + storage: "letters", + width: 50, + setValue: 7000, + text: { after: "letters above" } } ], - text:{ - head:"Auto folding", - desc:"TheDesk does not collapse totes of 5 characters or less. Also, when collapsing, newlines are not shown. TheDesk count only newlines as the number of lines.", + text: { + head: "Auto folding", + desc: "TheDesk does not collapse totes of 5 characters or less. Also, when collapsing, newlines are not shown. TheDesk count only newlines as the number of lines.", } - },{ - id:"img-height", - storage:"img-height", - checkbox:false, - doubleText:false, - width:80, - setValue:200, - text:{ - head:"Height of images", - desc:'Option:Set "full" to uncrop.', - after:"px" + }, { + id: "img-height", + storage: "img-height", + checkbox: false, + doubleText: false, + width: 80, + setValue: 200, + text: { + head: "Height of images", + desc: 'Option:Set "full" to uncrop.', + after: "px" } - },{ - id:"ticker", - storage:"ticker_ok", - checkbox:true, - setValue:"no", - text:{ - head:"Enable #InstanceTicker", - desc:'Show colorful stickers about the server. About #InstanceTicker Copyright 2018 weepjp, kyori19.', - checkbox:yesno + }, { + id: "ticker", + storage: "ticker_ok", + checkbox: true, + setValue: "no", + text: { + head: "Enable #InstanceTicker", + desc: 'Show colorful stickers about the server. About #InstanceTicker Copyright 2018 weepjp, kyori19.', + checkbox: yesno } - },{ - id:"anime", - storage:"animation", - checkbox:true, - setValue:"yes", - text:{ - head:"Animation of timelines", - desc:"", - checkbox:yesno + }, { + id: "anime", + storage: "animation", + checkbox: true, + setValue: "yes", + text: { + head: "Animation of timelines", + desc: "", + checkbox: yesno } - },{ - id:"replySound", - storage:"replySound", - checkbox:true, - setValue:"none", - text:{ - head:"Sound(Reply)", - desc:"", - checkbox:sound + }, { + id: "replySound", + storage: "replySound", + checkbox: true, + setValue: "none", + text: { + head: "Sound(Reply)", + desc: "", + checkbox: sound } - },{ - id:"favSound", - storage:"favSound", - checkbox:true, - setValue:"none", - text:{ - head:"Sound(Fav)", - desc:"", - checkbox:sound + }, { + id: "favSound", + storage: "favSound", + checkbox: true, + setValue: "none", + text: { + head: "Sound(Fav)", + desc: "", + checkbox: sound } - },{ - id:"btSound", - storage:"btSound", - checkbox:true, - setValue:"none", - text:{ - head:"Sound(Boost)", - desc:"", - checkbox:sound + }, { + id: "btSound", + storage: "btSound", + checkbox: true, + setValue: "none", + text: { + head: "Sound(Boost)", + desc: "", + checkbox: sound } - },{ - id:"followSound", - storage:"followSound", - checkbox:true, - setValue:"none", - text:{ - head:"Sound(Follow)", - desc:"", - checkbox:sound + }, { + id: "followSound", + storage: "followSound", + checkbox: true, + setValue: "none", + text: { + head: "Sound(Follow)", + desc: "", + checkbox: sound } } ]; -var postConstruction=[ +var postConstruction = [ { - id:"cw-text", - storage:"cw-text", - checkbox:false, - doubleText:false, - width:150, - setValue:"", - text:{ - head:"Default warining text", - desc:"", - after:"" + id: "cw-text", + storage: "cw-text", + checkbox: false, + doubleText: false, + width: 150, + setValue: "", + text: { + head: "Default warining text", + desc: "", + after: "" } - },{ - checkbox:false, - doubleText:true, - data:[ + }, { + checkbox: false, + doubleText: true, + data: [ { - id:"cw_sentence", - storage:"cw_sentence", - width:50, - setValue:500, - text:{after:"lines above or"} - },{ - id:"cw_letters", - storage:"cw_letters", - width:50, - setValue:7000, - text:{after:"letters above"} + id: "cw_sentence", + storage: "cw_sentence", + width: 50, + setValue: 500, + text: { after: "lines above or" } + }, { + id: "cw_letters", + storage: "cw_letters", + width: 50, + setValue: 7000, + text: { after: "letters above" } } ], - text:{ - head:"Alert before posting a long toot.", - desc:"Show dialog whether you make too-long text hidden.", + text: { + head: "Alert before posting a long toot.", + desc: "Show dialog whether you make too-long text hidden.", } - },{ - id:"cws", - storage:"always-cw", - checkbox:true, - setValue:"no", - text:{ - head:"Always CW set", - desc:"", - checkbox:yesno + }, { + id: "cws", + storage: "always-cw", + checkbox: true, + setValue: "no", + text: { + head: "Always CW set", + desc: "", + checkbox: yesno } - },{ - id:"vis", - storage:"vis", - checkbox:true, - setValue:"public", - text:{ - head:"Default visibility", - desc:"", - checkbox:[ + }, { + id: "vis", + storage: "vis", + checkbox: true, + setValue: "public", + text: { + head: "Default visibility", + desc: "", + checkbox: [ { - text:"Public", - value:"public" - },{ - text:"Unlisted", - value:"unlisted" - },{ - text:"Private", - value:"private" - },{ - text:"Direct", - value:"direct" - },{ - text:"Memory(memorized as each server)", - value:"memory" - },{ - text:"Default of your visibility(Set on preferences of Mastodon server)", - value:"useapi" + text: "Public", + value: "public" + }, { + text: "Unlisted", + value: "unlisted" + }, { + text: "Private", + value: "private" + }, { + text: "Direct", + value: "direct" + }, { + text: "Memory(memorized as each server)", + value: "memory" + }, { + text: "Default of your visibility(Set on preferences of Mastodon server)", + value: "useapi" } ] } - },{ - id:"img", - storage:"img", - checkbox:true, - setValue:"no-act", - text:{ - head:"Posting images preferences", - desc:"", - checkbox:[ + }, { + id: "img", + storage: "img", + checkbox: true, + setValue: "no-act", + text: { + head: "Posting images preferences", + desc: "", + checkbox: [ { - text:"Insert media URL", - value:"url" - },{ - text:"Insert nothig", - value:"no-act" + text: "Insert media URL", + value: "url" + }, { + text: "Insert nothig", + value: "no-act" } ] } - },{ - id:"box", - storage:"box", - checkbox:true, - setValue:"yes", - text:{ - head:"Action of posting-box", - desc:"", - checkbox:[ + }, { + id: "box", + storage: "box", + checkbox: true, + setValue: "yes", + text: { + head: "Action of posting-box", + desc: "", + checkbox: [ { - text:"Folding", - value:"yes" - },{ - text:"Open after posting", - value:"no" - },{ - text:"Absolutely open", - value:"absolute" + text: "Folding", + value: "yes" + }, { + text: "Open after posting", + value: "no" + }, { + text: "Absolutely open", + value: "absolute" } ] } - },{ - id:"quote", - storage:"quote", - checkbox:true, - setValue:"nothing", - text:{ - head:"Quote format", - desc:"", - checkbox:[ + }, { + id: "quote", + storage: "quote", + checkbox: true, + setValue: "nothing", + text: { + head: "Quote format", + desc: "", + checkbox: [ { - text:"Only URL", - value:"simple" - },{ - text:"URL and acct(mention to the user)", - value:"mention" - },{ - text:"URL, text and acct(mention to the user)", - value:"full" - },{ - text:"Disabled(Hide buttons on TLs)", - value:"nothing" + text: "Only URL", + value: "simple" + }, { + text: "URL and acct(mention to the user)", + value: "mention" + }, { + text: "URL, text and acct(mention to the user)", + value: "full" + }, { + text: "Disabled(Hide buttons on TLs)", + value: "nothing" } ] } - },{ - id:"main", - storage:"mainuse", - checkbox:true, - setValue:"remain", - text:{ - head:"Default accounts of actions", - desc:"Main account can be set on Account Manager.", - checkbox:[ + }, { + id: "main", + storage: "mainuse", + checkbox: true, + setValue: "remain", + text: { + head: "Default accounts of actions", + desc: "Main account can be set on Account Manager.", + checkbox: [ { - text:"Account you used recently", - value:"remain" - },{ - text:"Main account", - value:"main" + text: "Account you used recently", + value: "remain" + }, { + text: "Main account", + value: "main" } ] } - },{ - id:"sec", - storage:"sec", - checkbox:true, - setValue:"public", - text:{ - head:"Secondary Toot Button", - desc:"", - checkbox:[ + }, { + id: "sec", + storage: "sec", + checkbox: true, + setValue: "public", + text: { + head: "Secondary Toot Button", + desc: "", + checkbox: [ { - text:"Hidden", - value:"nothing" - },{ - text:"Public", - value:"public" - },{ - text:"Unlisted", - value:"unlisted" - },{ - text:"Private", - value:"private" - },{ - text:"Direct", - value:"direct" - },{ - text:"Local Only", - value:"local", - kirishima:true, - kirishimaText:"非対応インスタンスでは「未収載」になります。" + text: "Hidden", + value: "nothing" + }, { + text: "Public", + value: "public" + }, { + text: "Unlisted", + value: "unlisted" + }, { + text: "Private", + value: "private" + }, { + text: "Direct", + value: "direct" + }, { + text: "Local Only", + value: "local", + kirishima: true, + kirishimaText: "非対応インスタンスでは「未収載」になります。" } ] } - },{ - id:"zero", - storage:"emoji-zero-width", - checkbox:true, - setValue:"normal", - setValue:"no", - text:{ - head:"Zero-width space when inserting emojis", - desc:"", - checkbox:yesno + }, { + id: "zero", + storage: "emoji-zero-width", + checkbox: true, + setValue: "normal", + setValue: "no", + text: { + head: "Zero-width space when inserting emojis", + desc: "", + checkbox: yesno } } ] \ No newline at end of file diff --git a/app/view/en/update.html b/app/view/en/update.html index 482f9b1f..e3a1fa57 100644 --- a/app/view/en/update.html +++ b/app/view/en/update.html @@ -1,235 +1,256 @@ + -Update - TheDesk - - - - - +Update - TheDesk + + + + + + - - - - -info -clear - -- - -- - - + + + info + clear + +--Downloading...
- -+ + ++ + + \ No newline at end of file + var start = "https://thedesk.top/ver.json"; + fetch(start, { + method: 'GET', + headers: { 'content-type': 'application/json' }, + }).then(function (response) { + return response.json(); + }).catch(function (error) { + todo(error); + console.error(error); + }).then(function (json) { + console.log(json); + if (platform == "win32") { + $("#ver").text(json.desk); + localStorage.setItem("next-ver", json.desk); + } else if (platform == "linux") { + $("#ver").text(json.desk_linux); + localStorage.setItem("next-ver", json.desk_linux); + } else if (platform == "darwin") { + $("#ver").text(json.desk_mac); + localStorage.setItem("next-ver", json.desk_mac); + } + var lang = "en"; + if (lang == "ja") { + $("#det").html(json.detail); + } else { + $("#det").html(json.detail_en); + } + + $("#now").text(localStorage.getItem("ver")); + + }); + } + function nextv() { + localStorage.setItem("new-ver-skip", "true"); + window.close(); + } + function enc(ver) { + var ver = ver.replace(/\s/g, ""); + var ver = ver.replace(/\(/g, "-"); + var ver = ver.replace(/\)/g, ""); + var ver = ver.replace(/\[/g, "_"); + var ver = ver.replace(/\]/g, ""); + return ver; + } + \ No newline at end of file diff --git a/app/view/ja/acct.html b/app/view/ja/acct.html index c3a3c1ff..be7dfa80 100644 --- a/app/view/ja/acct.html +++ b/app/view/ja/acct.html @@ -1,83 +1,122 @@ + -++Downloading...
+ +Account Manager - TheDesk - - - - - - - - - - - +Account Manager - TheDesk + + + + + + + + + + + + - - - - - - - - - --アカウントを追加
---- -- - - チェックを外すとコード貼り付けをスキップできます。(MastodonにWindowsやmacOSからログインする場合)失敗する場合はチェックを入れてください。
- -
- -
-Login
+ + + + + + + + + -- Supports - --@@ -154,14 +161,15 @@visibility_off - public + public CW photo_library tag_faces - more_vert + more_vert clear@@ -176,13 +184,15 @@
時間指定投稿
2.7.0~ 5分以内には投稿できません。サーバーの時計が正確とは限りません。
- +-
- 公開範囲指定
+- 公開範囲指定 +
- 公開(Public)
@@ -228,8 +238,9 @@トゥート - +@@ -398,12 +409,12 @@ class="fas fa-share">-+ -+ @@ -449,8 +460,8 @@@@ -523,10 +539,12 @@
@@ -471,10 +482,12 @@ people→- - people← + people←
- - account_box + account_box
- list @@ -486,20 +499,23 @@ block
- - voice_over_off + voice_over_off
- - languageblock + languageblock
- create
- - how_to_reg + how_to_reg
- - recent_actors + recent_actors
リストに追加するためにはフォローが必要です。@@ -536,17 +554,20 @@-もっと +もっと -もっと +もっと -もっと +もっと @@ -741,7 +766,8 @@@@ -567,7 +588,8 @@-変更 +変更
アバターを変更: @@ -580,7 +602,8 @@-もっと +もっと @@ -686,7 +709,8 @@ Amazonほしいものリスト@@ -720,7 +744,8 @@ class="material-icons">view_headlineリスト
- web-pro@cutls.comにAmazonギフトカードを送る
+ web-pro@cutls.comにAmazonギフトカードを送る
Kyash
filter_listフィルター-help_outlineヘルプ+help_outlineヘルプrefreshTL再読込people_outlineローカル-people_outlineperm_media +people_outlineperm_mediaローカル(メディア)@@ -751,7 +777,8 @@language連合-languageperm_media+languageperm_media連合(メディア)@@ -761,7 +788,8 @@merge_type統合(ローカルとホーム)-merge_typereply+merge_typereply統合(LTL+BT+返信)@@ -791,8 +819,8 @@-+ search検索
@@ -819,7 +847,8 @@-@@ -836,7 +865,8 @@+ 一覧 -@@ -915,7 +945,8 @@ settings - remove_from_queue + remove_from_queue apps diff --git a/app/view/ja/setting.html b/app/view/ja/setting.html index ec768f6e..380fa90d 100644 --- a/app/view/ja/setting.html +++ b/app/view/ja/setting.html @@ -22,6 +22,7 @@ input { max-height: 50px !important } + .pcr-result { height: 1rem !important; } @@ -157,11 +158,11 @@+ 一覧 -Accent
ブーストの背景色など -- -- +Accent
ブーストの背景色など ++ ++変更 カスタム通知音
-Custom 1
-Custom 2
-Custom 3
-Custom 4
+Custom 1
+Custom 2
+Custom 3
+Custom 4
- diff --git a/app/view/ja/setting.vue.js b/app/view/ja/setting.vue.js index 32f4d993..1238b298 100644 --- a/app/view/ja/setting.vue.js +++ b/app/view/ja/setting.vue.js @@ -1,552 +1,552 @@ -var yesno=[ +var yesno = [ { - text:"はい", - value:"yes" - },{ - text:"いいえ", - value:"no" + text: "はい", + value: "yes" + }, { + text: "いいえ", + value: "no" } ]; -var sound=[ +var sound = [ { - text:"なし", - value:"none" - },{ - text:"既定", - value:"default" - },{ - text:"Custom 1", - value:"c1" - },{ - text:"Custom 2", - value:"c2" - },{ - text:"Custom 3", - value:"c3" - },{ - text:"Custom 4", - value:"c4" + text: "なし", + value: "none" + }, { + text: "既定", + value: "default" + }, { + text: "Custom 1", + value: "c1" + }, { + text: "Custom 2", + value: "c2" + }, { + text: "Custom 3", + value: "c3" + }, { + text: "Custom 4", + value: "c4" } ]; -var envConstruction=[ +var envConstruction = [ { - id:"popup", - storage:"popup", - checkbox:false, - doubleText:false, - setValue:0, - width:50, - text:{ - head:"新規通知のポップアップお知らせの表示秒数", - desc:'0に設定すると表示されません', - after:"秒" + id: "popup", + storage: "popup", + checkbox: false, + doubleText: false, + setValue: 0, + width: 50, + text: { + head: "新規通知のポップアップお知らせの表示秒数", + desc: '0に設定すると表示されません', + after: "秒" } - },{ - id:"notf", - storage:"nativenotf", - checkbox:true, - setValue:"yes", - text:{ - head:"ネイティブ通知設定", - desc:"Portableバージョンでは表示できません。", - checkbox:yesno + }, { + id: "notf", + storage: "nativenotf", + checkbox: true, + setValue: "yes", + text: { + head: "ネイティブ通知設定", + desc: "Portableバージョンでは表示できません。", + checkbox: yesno } - },{ - id:"width", - storage:"width", - checkbox:false, - doubleText:false, - width:50, - setValue:300, - text:{ - head:"マルチカラムの最低横幅", - desc:"画面全体の横幅÷コラム数がこの値を超えた時、横スクロールとなります。", - after:"px 以上" + }, { + id: "width", + storage: "width", + checkbox: false, + doubleText: false, + width: 50, + setValue: 300, + text: { + head: "マルチカラムの最低横幅", + desc: "画面全体の横幅÷コラム数がこの値を超えた時、横スクロールとなります。", + after: "px 以上" } - },{ - id:"fixwidth", - storage:"fixwidth", - checkbox:false, - doubleText:false, - setValue:300, - width:50, - text:{ - head:"TweetDeckの限定の最低横幅", - desc:"", - after:"px 以上" + }, { + id: "fixwidth", + storage: "fixwidth", + checkbox: false, + doubleText: false, + setValue: 300, + width: 50, + text: { + head: "TweetDeckの限定の最低横幅", + desc: "", + after: "px 以上" } - },{ - id:"size", - storage:"size", - checkbox:false, - doubleText:false, - width:50, - setValue:13, - text:{ - head:"フォントサイズ", - desc:'13px(絶対指定)', - after:"px" + }, { + id: "size", + storage: "size", + checkbox: false, + doubleText: false, + width: 50, + setValue: 13, + text: { + head: "フォントサイズ", + desc: '13px(絶対指定)', + after: "px" } - },{ - id:"ha", - storage:"ha", - checkbox:true, - setValue:false, - text:{ - head:"ハードウェアアクセラレーションの無効化", - desc:"表示(特に設定画面)が乱れる場合に「はい」を選択してください。自動で再起動します。", - checkbox:[ + }, { + id: "ha", + storage: "ha", + checkbox: true, + setValue: false, + text: { + head: "ハードウェアアクセラレーションの無効化", + desc: "表示(特に設定画面)が乱れる場合に「はい」を選択してください。自動で再起動します。", + checkbox: [ { - text:"はい", - value:"true" - },{ - text:"いいえ", - value:"false" + text: "はい", + value: "true" + }, { + text: "いいえ", + value: "false" } ] } } ]; -var tlConstruction=[ +var tlConstruction = [ { - id:"time", - storage:"datetype", - checkbox:true, - setValue:"absolute", - text:{ - head:"時間表記設定", - desc:'相対時間の例:"1分前","3日前"
絶対時間の例"23:25:21","2017年12月30日 23:59:00"
混合表示は、当日のトゥートのみ相対、それ以外は絶対で表示 ', - checkbox:[ + id: "time", + storage: "datetype", + checkbox: true, + setValue: "absolute", + text: { + head: "時間表記設定", + desc: '相対時間の例:"1分前","3日前"
絶対時間の例"23:25:21","2017年12月30日 23:59:00"
混合表示は、当日のトゥートのみ相対、それ以外は絶対で表示 ', + checkbox: [ { - text:"相対時間", - value:"relative" - },{ - text:"絶対時間", - value:"absolute" - },{ - text:"両方表示", - value:"double" - },{ - text:"混合表示", - value:"medium" + text: "相対時間", + value: "relative" + }, { + text: "絶対時間", + value: "absolute" + }, { + text: "両方表示", + value: "double" + }, { + text: "混合表示", + value: "medium" } ] } - },{ - id:"ul", - storage:"locale", - checkbox:true, - setValue:"yes", - text:{ - head:"独自ロケールを使用", - desc:"対応サーバーではそのサーバーにあわせた言語表示ができます。", - checkbox:yesno + }, { + id: "ul", + storage: "locale", + checkbox: true, + setValue: "yes", + text: { + head: "独自ロケールを使用", + desc: "対応サーバーではそのサーバーにあわせた言語表示ができます。", + checkbox: yesno } - },{ - id:"nsfw", - storage:"nsfw", - checkbox:true, - setValue:"yes", - text:{ - head:"非表示設定の画像(NSFW)を隠す", - desc:"きつめのぼかしがかかります。", - checkbox:yesno + }, { + id: "nsfw", + storage: "nsfw", + checkbox: true, + setValue: "yes", + text: { + head: "非表示設定の画像(NSFW)を隠す", + desc: "きつめのぼかしがかかります。", + checkbox: yesno } - },{ - id:"cw", - storage:"cw", - checkbox:true, - setValue:"yes", - text:{ - head:"非表示設定のテキスト(CW)を隠す", - desc:"", - checkbox:yesno + }, { + id: "cw", + storage: "cw", + checkbox: true, + setValue: "yes", + text: { + head: "非表示設定のテキスト(CW)を隠す", + desc: "", + checkbox: yesno } - },{ - id:"rp", - storage:"replyct", - checkbox:true, - setValue:"hidden", - text:{ - head:"リプライ数表示", - desc:"", - checkbox:[ + }, { + id: "rp", + storage: "replyct", + checkbox: true, + setValue: "hidden", + text: { + head: "リプライ数表示", + desc: "", + checkbox: [ { - text:"2以上のとき1+と表示", - value:"hidden" - },{ - text:"2以上のとき1+と表示", - value:"all" + text: "2以上のとき1+と表示", + value: "hidden" + }, { + text: "2以上のとき1+と表示", + value: "all" } ] } - },{ - id:"gif", - storage:"gif", - checkbox:true, - setValue:"yes", - text:{ - head:"アイコンのアニメーションを再生する", - desc:"", - checkbox:yesno + }, { + id: "gif", + storage: "gif", + checkbox: true, + setValue: "yes", + text: { + head: "アイコンのアニメーションを再生する", + desc: "", + checkbox: yesno } - },{ - id:"tag", - storage:"tag-range", - checkbox:true, - setValue:"local", - text:{ - head:"タグタイムラインの表示範囲", - desc:"", - checkbox:[ + }, { + id: "tag", + storage: "tag-range", + checkbox: true, + setValue: "local", + text: { + head: "タグタイムラインの表示範囲", + desc: "", + checkbox: [ { - text:"接続しているサーバー", - value:"all" - },{ - text:"検索対象のサーバーのみ", - value:"local" + text: "接続しているサーバー", + value: "all" + }, { + text: "検索対象のサーバーのみ", + value: "local" } ] } - },{ - id:"via", - storage:"viashow", - checkbox:true, - setValue:"no", - text:{ - head:"viaを表示する", - desc:"", - checkbox:yesno + }, { + id: "via", + storage: "viashow", + checkbox: true, + setValue: "no", + text: { + head: "viaを表示する", + desc: "", + checkbox: yesno } - },{ - id:"mov", - storage:"mouseover", - checkbox:true, - setValue:"no", - text:{ - head:"アクションメニューを非表示", - desc:"「マウスオーバー」はすこし鬱陶しいと思うかもしれません。", - checkbox:[ + }, { + id: "mov", + storage: "mouseover", + checkbox: true, + setValue: "no", + text: { + head: "アクションメニューを非表示", + desc: "「マウスオーバー」はすこし鬱陶しいと思うかもしれません。", + checkbox: [ { - text:"マウスオーバーで表示", - value:"yes" - },{ - text:"クリックで表示", - value:"click" - },{ - text:"いいえ", - value:"no" + text: "マウスオーバーで表示", + value: "yes" + }, { + text: "クリックで表示", + value: "click" + }, { + text: "いいえ", + value: "no" } ] } - },{ - id:"notfm", - storage:"setasread", - checkbox:true, - setValue:"yes", - text:{ - head:"通知を開いているとき、通知新着お知らせを表示する", - desc:"", - checkbox:yesno + }, { + id: "notfm", + storage: "setasread", + checkbox: true, + setValue: "yes", + text: { + head: "通知を開いているとき、通知新着お知らせを表示する", + desc: "", + checkbox: yesno } - },{ - checkbox:false, - doubleText:true, - data:[ + }, { + checkbox: false, + doubleText: true, + data: [ { - id:"sentence", - storage:"sentence", - width:50, - setValue:500, - text:{after:"行 以上 または"} - },{ - id:"letters", - storage:"letters", - width:50, - setValue:7000, - text:{after:"文字 以上"} + id: "sentence", + storage: "sentence", + width: 50, + setValue: 500, + text: { after: "行 以上 または" } + }, { + id: "letters", + storage: "letters", + width: 50, + setValue: 7000, + text: { after: "文字 以上" } } ], - text:{ - head:"指定行数以上を折りたたむ", - desc:"5文字以下のトゥートは折りたたみません。また、折りたたみ時は改行が描画されません。改行のみを行数とカウントします。", + text: { + head: "指定行数以上を折りたたむ", + desc: "5文字以下のトゥートは折りたたみません。また、折りたたみ時は改行が描画されません。改行のみを行数とカウントします。", } - },{ - id:"img-height", - storage:"img-height", - checkbox:false, - doubleText:false, - width:80, - setValue:200, - text:{ - head:"画像の高さ", - desc:'オプション:「full」と指定すると全ての画像をクロップしません。', - after:"px" + }, { + id: "img-height", + storage: "img-height", + checkbox: false, + doubleText: false, + width: 80, + setValue: 200, + text: { + head: "画像の高さ", + desc: 'オプション:「full」と指定すると全ての画像をクロップしません。', + after: "px" } - },{ - id:"ticker", - storage:"ticker_ok", - checkbox:true, - setValue:"no", - text:{ - head:"#InstanceTickerを使う", - desc:'トゥートした人の所属サーバーをわかりやすく彩ります(自サーバー以外のトゥート向け)。#InstanceTickerについて Copyright 2018 weepjp, kyori19.', - checkbox:yesno + }, { + id: "ticker", + storage: "ticker_ok", + checkbox: true, + setValue: "no", + text: { + head: "#InstanceTickerを使う", + desc: 'トゥートした人の所属サーバーをわかりやすく彩ります(自サーバー以外のトゥート向け)。#InstanceTickerについて Copyright 2018 weepjp, kyori19.', + checkbox: yesno } - },{ - id:"anime", - storage:"animation", - checkbox:true, - setValue:"yes", - text:{ - head:"タイムラインのアニメーション", - desc:"", - checkbox:yesno + }, { + id: "anime", + storage: "animation", + checkbox: true, + setValue: "yes", + text: { + head: "タイムラインのアニメーション", + desc: "", + checkbox: yesno } - },{ - id:"replySound", - storage:"replySound", - checkbox:true, - setValue:"none", - text:{ - head:"リプライの通知音", - desc:"", - checkbox:sound + }, { + id: "replySound", + storage: "replySound", + checkbox: true, + setValue: "none", + text: { + head: "リプライの通知音", + desc: "", + checkbox: sound } - },{ - id:"favSound", - storage:"favSound", - checkbox:true, - setValue:"none", - text:{ - head:"お気に入り登録の通知音", - desc:"", - checkbox:sound + }, { + id: "favSound", + storage: "favSound", + checkbox: true, + setValue: "none", + text: { + head: "お気に入り登録の通知音", + desc: "", + checkbox: sound } - },{ - id:"btSound", - storage:"btSound", - checkbox:true, - setValue:"none", - text:{ - head:"ブーストの通知音", - desc:"", - checkbox:sound + }, { + id: "btSound", + storage: "btSound", + checkbox: true, + setValue: "none", + text: { + head: "ブーストの通知音", + desc: "", + checkbox: sound } - },{ - id:"followSound", - storage:"followSound", - checkbox:true, - setValue:"none", - text:{ - head:"フォローの通知音", - desc:"", - checkbox:sound + }, { + id: "followSound", + storage: "followSound", + checkbox: true, + setValue: "none", + text: { + head: "フォローの通知音", + desc: "", + checkbox: sound } } ]; -var postConstruction=[ +var postConstruction = [ { - id:"cw-text", - storage:"cw-text", - checkbox:false, - doubleText:false, - width:150, - setValue:"", - text:{ - head:"デフォルトの警告文", - desc:"", - after:"" + id: "cw-text", + storage: "cw-text", + checkbox: false, + doubleText: false, + width: 150, + setValue: "", + text: { + head: "デフォルトの警告文", + desc: "", + after: "" } - },{ - checkbox:false, - doubleText:true, - data:[ + }, { + checkbox: false, + doubleText: true, + data: [ { - id:"cw_sentence", - storage:"cw_sentence", - width:50, - setValue:500, - text:{after:"行 以上 または"} - },{ - id:"cw_letters", - storage:"cw_letters", - width:50, - setValue:7000, - text:{after:"文字 以上"} + id: "cw_sentence", + storage: "cw_sentence", + width: 50, + setValue: 500, + text: { after: "行 以上 または" } + }, { + id: "cw_letters", + storage: "cw_letters", + width: 50, + setValue: 7000, + text: { after: "文字 以上" } } ], - text:{ - head:"長文投稿時に警告", - desc:"下で指定した以上のトゥートを投稿するときにCWするかのダイアログを表示します。", + text: { + head: "長文投稿時に警告", + desc: "下で指定した以上のトゥートを投稿するときにCWするかのダイアログを表示します。", } - },{ - id:"cws", - storage:"always-cw", - checkbox:true, - setValue:"no", - text:{ - head:"標準でCWを設定", - desc:"", - checkbox:yesno + }, { + id: "cws", + storage: "always-cw", + checkbox: true, + setValue: "no", + text: { + head: "標準でCWを設定", + desc: "", + checkbox: yesno } - },{ - id:"vis", - storage:"vis", - checkbox:true, - setValue:"public", - text:{ - head:"デフォルトの公開設定", - desc:"", - checkbox:[ + }, { + id: "vis", + storage: "vis", + checkbox: true, + setValue: "public", + text: { + head: "デフォルトの公開設定", + desc: "", + checkbox: [ { - text:"公開(Public)", - value:"public" - },{ - text:"未収載(Unlisted)", - value:"unlisted" - },{ - text:"非公開(Private)", - value:"private" - },{ - text:"ダイレクト(Direct)", - value:"direct" - },{ - text:"前回の投稿設定を記憶する(サーバーごとに記憶されます)", - value:"memory" - },{ - text:"マストドンアカウント設定の既定値", - value:"useapi" + text: "公開(Public)", + value: "public" + }, { + text: "未収載(Unlisted)", + value: "unlisted" + }, { + text: "非公開(Private)", + value: "private" + }, { + text: "ダイレクト(Direct)", + value: "direct" + }, { + text: "前回の投稿設定を記憶する(サーバーごとに記憶されます)", + value: "memory" + }, { + text: "マストドンアカウント設定の既定値", + value: "useapi" } ] } - },{ - id:"img", - storage:"img", - checkbox:true, - setValue:"no-act", - text:{ - head:"画像投稿設定", - desc:"", - checkbox:[ + }, { + id: "img", + storage: "img", + checkbox: true, + setValue: "no-act", + text: { + head: "画像投稿設定", + desc: "", + checkbox: [ { - text:"画像を投稿し、画像のURLを最後に表示", - value:"url" - },{ - text:"画像を投稿するがURLは表示しない", - value:"no-act" + text: "画像を投稿し、画像のURLを最後に表示", + value: "url" + }, { + text: "画像を投稿するがURLは表示しない", + value: "no-act" } ] } - },{ - id:"box", - storage:"box", - checkbox:true, - setValue:"yes", - text:{ - head:"投稿ボックスの挙動", - desc:"", - checkbox:[ + }, { + id: "box", + storage: "box", + checkbox: true, + setValue: "yes", + text: { + head: "投稿ボックスの挙動", + desc: "", + checkbox: [ { - text:"たたむ", - value:"yes" - },{ - text:"投稿後も隠さない", - value:"no" - },{ - text:"枠外クリックで閉じない(起動時に展開)", - value:"absolute" + text: "たたむ", + value: "yes" + }, { + text: "投稿後も隠さない", + value: "no" + }, { + text: "枠外クリックで閉じない(起動時に展開)", + value: "absolute" } ] } - },{ - id:"quote", - storage:"quote", - checkbox:true, - setValue:"nothing", - text:{ - head:"引用形式", - desc:"", - checkbox:[ + }, { + id: "quote", + storage: "quote", + checkbox: true, + setValue: "nothing", + text: { + head: "引用形式", + desc: "", + checkbox: [ { - text:"URLのみ", - value:"simple" - },{ - text:"URLとアカウント名(相手に通知)", - value:"mention" - },{ - text:"本文・URL・アカウント名", - value:"full" - },{ - text:"使わない(TL上にボタンも表示されません)", - value:"nothing" + text: "URLのみ", + value: "simple" + }, { + text: "URLとアカウント名(相手に通知)", + value: "mention" + }, { + text: "本文・URL・アカウント名", + value: "full" + }, { + text: "使わない(TL上にボタンも表示されません)", + value: "nothing" } ] } - },{ - id:"main", - storage:"mainuse", - checkbox:true, - setValue:"remain", - text:{ - head:"投稿後や起動時のアカウント", - desc:"メインアカウントはアカウント設定で指定できます。投稿以外のアカウント選択にも影響します。", - checkbox:[ + }, { + id: "main", + storage: "mainuse", + checkbox: true, + setValue: "remain", + text: { + head: "投稿後や起動時のアカウント", + desc: "メインアカウントはアカウント設定で指定できます。投稿以外のアカウント選択にも影響します。", + checkbox: [ { - text:"最後に使用したアカウント", - value:"remain" - },{ - text:"メインアカウント", - value:"main" + text: "最後に使用したアカウント", + value: "remain" + }, { + text: "メインアカウント", + value: "main" } ] } - },{ - id:"sec", - storage:"sec", - checkbox:true, - setValue:"public", - text:{ - head:"セカンダリートゥートボタン", - desc:"", - checkbox:[ + }, { + id: "sec", + storage: "sec", + checkbox: true, + setValue: "public", + text: { + head: "セカンダリートゥートボタン", + desc: "", + checkbox: [ { - text:"表示しない", - value:"nothing" - },{ - text:"公開(Public)", - value:"public" - },{ - text:"未収載(Unlisted)", - value:"unlisted" - },{ - text:"非公開(Private)", - value:"private" - },{ - text:"ダイレクト(Direct)", - value:"direct" - },{ - text:"ローカル限定", - value:"local", - kirishima:true, - kirishimaText:"非対応インスタンスでは「未収載」になります。" + text: "表示しない", + value: "nothing" + }, { + text: "公開(Public)", + value: "public" + }, { + text: "未収載(Unlisted)", + value: "unlisted" + }, { + text: "非公開(Private)", + value: "private" + }, { + text: "ダイレクト(Direct)", + value: "direct" + }, { + text: "ローカル限定", + value: "local", + kirishima: true, + kirishimaText: "非対応インスタンスでは「未収載」になります。" } ] } - },{ - id:"zero", - storage:"emoji-zero-width", - checkbox:true, - setValue:"normal", - setValue:"no", - text:{ - head:"絵文字にゼロ幅スペースを使う", - desc:"", - checkbox:yesno + }, { + id: "zero", + storage: "emoji-zero-width", + checkbox: true, + setValue: "normal", + setValue: "no", + text: { + head: "絵文字にゼロ幅スペースを使う", + desc: "", + checkbox: yesno } } ] \ No newline at end of file diff --git a/app/view/ja/update.html b/app/view/ja/update.html index 47e9122a..2df29256 100644 --- a/app/view/ja/update.html +++ b/app/view/ja/update.html @@ -1,235 +1,256 @@ + -Update - TheDesk - - - - - +Update - TheDesk + + + + + + - - - - -info -clear - -- - -- - - + + + info + clear + +--ダウンロード中
- -+ + ++ + + \ No newline at end of file + var start = "https://thedesk.top/ver.json"; + fetch(start, { + method: 'GET', + headers: { 'content-type': 'application/json' }, + }).then(function (response) { + return response.json(); + }).catch(function (error) { + todo(error); + console.error(error); + }).then(function (json) { + console.log(json); + if (platform == "win32") { + $("#ver").text(json.desk); + localStorage.setItem("next-ver", json.desk); + } else if (platform == "linux") { + $("#ver").text(json.desk_linux); + localStorage.setItem("next-ver", json.desk_linux); + } else if (platform == "darwin") { + $("#ver").text(json.desk_mac); + localStorage.setItem("next-ver", json.desk_mac); + } + var lang = "ja"; + if (lang == "ja") { + $("#det").html(json.detail); + } else { + $("#det").html(json.detail_en); + } + + $("#now").text(localStorage.getItem("ver")); + + }); + } + function nextv() { + localStorage.setItem("new-ver-skip", "true"); + window.close(); + } + function enc(ver) { + var ver = ver.replace(/\s/g, ""); + var ver = ver.replace(/\(/g, "-"); + var ver = ver.replace(/\)/g, ""); + var ver = ver.replace(/\[/g, "_"); + var ver = ver.replace(/\]/g, ""); + return ver; + } + \ No newline at end of file diff --git a/app/view/make/acct.sample.html b/app/view/make/acct.sample.html index 2f3c84c5..fa040455 100644 --- a/app/view/make/acct.sample.html +++ b/app/view/make/acct.sample.html @@ -1,83 +1,122 @@ + -++ダウンロード中
+ +Account Manager - TheDesk - - - - - - - - - - -@@comment-start@@ - - -@@comment-end@@ +Account Manager - TheDesk + + + + + + + + + + + @@comment-start@@ + + + @@comment-end@@ + - - - - - - - - - --@@add@@
---- -- - - @@codesetupwarn@@
- -
- -
-Login
+ + + + + + + + + -- Supports - --@@ -154,14 +161,15 @@visibility_off - public + public CW photo_library tag_faces - more_vert + more_vert clear@@ -176,13 +184,15 @@
@@postat@@
@@scheduleWarn@@
- +-
- @@selectVis@@
+- @@selectVis@@ +
- @@publicJP@@(Public)
@@ -228,8 +238,9 @@@@toot@@ - +@@ -398,12 +409,12 @@ class="fas fa-share">-+ -+ @@ -449,8 +460,8 @@@@ -523,10 +539,12 @@
@@ -471,10 +482,12 @@ people→- - people← + people←
- - account_box + account_box
- list @@ -486,20 +499,23 @@ block
- - voice_over_off + voice_over_off
- - languageblock + languageblock
- create
- - how_to_reg + how_to_reg
- - recent_actors + recent_actors
@@useOtherAcct1@@@@revoverJP@@@@follow@@(@@warnUseOtherAcct@@)
- @@revoverJPde@@ + + @@revoverJPde@@ @@follow@@
@@or@@
- @@openProf@@
+ @@openProf@@
@@warnListRegist@@@@ -536,17 +554,20 @@-@@more@@ +@@more@@ -@@more@@ +@@more@@ -@@more@@ +@@more@@ @@ -741,7 +766,8 @@@@ -567,7 +588,8 @@-@@change@@ +@@change@@
@@editProfImg@@: @@ -580,7 +602,8 @@-@@more@@ +@@more@@ @@ -686,7 +709,8 @@ @@AWLSupport@@@@ -720,7 +744,8 @@ class="material-icons">view_headline@@list@@
- @@SendAmazonGift1@@web-pro@cutls.com@@SendAmazonGift2@@
+ @@SendAmazonGift1@@web-pro@cutls.com@@SendAmazonGift2@@
Kyash
filter_list@@filter@@-help_outline@@help@@+help_outline@@help@@refresh@@f5@@people_outline@@local@@-people_outlineperm_media +people_outlineperm_media@@localMedia@@@@ -751,7 +777,8 @@language@@fed@@-languageperm_media+languageperm_media@@fedMedia@@@@ -761,7 +788,8 @@merge_type@@integratedTLDes@@-merge_typereply+merge_typereply@@localPlusDes@@@@ -791,8 +819,8 @@-+ search@@search@@
@@ -819,7 +847,8 @@-@@ -836,7 +865,8 @@+ @@listLocale@@ -@@ -915,7 +945,8 @@ settings - remove_from_queue + remove_from_queue apps diff --git a/app/view/make/make.js b/app/view/make/make.js index 6134f6a8..cfdd7039 100644 --- a/app/view/make/make.js +++ b/app/view/make/make.js @@ -1,37 +1,37 @@ const fs = require("fs") -const ver="Usamin (18.4.0)" -const langs=["ja","en","ps"] -const langsh=["日本語","English","Crowdin translate system(beta)"] -const simples=["acct","index","setting","update","setting"] -const samples=["acct.sample.html","index.sample.html","setting.sample.html","update.sample.html","setting.sample.js"] -const pages=["acct.html","index.html","setting.html","update.html","setting.vue.js"] -let langstr="" -for(let n=0; n+ @@listLocale@@ '+langsh[n]+' ' +const ver = "Usamin (18.4.0)" +const langs = ["ja", "en", "ps"] +const langsh = ["日本語", "English", "Crowdin translate system(beta)"] +const simples = ["acct", "index", "setting", "update", "setting"] +const samples = ["acct.sample.html", "index.sample.html", "setting.sample.html", "update.sample.html", "setting.sample.js"] +const pages = ["acct.html", "index.html", "setting.html", "update.html", "setting.vue.js"] +let langstr = "" +for (let n = 0; n < langs.length; n++) { + let lang = langs[n] + langstr = langstr + '' + langsh[n] + '' } -for(let i=0; i") } source = source.replace(/@@versionLetter@@/g, ver) source = source.replace(/@@lang@@/g, lang) source = source.replace(/@@langlist@@/g, langstr) - fs.writeFileSync("../"+lang+"/"+pages[i], source) + fs.writeFileSync("../" + lang + "/" + pages[i], source) } } \ No newline at end of file diff --git a/app/view/make/setting.sample.html b/app/view/make/setting.sample.html index bfcf3865..7fe75198 100644 --- a/app/view/make/setting.sample.html +++ b/app/view/make/setting.sample.html @@ -22,6 +22,7 @@ input { max-height: 50px !important } + .pcr-result { height: 1rem !important; } @@ -157,11 +158,11 @@ -Accent
@@accent@@ -- -- +Accent
@@accent@@ ++ ++@@change@@ @@customSound@@
-Custom 1
-Custom 2
-Custom 3
-Custom 4
+Custom 1
+Custom 2
+Custom 3
+Custom 4
- diff --git a/app/view/make/setting.sample.js b/app/view/make/setting.sample.js index 899d07ac..099ee0df 100644 --- a/app/view/make/setting.sample.js +++ b/app/view/make/setting.sample.js @@ -1,552 +1,552 @@ -var yesno=[ +var yesno = [ { - text:"@@yes@@", - value:"yes" - },{ - text:"@@no@@", - value:"no" + text: "@@yes@@", + value: "yes" + }, { + text: "@@no@@", + value: "no" } ]; -var sound=[ +var sound = [ { - text:"@@none@@", - value:"none" - },{ - text:"@@default@@", - value:"default" - },{ - text:"Custom 1", - value:"c1" - },{ - text:"Custom 2", - value:"c2" - },{ - text:"Custom 3", - value:"c3" - },{ - text:"Custom 4", - value:"c4" + text: "@@none@@", + value: "none" + }, { + text: "@@default@@", + value: "default" + }, { + text: "Custom 1", + value: "c1" + }, { + text: "Custom 2", + value: "c2" + }, { + text: "Custom 3", + value: "c3" + }, { + text: "Custom 4", + value: "c4" } ]; -var envConstruction=[ +var envConstruction = [ { - id:"popup", - storage:"popup", - checkbox:false, - doubleText:false, - setValue:0, - width:50, - text:{ - head:"@@popup@@", - desc:'@@popupwarn@@', - after:"@@s@@" + id: "popup", + storage: "popup", + checkbox: false, + doubleText: false, + setValue: 0, + width: 50, + text: { + head: "@@popup@@", + desc: '@@popupwarn@@', + after: "@@s@@" } - },{ - id:"notf", - storage:"nativenotf", - checkbox:true, - setValue:"yes", - text:{ - head:"@@nativenotf@@", - desc:"@@nnwarn@@", - checkbox:yesno + }, { + id: "notf", + storage: "nativenotf", + checkbox: true, + setValue: "yes", + text: { + head: "@@nativenotf@@", + desc: "@@nnwarn@@", + checkbox: yesno } - },{ - id:"width", - storage:"width", - checkbox:false, - doubleText:false, - width:50, - setValue:300, - text:{ - head:"@@minwidth@@", - desc:"@@minwidthwarn@@", - after:"px @@above@@" + }, { + id: "width", + storage: "width", + checkbox: false, + doubleText: false, + width: 50, + setValue: 300, + text: { + head: "@@minwidth@@", + desc: "@@minwidthwarn@@", + after: "px @@above@@" } - },{ - id:"fixwidth", - storage:"fixwidth", - checkbox:false, - doubleText:false, - setValue:300, - width:50, - text:{ - head:"@@fixwidth@@", - desc:"@@fixwidthwarn@@", - after:"px @@above@@" + }, { + id: "fixwidth", + storage: "fixwidth", + checkbox: false, + doubleText: false, + setValue: 300, + width: 50, + text: { + head: "@@fixwidth@@", + desc: "@@fixwidthwarn@@", + after: "px @@above@@" } - },{ - id:"size", - storage:"size", - checkbox:false, - doubleText:false, - width:50, - setValue:13, - text:{ - head:"@@fontsize@@", - desc:'13px(@@absolute@@)', - after:"px" + }, { + id: "size", + storage: "size", + checkbox: false, + doubleText: false, + width: 50, + setValue: 13, + text: { + head: "@@fontsize@@", + desc: '13px(@@absolute@@)', + after: "px" } - },{ - id:"ha", - storage:"ha", - checkbox:true, - setValue:false, - text:{ - head:"@@hardwareAcceleration@@", - desc:"@@hardwareAccelerationWarn@@", - checkbox:[ + }, { + id: "ha", + storage: "ha", + checkbox: true, + setValue: false, + text: { + head: "@@hardwareAcceleration@@", + desc: "@@hardwareAccelerationWarn@@", + checkbox: [ { - text:"@@yes@@", - value:"true" - },{ - text:"@@no@@", - value:"false" + text: "@@yes@@", + value: "true" + }, { + text: "@@no@@", + value: "false" } ] } } ]; -var tlConstruction=[ +var tlConstruction = [ { - id:"time", - storage:"datetype", - checkbox:true, - setValue:"absolute", - text:{ - head:"@@timemode@@", - desc:'@@relativetime@@
@@absolutetime@@
@@mixtime@@', - checkbox:[ + id: "time", + storage: "datetype", + checkbox: true, + setValue: "absolute", + text: { + head: "@@timemode@@", + desc: '@@relativetime@@
@@absolutetime@@
@@mixtime@@', + checkbox: [ { - text:"@@relativesel@@", - value:"relative" - },{ - text:"@@absolutesel@@", - value:"absolute" - },{ - text:"@@doublesel@@", - value:"double" - },{ - text:"@@mixsel@@", - value:"medium" + text: "@@relativesel@@", + value: "relative" + }, { + text: "@@absolutesel@@", + value: "absolute" + }, { + text: "@@doublesel@@", + value: "double" + }, { + text: "@@mixsel@@", + value: "medium" } ] } - },{ - id:"ul", - storage:"locale", - checkbox:true, - setValue:"yes", - text:{ - head:"@@locale@@", - desc:"@@localewarn@@", - checkbox:yesno + }, { + id: "ul", + storage: "locale", + checkbox: true, + setValue: "yes", + text: { + head: "@@locale@@", + desc: "@@localewarn@@", + checkbox: yesno } - },{ - id:"nsfw", - storage:"nsfw", - checkbox:true, - setValue:"yes", - text:{ - head:"@@nswf@@", - desc:"@@nsfwwarn@@", - checkbox:yesno + }, { + id: "nsfw", + storage: "nsfw", + checkbox: true, + setValue: "yes", + text: { + head: "@@nswf@@", + desc: "@@nsfwwarn@@", + checkbox: yesno } - },{ - id:"cw", - storage:"cw", - checkbox:true, - setValue:"yes", - text:{ - head:"@@cw@@", - desc:"", - checkbox:yesno + }, { + id: "cw", + storage: "cw", + checkbox: true, + setValue: "yes", + text: { + head: "@@cw@@", + desc: "", + checkbox: yesno } - },{ - id:"rp", - storage:"replyct", - checkbox:true, - setValue:"hidden", - text:{ - head:"@@replyct@@", - desc:"", - checkbox:[ + }, { + id: "rp", + storage: "replyct", + checkbox: true, + setValue: "hidden", + text: { + head: "@@replyct@@", + desc: "", + checkbox: [ { - text:"@@replyct_hidden@@", - value:"hidden" - },{ - text:"@@replyct_hidden@@", - value:"all" + text: "@@replyct_hidden@@", + value: "hidden" + }, { + text: "@@replyct_hidden@@", + value: "all" } ] } - },{ - id:"gif", - storage:"gif", - checkbox:true, - setValue:"yes", - text:{ - head:"@@gif@@", - desc:"", - checkbox:yesno + }, { + id: "gif", + storage: "gif", + checkbox: true, + setValue: "yes", + text: { + head: "@@gif@@", + desc: "", + checkbox: yesno } - },{ - id:"tag", - storage:"tag-range", - checkbox:true, - setValue:"local", - text:{ - head:"@@tag@@", - desc:"", - checkbox:[ + }, { + id: "tag", + storage: "tag-range", + checkbox: true, + setValue: "local", + text: { + head: "@@tag@@", + desc: "", + checkbox: [ { - text:"@@tagfed@@", - value:"all" - },{ - text:"@@taglocal@@", - value:"local" + text: "@@tagfed@@", + value: "all" + }, { + text: "@@taglocal@@", + value: "local" } ] } - },{ - id:"via", - storage:"viashow", - checkbox:true, - setValue:"no", - text:{ - head:"@@via@@", - desc:"", - checkbox:yesno + }, { + id: "via", + storage: "viashow", + checkbox: true, + setValue: "no", + text: { + head: "@@via@@", + desc: "", + checkbox: yesno } - },{ - id:"mov", - storage:"mouseover", - checkbox:true, - setValue:"no", - text:{ - head:"@@mouseover@@", - desc:"@@mouseoverwarn@@", - checkbox:[ + }, { + id: "mov", + storage: "mouseover", + checkbox: true, + setValue: "no", + text: { + head: "@@mouseover@@", + desc: "@@mouseoverwarn@@", + checkbox: [ { - text:"@@mv@@", - value:"yes" - },{ - text:"@@mvclick@@", - value:"click" - },{ - text:"@@no@@", - value:"no" + text: "@@mv@@", + value: "yes" + }, { + text: "@@mvclick@@", + value: "click" + }, { + text: "@@no@@", + value: "no" } ] } - },{ - id:"notfm", - storage:"setasread", - checkbox:true, - setValue:"yes", - text:{ - head:"@@notfmarker@@", - desc:"", - checkbox:yesno + }, { + id: "notfm", + storage: "setasread", + checkbox: true, + setValue: "yes", + text: { + head: "@@notfmarker@@", + desc: "", + checkbox: yesno } - },{ - checkbox:false, - doubleText:true, - data:[ + }, { + checkbox: false, + doubleText: true, + data: [ { - id:"sentence", - storage:"sentence", - width:50, - setValue:500, - text:{after:"@@lines@@ @@above@@ @@or@@"} - },{ - id:"letters", - storage:"letters", - width:50, - setValue:7000, - text:{after:"@@letters@@ @@above@@"} + id: "sentence", + storage: "sentence", + width: 50, + setValue: 500, + text: { after: "@@lines@@ @@above@@ @@or@@" } + }, { + id: "letters", + storage: "letters", + width: 50, + setValue: 7000, + text: { after: "@@letters@@ @@above@@" } } ], - text:{ - head:"@@autofold@@", - desc:"@@autofoldwarn@@", + text: { + head: "@@autofold@@", + desc: "@@autofoldwarn@@", } - },{ - id:"img-height", - storage:"img-height", - checkbox:false, - doubleText:false, - width:80, - setValue:200, - text:{ - head:"@@imgheight@@", - desc:'@@imgheightwarn@@', - after:"px" + }, { + id: "img-height", + storage: "img-height", + checkbox: false, + doubleText: false, + width: 80, + setValue: 200, + text: { + head: "@@imgheight@@", + desc: '@@imgheightwarn@@', + after: "px" } - },{ - id:"ticker", - storage:"ticker_ok", - checkbox:true, - setValue:"no", - text:{ - head:"@@ticker@@", - desc:'@@tickerwarn@@', - checkbox:yesno + }, { + id: "ticker", + storage: "ticker_ok", + checkbox: true, + setValue: "no", + text: { + head: "@@ticker@@", + desc: '@@tickerwarn@@', + checkbox: yesno } - },{ - id:"anime", - storage:"animation", - checkbox:true, - setValue:"yes", - text:{ - head:"@@animation@@", - desc:"", - checkbox:yesno + }, { + id: "anime", + storage: "animation", + checkbox: true, + setValue: "yes", + text: { + head: "@@animation@@", + desc: "", + checkbox: yesno } - },{ - id:"replySound", - storage:"replySound", - checkbox:true, - setValue:"none", - text:{ - head:"@@replySound@@", - desc:"", - checkbox:sound + }, { + id: "replySound", + storage: "replySound", + checkbox: true, + setValue: "none", + text: { + head: "@@replySound@@", + desc: "", + checkbox: sound } - },{ - id:"favSound", - storage:"favSound", - checkbox:true, - setValue:"none", - text:{ - head:"@@favSound@@", - desc:"", - checkbox:sound + }, { + id: "favSound", + storage: "favSound", + checkbox: true, + setValue: "none", + text: { + head: "@@favSound@@", + desc: "", + checkbox: sound } - },{ - id:"btSound", - storage:"btSound", - checkbox:true, - setValue:"none", - text:{ - head:"@@btSound@@", - desc:"", - checkbox:sound + }, { + id: "btSound", + storage: "btSound", + checkbox: true, + setValue: "none", + text: { + head: "@@btSound@@", + desc: "", + checkbox: sound } - },{ - id:"followSound", - storage:"followSound", - checkbox:true, - setValue:"none", - text:{ - head:"@@followSound@@", - desc:"", - checkbox:sound + }, { + id: "followSound", + storage: "followSound", + checkbox: true, + setValue: "none", + text: { + head: "@@followSound@@", + desc: "", + checkbox: sound } } ]; -var postConstruction=[ +var postConstruction = [ { - id:"cw-text", - storage:"cw-text", - checkbox:false, - doubleText:false, - width:150, - setValue:"", - text:{ - head:"@@defaultcw@@", - desc:"", - after:"" + id: "cw-text", + storage: "cw-text", + checkbox: false, + doubleText: false, + width: 150, + setValue: "", + text: { + head: "@@defaultcw@@", + desc: "", + after: "" } - },{ - checkbox:false, - doubleText:true, - data:[ + }, { + checkbox: false, + doubleText: true, + data: [ { - id:"cw_sentence", - storage:"cw_sentence", - width:50, - setValue:500, - text:{after:"@@lines@@ @@above@@ @@or@@"} - },{ - id:"cw_letters", - storage:"cw_letters", - width:50, - setValue:7000, - text:{after:"@@letters@@ @@above@@"} + id: "cw_sentence", + storage: "cw_sentence", + width: 50, + setValue: 500, + text: { after: "@@lines@@ @@above@@ @@or@@" } + }, { + id: "cw_letters", + storage: "cw_letters", + width: 50, + setValue: 7000, + text: { after: "@@letters@@ @@above@@" } } ], - text:{ - head:"@@autocw@@", - desc:"@@autocwwarn@@", + text: { + head: "@@autocw@@", + desc: "@@autocwwarn@@", } - },{ - id:"cws", - storage:"always-cw", - checkbox:true, - setValue:"no", - text:{ - head:"@@cws@@", - desc:"", - checkbox:yesno + }, { + id: "cws", + storage: "always-cw", + checkbox: true, + setValue: "no", + text: { + head: "@@cws@@", + desc: "", + checkbox: yesno } - },{ - id:"vis", - storage:"vis", - checkbox:true, - setValue:"public", - text:{ - head:"@@defaultvis@@", - desc:"", - checkbox:[ + }, { + id: "vis", + storage: "vis", + checkbox: true, + setValue: "public", + text: { + head: "@@defaultvis@@", + desc: "", + checkbox: [ { - text:"@@public@@", - value:"public" - },{ - text:"@@unlisted@@", - value:"unlisted" - },{ - text:"@@private@@", - value:"private" - },{ - text:"@@direct@@", - value:"direct" - },{ - text:"@@memory@@", - value:"memory" - },{ - text:"@@useapi@@", - value:"useapi" + text: "@@public@@", + value: "public" + }, { + text: "@@unlisted@@", + value: "unlisted" + }, { + text: "@@private@@", + value: "private" + }, { + text: "@@direct@@", + value: "direct" + }, { + text: "@@memory@@", + value: "memory" + }, { + text: "@@useapi@@", + value: "useapi" } ] } - },{ - id:"img", - storage:"img", - checkbox:true, - setValue:"no-act", - text:{ - head:"@@postimg@@", - desc:"", - checkbox:[ + }, { + id: "img", + storage: "img", + checkbox: true, + setValue: "no-act", + text: { + head: "@@postimg@@", + desc: "", + checkbox: [ { - text:"@@showurl@@", - value:"url" - },{ - text:"@@nourl@@", - value:"no-act" + text: "@@showurl@@", + value: "url" + }, { + text: "@@nourl@@", + value: "no-act" } ] } - },{ - id:"box", - storage:"box", - checkbox:true, - setValue:"yes", - text:{ - head:"@@box@@", - desc:"", - checkbox:[ + }, { + id: "box", + storage: "box", + checkbox: true, + setValue: "yes", + text: { + head: "@@box@@", + desc: "", + checkbox: [ { - text:"@@boxyes@@", - value:"yes" - },{ - text:"@@boxno@@", - value:"no" - },{ - text:"@@boxabs@@", - value:"absolute" + text: "@@boxyes@@", + value: "yes" + }, { + text: "@@boxno@@", + value: "no" + }, { + text: "@@boxabs@@", + value: "absolute" } ] } - },{ - id:"quote", - storage:"quote", - checkbox:true, - setValue:"nothing", - text:{ - head:"@@quote@@", - desc:"", - checkbox:[ + }, { + id: "quote", + storage: "quote", + checkbox: true, + setValue: "nothing", + text: { + head: "@@quote@@", + desc: "", + checkbox: [ { - text:"@@simple@@", - value:"simple" - },{ - text:"@@mention@@", - value:"mention" - },{ - text:"@@full@@", - value:"full" - },{ - text:"@@notqt@@", - value:"nothing" + text: "@@simple@@", + value: "simple" + }, { + text: "@@mention@@", + value: "mention" + }, { + text: "@@full@@", + value: "full" + }, { + text: "@@notqt@@", + value: "nothing" } ] } - },{ - id:"main", - storage:"mainuse", - checkbox:true, - setValue:"remain", - text:{ - head:"@@main@@", - desc:"@@mainwarn@@", - checkbox:[ + }, { + id: "main", + storage: "mainuse", + checkbox: true, + setValue: "remain", + text: { + head: "@@main@@", + desc: "@@mainwarn@@", + checkbox: [ { - text:"@@lastacct@@", - value:"remain" - },{ - text:"@@usemainacct@@", - value:"main" + text: "@@lastacct@@", + value: "remain" + }, { + text: "@@usemainacct@@", + value: "main" } ] } - },{ - id:"sec", - storage:"sec", - checkbox:true, - setValue:"public", - text:{ - head:"@@secondary@@", - desc:"", - checkbox:[ + }, { + id: "sec", + storage: "sec", + checkbox: true, + setValue: "public", + text: { + head: "@@secondary@@", + desc: "", + checkbox: [ { - text:"@@nothing@@", - value:"nothing" - },{ - text:"@@public@@", - value:"public" - },{ - text:"@@unlisted@@", - value:"unlisted" - },{ - text:"@@private@@", - value:"private" - },{ - text:"@@direct@@", - value:"direct" - },{ - text:"@@localonly@@", - value:"local", - kirishima:true, - kirishimaText:"非対応インスタンスでは「未収載」になります。" + text: "@@nothing@@", + value: "nothing" + }, { + text: "@@public@@", + value: "public" + }, { + text: "@@unlisted@@", + value: "unlisted" + }, { + text: "@@private@@", + value: "private" + }, { + text: "@@direct@@", + value: "direct" + }, { + text: "@@localonly@@", + value: "local", + kirishima: true, + kirishimaText: "非対応インスタンスでは「未収載」になります。" } ] } - },{ - id:"zero", - storage:"emoji-zero-width", - checkbox:true, - setValue:"normal", - setValue:"no", - text:{ - head:"@@zeroWidthEmoji@@", - desc:"", - checkbox:yesno + }, { + id: "zero", + storage: "emoji-zero-width", + checkbox: true, + setValue: "normal", + setValue: "no", + text: { + head: "@@zeroWidthEmoji@@", + desc: "", + checkbox: yesno } } ] \ No newline at end of file diff --git a/app/view/make/update.sample.html b/app/view/make/update.sample.html index 32eed10f..1a058bae 100644 --- a/app/view/make/update.sample.html +++ b/app/view/make/update.sample.html @@ -1,235 +1,256 @@ + -Update - TheDesk - - - - -@@comment-start@@ - - -@@comment-end@@ +Update - TheDesk + + + + + @@comment-start@@ + + + @@comment-end@@ + - - - - -info -clear - --- - - + + + info + clear + +-- -TheDesk
-@@updatehere@@
- →
-
- - - - -
- @@problem1@@
@@problem2@@ ---@@dlnow@@
- -++ + + \ No newline at end of file + var start = "https://thedesk.top/ver.json"; + fetch(start, { + method: 'GET', + headers: { 'content-type': 'application/json' }, + }).then(function (response) { + return response.json(); + }).catch(function (error) { + todo(error); + console.error(error); + }).then(function (json) { + console.log(json); + if (platform == "win32") { + $("#ver").text(json.desk); + localStorage.setItem("next-ver", json.desk); + } else if (platform == "linux") { + $("#ver").text(json.desk_linux); + localStorage.setItem("next-ver", json.desk_linux); + } else if (platform == "darwin") { + $("#ver").text(json.desk_mac); + localStorage.setItem("next-ver", json.desk_mac); + } + var lang = "@@lang@@"; + if (lang == "ja") { + $("#det").html(json.detail); + } else { + $("#det").html(json.detail_en); + } + + $("#now").text(localStorage.getItem("ver")); + + }); + } + function nextv() { + localStorage.setItem("new-ver-skip", "true"); + window.close(); + } + function enc(ver) { + var ver = ver.replace(/\s/g, ""); + var ver = ver.replace(/\(/g, "-"); + var ver = ver.replace(/\)/g, ""); + var ver = ver.replace(/\[/g, "_"); + var ver = ver.replace(/\]/g, ""); + return ver; + } + \ No newline at end of file diff --git a/app/view/ps/acct.html b/app/view/ps/acct.html index 71e5dde6..e407e0e9 100644 --- a/app/view/ps/acct.html +++ b/app/view/ps/acct.html @@ -1,83 +1,122 @@ + -++ +TheDesk
+@@updatehere@@
+ →
+
+ + + + +
+ @@problem1@@
@@problem2@@ +++@@dlnow@@
+ +Account Manager - TheDesk - - - - - - - - - - +Account Manager - TheDesk + + + + + + + + + + + + + + + - - - - - - - - - --crwdns367:0crwdne367:0
---- -- - - crwdns368:0crwdne368:0
- -
- -
-Login
+ + + + + + + + + -- Supports - --@@ -154,14 +161,15 @@visibility_off - public + public CW photo_library tag_faces - more_vert + more_vert clear@@ -176,13 +184,15 @@
crwdns1886:0crwdne1886:0
crwdns1888:0crwdne1888:0
- +-
- crwdns403:0crwdne403:0
+- crwdns403:0crwdne403:0 +
- crwdns404:0crwdne404:0(Public)
@@ -228,8 +238,9 @@crwdns388:0crwdne388:0 - +@@ -398,12 +409,12 @@ class="fas fa-share">-+ -+ @@ -449,8 +460,8 @@@@ -523,10 +539,12 @@
@@ -471,10 +482,12 @@ people→- - people← + people←
- - account_box + account_box
- list @@ -486,20 +499,23 @@ block
- - voice_over_off + voice_over_off
- - languageblock + languageblock
- create
- - how_to_reg + how_to_reg
- - recent_actors + recent_actors
crwdns430:0crwdne430:0crwdns458:0crwdne458:0crwdns440:0crwdne440:0(crwdns459:0crwdne459:0)
- crwdns460:0crwdne460:0 + + crwdns460:0crwdne460:0 crwdns440:0crwdne440:0
crwdns461:0crwdne461:0
- crwdns462:0crwdne462:0
+ crwdns462:0crwdne462:0
crwdns463:0crwdne463:0@@ -536,17 +554,20 @@-crwdns457:0crwdne457:0 +crwdns457:0crwdne457:0 -crwdns457:0crwdne457:0 +crwdns457:0crwdne457:0 -crwdns457:0crwdne457:0 +crwdns457:0crwdne457:0 @@ -741,7 +766,8 @@@@ -567,7 +588,8 @@-crwdns1892:0crwdne1892:0 +crwdns1892:0crwdne1892:0
crwdns467:0crwdne467:0: @@ -580,7 +602,8 @@-crwdns457:0crwdne457:0 +crwdns457:0crwdne457:0 @@ -686,7 +709,8 @@ crwdns476:0crwdne476:0@@ -720,7 +744,8 @@ class="material-icons">view_headlinecrwdns444:0crwdne444:0
- crwdns477:0crwdne477:0web-pro@cutls.comcrwdns478:0crwdne478:0
+ crwdns477:0crwdne477:0web-pro@cutls.comcrwdns478:0crwdne478:0
Kyash
filter_listcrwdns515:0crwdne515:0-help_outlinecrwdns1894:0crwdne1894:0+help_outlinecrwdns1894:0crwdne1894:0refreshcrwdns518:0crwdne518:0people_outlinecrwdns480:0crwdne480:0-people_outlineperm_media +people_outlineperm_mediacrwdns481:0crwdne481:0@@ -751,7 +777,8 @@languagecrwdns483:0crwdne483:0-languageperm_media+languageperm_mediacrwdns484:0crwdne484:0@@ -761,7 +788,8 @@merge_typecrwdns486:0crwdne486:0-merge_typereply+merge_typereplycrwdns487:0crwdne487:0@@ -791,8 +819,8 @@-+ searchcrwdns492:0crwdne492:0
@@ -819,7 +847,8 @@-@@ -836,7 +865,8 @@+ crwdns495:0crwdne495:0 -@@ -915,7 +945,8 @@ settings - remove_from_queue + remove_from_queue apps diff --git a/app/view/ps/setting.html b/app/view/ps/setting.html index a56bb675..dd53632e 100644 --- a/app/view/ps/setting.html +++ b/app/view/ps/setting.html @@ -22,6 +22,7 @@ input { max-height: 50px !important } + .pcr-result { height: 1rem !important; } @@ -157,11 +158,11 @@+ crwdns495:0crwdne495:0 -Accent
crwdns2434:0crwdne2434:0 -- -- +Accent
crwdns2434:0crwdne2434:0 ++ ++crwdns528:0crwdne528:0 @@customSound@@
-Custom 1
-Custom 2
-Custom 3
-Custom 4
+Custom 1
+Custom 2
+Custom 3
+Custom 4
- diff --git a/app/view/ps/setting.vue.js b/app/view/ps/setting.vue.js index 0ec8aea0..56f6d6e4 100644 --- a/app/view/ps/setting.vue.js +++ b/app/view/ps/setting.vue.js @@ -1,552 +1,552 @@ -var yesno=[ +var yesno = [ { - text:"crwdns526:0crwdne526:0", - value:"yes" - },{ - text:"crwdns527:0crwdne527:0", - value:"no" + text: "crwdns526:0crwdne526:0", + value: "yes" + }, { + text: "crwdns527:0crwdne527:0", + value: "no" } ]; -var sound=[ +var sound = [ { - text:"@@none@@", - value:"none" - },{ - text:"@@default@@", - value:"default" - },{ - text:"Custom 1", - value:"c1" - },{ - text:"Custom 2", - value:"c2" - },{ - text:"Custom 3", - value:"c3" - },{ - text:"Custom 4", - value:"c4" + text: "@@none@@", + value: "none" + }, { + text: "@@default@@", + value: "default" + }, { + text: "Custom 1", + value: "c1" + }, { + text: "Custom 2", + value: "c2" + }, { + text: "Custom 3", + value: "c3" + }, { + text: "Custom 4", + value: "c4" } ]; -var envConstruction=[ +var envConstruction = [ { - id:"popup", - storage:"popup", - checkbox:false, - doubleText:false, - setValue:0, - width:50, - text:{ - head:"crwdns1898:0crwdne1898:0", - desc:'crwdns536:0crwdne536:0', - after:"crwdns537:0crwdne537:0" + id: "popup", + storage: "popup", + checkbox: false, + doubleText: false, + setValue: 0, + width: 50, + text: { + head: "crwdns1898:0crwdne1898:0", + desc: 'crwdns536:0crwdne536:0', + after: "crwdns537:0crwdne537:0" } - },{ - id:"notf", - storage:"nativenotf", - checkbox:true, - setValue:"yes", - text:{ - head:"crwdns538:0crwdne538:0", - desc:"crwdns539:0crwdne539:0", - checkbox:yesno + }, { + id: "notf", + storage: "nativenotf", + checkbox: true, + setValue: "yes", + text: { + head: "crwdns538:0crwdne538:0", + desc: "crwdns539:0crwdne539:0", + checkbox: yesno } - },{ - id:"width", - storage:"width", - checkbox:false, - doubleText:false, - width:50, - setValue:300, - text:{ - head:"crwdns2376:0crwdne2376:0", - desc:"crwdns542:0crwdne542:0", - after:"px crwdns543:0crwdne543:0" + }, { + id: "width", + storage: "width", + checkbox: false, + doubleText: false, + width: 50, + setValue: 300, + text: { + head: "crwdns2376:0crwdne2376:0", + desc: "crwdns542:0crwdne542:0", + after: "px crwdns543:0crwdne543:0" } - },{ - id:"fixwidth", - storage:"fixwidth", - checkbox:false, - doubleText:false, - setValue:300, - width:50, - text:{ - head:"crwdns2378:0crwdne2378:0", - desc:"crwdns2380:0crwdne2380:0", - after:"px crwdns543:0crwdne543:0" + }, { + id: "fixwidth", + storage: "fixwidth", + checkbox: false, + doubleText: false, + setValue: 300, + width: 50, + text: { + head: "crwdns2378:0crwdne2378:0", + desc: "crwdns2380:0crwdne2380:0", + after: "px crwdns543:0crwdne543:0" } - },{ - id:"size", - storage:"size", - checkbox:false, - doubleText:false, - width:50, - setValue:13, - text:{ - head:"crwdns546:0crwdne546:0", - desc:'13px(crwdns549:0crwdne549:0)', - after:"px" + }, { + id: "size", + storage: "size", + checkbox: false, + doubleText: false, + width: 50, + setValue: 13, + text: { + head: "crwdns546:0crwdne546:0", + desc: '13px(crwdns549:0crwdne549:0)', + after: "px" } - },{ - id:"ha", - storage:"ha", - checkbox:true, - setValue:false, - text:{ - head:"@@hardwareAcceleration@@", - desc:"@@hardwareAccelerationWarn@@", - checkbox:[ + }, { + id: "ha", + storage: "ha", + checkbox: true, + setValue: false, + text: { + head: "@@hardwareAcceleration@@", + desc: "@@hardwareAccelerationWarn@@", + checkbox: [ { - text:"crwdns526:0crwdne526:0", - value:"true" - },{ - text:"crwdns527:0crwdne527:0", - value:"false" + text: "crwdns526:0crwdne526:0", + value: "true" + }, { + text: "crwdns527:0crwdne527:0", + value: "false" } ] } } ]; -var tlConstruction=[ +var tlConstruction = [ { - id:"time", - storage:"datetype", - checkbox:true, - setValue:"absolute", - text:{ - head:"crwdns551:0crwdne551:0", - desc:'crwdns552:0crwdne552:0
crwdns553:0crwdne553:0
crwdns554:0crwdne554:0', - checkbox:[ + id: "time", + storage: "datetype", + checkbox: true, + setValue: "absolute", + text: { + head: "crwdns551:0crwdne551:0", + desc: 'crwdns552:0crwdne552:0
crwdns553:0crwdne553:0
crwdns554:0crwdne554:0', + checkbox: [ { - text:"crwdns555:0crwdne555:0", - value:"relative" - },{ - text:"crwdns1902:0crwdne1902:0", - value:"absolute" - },{ - text:"crwdns557:0crwdne557:0", - value:"double" - },{ - text:"crwdns558:0crwdne558:0", - value:"medium" + text: "crwdns555:0crwdne555:0", + value: "relative" + }, { + text: "crwdns1902:0crwdne1902:0", + value: "absolute" + }, { + text: "crwdns557:0crwdne557:0", + value: "double" + }, { + text: "crwdns558:0crwdne558:0", + value: "medium" } ] } - },{ - id:"ul", - storage:"locale", - checkbox:true, - setValue:"yes", - text:{ - head:"crwdns1904:0crwdne1904:0", - desc:"crwdns1906:0crwdne1906:0", - checkbox:yesno + }, { + id: "ul", + storage: "locale", + checkbox: true, + setValue: "yes", + text: { + head: "crwdns1904:0crwdne1904:0", + desc: "crwdns1906:0crwdne1906:0", + checkbox: yesno } - },{ - id:"nsfw", - storage:"nsfw", - checkbox:true, - setValue:"yes", - text:{ - head:"crwdns561:0crwdne561:0", - desc:"crwdns562:0crwdne562:0", - checkbox:yesno + }, { + id: "nsfw", + storage: "nsfw", + checkbox: true, + setValue: "yes", + text: { + head: "crwdns561:0crwdne561:0", + desc: "crwdns562:0crwdne562:0", + checkbox: yesno } - },{ - id:"cw", - storage:"cw", - checkbox:true, - setValue:"yes", - text:{ - head:"crwdns563:0crwdne563:0", - desc:"", - checkbox:yesno + }, { + id: "cw", + storage: "cw", + checkbox: true, + setValue: "yes", + text: { + head: "crwdns563:0crwdne563:0", + desc: "", + checkbox: yesno } - },{ - id:"rp", - storage:"replyct", - checkbox:true, - setValue:"hidden", - text:{ - head:"crwdns564:0crwdne564:0", - desc:"", - checkbox:[ + }, { + id: "rp", + storage: "replyct", + checkbox: true, + setValue: "hidden", + text: { + head: "crwdns564:0crwdne564:0", + desc: "", + checkbox: [ { - text:"crwdns565:0crwdne565:0", - value:"hidden" - },{ - text:"crwdns565:0crwdne565:0", - value:"all" + text: "crwdns565:0crwdne565:0", + value: "hidden" + }, { + text: "crwdns565:0crwdne565:0", + value: "all" } ] } - },{ - id:"gif", - storage:"gif", - checkbox:true, - setValue:"yes", - text:{ - head:"crwdns567:0crwdne567:0", - desc:"", - checkbox:yesno + }, { + id: "gif", + storage: "gif", + checkbox: true, + setValue: "yes", + text: { + head: "crwdns567:0crwdne567:0", + desc: "", + checkbox: yesno } - },{ - id:"tag", - storage:"tag-range", - checkbox:true, - setValue:"local", - text:{ - head:"crwdns572:0crwdne572:0", - desc:"", - checkbox:[ + }, { + id: "tag", + storage: "tag-range", + checkbox: true, + setValue: "local", + text: { + head: "crwdns572:0crwdne572:0", + desc: "", + checkbox: [ { - text:"crwdns573:0crwdne573:0", - value:"all" - },{ - text:"crwdns574:0crwdne574:0", - value:"local" + text: "crwdns573:0crwdne573:0", + value: "all" + }, { + text: "crwdns574:0crwdne574:0", + value: "local" } ] } - },{ - id:"via", - storage:"viashow", - checkbox:true, - setValue:"no", - text:{ - head:"crwdns575:0crwdne575:0", - desc:"", - checkbox:yesno + }, { + id: "via", + storage: "viashow", + checkbox: true, + setValue: "no", + text: { + head: "crwdns575:0crwdne575:0", + desc: "", + checkbox: yesno } - },{ - id:"mov", - storage:"mouseover", - checkbox:true, - setValue:"no", - text:{ - head:"crwdns576:0crwdne576:0", - desc:"crwdns577:0crwdne577:0", - checkbox:[ + }, { + id: "mov", + storage: "mouseover", + checkbox: true, + setValue: "no", + text: { + head: "crwdns576:0crwdne576:0", + desc: "crwdns577:0crwdne577:0", + checkbox: [ { - text:"crwdns578:0crwdne578:0", - value:"yes" - },{ - text:"crwdns579:0crwdne579:0", - value:"click" - },{ - text:"crwdns527:0crwdne527:0", - value:"no" + text: "crwdns578:0crwdne578:0", + value: "yes" + }, { + text: "crwdns579:0crwdne579:0", + value: "click" + }, { + text: "crwdns527:0crwdne527:0", + value: "no" } ] } - },{ - id:"notfm", - storage:"setasread", - checkbox:true, - setValue:"yes", - text:{ - head:"crwdns580:0crwdne580:0", - desc:"", - checkbox:yesno + }, { + id: "notfm", + storage: "setasread", + checkbox: true, + setValue: "yes", + text: { + head: "crwdns580:0crwdne580:0", + desc: "", + checkbox: yesno } - },{ - checkbox:false, - doubleText:true, - data:[ + }, { + checkbox: false, + doubleText: true, + data: [ { - id:"sentence", - storage:"sentence", - width:50, - setValue:500, - text:{after:"crwdns583:0crwdne583:0 crwdns543:0crwdne543:0 crwdns585:0crwdne585:0"} - },{ - id:"letters", - storage:"letters", - width:50, - setValue:7000, - text:{after:"crwdns584:0crwdne584:0 crwdns543:0crwdne543:0"} + id: "sentence", + storage: "sentence", + width: 50, + setValue: 500, + text: { after: "crwdns583:0crwdne583:0 crwdns543:0crwdne543:0 crwdns585:0crwdne585:0" } + }, { + id: "letters", + storage: "letters", + width: 50, + setValue: 7000, + text: { after: "crwdns584:0crwdne584:0 crwdns543:0crwdne543:0" } } ], - text:{ - head:"crwdns581:0crwdne581:0", - desc:"crwdns582:0crwdne582:0", + text: { + head: "crwdns581:0crwdne581:0", + desc: "crwdns582:0crwdne582:0", } - },{ - id:"img-height", - storage:"img-height", - checkbox:false, - doubleText:false, - width:80, - setValue:200, - text:{ - head:"crwdns586:0crwdne586:0", - desc:'@@imgheightwarn@@', - after:"px" + }, { + id: "img-height", + storage: "img-height", + checkbox: false, + doubleText: false, + width: 80, + setValue: 200, + text: { + head: "crwdns586:0crwdne586:0", + desc: '@@imgheightwarn@@', + after: "px" } - },{ - id:"ticker", - storage:"ticker_ok", - checkbox:true, - setValue:"no", - text:{ - head:"crwdns1908:0crwdne1908:0", - desc:'crwdns1910:0crwdne1910:0', - checkbox:yesno + }, { + id: "ticker", + storage: "ticker_ok", + checkbox: true, + setValue: "no", + text: { + head: "crwdns1908:0crwdne1908:0", + desc: 'crwdns1910:0crwdne1910:0', + checkbox: yesno } - },{ - id:"anime", - storage:"animation", - checkbox:true, - setValue:"yes", - text:{ - head:"crwdns2446:0crwdne2446:0", - desc:"", - checkbox:yesno + }, { + id: "anime", + storage: "animation", + checkbox: true, + setValue: "yes", + text: { + head: "crwdns2446:0crwdne2446:0", + desc: "", + checkbox: yesno } - },{ - id:"replySound", - storage:"replySound", - checkbox:true, - setValue:"none", - text:{ - head:"@@replySound@@", - desc:"", - checkbox:sound + }, { + id: "replySound", + storage: "replySound", + checkbox: true, + setValue: "none", + text: { + head: "@@replySound@@", + desc: "", + checkbox: sound } - },{ - id:"favSound", - storage:"favSound", - checkbox:true, - setValue:"none", - text:{ - head:"@@favSound@@", - desc:"", - checkbox:sound + }, { + id: "favSound", + storage: "favSound", + checkbox: true, + setValue: "none", + text: { + head: "@@favSound@@", + desc: "", + checkbox: sound } - },{ - id:"btSound", - storage:"btSound", - checkbox:true, - setValue:"none", - text:{ - head:"@@btSound@@", - desc:"", - checkbox:sound + }, { + id: "btSound", + storage: "btSound", + checkbox: true, + setValue: "none", + text: { + head: "@@btSound@@", + desc: "", + checkbox: sound } - },{ - id:"followSound", - storage:"followSound", - checkbox:true, - setValue:"none", - text:{ - head:"@@followSound@@", - desc:"", - checkbox:sound + }, { + id: "followSound", + storage: "followSound", + checkbox: true, + setValue: "none", + text: { + head: "@@followSound@@", + desc: "", + checkbox: sound } } ]; -var postConstruction=[ +var postConstruction = [ { - id:"cw-text", - storage:"cw-text", - checkbox:false, - doubleText:false, - width:150, - setValue:"", - text:{ - head:"crwdns590:0crwdne590:0", - desc:"", - after:"" + id: "cw-text", + storage: "cw-text", + checkbox: false, + doubleText: false, + width: 150, + setValue: "", + text: { + head: "crwdns590:0crwdne590:0", + desc: "", + after: "" } - },{ - checkbox:false, - doubleText:true, - data:[ + }, { + checkbox: false, + doubleText: true, + data: [ { - id:"cw_sentence", - storage:"cw_sentence", - width:50, - setValue:500, - text:{after:"crwdns583:0crwdne583:0 crwdns543:0crwdne543:0 crwdns585:0crwdne585:0"} - },{ - id:"cw_letters", - storage:"cw_letters", - width:50, - setValue:7000, - text:{after:"crwdns584:0crwdne584:0 crwdns543:0crwdne543:0"} + id: "cw_sentence", + storage: "cw_sentence", + width: 50, + setValue: 500, + text: { after: "crwdns583:0crwdne583:0 crwdns543:0crwdne543:0 crwdns585:0crwdne585:0" } + }, { + id: "cw_letters", + storage: "cw_letters", + width: 50, + setValue: 7000, + text: { after: "crwdns584:0crwdne584:0 crwdns543:0crwdne543:0" } } ], - text:{ - head:"crwdns588:0crwdne588:0", - desc:"crwdns589:0crwdne589:0", + text: { + head: "crwdns588:0crwdne588:0", + desc: "crwdns589:0crwdne589:0", } - },{ - id:"cws", - storage:"always-cw", - checkbox:true, - setValue:"no", - text:{ - head:"crwdns591:0crwdne591:0", - desc:"", - checkbox:yesno + }, { + id: "cws", + storage: "always-cw", + checkbox: true, + setValue: "no", + text: { + head: "crwdns591:0crwdne591:0", + desc: "", + checkbox: yesno } - },{ - id:"vis", - storage:"vis", - checkbox:true, - setValue:"public", - text:{ - head:"crwdns592:0crwdne592:0", - desc:"", - checkbox:[ + }, { + id: "vis", + storage: "vis", + checkbox: true, + setValue: "public", + text: { + head: "crwdns592:0crwdne592:0", + desc: "", + checkbox: [ { - text:"crwdns593:0crwdne593:0", - value:"public" - },{ - text:"crwdns594:0crwdne594:0", - value:"unlisted" - },{ - text:"crwdns595:0crwdne595:0", - value:"private" - },{ - text:"crwdns596:0crwdne596:0", - value:"direct" - },{ - text:"crwdns1912:0crwdne1912:0", - value:"memory" - },{ - text:"crwdns1914:0crwdne1914:0", - value:"useapi" + text: "crwdns593:0crwdne593:0", + value: "public" + }, { + text: "crwdns594:0crwdne594:0", + value: "unlisted" + }, { + text: "crwdns595:0crwdne595:0", + value: "private" + }, { + text: "crwdns596:0crwdne596:0", + value: "direct" + }, { + text: "crwdns1912:0crwdne1912:0", + value: "memory" + }, { + text: "crwdns1914:0crwdne1914:0", + value: "useapi" } ] } - },{ - id:"img", - storage:"img", - checkbox:true, - setValue:"no-act", - text:{ - head:"crwdns599:0crwdne599:0", - desc:"", - checkbox:[ + }, { + id: "img", + storage: "img", + checkbox: true, + setValue: "no-act", + text: { + head: "crwdns599:0crwdne599:0", + desc: "", + checkbox: [ { - text:"crwdns600:0crwdne600:0", - value:"url" - },{ - text:"crwdns601:0crwdne601:0", - value:"no-act" + text: "crwdns600:0crwdne600:0", + value: "url" + }, { + text: "crwdns601:0crwdne601:0", + value: "no-act" } ] } - },{ - id:"box", - storage:"box", - checkbox:true, - setValue:"yes", - text:{ - head:"crwdns568:0crwdne568:0", - desc:"", - checkbox:[ + }, { + id: "box", + storage: "box", + checkbox: true, + setValue: "yes", + text: { + head: "crwdns568:0crwdne568:0", + desc: "", + checkbox: [ { - text:"crwdns569:0crwdne569:0", - value:"yes" - },{ - text:"crwdns571:0crwdne571:0", - value:"no" - },{ - text:"crwdns570:0crwdne570:0", - value:"absolute" + text: "crwdns569:0crwdne569:0", + value: "yes" + }, { + text: "crwdns571:0crwdne571:0", + value: "no" + }, { + text: "crwdns570:0crwdne570:0", + value: "absolute" } ] } - },{ - id:"quote", - storage:"quote", - checkbox:true, - setValue:"nothing", - text:{ - head:"crwdns603:0crwdne603:0", - desc:"", - checkbox:[ + }, { + id: "quote", + storage: "quote", + checkbox: true, + setValue: "nothing", + text: { + head: "crwdns603:0crwdne603:0", + desc: "", + checkbox: [ { - text:"crwdns604:0crwdne604:0", - value:"simple" - },{ - text:"crwdns605:0crwdne605:0", - value:"mention" - },{ - text:"crwdns606:0crwdne606:0", - value:"full" - },{ - text:"@@notqt@@", - value:"nothing" + text: "crwdns604:0crwdne604:0", + value: "simple" + }, { + text: "crwdns605:0crwdne605:0", + value: "mention" + }, { + text: "crwdns606:0crwdne606:0", + value: "full" + }, { + text: "@@notqt@@", + value: "nothing" } ] } - },{ - id:"main", - storage:"mainuse", - checkbox:true, - setValue:"remain", - text:{ - head:"crwdns607:0crwdne607:0", - desc:"crwdns608:0crwdne608:0", - checkbox:[ + }, { + id: "main", + storage: "mainuse", + checkbox: true, + setValue: "remain", + text: { + head: "crwdns607:0crwdne607:0", + desc: "crwdns608:0crwdne608:0", + checkbox: [ { - text:"crwdns609:0crwdne609:0", - value:"remain" - },{ - text:"crwdns610:0crwdne610:0", - value:"main" + text: "crwdns609:0crwdne609:0", + value: "remain" + }, { + text: "crwdns610:0crwdne610:0", + value: "main" } ] } - },{ - id:"sec", - storage:"sec", - checkbox:true, - setValue:"public", - text:{ - head:"crwdns1916:0crwdne1916:0", - desc:"", - checkbox:[ + }, { + id: "sec", + storage: "sec", + checkbox: true, + setValue: "public", + text: { + head: "crwdns1916:0crwdne1916:0", + desc: "", + checkbox: [ { - text:"crwdns1920:0crwdne1920:0", - value:"nothing" - },{ - text:"crwdns593:0crwdne593:0", - value:"public" - },{ - text:"crwdns594:0crwdne594:0", - value:"unlisted" - },{ - text:"crwdns595:0crwdne595:0", - value:"private" - },{ - text:"crwdns596:0crwdne596:0", - value:"direct" - },{ - text:"crwdns1922:0crwdne1922:0", - value:"local", - kirishima:true, - kirishimaText:"非対応インスタンスでは「未収載」になります。" + text: "crwdns1920:0crwdne1920:0", + value: "nothing" + }, { + text: "crwdns593:0crwdne593:0", + value: "public" + }, { + text: "crwdns594:0crwdne594:0", + value: "unlisted" + }, { + text: "crwdns595:0crwdne595:0", + value: "private" + }, { + text: "crwdns596:0crwdne596:0", + value: "direct" + }, { + text: "crwdns1922:0crwdne1922:0", + value: "local", + kirishima: true, + kirishimaText: "非対応インスタンスでは「未収載」になります。" } ] } - },{ - id:"zero", - storage:"emoji-zero-width", - checkbox:true, - setValue:"normal", - setValue:"no", - text:{ - head:"@@zeroWidthEmoji@@", - desc:"", - checkbox:yesno + }, { + id: "zero", + storage: "emoji-zero-width", + checkbox: true, + setValue: "normal", + setValue: "no", + text: { + head: "@@zeroWidthEmoji@@", + desc: "", + checkbox: yesno } } ] \ No newline at end of file diff --git a/app/view/ps/update.html b/app/view/ps/update.html index b0460e8b..5043f7dc 100644 --- a/app/view/ps/update.html +++ b/app/view/ps/update.html @@ -1,235 +1,256 @@ + -Update - TheDesk - - - - - - - - +Update - TheDesk + + + + + + + + + - - - - -info -clear - --- - - + + + info + clear + +-- -TheDesk
-crwdns669:0crwdne669:0
- →
-
- - - - -
- crwdns678:0crwdne678:0
crwdns679:0crwdne679:0 ---crwdns681:0crwdne681:0
- -++ + + \ No newline at end of file + var start = "https://thedesk.top/ver.json"; + fetch(start, { + method: 'GET', + headers: { 'content-type': 'application/json' }, + }).then(function (response) { + return response.json(); + }).catch(function (error) { + todo(error); + console.error(error); + }).then(function (json) { + console.log(json); + if (platform == "win32") { + $("#ver").text(json.desk); + localStorage.setItem("next-ver", json.desk); + } else if (platform == "linux") { + $("#ver").text(json.desk_linux); + localStorage.setItem("next-ver", json.desk_linux); + } else if (platform == "darwin") { + $("#ver").text(json.desk_mac); + localStorage.setItem("next-ver", json.desk_mac); + } + var lang = "ps"; + if (lang == "ja") { + $("#det").html(json.detail); + } else { + $("#det").html(json.detail_en); + } + + $("#now").text(localStorage.getItem("ver")); + + }); + } + function nextv() { + localStorage.setItem("new-ver-skip", "true"); + window.close(); + } + function enc(ver) { + var ver = ver.replace(/\s/g, ""); + var ver = ver.replace(/\(/g, "-"); + var ver = ver.replace(/\)/g, ""); + var ver = ver.replace(/\[/g, "_"); + var ver = ver.replace(/\]/g, ""); + return ver; + } + \ No newline at end of file++ +TheDesk
+crwdns669:0crwdne669:0
+ →
+
+ + + + +
+ crwdns678:0crwdne678:0
crwdns679:0crwdne679:0 +++crwdns681:0crwdne681:0
+ +