From 1c16a5f4a01e21f6ae079d012845e5b0244624f9 Mon Sep 17 00:00:00 2001 From: Cutls Date: Thu, 11 Apr 2019 02:59:13 +0900 Subject: [PATCH] WIP done some ToDO --- app/css/tl.css | 21 ++++++- app/js/post/emoji.js | 18 +++--- app/js/post/misskeystatus.js | 10 +++- app/js/post/status.js | 2 + app/js/tl/misskeyparse.js | 83 ++++++++++++++++++-------- app/js/tl/notification.js | 4 +- app/view/en/setting.html | 12 ++-- app/view/en/setting.vue.js | 11 ++++ app/view/ja/setting.html | 12 ++-- app/view/ja/setting.vue.js | 11 ++++ app/view/make/language/setting.en.json | 1 + app/view/make/language/setting.ja.json | 1 + app/view/make/setting.sample.html | 12 ++-- app/view/make/setting.sample.js | 11 ++++ app/view/ps/setting.html | 12 ++-- app/view/ps/setting.vue.js | 11 ++++ 16 files changed, 168 insertions(+), 64 deletions(-) diff --git a/app/css/tl.css b/app/css/tl.css index 49785705..42df4407 100644 --- a/app/css/tl.css +++ b/app/css/tl.css @@ -505,7 +505,26 @@ p:not(:last-child){ .votebtn:hover{ background-color:var(--color); } - +.jump{ + display: inline-block; animation: jump 0.75s linear infinite; +} +@keyframes jump { + 0% { + transform: translateY(0); +} +25% { + transform: translateY(-16px); +} +50% { + transform: translateY(0); +} +75% { + transform: translateY(-8px); +} +100% { + transform: translateY(0); +} +} @keyframes fadeInDown { from { opacity: 0; diff --git a/app/js/post/emoji.js b/app/js/post/emoji.js index 2c4f8956..74023307 100644 --- a/app/js/post/emoji.js +++ b/app/js/post/emoji.js @@ -154,11 +154,6 @@ function emojiList(target,reaction) { } $("#emoji-next").removeClass("disabled"); $("#emoji-count").text(ct); - if(localStorage.getItem("emoji-zero-width")){ - var brank="​"; - }else{ - var brank=" "; - } for (i = start; i < start + 126; i++) { var emoji = obj[i]; if (emoji) { @@ -167,7 +162,7 @@ function emojiList(target,reaction) { ':\')" class="pointer">'; }else{ html = html + ''; + ':\')" class="pointer">'; } } @@ -179,14 +174,19 @@ function emojiList(target,reaction) { function emojiInsert(code, del) { var now = $("#textarea").val(); var selin = localStorage.getItem("cursor"); + if(localStorage.getItem("emoji-zero-width")=="yes"){ + var brank="​"; + }else{ + var brank=" "; + } console.log(selin); var now = $("#textarea").val(); if(selin>0){ var before = now.substr(0, selin); var after = now.substr(selin, now.length); - newt = before + " "+ code+" " + after; + newt = before + brank+ code+brank + after; }else{ - newt = code+" "; + newt = code+brank; } if (!del) { $("#textarea").val(newt); @@ -194,7 +194,7 @@ function emojiInsert(code, del) { } else { var regExp = new RegExp(del, "g"); var now = now.replace(regExp, ""); - $("#textarea").val(now + " " + code); + $("#textarea").val(now + brank + code); } $("#textarea").focus(); diff --git a/app/js/post/misskeystatus.js b/app/js/post/misskeystatus.js index a4261c1a..84366e83 100644 --- a/app/js/post/misskeystatus.js +++ b/app/js/post/misskeystatus.js @@ -65,7 +65,7 @@ function reactiontoggle(id,acct_id,tlid){ var json = httpreq.response; console.log(json); if(json.reactionCounts){ - var reactions=["like","love","laugh","hmm","surprise","congrats","angry","confused","pudding"]; + var reactions=["like","love","laugh","hmm","surprise","congrats","angry","confused","pudding","star"]; for(var i=0;i'; + var regExp = new RegExp(":" + shortcode + ":", "g"); + dis_name = dis_name.replace(regExp, emoji_url); + }); if (mix == "notf") { if (gif == "yes") { noticeavatar = toot.user.avatarUrl; @@ -192,24 +201,25 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) { "congrats":"🎉", "amgry":"💢", "confused":"😥", - "pudding":"🍮" + "pudding":"🍮", + "star":"⭐" } var icon=reactions[toot.reaction]; - var reactions=["like","love","laugh","hmm","surprise","congrats","angry","confused","pudding"]; - for(var i=0;i'; + } + } + } + } + } }else{ var icon = 'info'; } @@ -250,19 +260,19 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) { var ipc = electron.ipcRenderer; var os = electron.remote.process.platform; var options = { - body: toot.account.display_name+"(" + toot.account.acct +")"+what+"\n\n"+$.strip_tagstemp(toot.status.content), - icon: toot.account.avatar + body: toot.user.name+"(" + toot.user.username +")"+what+"\n\n"+$.strip_tagstemp(toot.note.text), + icon: toot.user.avatarUrl }; if(os=="darwin"){ var n = new Notification('TheDesk:'+domain, options); }else{ ipc.send('native-notf', [ 'TheDesk:'+domain, - toot.account.display_name+"(" + toot.account.acct +")"+what+"\n\n"+$.strip_tagstemp(toot.status.content), - toot.account.avatar, + toot.user.name+"(" + toot.user.username +")"+what+"\n\n"+$.strip_tagstemp(toot.note.text), + toot.user.avatarUrl, "toot", acct_id, - toot.status.id + toot.note.id ]); } } @@ -395,7 +405,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) { var emojick = toot.emojis[0]; }else{ var emojick=false; - } + } //デフォ絵文字 if(content){ //MFM @@ -403,17 +413,35 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) { content=content.replace(/`(.+)`/gi, '$1') content=content.replace(/(http(s)?:\/\/[\x21-\x7e]+)/gi, '$1') content=content.replace(/\(\(\((.+)\)\)\)/gi, '$1') - content=content.replace(/(.+)<\/motion>/gi, '$1') + content=content.replace(/<motion>(.+)<\/motion>/gi, '$1') content=content.replace(/\*\*\*([^*]+)\*\*\*/gi, '$1') content=content.replace(/\*\*([^*]+)\*\*/gi, '$1') content=content.replace(/^(.+)\s(検索|search)$/gmi, '
search
') content=content.replace(/\[(.+)\]\($1'); - + content=content.replace(/<center>/gi, '
') + content=content.replace(/<\/center>/gi, '
') + content=content.replace(/<flip>(.+)<\/flip>/gi, '$1') + content=content.replace(/<small>(.+)<\/small>/gi, '$1') + content=content.replace(/<i>(.+)<\/i>/gi, '$1') + content=content.replace(/<spin>(.+)<\/spin>/gi, '$1') + content=content.replace(/\*\*(.+)\*\*/gi, '$1') + content=content.replace(/<jump>(.+)<\/jump>/gi, '$1') content=twemoji.parse(content); }else{ content=""; } - + //絵文字があれば + if (emojick) { + Object.keys(toot.emojis).forEach(function(key5) { + var emoji = toot.emojis[key5]; + var shortcode = emoji.name; + var emoji_url = ' :'+shortcode+': '; + var regExp = new RegExp(":" + shortcode + ":", "g"); + content = content.replace(regExp, emoji_url); + spoil = spoil.replace(regExp, emoji_url); + }); + } if(dis_name){ dis_name=twemoji.parse(dis_name); }else{ @@ -728,6 +756,11 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) { content='This post has no content. It may be media-only, private or deleted.'; } var trans=""; + if(toot.user.emojis){ + var actemojick = toot.user.emojis[0]; + }else{ + var actemojick=false; + } templete = templete + '
' + diff --git a/app/js/tl/notification.js b/app/js/tl/notification.js index 19ff99b7..739ffe69 100644 --- a/app/js/tl/notification.js +++ b/app/js/tl/notification.js @@ -233,13 +233,13 @@ function notfCommon(acct_id, tlid, sys) { var ipc = electron.ipcRenderer; var os = electron.remote.process.platform; var options = { - body: ct+lang_notf_new[lang], + body: ct+lang.lang_notf_new[lang], 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_notf_new[lang],localStorage.getItem("prof_"+acct_id)]); + ipc.send('native-notf', ['TheDesk:'+domain,ct+lang.lang_notf_new[lang],localStorage.getItem("prof_"+acct_id)]); } } diff --git a/app/view/en/setting.html b/app/view/en/setting.html index 476d5df0..bd013ccc 100644 --- a/app/view/en/setting.html +++ b/app/view/en/setting.html @@ -44,7 +44,7 @@

Font
@@ -153,7 +153,7 @@

@@ -183,7 +183,7 @@
diff --git a/app/view/en/setting.vue.js b/app/view/en/setting.vue.js index 04def4de..67154761 100644 --- a/app/view/en/setting.vue.js +++ b/app/view/en/setting.vue.js @@ -476,5 +476,16 @@ var postConstruction=[ } ] } + },{ + 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/ja/setting.html b/app/view/ja/setting.html index 07430a7d..f432016d 100644 --- a/app/view/ja/setting.html +++ b/app/view/ja/setting.html @@ -44,7 +44,7 @@

フォント
@@ -153,7 +153,7 @@

@@ -183,7 +183,7 @@
diff --git a/app/view/ja/setting.vue.js b/app/view/ja/setting.vue.js index c2a40931..071f0920 100644 --- a/app/view/ja/setting.vue.js +++ b/app/view/ja/setting.vue.js @@ -476,5 +476,16 @@ var postConstruction=[ } ] } + },{ + 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/make/language/setting.en.json b/app/view/make/language/setting.en.json index 08cc2a60..e27e20c3 100644 --- a/app/view/make/language/setting.en.json +++ b/app/view/make/language/setting.en.json @@ -114,6 +114,7 @@ "secwarn":"Toot with other visibility setting", "nothing":"Hidden", "localonly":"Local Only", + "zeroWidthEmoji":"Zero-width space when inserting emojis", "keysc":"Keyboard shortcut Preferences", "iks":"Easy inserter", "okswarn":"You can insert any letters and emojis with only 3 keys", diff --git a/app/view/make/language/setting.ja.json b/app/view/make/language/setting.ja.json index 4e0cc760..3c6396b6 100644 --- a/app/view/make/language/setting.ja.json +++ b/app/view/make/language/setting.ja.json @@ -114,6 +114,7 @@ "secwarn":"公開範囲の変更とトゥートを一発でできます。", "nothing":"表示しない", "localonly":"ローカル限定", + "zeroWidthEmoji":"絵文字にゼロ幅スペースを使う", "keysc":"キーボードショートカットの設定", "iks":"簡単文字入力", "okswarn":"絵文字やタグ、>BTなどを登録しておくとすぐに入力できます。", diff --git a/app/view/make/setting.sample.html b/app/view/make/setting.sample.html index 038f7ab5..05d1fa29 100644 --- a/app/view/make/setting.sample.html +++ b/app/view/make/setting.sample.html @@ -44,7 +44,7 @@

@@font@@
@@ -153,7 +153,7 @@

@@ -183,7 +183,7 @@
diff --git a/app/view/make/setting.sample.js b/app/view/make/setting.sample.js index 526862d0..fd4c0f0b 100644 --- a/app/view/make/setting.sample.js +++ b/app/view/make/setting.sample.js @@ -476,5 +476,16 @@ var postConstruction=[ } ] } + },{ + 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/setting.html b/app/view/ps/setting.html index 720f2caf..10358369 100644 --- a/app/view/ps/setting.html +++ b/app/view/ps/setting.html @@ -44,7 +44,7 @@

crwdns544:0crwdne544:0
@@ -153,7 +153,7 @@

@@ -183,7 +183,7 @@
diff --git a/app/view/ps/setting.vue.js b/app/view/ps/setting.vue.js index 38614609..bea8453f 100644 --- a/app/view/ps/setting.vue.js +++ b/app/view/ps/setting.vue.js @@ -476,5 +476,16 @@ var postConstruction=[ } ] } + },{ + id:"zero", + storage:"emoji-zero-width", + checkbox:true, + setValue:"normal", + setValue:"no", + text:{ + head:"@@zeroWidthEmoji@@", + desc:"", + checkbox:yesno + } } ] \ No newline at end of file