From f3335958176a09decd46f128017349d7f8fe9c07 Mon Sep 17 00:00:00 2001 From: Cutls Date: Thu, 11 Apr 2019 12:52:38 +0900 Subject: [PATCH] WIP: done some ToDo --- app/js/post/emoji.js | 198 +++---- app/js/tl/filter.js | 5 + app/js/tl/notification.js | 4 +- app/js/tl/parse.js | 4 +- app/js/tl/src.js | 45 +- app/js/tl/tl.js | 8 + app/js/ui/layout.js | 4 +- app/view/en/index.html | 19 +- app/view/en/setting.html | 750 +++++++++++++++------------ app/view/ja/index.html | 11 +- app/view/ja/setting.html | 750 +++++++++++++++------------ app/view/make/index.sample.html | 9 +- app/view/make/language/index.en.json | 9 +- app/view/make/language/index.ja.json | 3 +- app/view/make/setting.sample.html | 750 +++++++++++++++------------ app/view/ps/index.html | 9 +- app/view/ps/setting.html | 750 +++++++++++++++------------ 17 files changed, 1839 insertions(+), 1489 deletions(-) diff --git a/app/js/post/emoji.js b/app/js/post/emoji.js index 74023307..5f571c46 100644 --- a/app/js/post/emoji.js +++ b/app/js/post/emoji.js @@ -7,8 +7,8 @@ $("#emoji-next").addClass("disabled"); function emojiToggle(reaction) { var acct_id = $("#post-acct-sel").val(); var selin = $("#textarea").prop('selectionStart'); - if(!selin){ - selin=0; + if (!selin) { + selin = 0; } localStorage.setItem("cursor", selin); @@ -18,10 +18,10 @@ function emojiToggle(reaction) { $("#suggest").html(""); if (!localStorage.getItem("emoji_" + acct_id)) { var html = - ''; + ''; $("#emoji-list").html(html); } else { - emojiList('home',reaction); + emojiList('home', reaction); } } else { $("#poll").addClass("hide") @@ -34,92 +34,92 @@ function emojiToggle(reaction) { } //絵文字リスト挿入 -function emojiGet(parse,started) { +function emojiGet(parse, started) { $('#emoji-list').html('Loading...'); var acct_id = $("#post-acct-sel").val(); var domain = localStorage.getItem("domain_" + acct_id); - if(localStorage.getItem("mode_" + domain)!="misskey"){ - var start = "https://" + domain + "/api/v1/custom_emojis"; - 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) { - if (parse == "true") { - $('#emoji-list').html('Parsing...'); - //絵文字をマストドン公式と同順にソート - json.sort(function(a, b) { - if (a.shortcode < b.shortcode) return -1; - if (a.shortcode > b.shortcode) return 1; - return 0; - }); - localStorage.setItem("emoji_" + acct_id, JSON.stringify(json)); - } else { - localStorage.setItem("emoji_" + acct_id, JSON.stringify(json)); - } - localStorage.setItem("emojiseek", 0); - if(!started){ - emojiList('home') - } - }); - }else{ - var start = "https://" + domain + "/api/meta"; - fetch(start, { - method: 'POST', - headers: { - 'content-type': 'application/json' - }, - }).then(function(response) { - return response.json(); - }).catch(function(error) { - todo(error); - console.error(error); - }).then(function(json) { - if(json.enableEmojiReaction){ - localStorage.setItem("emojiReaction_" + acct_id, "true"); - }else{ - localStorage.setItem("emojiReaction_" + acct_id,"disabled"); - } - var emojis=json.emojis; - var md=[]; - Object.keys(emojis).forEach(function(key) { - var emoji = emojis[key]; - md.push({ - "shortcode":emoji.name, - "url":emoji.url - }) + if (localStorage.getItem("mode_" + domain) != "misskey") { + var start = "https://" + domain + "/api/v1/custom_emojis"; + 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) { + if (parse == "true") { + $('#emoji-list').html('Parsing...'); + //絵文字をマストドン公式と同順にソート + json.sort(function (a, b) { + if (a.shortcode < b.shortcode) return -1; + if (a.shortcode > b.shortcode) return 1; + return 0; + }); + localStorage.setItem("emoji_" + acct_id, JSON.stringify(json)); + } else { + localStorage.setItem("emoji_" + acct_id, JSON.stringify(json)); + } + localStorage.setItem("emojiseek", 0); + if (!started) { + emojiList('home') + } }); - if (parse == "true") { - $('#emoji-list').html('Parsing...'); - //絵文字をマストドン公式と同順にソート - md.sort(function(a, b) { - if (a.shortcode < b.shortcode) return -1; - if (a.shortcode > b.shortcode) return 1; - return 0; + } else { + var start = "https://" + domain + "/api/meta"; + fetch(start, { + method: 'POST', + headers: { + 'content-type': 'application/json' + }, + }).then(function (response) { + return response.json(); + }).catch(function (error) { + todo(error); + console.error(error); + }).then(function (json) { + if (json.enableEmojiReaction) { + localStorage.setItem("emojiReaction_" + acct_id, "true"); + } else { + localStorage.setItem("emojiReaction_" + acct_id, "disabled"); + } + var emojis = json.emojis; + var md = []; + Object.keys(emojis).forEach(function (key) { + var emoji = emojis[key]; + md.push({ + "shortcode": emoji.name, + "url": emoji.url + }) }); - localStorage.setItem("emoji_" + acct_id, JSON.stringify(md)); - } else { - localStorage.setItem("emoji_" + acct_id, JSON.stringify(md)); - } - localStorage.setItem("emojiseek", 0); - if(!started){ - emojiList('home') - } - }); + if (parse == "true") { + $('#emoji-list').html('Parsing...'); + //絵文字をマストドン公式と同順にソート + md.sort(function (a, b) { + if (a.shortcode < b.shortcode) return -1; + if (a.shortcode > b.shortcode) return 1; + return 0; + }); + localStorage.setItem("emoji_" + acct_id, JSON.stringify(md)); + } else { + localStorage.setItem("emoji_" + acct_id, JSON.stringify(md)); + } + localStorage.setItem("emojiseek", 0); + if (!started) { + emojiList('home') + } + }); } } //リストの描画 -function emojiList(target,reaction) { +function emojiList(target, reaction) { $("#now-emoji").text(lang.lang_emoji_custom); var acct_id = $("#post-acct-sel").val(); - if(reaction && localStorage.getItem("emojiReaction_" + acct_id)!="true"){ + if (reaction && localStorage.getItem("emojiReaction_" + acct_id) != "true") { console.error("Disabled") clear() hide(); @@ -157,14 +157,14 @@ function emojiList(target,reaction) { for (i = start; i < start + 126; i++) { var emoji = obj[i]; if (emoji) { - if(reaction){ + if (reaction) { html = html + ''; - }else{ + ':\')" class="pointer">'; + } else { html = html + ''; + ':\')" class="pointer">'; } - + } } $("#emoji-list").html(html); @@ -174,19 +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=" "; + 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 + brank+ code+brank + after; - }else{ - newt = code+brank; + if (selin > 0) { + var before = now.substr(0, selin); + var after = now.substr(selin, now.length); + newt = before + brank + code + brank + after; + } else { + newt = code + brank; } if (!del) { $("#textarea").val(newt); @@ -196,18 +196,18 @@ function emojiInsert(code, del) { var now = now.replace(regExp, ""); $("#textarea").val(now + brank + code); } - + $("#textarea").focus(); var selin = $("#textarea").prop('selectionStart'); - if(!selin){ - selin=0; + if (!selin) { + selin = 0; } localStorage.setItem("cursor", selin); } //改行挿入 function brInsert(code) { - if(!$('#post-box').hasClass("appear")){ - localStorage.setItem("nohide",true); + if (!$('#post-box').hasClass("appear")) { + localStorage.setItem("nohide", true); show(); } var now = $("#textarea").val(); diff --git a/app/js/tl/filter.js b/app/js/tl/filter.js index f4a5fa0a..e1030a08 100644 --- a/app/js/tl/filter.js +++ b/app/js/tl/filter.js @@ -146,6 +146,11 @@ function filter(){ } }); } +function filterTime(day,hour,min){ + $("#days_filter").val(day) + $("#hours_filter").val(hour) + $("#mins_filter").val(min) +} function makeNewFilter(){ var acct_id = $("#filter-acct-sel").val(); var phr=$("#filter-add-word").val(); diff --git a/app/js/tl/notification.js b/app/js/tl/notification.js index 739ffe69..07bfa618 100644 --- a/app/js/tl/notification.js +++ b/app/js/tl/notification.js @@ -60,13 +60,13 @@ function notfColumn(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/js/tl/parse.js b/app/js/tl/parse.js index 3530733f..05e97ecd 100644 --- a/app/js/tl/parse.js +++ b/app/js/tl/parse.js @@ -760,12 +760,12 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { '' + '
'+tickerdom+'' + spoil + "" + spoiler_show + - '' + content + + '' + content +poll+ '' + '' + viewer + '' + '
' + analyze + '' + - '' +poll+ mentions + tags + '
' + + '' + mentions + tags + '' + '
'+ '
' + '
'+vis+'
'+ diff --git a/app/js/tl/src.js b/app/js/tl/src.js index 270a29c9..7f6bcbb6 100644 --- a/app/js/tl/src.js +++ b/app/js/tl/src.js @@ -107,7 +107,7 @@ function tootsearch(tlid,q){ var templete=""; var json=raw.hits.hits; console.log(json); - var max_id = raw["hits"]["total"]; + 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; diff --git a/app/js/tl/tl.js b/app/js/tl/tl.js index 8711e086..d6451b6d 100644 --- a/app/js/tl/tl.js +++ b/app/js/tl/tl.js @@ -384,6 +384,10 @@ function moreload(type, tlid) { }else if (type == "notf") { notfmore(tlid); return; + }else if (type == "tootsearch") { + var data=obj[tlid].data; + moreTs(tlid,data); + return; } moreloading=true; localStorage.setItem("now", type); @@ -572,6 +576,10 @@ function tlDiff(type, data, acct_id, tlid, delc, voice, mode) { }); } } +//TL再取得 +function reloadTL(type, data, acct_id, key, delc,voice){ + tl(type, data, acct_id, key, delc,voice,""); +} //WebSocket切断 function tlCloser() { diff --git a/app/js/ui/layout.js b/app/js/ui/layout.js index e0b362a2..389117f1 100644 --- a/app/js/ui/layout.js +++ b/app/js/ui/layout.js @@ -190,7 +190,7 @@ function parseColumn() { ')" class="setting nex" title="'+lang.lang_layout_setthis +'"'+icnsert+'>settings'+ '
'+exclude+left_hold+'perm_mediaOn'+lang.lang_layout_mediafil +'
@@ -755,9 +755,16 @@ var tlid=0;
Filtered toots will disappear irreversibly, even if filter is later removed
Expire afterUnset or "0" means "Never"This value may contain some error

- days - hours - minutes + day(s) + hour(s) + minute(s)
+ Quick:
30minute(s)/ + 1hour(s)/ + 6hour(s)/ + 12hour(s)/ + 1day(s)/ + 7day(s)/ + Never

Integrated TL/Plus TL will hide both Home-filtering words and Local-filtering words. diff --git a/app/view/en/setting.html b/app/view/en/setting.html index bd013ccc..768018ed 100644 --- a/app/view/en/setting.html +++ b/app/view/en/setting.html @@ -1,5 +1,6 @@ + Settings - TheDesk