WIP: use-strict 'login'

This commit is contained in:
cutls 2019-11-25 00:03:33 +09:00
parent bae73521e9
commit 957ef30fc0
5 changed files with 414 additions and 386 deletions

View File

@ -1,192 +1,192 @@
'use strict' 'use strict'
var selectedColumn = 0 var selectedColumn = 0
var selectedToot = 0 var selectedToot = 0
$(function ($) { $(function($) {
//キーボードショートカット //キーボードショートカット
$(window).keydown(function (e) { $(window).keydown(function(e) {
var hasFocus = $('input').is(':focus'); var hasFocus = $('input').is(':focus')
var hasFocus2 = $('textarea').is(':focus'); var hasFocus2 = $('textarea').is(':focus')
if (document.getElementById("webview")) { if (document.getElementById('webview')) {
if ($("#webviewsel:checked").val()) { if ($('#webviewsel:checked').val()) {
var wv = false; var wv = false
} else { } else {
var wv = true; var wv = true
} }
} else { } else {
var wv = true; var wv = true
} }
//Enter //Enter
if (e.keyCode === 13) { if (e.keyCode === 13) {
if($("#src").is(':focus')){ if ($('#src').is(':focus')) {
src() src()
return false; return false
} }
if($("#list-add").is(':focus')){ if ($('#list-add').is(':focus')) {
makeNewList() makeNewList()
return false; return false
} }
} }
//Ctrl+Shift+Enter:Lgen //Ctrl+Shift+Enter:Lgen
if (event.metaKey || event.ctrlKey && wv) { if (event.metaKey || (event.ctrlKey && wv)) {
if (event.shiftKey) { if (event.shiftKey) {
if (e.keyCode === 13) { if (e.keyCode === 13) {
post('local'); post('local')
return false; return false
} }
} }
} }
//Ctrl+Enter:投稿 //Ctrl+Enter:投稿
if (event.metaKey || event.ctrlKey && wv) { if (event.metaKey || (event.ctrlKey && wv)) {
if (e.keyCode === 13) { if (e.keyCode === 13) {
post(); post()
return false; return false
} }
} }
//Alt+Enter:セカンダリー //Alt+Enter:セカンダリー
if (event.metaKey || event.altKey && wv) { if (event.metaKey || (event.altKey && wv)) {
if (e.keyCode === 13) { if (e.keyCode === 13) {
sec(); sec()
return false; return false
} }
} }
//Esc:消す //Esc:消す
if (e.keyCode === 27 && wv) { if (e.keyCode === 27 && wv) {
hide(); hide()
return false; return false
} }
//F5リロード //F5リロード
if (e.keyCode === 116 && wv) { if (e.keyCode === 116 && wv) {
location.href = "index.html"; location.href = 'index.html'
return false; return false
} }
//Ctrl+Sift+C:全消し //Ctrl+Sift+C:全消し
if (((event.metaKey || event.ctrlKey) && event.shiftKey) && wv) { if ((event.metaKey || event.ctrlKey) && event.shiftKey && wv) {
if (e.keyCode === 67) { if (e.keyCode === 67) {
clear(); clear()
return false; return false
} }
} }
//Ctrl+Sift+N:NowPlaying //Ctrl+Sift+N:NowPlaying
if (((event.metaKey || event.ctrlKey) && event.shiftKey) && wv) { if ((event.metaKey || event.ctrlKey) && event.shiftKey && wv) {
if (e.keyCode === 78) { if (e.keyCode === 78) {
show(); show()
nowplaying() nowplaying()
return false; return false
} }
} }
//input/textareaにフォーカスなし時 //input/textareaにフォーカスなし時
if ((!hasFocus && !hasFocus2) && wv) { if (!hasFocus && !hasFocus2 && wv) {
if (!wv) { if (!wv) {
return true; return true
} }
//Ctrl+V:いつもの //Ctrl+V:いつもの
if (event.metaKey || event.ctrlKey) { if (event.metaKey || event.ctrlKey) {
if (e.keyCode === 86) { if (e.keyCode === 86) {
show(); show()
} }
} }
//X:開閉 //X:開閉
if (e.keyCode === 88) { if (e.keyCode === 88) {
if (!$("#post-box").hasClass("appear")) { if (!$('#post-box').hasClass('appear')) {
show(); show()
$('textarea').focus(); $('textarea').focus()
} else { } else {
hide(); hide()
} }
return false; return false
} }
//N:新トゥート //N:新トゥート
if (e.keyCode === 78) { if (e.keyCode === 78) {
if (!$("#post-box").hasClass("appear")) { if (!$('#post-box').hasClass('appear')) {
show(); show()
} }
$('textarea').focus(); $('textarea').focus()
return false; return false
} }
//Ctrl+E:全ての通知未読を既読にする //Ctrl+E:全ての通知未読を既読にする
if (event.metaKey || event.ctrlKey) { if (event.metaKey || event.ctrlKey) {
if (e.keyCode === 69) { if (e.keyCode === 69) {
allNotfRead(); allNotfRead()
return false; return false
} }
} }
//Ctrl+Space:読み込み //Ctrl+Space:読み込み
if (event.metaKey || event.ctrlKey) { if (event.metaKey || event.ctrlKey) {
if (e.keyCode === 32) { if (e.keyCode === 32) {
parseColumn(); parseColumn()
return false; return false
} }
} }
//Ctrl+Sift+S:設定 //Ctrl+Sift+S:設定
if ((event.metaKey || event.ctrlKey) && event.shiftKey) { if ((event.metaKey || event.ctrlKey) && event.shiftKey) {
if (e.keyCode === 83) { if (e.keyCode === 83) {
location.href = "setting.html"; location.href = 'setting.html'
return false; return false
} }
} }
//Ctrl+Sift+M:アカマネ //Ctrl+Sift+M:アカマネ
if ((event.metaKey || event.ctrlKey) && event.shiftKey) { if ((event.metaKey || event.ctrlKey) && event.shiftKey) {
if (e.keyCode === 77) { if (e.keyCode === 77) {
location.href = "acct.html"; location.href = 'acct.html'
return false; return false
} }
} }
//Ctrl+Sift+P:プロフ //Ctrl+Sift+P:プロフ
if ((event.metaKey || event.ctrlKey) && event.shiftKey) { if ((event.metaKey || event.ctrlKey) && event.shiftKey) {
if (e.keyCode === 80) { if (e.keyCode === 80) {
profShow() profShow()
return false; return false
} }
} }
//数字:TL //数字:TL
if (event.metaKey || event.ctrlKey) { if (event.metaKey || event.ctrlKey) {
if (e.keyCode >= 49 && e.keyCode <= 57) { if (e.keyCode >= 49 && e.keyCode <= 57) {
var kz = e.keyCode - 49; var kz = e.keyCode - 49
goColumn(kz); goColumn(kz)
return false; return false
} }
} }
//矢印:選択 //矢印:選択
if (e.code == "ArrowLeft") { if (e.code == 'ArrowLeft') {
//left //left
if ($("#imagemodal").hasClass("open")) { if ($('#imagemodal').hasClass('open')) {
imgCont('prev'); imgCont('prev')
return false; return false
} }
if (selectedColumn > 0) { if (selectedColumn > 0) {
selectedColumn-- selectedColumn--
} }
tootSelector(selectedColumn, selectedToot) tootSelector(selectedColumn, selectedToot)
return false; return false
} else if (e.code == "ArrowUp") { } else if (e.code == 'ArrowUp') {
//up //up
if ($("#imagemodal").hasClass("open")) { if ($('#imagemodal').hasClass('open')) {
return false; return false
} }
if (selectedToot > 0) { if (selectedToot > 0) {
selectedToot-- selectedToot--
} }
tootSelector(selectedColumn, selectedToot) tootSelector(selectedColumn, selectedToot)
return false; return false
} else if (e.code == "ArrowRight") { } else if (e.code == 'ArrowRight') {
//right //right
if ($("#imagemodal").hasClass("open")) { if ($('#imagemodal').hasClass('open')) {
imgCont('next'); imgCont('next')
return false; return false
} }
if (selectedColumn < $(".tl-box").length - 1) { if (selectedColumn < $('.tl-box').length - 1) {
selectedColumn++ selectedColumn++
} }
tootSelector(selectedColumn, selectedToot) tootSelector(selectedColumn, selectedToot)
return false; return false
} else if (e.code == "ArrowDown") { } else if (e.code == 'ArrowDown') {
//down //down
if ($("#imagemodal").hasClass("open")) { if ($('#imagemodal').hasClass('open')) {
return false; return false
} }
selectedToot++ selectedToot++
tootSelector(selectedColumn, selectedToot) tootSelector(selectedColumn, selectedToot)
return false; return false
} }
//Ctrl+U:0,0選択 //Ctrl+U:0,0選択
if (event.ctrlKey || event.metaKey) { if (event.ctrlKey || event.metaKey) {
@ -194,29 +194,29 @@ $(function ($) {
selectedToot = 0 selectedToot = 0
selectedColumn = 0 selectedColumn = 0
tootSelector(0, 0) tootSelector(0, 0)
return false; return false
} }
} }
//選択時 //選択時
if (e.keyCode == 70) { if (e.keyCode == 70) {
var id = $(".selectedToot").attr('unique-id') var id = $('.selectedToot').attr('unique-id')
var acct_id = $('#timeline_' + selectedColumn).attr("data-acct") var acct_id = $('#timeline_' + selectedColumn).attr('data-acct')
fav(id, acct_id, false) fav(id, acct_id, false)
return false; return false
} }
if (e.keyCode == 66) { if (e.keyCode == 66) {
var id = $(".selectedToot").attr('unique-id') var id = $('.selectedToot').attr('unique-id')
var acct_id = $('#timeline_' + selectedColumn).attr("data-acct") var acct_id = $('#timeline_' + selectedColumn).attr('data-acct')
rt(id, acct_id, false) rt(id, acct_id, false)
return false; return false
} }
if (e.keyCode == 82) { if (e.keyCode == 82) {
var id = $(".selectedToot").attr('unique-id') var id = $('.selectedToot').attr('unique-id')
var acct_id = $('#timeline_' + selectedColumn).attr("data-acct") var acct_id = $('#timeline_' + selectedColumn).attr('data-acct')
var ats_cm = $('.selectedToot .rep-btn').attr("data-men") var ats_cm = $('.selectedToot .rep-btn').attr('data-men')
var mode = $('.selectedToot .rep-btn').attr("data-visen") var mode = $('.selectedToot .rep-btn').attr('data-visen')
re(id, ats_cm, acct_id, mode) re(id, ats_cm, acct_id, mode)
return false; return false
} }
} }
//textareaフォーカス時 //textareaフォーカス時
@ -225,23 +225,27 @@ $(function ($) {
//C+S+(No):ワンクリ //C+S+(No):ワンクリ
if ((event.metaKey || event.ctrlKey) && event.shiftKey) { if ((event.metaKey || event.ctrlKey) && event.shiftKey) {
if (e.keyCode >= 49 && e.keyCode <= 51) { if (e.keyCode >= 49 && e.keyCode <= 51) {
var no = e.keyCode - 48; var no = e.keyCode - 48
if (localStorage.getItem("oks-" + no)) { $("#textarea").val($("#textarea").val() + localStorage.getItem("oks-" + no)) } if (localStorage.getItem('oks-' + no)) {
return false; $('#textarea').val($('#textarea').val() + localStorage.getItem('oks-' + no))
}
return false
} }
} }
} }
} }
}); })
//クリアボタン //クリアボタン
$("#clear").click(function () { $('#clear').click(function() {
clear(); clear()
}); })
}); })
//選択する //選択する
function tootSelector(column, toot) { function tootSelector(column, toot) {
$('.cvo').removeClass("selectedToot") $('.cvo').removeClass('selectedToot')
$('#timeline_' + column + ' .cvo').eq(toot).addClass("selectedToot") $('#timeline_' + column + ' .cvo')
.eq(toot)
.addClass('selectedToot')
var scr = $('.tl-box[tlid=' + column + ']').scrollTop() var scr = $('.tl-box[tlid=' + column + ']').scrollTop()
var elem = $('.selectedToot').offset().top var elem = $('.selectedToot').offset().top
var top = elem - $('.tl-box').height() + scr var top = elem - $('.tl-box').height() + scr

View File

@ -1,347 +1,373 @@
'use strict' 'use strict'
//バージョンチェッカー //バージョンチェッカー
function verck(ver, jp) { function verck(ver, jp) {
console.log("%c Welcome😊", "color: red;font-size:200%;"); console.log('%c Welcome😊', 'color: red;font-size:200%;')
var date = new Date(); var date = new Date()
var show = false; var show = false
if (localStorage.getItem("ver") != ver && localStorage.getItem("winstore")) { if (localStorage.getItem('ver') != ver && localStorage.getItem('winstore')) {
//ちょっと削除とリンク解析の都合上アレ(s) //ちょっと削除とリンク解析の都合上アレ(s)
//対象外のアプデ:storageが20の最初まで"Usamin (18.6.5)" //対象外のアプデ:storageが20の最初まで"Usamin (18.6.5)"
if (!localStorage.getItem("usamin_18_6_5_flag")) { if (!localStorage.getItem('usamin_18_6_5_flag')) {
localStorage.setItem("usamin_18_6_5_flag", true); localStorage.setItem('usamin_18_6_5_flag', true)
var multi = localStorage.getItem("column"); var multi = localStorage.getItem('column')
var obj = JSON.parse(multi); var obj = JSON.parse(multi)
for (var i = 0; i < obj.length; i++) { for (var i = 0; i < obj.length; i++) {
localStorage.removeItem("card_" + i); localStorage.removeItem('card_' + i)
} }
} }
//ちょっと削除とリンク解析の都合上アレ(e) //ちょっと削除とリンク解析の都合上アレ(e)
show = true; show = true
console.log("%c Thank you for your update🎉", "color: red;font-size:200%;"); console.log('%c Thank you for your update🎉', 'color: red;font-size:200%;')
$(document).ready(function() { $(document).ready(function() {
if (localStorage.getItem("winstore")) { if (localStorage.getItem('winstore')) {
$("#releasenote").modal("open"); $('#releasenote').modal('open')
} }
verp = ver.replace("(", ""); var verp = ver.replace('(', '')
verp = verp.replace(".", "-"); verp = verp.replace('.', '-')
verp = verp.replace(".", "-"); verp = verp.replace('.', '-')
verp = verp.replace("[", "-"); verp = verp.replace('[', '-')
verp = verp.replace("]", ""); verp = verp.replace(']', '')
verp = verp.replace(")", ""); verp = verp.replace(')', '')
verp = verp.replace(" ", "_"); verp = verp.replace(' ', '_')
console.log("%c " + verp, "color: red;font-size:200%;"); console.log('%c ' + verp, 'color: red;font-size:200%;')
if (lang.language == "ja") { if (lang.language == 'ja') {
$("#release-" + verp).show(); $('#release-' + verp).show()
} else { } else {
$("#release-en").show(); $('#release-en').show()
} }
}); })
} }
localStorage.setItem("ver", ver); localStorage.setItem('ver', ver)
if (!show) { if (!show) {
console.log(show); console.log(show)
if (date.getMonth() + 1 >= localStorage.getItem("showSupportMe") || !localStorage.getItem("showSupportMe")) { if (
date.getMonth() + 1 >= localStorage.getItem('showSupportMe') ||
!localStorage.getItem('showSupportMe')
) {
if (date.getMonth() == 11) { if (date.getMonth() == 11) {
var nextmonth = 1; var nextmonth = 1
} else { } else {
var nextmonth = date.getMonth() + 2; var nextmonth = date.getMonth() + 2
} }
if (lang.language != "ja") { if (lang.language != 'ja') {
$("#support-btm-ja").addClass("hide"); $('#support-btm-ja').addClass('hide')
$("#support-btm-en").removeClass("hide"); $('#support-btm-en').removeClass('hide')
} }
localStorage.setItem("showSupportMe", nextmonth); localStorage.setItem('showSupportMe', nextmonth)
$("#support-btm").removeClass("hide"); $('#support-btm').removeClass('hide')
$("#support-btm").animate( $('#support-btm').animate(
{ {
bottom: "0" bottom: '0'
}, },
{ {
duration: 300 duration: 300
} }
); )
} }
} }
var platform = localStorage.getItem("platform"); var platform = localStorage.getItem('platform')
console.log("Your platform:" + platform); console.log('Your platform:' + platform)
if (!localStorage.getItem("winstore")) { if (!localStorage.getItem('winstore')) {
$("#start").css("display", "flex"); $('#start').css('display', 'flex')
} }
if (localStorage.getItem("winstore") == "brewcask" || localStorage.getItem("winstore") == "snapcraft" || localStorage.getItem("winstore") == "winstore") { if (
var winstore = true; localStorage.getItem('winstore') == 'brewcask' ||
localStorage.getItem('winstore') == 'snapcraft' ||
localStorage.getItem('winstore') == 'winstore'
) {
var winstore = true
} else { } else {
var winstore = false; var winstore = false
} }
var l = 5; var l = 5
// 生成する文字列に含める文字セット // 生成する文字列に含める文字セット
var c = "abcdefghijklmnopqrstuvwxyz0123456789"; var c = 'abcdefghijklmnopqrstuvwxyz0123456789'
var cl = c.length; var cl = c.length
var r = ""; var r = ''
for (var i = 0; i < l; i++) { for (var i = 0; i < l; i++) {
r += c[Math.floor(Math.random() * cl)]; r += c[Math.floor(Math.random() * cl)]
} }
var start = "https://thedesk.top/ver.json"; var start = 'https://thedesk.top/ver.json'
fetch(start, { fetch(start, {
method: "GET" method: 'GET'
}) })
.then(function(response) { .then(function(response) {
if (!response.ok) { if (!response.ok) {
response.text().then(function(text) { response.text().then(function(text) {
setLog(response.url, response.status, text); setLog(response.url, response.status, text)
}); })
} }
return response.json(); return response.json()
}) })
.catch(function(error) { .catch(function(error) {
todo(error);setLog(start, "JSON", error); todo(error)
setLog(start, "JSON", error); setLog(start, 'JSON', error)
console.error(error); setLog(start, 'JSON', error)
console.error(error)
}) })
.then(function(mess) { .then(function(mess) {
console.table(mess); console.table(mess)
if (mess) { if (mess) {
//askjp_jp_ua: 2019年10月24日、mstdn.jpによるユーザーエージェントアクセス制限 //askjp_jp_ua: 2019年10月24日、mstdn.jpによるユーザーエージェントアクセス制限
if (jp && mess.jp_ua && !localStorage.getItem("askjp_jp_ua")) { if (jp && mess.jp_ua && !localStorage.getItem('askjp_jp_ua')) {
localStorage.setItem("askjp_jp_ua", true); localStorage.setItem('askjp_jp_ua', true)
$("#askjp_jp_ua").removeClass("hide"); $('#askjp_jp_ua').removeClass('hide')
} }
var platform = localStorage.getItem("platform"); var platform = localStorage.getItem('platform')
if (platform == "darwin") { if (platform == 'darwin') {
var newest = mess.desk_mac; var newest = mess.desk_mac
} else { } else {
var newest = mess.desk; var newest = mess.desk
} }
if (newest == ver) { if (newest == ver) {
todo(lang.lang_version_usever.replace("{{ver}}", mess.desk)); todo(lang.lang_version_usever.replace('{{ver}}', mess.desk))
//betaかWinstoreならアプデチェックしない //betaかWinstoreならアプデチェックしない
} else if (ver.indexOf("beta") != -1 || winstore) { } else if (ver.indexOf('beta') != -1 || winstore) {
} else { } else {
localStorage.removeItem("instance"); localStorage.removeItem('instance')
if (localStorage.getItem("new-ver-skip")) { if (localStorage.getItem('new-ver-skip')) {
if (localStorage.getItem("next-ver") != newest) { if (localStorage.getItem('next-ver') != newest) {
postMessage(["sendSinmpleIpc", "update"], "*"); postMessage(['sendSinmpleIpc', 'update'], '*')
} else { } else {
console.warn(lang.lang_version_skipver); console.warn(lang.lang_version_skipver)
todo(lang.lang_version_skipver); todo(lang.lang_version_skipver)
} }
} else { } else {
postMessage(["sendSinmpleIpc", "update"], "*"); postMessage(['sendSinmpleIpc', 'update'], '*')
} }
} }
} }
}); })
if (!localStorage.getItem("last-notice-id")) { if (!localStorage.getItem('last-notice-id')) {
localStorage.setItem("last-notice-id", 0); localStorage.setItem('last-notice-id', 0)
} }
var start = "https://thedesk.top/notice?since_id=" + localStorage.getItem("last-notice-id"); var start = 'https://thedesk.top/notice?since_id=' + localStorage.getItem('last-notice-id')
fetch(start, { fetch(start, {
method: "GET" method: 'GET'
}) })
.then(function(response) { .then(function(response) {
if (!response.ok) { if (!response.ok) {
response.text().then(function(text) { response.text().then(function(text) {
setLog(response.url, response.status, text); setLog(response.url, response.status, text)
}); })
} }
return response.json(); return response.json()
}) })
.catch(function(error) { .catch(function(error) {
todo(error);setLog(start, "JSON", error); todo(error)
console.error(error); setLog(start, 'JSON', error)
console.error(error)
}) })
.then(function(mess) { .then(function(mess) {
if (mess.length < 1) { if (mess.length < 1) {
return false; return false
} else { } else {
var last = localStorage.getItem("last-notice-id"); var last = localStorage.getItem('last-notice-id')
localStorage.setItem("last-notice-id", mess[0].ID); localStorage.setItem('last-notice-id', mess[0].ID)
for (i = 0; i < mess.length; i++) { for (i = 0; i < mess.length; i++) {
var obj = mess[i]; var obj = mess[i]
if (obj.ID * 1 <= last) { if (obj.ID * 1 <= last) {
break; break
} else { } else {
if (obj.type == "textv2") { if (obj.type == 'textv2') {
if (~obj.languages.indexOf(lang.language)) { if (~obj.languages.indexOf(lang.language)) {
var show = true; var show = true
if (obj.toot != "") { if (obj.toot != '') {
var toot = '<button class="btn-flat toast-action" onclick="detEx(\'' + obj.toot + "','main')\">Show</button>"; var toot =
'<button class="btn-flat toast-action" onclick="detEx(\'' +
obj.toot +
"','main')\">Show</button>"
} else { } else {
var toot = ""; var toot = ''
} }
if (obj.ver != "") { if (obj.ver != '') {
if (obj.ver == ver) { if (obj.ver == ver) {
show = true; show = true
} else { } else {
show = false; show = false
} }
} }
if (obj.domain != "") { if (obj.domain != '') {
var multi = localStorage.getItem("multi"); var multi = localStorage.getItem('multi')
if (multi) { if (multi) {
show = false; show = false
var accts = JSON.parse(multi); var accts = JSON.parse(multi)
Object.keys(accts).forEach(function(key) { Object.keys(accts).forEach(function(key) {
var acct = accts[key]; var acct = accts[key]
if (acct.domain == obj.domain) { if (acct.domain == obj.domain) {
show = true; show = true
} }
}); })
} }
} }
if (show) { if (show) {
M.toast({ html: escapeHTML(obj.text) + toot + '<span class="sml grey-text">(スライドして消去)</span>', displayLength: 86400 }); M.toast({
html:
escapeHTML(obj.text) +
toot +
'<span class="sml grey-text">(スライドして消去)</span>',
displayLength: 86400
})
} }
} }
} }
} }
} }
} }
}); })
} }
var infostreaming = false; var infostreaming = false
function infowebsocket() { function infowebsocket() {
var infows = new WebSocket("wss://thedesk.top/ws/"); var infows = new WebSocket('wss://thedesk.top/ws/')
infows.onopen = function(mess) { infows.onopen = function(mess) {
console.log([tlid, ":Connect Streaming Info:", mess]); console.log([tlid, ':Connect Streaming Info:', mess])
infostreaming = true; infostreaming = true
}; }
infows.onmessage = function(mess) { infows.onmessage = function(mess) {
console.log([tlid, ":Receive Streaming:", JSON.parse(mess.data)]); console.log([tlid, ':Receive Streaming:', JSON.parse(mess.data)])
var obj = JSON.parse(mess.data); var obj = JSON.parse(mess.data)
if (obj.type != "counter") { if (obj.type != 'counter') {
if (obj.type == "textv2") { if (obj.type == 'textv2') {
if (~obj.languages.indexOf(lang.language)) { if (~obj.languages.indexOf(lang.language)) {
localStorage.setItem("last-notice-id", obj.id); localStorage.setItem('last-notice-id', obj.id)
var show = true; var show = true
if (obj.toot != "") { if (obj.toot != '') {
var toot = '<button class="btn-flat toast-action" onclick="detEx(\'' + obj.toot + "','main')\">Show</button>"; var toot =
'<button class="btn-flat toast-action" onclick="detEx(\'' +
obj.toot +
"','main')\">Show</button>"
} else { } else {
var toot = ""; var toot = ''
} }
if (obj.ver != "") { if (obj.ver != '') {
if (obj.ver == ver) { if (obj.ver == ver) {
show = true; show = true
} else { } else {
show = false; show = false
} }
} }
if (obj.domain != "") { if (obj.domain != '') {
var multi = localStorage.getItem("multi"); var multi = localStorage.getItem('multi')
if (multi) { if (multi) {
show = false; show = false
var accts = JSON.parse(multi); var accts = JSON.parse(multi)
Object.keys(accts).forEach(function(key) { Object.keys(accts).forEach(function(key) {
var acct = accts[key]; var acct = accts[key]
if (acct.domain == obj.domain) { if (acct.domain == obj.domain) {
show = true; show = true
} }
}); })
} }
} }
if (show) { if (show) {
console.log(obj.text); console.log(obj.text)
console.log(escapeHTML(obj.text)); console.log(escapeHTML(obj.text))
M.toast({ html: escapeHTML(obj.text) + toot + '<span class="sml grey-text">(スライドして消去)</span>', displayLength: 86400 }); M.toast({
html:
escapeHTML(obj.text) +
toot +
'<span class="sml grey-text">(スライドして消去)</span>',
displayLength: 86400
})
} }
} }
} }
} else { } else {
$("#persons").text(obj.text); $('#persons').text(obj.text)
}
} }
};
infows.onerror = function(error) { infows.onerror = function(error) {
infostreaming = false; infostreaming = false
console.error("Error closing:info"); console.error('Error closing:info')
console.error(error); console.error(error)
return false; return false
}; }
infows.onclose = function() { infows.onclose = function() {
infostreaming = false; infostreaming = false
console.error("Closing:info"); console.error('Closing:info')
}; }
} }
setInterval(function() { setInterval(function() {
if (!infostreaming) { if (!infostreaming) {
console.log("try to connect to base-streaming"); console.log('try to connect to base-streaming')
infowebsocket(); infowebsocket()
} }
}, 10000); }, 10000)
function openRN() { function openRN() {
$("#releasenote").modal("open"); $('#releasenote').modal('open')
if (lang.language == "ja") { if (lang.language == 'ja') {
verp = ver.replace("(", ""); verp = ver.replace('(', '')
verp = verp.replace(".", "-"); verp = verp.replace('.', '-')
verp = verp.replace(".", "-"); verp = verp.replace('.', '-')
verp = verp.replace("[", "-"); verp = verp.replace('[', '-')
verp = verp.replace("]", ""); verp = verp.replace(']', '')
verp = verp.replace(")", ""); verp = verp.replace(')', '')
verp = verp.replace(" ", "_"); verp = verp.replace(' ', '_')
$("#release-" + verp).show(); $('#release-' + verp).show()
} else { } else {
$("#release-en").show(); $('#release-en').show()
} }
} }
function closeSupport() { function closeSupport() {
$("#support-btm").animate( $('#support-btm').animate(
{ {
bottom: "-300px" bottom: '-300px'
}, },
{ {
duration: 300, duration: 300,
complete: function() { complete: function() {
$("#support-btm").addClass("hide"); $('#support-btm').addClass('hide')
} }
} }
); )
} }
function storeDialog(platform, ver) { function storeDialog(platform, ver) {
if (platform == "win32") { if (platform == 'win32') {
var mes = lang.lang_version_platform; var mes = lang.lang_version_platform
} else if (platform == "linux") { } else if (platform == 'linux') {
var mes = lang.lang_version_platform_linux; var mes = lang.lang_version_platform_linux
} else if (platform == "darwin") { } else if (platform == 'darwin') {
var mes = lang.lang_version_platform_mac; var mes = lang.lang_version_platform_mac
} }
Swal.fire({ Swal.fire({
title: "Select your platform", title: 'Select your platform',
text: mes, text: mes,
type: "info", type: 'info',
showCancelButton: true, showCancelButton: true,
confirmButtonColor: "#3085d6", confirmButtonColor: '#3085d6',
cancelButtonColor: "#3085d6", cancelButtonColor: '#3085d6',
confirmButtonText: lang.lang_no, confirmButtonText: lang.lang_no,
cancelButtonText: lang.lang_yesno cancelButtonText: lang.lang_yesno
}).then(result => { }).then(result => {
//逆にしてる //逆にしてる
if (!result.value) { if (!result.value) {
localStorage.setItem("winstore", "winstore"); localStorage.setItem('winstore', 'winstore')
} else { } else {
localStorage.setItem("winstore", "localinstall"); localStorage.setItem('winstore', 'localinstall')
} }
localStorage.setItem("ver", ver); localStorage.setItem('ver', ver)
show = true; console.log('%c Thank you for your update🎉', 'color: red;font-size:200%;')
console.log("%c Thank you for your update🎉", "color: red;font-size:200%;");
$(document).ready(function() { $(document).ready(function() {
$("#releasenote").modal("open"); $('#releasenote').modal('open')
verp = ver.replace("(", ""); var verp = ver.replace('(', '')
verp = verp.replace(".", "-"); verp = verp.replace('.', '-')
verp = verp.replace(".", "-"); verp = verp.replace('.', '-')
verp = verp.replace("[", "-"); verp = verp.replace('[', '-')
verp = verp.replace("]", ""); verp = verp.replace(']', '')
verp = verp.replace(")", ""); verp = verp.replace(')', '')
verp = verp.replace(" ", "_"); verp = verp.replace(' ', '_')
console.log("%c " + verp, "color: red;font-size:200%;"); console.log('%c ' + verp, 'color: red;font-size:200%;')
if (lang.language == "ja") { if (lang.language == 'ja') {
$("#release-" + verp).show(); $('#release-' + verp).show()
} else { } else {
$("#release-en").show(); $('#release-en').show()
} }
}); })
}); })
} }
function closeStart() { function closeStart() {
$("#start").css("display", "none"); $('#start').css('display', 'none')
var platform = localStorage.getItem("platform"); var platform = localStorage.getItem('platform')
var ver = localStorage.getItem("ver"); var ver = localStorage.getItem('ver')
storeDialog(platform, ver); storeDialog(platform, ver)
} }

View File

@ -1,5 +1,5 @@
'use strict' 'use strict'
var defaultemojiList = ["activity", "flag", "food", "nature", "object", "people", "place", "symbol"]; var defaultemojiList = ['activity', 'flag', 'food', 'nature', 'object', 'people', 'place', 'symbol']
var defaultemoji = { var defaultemoji = {
activity: activity, activity: activity,
flag: flag, flag: flag,
@ -9,77 +9,89 @@ var defaultemoji = {
people: people, people: people,
place: place, place: place,
symbol: symbol symbol: symbol
}; }
if (lang == "ja") { if (lang == 'ja') {
var defaultemojiname = { var defaultemojiname = {
activity: "活動", activity: '活動',
flag: "国旗", flag: '国旗',
food: "食べ物", food: '食べ物',
nature: "自然", nature: '自然',
object: "もの", object: 'もの',
people: "ひと", people: 'ひと',
place: "場所", place: '場所',
symbol: "記号" symbol: '記号'
}; }
} else { } else {
var defaultemojiname = { var defaultemojiname = {
activity: "Activities", activity: 'Activities',
flag: "Flags", flag: 'Flags',
food: "Foods", food: 'Foods',
nature: "Nature", nature: 'Nature',
object: "Tools", object: 'Tools',
people: "People", people: 'People',
place: "Places", place: 'Places',
symbol: "Symbols" symbol: 'Symbols'
}; }
} }
function defaultEmoji(target) { function defaultEmoji(target) {
var json = defaultemoji[target]; var json = defaultemoji[target]
var emojis = ""; var emojis = ''
Object.keys(json).forEach(function (key) { Object.keys(json).forEach(function(key) {
var emoji = json[key]; var emoji = json[key]
emojis = emojis + '<a onclick="defEmoji(\'' + emoji["shortcode"] + '\')" class="pointer"><span style="width: 20px; height: 20px; display: inline-block; background-image: url(\'../../img/sheet.png\'); background-size: 4900%; background-position: ' + emoji["css"] + ';"></span></a>'; emojis =
}); emojis +
$("#emoji-list").html(emojis); '<a onclick="defEmoji(\'' +
$("#now-emoji").text(lang.lang_defaultemojis_text.replace("{{cat}}", defaultemojiname[target])); emoji['shortcode'] +
$(".emoji-control").addClass("hide"); '\')" class="pointer"><span style="width: 20px; height: 20px; display: inline-block; background-image: url(\'../../img/sheet.png\'); background-size: 4900%; background-position: ' +
emoji['css'] +
';"></span></a>'
})
$('#emoji-list').html(emojis)
$('#now-emoji').text(lang.lang_defaultemojis_text.replace('{{cat}}', defaultemojiname[target]))
$('.emoji-control').addClass('hide')
} }
function customEmoji() { function customEmoji() {
$("#emoji-suggest").val(""); $('#emoji-suggest').val('')
$(".emoji-control").removeClass("hide"); $('.emoji-control').removeClass('hide')
emojiList('home') emojiList('home')
} }
function defEmoji(target) { function defEmoji(target) {
var selin = $("#textarea").prop('selectionStart'); var selin = $('#textarea').prop('selectionStart')
if (!selin) { if (!selin) {
selin = 0; selin = 0
} }
var emojiraw = newpack.filter(function (item, index) { var emojiraw = newpack.filter(function(item, index) {
if (item.short_name == target) return true; if (item.short_name == target) return true
}); })
var hex = emojiraw[0].unified.split("-"); var hex = emojiraw[0].unified.split('-')
if (hex.length === 2) { if (hex.length === 2) {
emoji = twemoji.convert.fromCodePoint(hex[0]) + twemoji.convert.fromCodePoint(hex[1]); emoji = twemoji.convert.fromCodePoint(hex[0]) + twemoji.convert.fromCodePoint(hex[1])
} else { } else {
emoji = twemoji.convert.fromCodePoint(hex[0]); emoji = twemoji.convert.fromCodePoint(hex[0])
} }
var now = $("#textarea").val(); var now = $('#textarea').val()
var before = now.substr(0, selin); var before = now.substr(0, selin)
var after = now.substr(selin, now.length); var after = now.substr(selin, now.length)
newt = before + emoji + after; var newt = before + emoji + after
$("#textarea").val(newt); $('#textarea').val(newt)
$("#textarea").focus(); $('#textarea').focus()
} }
function faicon() { function faicon() {
var json = faicons; var json = faicons
var emojis = ""; var emojis = ''
Object.keys(json).forEach(function (key) { Object.keys(json).forEach(function(key) {
var emoji = json[key]; var emoji = json[key]
var eje = emoji.replace(/fa-/g, ""); var eje = emoji.replace(/fa-/g, '')
emojis = emojis + '<a onclick="emojiInsert(\'[faicon]' + eje + '[/faicon]\')" class="pointer white-text" style="font-size:24px"><i class="fa ' + emoji + '"></i></a>'; emojis =
}); emojis +
$("#emoji-list").html(emojis); '<a onclick="emojiInsert(\'[faicon]' +
$("#now-emoji").text("faicon"); eje +
$(".emoji-control").addClass("hide"); '[/faicon]\')" class="pointer white-text" style="font-size:24px"><i class="fa ' +
emoji +
'"></i></a>'
})
$('#emoji-list').html(emojis)
$('#now-emoji').text('faicon')
$('.emoji-control').addClass('hide')
} }

View File

@ -380,9 +380,7 @@ function ckdb(acct_id) {
localStorage.setItem('imas', 'true') localStorage.setItem('imas', 'true')
$('.imasonly').show() $('.imasonly').show()
} }
var at = localStorage.getItem('acct_' + acct_id + '_at')
var bbcode = domain + '_bbcode' var bbcode = domain + '_bbcode'
var letters = domain + '_letters'
var quoteMarker = domain + '_quote' var quoteMarker = domain + '_quote'
if (localStorage.getItem('instance')) { if (localStorage.getItem('instance')) {
var json = JSON.parse(localStorage.getItem('instance')) var json = JSON.parse(localStorage.getItem('instance'))
@ -580,10 +578,10 @@ function multiSelector(parseC) {
//バージョンエンコ //バージョンエンコ
function enc(ver) { function enc(ver) {
var ver = ver.replace(/\s/g, '') var ver = ver.replace(/\s/g, '')
var ver = ver.replace(/\(/g, '-') ver = ver.replace(/\(/g, '-')
var ver = ver.replace(/\)/g, '') ver = ver.replace(/\)/g, '')
var ver = ver.replace(/\[/g, '_') ver = ver.replace(/\[/g, '_')
var ver = ver.replace(/\]/g, '') ver = ver.replace(/\]/g, '')
return ver return ver
} }
//インスタンスティッカー //インスタンスティッカー

View File

@ -318,13 +318,7 @@ function support() {
var instance = idata[key] var instance = idata[key]
if (instance == 'instance') { if (instance == 'instance') {
var templete = var templete =
'<a onclick="login(\'' + `<a onclick="login('${key}')" class="collection-item pointer transparent">${idata[key + '_name']}(${key})</a>`
key +
'\')" class="collection-item pointer transparent">' +
idata[key + '_name'] +
'(' +
key +
')</a>'
$('#support').append(templete) $('#support').append(templete)
} }
}) })
@ -332,8 +326,6 @@ function support() {
//URL指定してポップアップ //URL指定してポップアップ
function login(url) { function login(url) {
var multi = localStorage.getItem('multi')
var obj = JSON.parse(multi)
if ($('#misskey:checked').val() == 'on') { if ($('#misskey:checked').val() == 'on') {
$('#misskey').prop('checked', true) $('#misskey').prop('checked', true)
misskeyLogin(url) misskeyLogin(url)
@ -939,7 +931,6 @@ function multisel() {
} else { } else {
var obj = JSON.parse(multi) var obj = JSON.parse(multi)
} }
var templete
var last = localStorage.getItem('main') var last = localStorage.getItem('main')
var sel var sel
if (obj.length < 1) { if (obj.length < 1) {
@ -948,19 +939,16 @@ function multisel() {
} else { } else {
Object.keys(obj).forEach(function(key) { Object.keys(obj).forEach(function(key) {
var acct = obj[key] var acct = obj[key]
var list = key * 1 + 1
if (key == last) { if (key == last) {
sel = 'selected' sel = 'selected'
var mainb = '(' + lang.lang_manager_def + ')' var mainb = '(' + lang.lang_manager_def + ')'
var domain = localStorage.getItem('domain_' + key)
var profimg = localStorage.getItem('prof_' + key) var profimg = localStorage.getItem('prof_' + key)
var domain = localStorage.getItem('domain_' + key)
if (!profimg) { if (!profimg) {
profimg = '../../img/missing.svg' profimg = '../../img/missing.svg'
} }
} else { } else {
sel = '' sel = ''
mainb = '' var mainb = ''
} }
var template = ` var template = `
<option value="${key}" data-icon="${acct.prof}" class="left circle" ${sel}> <option value="${key}" data-icon="${acct.prof}" class="left circle" ${sel}>