WIP: use-strict 'login'
This commit is contained in:
parent
bae73521e9
commit
957ef30fc0
|
@ -1,192 +1,192 @@
|
|||
'use strict'
|
||||
var selectedColumn = 0
|
||||
var selectedToot = 0
|
||||
$(function ($) {
|
||||
$(function($) {
|
||||
//キーボードショートカット
|
||||
$(window).keydown(function (e) {
|
||||
var hasFocus = $('input').is(':focus');
|
||||
var hasFocus2 = $('textarea').is(':focus');
|
||||
if (document.getElementById("webview")) {
|
||||
if ($("#webviewsel:checked").val()) {
|
||||
var wv = false;
|
||||
$(window).keydown(function(e) {
|
||||
var hasFocus = $('input').is(':focus')
|
||||
var hasFocus2 = $('textarea').is(':focus')
|
||||
if (document.getElementById('webview')) {
|
||||
if ($('#webviewsel:checked').val()) {
|
||||
var wv = false
|
||||
} else {
|
||||
var wv = true;
|
||||
var wv = true
|
||||
}
|
||||
} else {
|
||||
var wv = true;
|
||||
var wv = true
|
||||
}
|
||||
//Enter
|
||||
if (e.keyCode === 13) {
|
||||
if($("#src").is(':focus')){
|
||||
if ($('#src').is(':focus')) {
|
||||
src()
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
if($("#list-add").is(':focus')){
|
||||
if ($('#list-add').is(':focus')) {
|
||||
makeNewList()
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
}
|
||||
//Ctrl+Shift+Enter:Lgen
|
||||
if (event.metaKey || event.ctrlKey && wv) {
|
||||
if (event.metaKey || (event.ctrlKey && wv)) {
|
||||
if (event.shiftKey) {
|
||||
if (e.keyCode === 13) {
|
||||
post('local');
|
||||
return false;
|
||||
post('local')
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
//Ctrl+Enter:投稿
|
||||
if (event.metaKey || event.ctrlKey && wv) {
|
||||
if (event.metaKey || (event.ctrlKey && wv)) {
|
||||
if (e.keyCode === 13) {
|
||||
post();
|
||||
return false;
|
||||
post()
|
||||
return false
|
||||
}
|
||||
}
|
||||
//Alt+Enter:セカンダリー
|
||||
if (event.metaKey || event.altKey && wv) {
|
||||
if (event.metaKey || (event.altKey && wv)) {
|
||||
if (e.keyCode === 13) {
|
||||
sec();
|
||||
return false;
|
||||
sec()
|
||||
return false
|
||||
}
|
||||
}
|
||||
//Esc:消す
|
||||
if (e.keyCode === 27 && wv) {
|
||||
hide();
|
||||
return false;
|
||||
hide()
|
||||
return false
|
||||
}
|
||||
//F5リロード
|
||||
if (e.keyCode === 116 && wv) {
|
||||
location.href = "index.html";
|
||||
return false;
|
||||
location.href = 'index.html'
|
||||
return false
|
||||
}
|
||||
//Ctrl+Sift+C:全消し
|
||||
if (((event.metaKey || event.ctrlKey) && event.shiftKey) && wv) {
|
||||
if ((event.metaKey || event.ctrlKey) && event.shiftKey && wv) {
|
||||
if (e.keyCode === 67) {
|
||||
clear();
|
||||
return false;
|
||||
clear()
|
||||
return false
|
||||
}
|
||||
}
|
||||
//Ctrl+Sift+N:NowPlaying
|
||||
if (((event.metaKey || event.ctrlKey) && event.shiftKey) && wv) {
|
||||
if ((event.metaKey || event.ctrlKey) && event.shiftKey && wv) {
|
||||
if (e.keyCode === 78) {
|
||||
show();
|
||||
show()
|
||||
nowplaying()
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
}
|
||||
//input/textareaにフォーカスなし時
|
||||
if ((!hasFocus && !hasFocus2) && wv) {
|
||||
if (!hasFocus && !hasFocus2 && wv) {
|
||||
if (!wv) {
|
||||
return true;
|
||||
return true
|
||||
}
|
||||
//Ctrl+V:いつもの
|
||||
if (event.metaKey || event.ctrlKey) {
|
||||
if (e.keyCode === 86) {
|
||||
show();
|
||||
show()
|
||||
}
|
||||
}
|
||||
//X:開閉
|
||||
if (e.keyCode === 88) {
|
||||
if (!$("#post-box").hasClass("appear")) {
|
||||
show();
|
||||
$('textarea').focus();
|
||||
if (!$('#post-box').hasClass('appear')) {
|
||||
show()
|
||||
$('textarea').focus()
|
||||
} else {
|
||||
hide();
|
||||
hide()
|
||||
}
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
//N:新トゥート
|
||||
if (e.keyCode === 78) {
|
||||
if (!$("#post-box").hasClass("appear")) {
|
||||
show();
|
||||
if (!$('#post-box').hasClass('appear')) {
|
||||
show()
|
||||
}
|
||||
$('textarea').focus();
|
||||
return false;
|
||||
$('textarea').focus()
|
||||
return false
|
||||
}
|
||||
//Ctrl+E:全ての通知未読を既読にする
|
||||
if (event.metaKey || event.ctrlKey) {
|
||||
if (e.keyCode === 69) {
|
||||
allNotfRead();
|
||||
return false;
|
||||
allNotfRead()
|
||||
return false
|
||||
}
|
||||
}
|
||||
//Ctrl+Space:読み込み
|
||||
if (event.metaKey || event.ctrlKey) {
|
||||
if (e.keyCode === 32) {
|
||||
parseColumn();
|
||||
return false;
|
||||
parseColumn()
|
||||
return false
|
||||
}
|
||||
}
|
||||
//Ctrl+Sift+S:設定
|
||||
if ((event.metaKey || event.ctrlKey) && event.shiftKey) {
|
||||
if (e.keyCode === 83) {
|
||||
location.href = "setting.html";
|
||||
return false;
|
||||
location.href = 'setting.html'
|
||||
return false
|
||||
}
|
||||
}
|
||||
//Ctrl+Sift+M:アカマネ
|
||||
if ((event.metaKey || event.ctrlKey) && event.shiftKey) {
|
||||
if (e.keyCode === 77) {
|
||||
location.href = "acct.html";
|
||||
return false;
|
||||
location.href = 'acct.html'
|
||||
return false
|
||||
}
|
||||
}
|
||||
//Ctrl+Sift+P:プロフ
|
||||
if ((event.metaKey || event.ctrlKey) && event.shiftKey) {
|
||||
if (e.keyCode === 80) {
|
||||
profShow()
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
}
|
||||
//数字:TL
|
||||
if (event.metaKey || event.ctrlKey) {
|
||||
if (e.keyCode >= 49 && e.keyCode <= 57) {
|
||||
var kz = e.keyCode - 49;
|
||||
goColumn(kz);
|
||||
return false;
|
||||
var kz = e.keyCode - 49
|
||||
goColumn(kz)
|
||||
return false
|
||||
}
|
||||
}
|
||||
//矢印:選択
|
||||
if (e.code == "ArrowLeft") {
|
||||
if (e.code == 'ArrowLeft') {
|
||||
//left
|
||||
if ($("#imagemodal").hasClass("open")) {
|
||||
imgCont('prev');
|
||||
return false;
|
||||
if ($('#imagemodal').hasClass('open')) {
|
||||
imgCont('prev')
|
||||
return false
|
||||
}
|
||||
if (selectedColumn > 0) {
|
||||
selectedColumn--
|
||||
}
|
||||
tootSelector(selectedColumn, selectedToot)
|
||||
return false;
|
||||
} else if (e.code == "ArrowUp") {
|
||||
return false
|
||||
} else if (e.code == 'ArrowUp') {
|
||||
//up
|
||||
if ($("#imagemodal").hasClass("open")) {
|
||||
return false;
|
||||
if ($('#imagemodal').hasClass('open')) {
|
||||
return false
|
||||
}
|
||||
if (selectedToot > 0) {
|
||||
selectedToot--
|
||||
}
|
||||
tootSelector(selectedColumn, selectedToot)
|
||||
return false;
|
||||
} else if (e.code == "ArrowRight") {
|
||||
return false
|
||||
} else if (e.code == 'ArrowRight') {
|
||||
//right
|
||||
if ($("#imagemodal").hasClass("open")) {
|
||||
imgCont('next');
|
||||
return false;
|
||||
if ($('#imagemodal').hasClass('open')) {
|
||||
imgCont('next')
|
||||
return false
|
||||
}
|
||||
if (selectedColumn < $(".tl-box").length - 1) {
|
||||
if (selectedColumn < $('.tl-box').length - 1) {
|
||||
selectedColumn++
|
||||
}
|
||||
tootSelector(selectedColumn, selectedToot)
|
||||
return false;
|
||||
} else if (e.code == "ArrowDown") {
|
||||
return false
|
||||
} else if (e.code == 'ArrowDown') {
|
||||
//down
|
||||
if ($("#imagemodal").hasClass("open")) {
|
||||
return false;
|
||||
if ($('#imagemodal').hasClass('open')) {
|
||||
return false
|
||||
}
|
||||
selectedToot++
|
||||
tootSelector(selectedColumn, selectedToot)
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
//Ctrl+U:0,0選択
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
|
@ -194,29 +194,29 @@ $(function ($) {
|
|||
selectedToot = 0
|
||||
selectedColumn = 0
|
||||
tootSelector(0, 0)
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
}
|
||||
//選択時
|
||||
if (e.keyCode == 70) {
|
||||
var id = $(".selectedToot").attr('unique-id')
|
||||
var acct_id = $('#timeline_' + selectedColumn).attr("data-acct")
|
||||
var id = $('.selectedToot').attr('unique-id')
|
||||
var acct_id = $('#timeline_' + selectedColumn).attr('data-acct')
|
||||
fav(id, acct_id, false)
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
if (e.keyCode == 66) {
|
||||
var id = $(".selectedToot").attr('unique-id')
|
||||
var acct_id = $('#timeline_' + selectedColumn).attr("data-acct")
|
||||
var id = $('.selectedToot').attr('unique-id')
|
||||
var acct_id = $('#timeline_' + selectedColumn).attr('data-acct')
|
||||
rt(id, acct_id, false)
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
if (e.keyCode == 82) {
|
||||
var id = $(".selectedToot").attr('unique-id')
|
||||
var acct_id = $('#timeline_' + selectedColumn).attr("data-acct")
|
||||
var ats_cm = $('.selectedToot .rep-btn').attr("data-men")
|
||||
var mode = $('.selectedToot .rep-btn').attr("data-visen")
|
||||
var id = $('.selectedToot').attr('unique-id')
|
||||
var acct_id = $('#timeline_' + selectedColumn).attr('data-acct')
|
||||
var ats_cm = $('.selectedToot .rep-btn').attr('data-men')
|
||||
var mode = $('.selectedToot .rep-btn').attr('data-visen')
|
||||
re(id, ats_cm, acct_id, mode)
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
}
|
||||
//textareaフォーカス時
|
||||
|
@ -225,23 +225,27 @@ $(function ($) {
|
|||
//C+S+(No):ワンクリ
|
||||
if ((event.metaKey || event.ctrlKey) && event.shiftKey) {
|
||||
if (e.keyCode >= 49 && e.keyCode <= 51) {
|
||||
var no = e.keyCode - 48;
|
||||
if (localStorage.getItem("oks-" + no)) { $("#textarea").val($("#textarea").val() + localStorage.getItem("oks-" + no)) }
|
||||
return false;
|
||||
var no = e.keyCode - 48
|
||||
if (localStorage.getItem('oks-' + no)) {
|
||||
$('#textarea').val($('#textarea').val() + localStorage.getItem('oks-' + no))
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
//クリアボタン
|
||||
$("#clear").click(function () {
|
||||
clear();
|
||||
});
|
||||
});
|
||||
$('#clear').click(function() {
|
||||
clear()
|
||||
})
|
||||
})
|
||||
//選択する
|
||||
function tootSelector(column, toot) {
|
||||
$('.cvo').removeClass("selectedToot")
|
||||
$('#timeline_' + column + ' .cvo').eq(toot).addClass("selectedToot")
|
||||
$('.cvo').removeClass('selectedToot')
|
||||
$('#timeline_' + column + ' .cvo')
|
||||
.eq(toot)
|
||||
.addClass('selectedToot')
|
||||
var scr = $('.tl-box[tlid=' + column + ']').scrollTop()
|
||||
var elem = $('.selectedToot').offset().top
|
||||
var top = elem - $('.tl-box').height() + scr
|
||||
|
@ -256,4 +260,4 @@ function tootSelector(column, toot) {
|
|||
$('.tl-box[tlid=' + column + ']').animate({ scrollTop: to })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,347 +1,373 @@
|
|||
'use strict'
|
||||
//バージョンチェッカー
|
||||
function verck(ver, jp) {
|
||||
console.log("%c Welcome😊", "color: red;font-size:200%;");
|
||||
var date = new Date();
|
||||
var show = false;
|
||||
if (localStorage.getItem("ver") != ver && localStorage.getItem("winstore")) {
|
||||
console.log('%c Welcome😊', 'color: red;font-size:200%;')
|
||||
var date = new Date()
|
||||
var show = false
|
||||
if (localStorage.getItem('ver') != ver && localStorage.getItem('winstore')) {
|
||||
//ちょっと削除とリンク解析の都合上アレ(s)
|
||||
//対象外のアプデ:storageが20の最初まで"Usamin (18.6.5)"
|
||||
if (!localStorage.getItem("usamin_18_6_5_flag")) {
|
||||
localStorage.setItem("usamin_18_6_5_flag", true);
|
||||
var multi = localStorage.getItem("column");
|
||||
var obj = JSON.parse(multi);
|
||||
if (!localStorage.getItem('usamin_18_6_5_flag')) {
|
||||
localStorage.setItem('usamin_18_6_5_flag', true)
|
||||
var multi = localStorage.getItem('column')
|
||||
var obj = JSON.parse(multi)
|
||||
for (var i = 0; i < obj.length; i++) {
|
||||
localStorage.removeItem("card_" + i);
|
||||
localStorage.removeItem('card_' + i)
|
||||
}
|
||||
}
|
||||
//ちょっと削除とリンク解析の都合上アレ(e)
|
||||
show = true;
|
||||
console.log("%c Thank you for your update🎉", "color: red;font-size:200%;");
|
||||
show = true
|
||||
console.log('%c Thank you for your update🎉', 'color: red;font-size:200%;')
|
||||
$(document).ready(function() {
|
||||
if (localStorage.getItem("winstore")) {
|
||||
$("#releasenote").modal("open");
|
||||
if (localStorage.getItem('winstore')) {
|
||||
$('#releasenote').modal('open')
|
||||
}
|
||||
verp = ver.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%;");
|
||||
if (lang.language == "ja") {
|
||||
$("#release-" + verp).show();
|
||||
var verp = ver.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%;')
|
||||
if (lang.language == 'ja') {
|
||||
$('#release-' + verp).show()
|
||||
} else {
|
||||
$("#release-en").show();
|
||||
$('#release-en').show()
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
localStorage.setItem("ver", ver);
|
||||
localStorage.setItem('ver', ver)
|
||||
if (!show) {
|
||||
console.log(show);
|
||||
if (date.getMonth() + 1 >= localStorage.getItem("showSupportMe") || !localStorage.getItem("showSupportMe")) {
|
||||
console.log(show)
|
||||
if (
|
||||
date.getMonth() + 1 >= localStorage.getItem('showSupportMe') ||
|
||||
!localStorage.getItem('showSupportMe')
|
||||
) {
|
||||
if (date.getMonth() == 11) {
|
||||
var nextmonth = 1;
|
||||
var nextmonth = 1
|
||||
} else {
|
||||
var nextmonth = date.getMonth() + 2;
|
||||
var nextmonth = date.getMonth() + 2
|
||||
}
|
||||
if (lang.language != "ja") {
|
||||
$("#support-btm-ja").addClass("hide");
|
||||
$("#support-btm-en").removeClass("hide");
|
||||
if (lang.language != 'ja') {
|
||||
$('#support-btm-ja').addClass('hide')
|
||||
$('#support-btm-en').removeClass('hide')
|
||||
}
|
||||
localStorage.setItem("showSupportMe", nextmonth);
|
||||
$("#support-btm").removeClass("hide");
|
||||
$("#support-btm").animate(
|
||||
localStorage.setItem('showSupportMe', nextmonth)
|
||||
$('#support-btm').removeClass('hide')
|
||||
$('#support-btm').animate(
|
||||
{
|
||||
bottom: "0"
|
||||
bottom: '0'
|
||||
},
|
||||
{
|
||||
duration: 300
|
||||
}
|
||||
);
|
||||
)
|
||||
}
|
||||
}
|
||||
var platform = localStorage.getItem("platform");
|
||||
console.log("Your platform:" + platform);
|
||||
if (!localStorage.getItem("winstore")) {
|
||||
$("#start").css("display", "flex");
|
||||
var platform = localStorage.getItem('platform')
|
||||
console.log('Your platform:' + platform)
|
||||
if (!localStorage.getItem('winstore')) {
|
||||
$('#start').css('display', 'flex')
|
||||
}
|
||||
if (localStorage.getItem("winstore") == "brewcask" || localStorage.getItem("winstore") == "snapcraft" || localStorage.getItem("winstore") == "winstore") {
|
||||
var winstore = true;
|
||||
if (
|
||||
localStorage.getItem('winstore') == 'brewcask' ||
|
||||
localStorage.getItem('winstore') == 'snapcraft' ||
|
||||
localStorage.getItem('winstore') == 'winstore'
|
||||
) {
|
||||
var winstore = true
|
||||
} else {
|
||||
var winstore = false;
|
||||
var winstore = false
|
||||
}
|
||||
var l = 5;
|
||||
var l = 5
|
||||
// 生成する文字列に含める文字セット
|
||||
var c = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
var cl = c.length;
|
||||
var r = "";
|
||||
var c = 'abcdefghijklmnopqrstuvwxyz0123456789'
|
||||
var cl = c.length
|
||||
var r = ''
|
||||
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, {
|
||||
method: "GET"
|
||||
method: 'GET'
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
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) {
|
||||
todo(error);setLog(start, "JSON", error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(mess) {
|
||||
console.table(mess);
|
||||
console.table(mess)
|
||||
if (mess) {
|
||||
//askjp_jp_ua: 2019年10月24日、mstdn.jpによるユーザーエージェントアクセス制限
|
||||
if (jp && mess.jp_ua && !localStorage.getItem("askjp_jp_ua")) {
|
||||
localStorage.setItem("askjp_jp_ua", true);
|
||||
$("#askjp_jp_ua").removeClass("hide");
|
||||
if (jp && mess.jp_ua && !localStorage.getItem('askjp_jp_ua')) {
|
||||
localStorage.setItem('askjp_jp_ua', true)
|
||||
$('#askjp_jp_ua').removeClass('hide')
|
||||
}
|
||||
var platform = localStorage.getItem("platform");
|
||||
if (platform == "darwin") {
|
||||
var newest = mess.desk_mac;
|
||||
var platform = localStorage.getItem('platform')
|
||||
if (platform == 'darwin') {
|
||||
var newest = mess.desk_mac
|
||||
} else {
|
||||
var newest = mess.desk;
|
||||
var newest = mess.desk
|
||||
}
|
||||
if (newest == ver) {
|
||||
todo(lang.lang_version_usever.replace("{{ver}}", mess.desk));
|
||||
todo(lang.lang_version_usever.replace('{{ver}}', mess.desk))
|
||||
//betaかWinstoreならアプデチェックしない
|
||||
} else if (ver.indexOf("beta") != -1 || winstore) {
|
||||
} else if (ver.indexOf('beta') != -1 || winstore) {
|
||||
} else {
|
||||
localStorage.removeItem("instance");
|
||||
if (localStorage.getItem("new-ver-skip")) {
|
||||
if (localStorage.getItem("next-ver") != newest) {
|
||||
postMessage(["sendSinmpleIpc", "update"], "*");
|
||||
localStorage.removeItem('instance')
|
||||
if (localStorage.getItem('new-ver-skip')) {
|
||||
if (localStorage.getItem('next-ver') != newest) {
|
||||
postMessage(['sendSinmpleIpc', 'update'], '*')
|
||||
} else {
|
||||
console.warn(lang.lang_version_skipver);
|
||||
todo(lang.lang_version_skipver);
|
||||
console.warn(lang.lang_version_skipver)
|
||||
todo(lang.lang_version_skipver)
|
||||
}
|
||||
} else {
|
||||
postMessage(["sendSinmpleIpc", "update"], "*");
|
||||
postMessage(['sendSinmpleIpc', 'update'], '*')
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!localStorage.getItem("last-notice-id")) {
|
||||
localStorage.setItem("last-notice-id", 0);
|
||||
})
|
||||
if (!localStorage.getItem('last-notice-id')) {
|
||||
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, {
|
||||
method: "GET"
|
||||
method: 'GET'
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
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) {
|
||||
todo(error);setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(mess) {
|
||||
if (mess.length < 1) {
|
||||
return false;
|
||||
return false
|
||||
} else {
|
||||
var last = localStorage.getItem("last-notice-id");
|
||||
localStorage.setItem("last-notice-id", mess[0].ID);
|
||||
var last = localStorage.getItem('last-notice-id')
|
||||
localStorage.setItem('last-notice-id', mess[0].ID)
|
||||
for (i = 0; i < mess.length; i++) {
|
||||
var obj = mess[i];
|
||||
var obj = mess[i]
|
||||
if (obj.ID * 1 <= last) {
|
||||
break;
|
||||
break
|
||||
} else {
|
||||
if (obj.type == "textv2") {
|
||||
if (obj.type == 'textv2') {
|
||||
if (~obj.languages.indexOf(lang.language)) {
|
||||
var show = true;
|
||||
if (obj.toot != "") {
|
||||
var toot = '<button class="btn-flat toast-action" onclick="detEx(\'' + obj.toot + "','main')\">Show</button>";
|
||||
var show = true
|
||||
if (obj.toot != '') {
|
||||
var toot =
|
||||
'<button class="btn-flat toast-action" onclick="detEx(\'' +
|
||||
obj.toot +
|
||||
"','main')\">Show</button>"
|
||||
} else {
|
||||
var toot = "";
|
||||
var toot = ''
|
||||
}
|
||||
if (obj.ver != "") {
|
||||
if (obj.ver != '') {
|
||||
if (obj.ver == ver) {
|
||||
show = true;
|
||||
show = true
|
||||
} else {
|
||||
show = false;
|
||||
show = false
|
||||
}
|
||||
}
|
||||
if (obj.domain != "") {
|
||||
var multi = localStorage.getItem("multi");
|
||||
if (obj.domain != '') {
|
||||
var multi = localStorage.getItem('multi')
|
||||
if (multi) {
|
||||
show = false;
|
||||
var accts = JSON.parse(multi);
|
||||
show = false
|
||||
var accts = JSON.parse(multi)
|
||||
Object.keys(accts).forEach(function(key) {
|
||||
var acct = accts[key];
|
||||
var acct = accts[key]
|
||||
if (acct.domain == obj.domain) {
|
||||
show = true;
|
||||
show = true
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
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() {
|
||||
var infows = new WebSocket("wss://thedesk.top/ws/");
|
||||
var infows = new WebSocket('wss://thedesk.top/ws/')
|
||||
infows.onopen = function(mess) {
|
||||
console.log([tlid, ":Connect Streaming Info:", mess]);
|
||||
infostreaming = true;
|
||||
};
|
||||
console.log([tlid, ':Connect Streaming Info:', mess])
|
||||
infostreaming = true
|
||||
}
|
||||
infows.onmessage = function(mess) {
|
||||
console.log([tlid, ":Receive Streaming:", JSON.parse(mess.data)]);
|
||||
var obj = JSON.parse(mess.data);
|
||||
if (obj.type != "counter") {
|
||||
if (obj.type == "textv2") {
|
||||
console.log([tlid, ':Receive Streaming:', JSON.parse(mess.data)])
|
||||
var obj = JSON.parse(mess.data)
|
||||
if (obj.type != 'counter') {
|
||||
if (obj.type == 'textv2') {
|
||||
if (~obj.languages.indexOf(lang.language)) {
|
||||
localStorage.setItem("last-notice-id", obj.id);
|
||||
var show = true;
|
||||
if (obj.toot != "") {
|
||||
var toot = '<button class="btn-flat toast-action" onclick="detEx(\'' + obj.toot + "','main')\">Show</button>";
|
||||
localStorage.setItem('last-notice-id', obj.id)
|
||||
var show = true
|
||||
if (obj.toot != '') {
|
||||
var toot =
|
||||
'<button class="btn-flat toast-action" onclick="detEx(\'' +
|
||||
obj.toot +
|
||||
"','main')\">Show</button>"
|
||||
} else {
|
||||
var toot = "";
|
||||
var toot = ''
|
||||
}
|
||||
if (obj.ver != "") {
|
||||
if (obj.ver != '') {
|
||||
if (obj.ver == ver) {
|
||||
show = true;
|
||||
show = true
|
||||
} else {
|
||||
show = false;
|
||||
show = false
|
||||
}
|
||||
}
|
||||
if (obj.domain != "") {
|
||||
var multi = localStorage.getItem("multi");
|
||||
if (obj.domain != '') {
|
||||
var multi = localStorage.getItem('multi')
|
||||
if (multi) {
|
||||
show = false;
|
||||
var accts = JSON.parse(multi);
|
||||
show = false
|
||||
var accts = JSON.parse(multi)
|
||||
Object.keys(accts).forEach(function(key) {
|
||||
var acct = accts[key];
|
||||
var acct = accts[key]
|
||||
if (acct.domain == obj.domain) {
|
||||
show = true;
|
||||
show = true
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
if (show) {
|
||||
console.log(obj.text);
|
||||
console.log(escapeHTML(obj.text));
|
||||
M.toast({ html: escapeHTML(obj.text) + toot + '<span class="sml grey-text">(スライドして消去)</span>', displayLength: 86400 });
|
||||
console.log(obj.text)
|
||||
console.log(escapeHTML(obj.text))
|
||||
M.toast({
|
||||
html:
|
||||
escapeHTML(obj.text) +
|
||||
toot +
|
||||
'<span class="sml grey-text">(スライドして消去)</span>',
|
||||
displayLength: 86400
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$("#persons").text(obj.text);
|
||||
$('#persons').text(obj.text)
|
||||
}
|
||||
};
|
||||
}
|
||||
infows.onerror = function(error) {
|
||||
infostreaming = false;
|
||||
console.error("Error closing:info");
|
||||
console.error(error);
|
||||
return false;
|
||||
};
|
||||
infostreaming = false
|
||||
console.error('Error closing:info')
|
||||
console.error(error)
|
||||
return false
|
||||
}
|
||||
infows.onclose = function() {
|
||||
infostreaming = false;
|
||||
console.error("Closing:info");
|
||||
};
|
||||
infostreaming = false
|
||||
console.error('Closing:info')
|
||||
}
|
||||
}
|
||||
setInterval(function() {
|
||||
if (!infostreaming) {
|
||||
console.log("try to connect to base-streaming");
|
||||
infowebsocket();
|
||||
console.log('try to connect to base-streaming')
|
||||
infowebsocket()
|
||||
}
|
||||
}, 10000);
|
||||
}, 10000)
|
||||
function openRN() {
|
||||
$("#releasenote").modal("open");
|
||||
if (lang.language == "ja") {
|
||||
verp = ver.replace("(", "");
|
||||
verp = verp.replace(".", "-");
|
||||
verp = verp.replace(".", "-");
|
||||
verp = verp.replace("[", "-");
|
||||
verp = verp.replace("]", "");
|
||||
verp = verp.replace(")", "");
|
||||
verp = verp.replace(" ", "_");
|
||||
$("#release-" + verp).show();
|
||||
$('#releasenote').modal('open')
|
||||
if (lang.language == 'ja') {
|
||||
verp = ver.replace('(', '')
|
||||
verp = verp.replace('.', '-')
|
||||
verp = verp.replace('.', '-')
|
||||
verp = verp.replace('[', '-')
|
||||
verp = verp.replace(']', '')
|
||||
verp = verp.replace(')', '')
|
||||
verp = verp.replace(' ', '_')
|
||||
$('#release-' + verp).show()
|
||||
} else {
|
||||
$("#release-en").show();
|
||||
$('#release-en').show()
|
||||
}
|
||||
}
|
||||
function closeSupport() {
|
||||
$("#support-btm").animate(
|
||||
$('#support-btm').animate(
|
||||
{
|
||||
bottom: "-300px"
|
||||
bottom: '-300px'
|
||||
},
|
||||
{
|
||||
duration: 300,
|
||||
complete: function() {
|
||||
$("#support-btm").addClass("hide");
|
||||
$('#support-btm').addClass('hide')
|
||||
}
|
||||
}
|
||||
);
|
||||
)
|
||||
}
|
||||
function storeDialog(platform, ver) {
|
||||
if (platform == "win32") {
|
||||
var mes = lang.lang_version_platform;
|
||||
} else if (platform == "linux") {
|
||||
var mes = lang.lang_version_platform_linux;
|
||||
} else if (platform == "darwin") {
|
||||
var mes = lang.lang_version_platform_mac;
|
||||
if (platform == 'win32') {
|
||||
var mes = lang.lang_version_platform
|
||||
} else if (platform == 'linux') {
|
||||
var mes = lang.lang_version_platform_linux
|
||||
} else if (platform == 'darwin') {
|
||||
var mes = lang.lang_version_platform_mac
|
||||
}
|
||||
Swal.fire({
|
||||
title: "Select your platform",
|
||||
title: 'Select your platform',
|
||||
text: mes,
|
||||
type: "info",
|
||||
type: 'info',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#3085d6",
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: lang.lang_no,
|
||||
cancelButtonText: lang.lang_yesno
|
||||
}).then(result => {
|
||||
//逆にしてる
|
||||
if (!result.value) {
|
||||
localStorage.setItem("winstore", "winstore");
|
||||
localStorage.setItem('winstore', 'winstore')
|
||||
} else {
|
||||
localStorage.setItem("winstore", "localinstall");
|
||||
localStorage.setItem('winstore', 'localinstall')
|
||||
}
|
||||
localStorage.setItem("ver", ver);
|
||||
show = true;
|
||||
console.log("%c Thank you for your update🎉", "color: red;font-size:200%;");
|
||||
localStorage.setItem('ver', ver)
|
||||
console.log('%c Thank you for your update🎉', 'color: red;font-size:200%;')
|
||||
$(document).ready(function() {
|
||||
$("#releasenote").modal("open");
|
||||
verp = ver.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%;");
|
||||
if (lang.language == "ja") {
|
||||
$("#release-" + verp).show();
|
||||
$('#releasenote').modal('open')
|
||||
var verp = ver.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%;')
|
||||
if (lang.language == 'ja') {
|
||||
$('#release-' + verp).show()
|
||||
} else {
|
||||
$("#release-en").show();
|
||||
$('#release-en').show()
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
}
|
||||
function closeStart() {
|
||||
$("#start").css("display", "none");
|
||||
var platform = localStorage.getItem("platform");
|
||||
var ver = localStorage.getItem("ver");
|
||||
storeDialog(platform, ver);
|
||||
$('#start').css('display', 'none')
|
||||
var platform = localStorage.getItem('platform')
|
||||
var ver = localStorage.getItem('ver')
|
||||
storeDialog(platform, ver)
|
||||
}
|
||||
|
|
|
@ -1,85 +1,97 @@
|
|||
'use strict'
|
||||
var defaultemojiList = ["activity", "flag", "food", "nature", "object", "people", "place", "symbol"];
|
||||
var defaultemojiList = ['activity', 'flag', 'food', 'nature', 'object', 'people', 'place', 'symbol']
|
||||
var defaultemoji = {
|
||||
activity: activity,
|
||||
flag: flag,
|
||||
food: food,
|
||||
nature: nature,
|
||||
object: object,
|
||||
people: people,
|
||||
place: place,
|
||||
symbol: symbol
|
||||
};
|
||||
if (lang == "ja") {
|
||||
var defaultemojiname = {
|
||||
activity: "活動",
|
||||
flag: "国旗",
|
||||
food: "食べ物",
|
||||
nature: "自然",
|
||||
object: "もの",
|
||||
people: "ひと",
|
||||
place: "場所",
|
||||
symbol: "記号"
|
||||
};
|
||||
activity: activity,
|
||||
flag: flag,
|
||||
food: food,
|
||||
nature: nature,
|
||||
object: object,
|
||||
people: people,
|
||||
place: place,
|
||||
symbol: symbol
|
||||
}
|
||||
if (lang == 'ja') {
|
||||
var defaultemojiname = {
|
||||
activity: '活動',
|
||||
flag: '国旗',
|
||||
food: '食べ物',
|
||||
nature: '自然',
|
||||
object: 'もの',
|
||||
people: 'ひと',
|
||||
place: '場所',
|
||||
symbol: '記号'
|
||||
}
|
||||
} else {
|
||||
var defaultemojiname = {
|
||||
activity: "Activities",
|
||||
flag: "Flags",
|
||||
food: "Foods",
|
||||
nature: "Nature",
|
||||
object: "Tools",
|
||||
people: "People",
|
||||
place: "Places",
|
||||
symbol: "Symbols"
|
||||
};
|
||||
var defaultemojiname = {
|
||||
activity: 'Activities',
|
||||
flag: 'Flags',
|
||||
food: 'Foods',
|
||||
nature: 'Nature',
|
||||
object: 'Tools',
|
||||
people: 'People',
|
||||
place: 'Places',
|
||||
symbol: 'Symbols'
|
||||
}
|
||||
}
|
||||
|
||||
function defaultEmoji(target) {
|
||||
var json = defaultemoji[target];
|
||||
var emojis = "";
|
||||
Object.keys(json).forEach(function (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>';
|
||||
});
|
||||
$("#emoji-list").html(emojis);
|
||||
$("#now-emoji").text(lang.lang_defaultemojis_text.replace("{{cat}}", defaultemojiname[target]));
|
||||
$(".emoji-control").addClass("hide");
|
||||
var json = defaultemoji[target]
|
||||
var emojis = ''
|
||||
Object.keys(json).forEach(function(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>'
|
||||
})
|
||||
$('#emoji-list').html(emojis)
|
||||
$('#now-emoji').text(lang.lang_defaultemojis_text.replace('{{cat}}', defaultemojiname[target]))
|
||||
$('.emoji-control').addClass('hide')
|
||||
}
|
||||
function customEmoji() {
|
||||
$("#emoji-suggest").val("");
|
||||
$(".emoji-control").removeClass("hide");
|
||||
emojiList('home')
|
||||
$('#emoji-suggest').val('')
|
||||
$('.emoji-control').removeClass('hide')
|
||||
emojiList('home')
|
||||
}
|
||||
function defEmoji(target) {
|
||||
var selin = $("#textarea").prop('selectionStart');
|
||||
if (!selin) {
|
||||
selin = 0;
|
||||
}
|
||||
var emojiraw = newpack.filter(function (item, index) {
|
||||
if (item.short_name == target) return true;
|
||||
});
|
||||
var hex = emojiraw[0].unified.split("-");
|
||||
if (hex.length === 2) {
|
||||
emoji = twemoji.convert.fromCodePoint(hex[0]) + twemoji.convert.fromCodePoint(hex[1]);
|
||||
} else {
|
||||
emoji = twemoji.convert.fromCodePoint(hex[0]);
|
||||
}
|
||||
var now = $("#textarea").val();
|
||||
var before = now.substr(0, selin);
|
||||
var after = now.substr(selin, now.length);
|
||||
newt = before + emoji + after;
|
||||
$("#textarea").val(newt);
|
||||
$("#textarea").focus();
|
||||
var selin = $('#textarea').prop('selectionStart')
|
||||
if (!selin) {
|
||||
selin = 0
|
||||
}
|
||||
var emojiraw = newpack.filter(function(item, index) {
|
||||
if (item.short_name == target) return true
|
||||
})
|
||||
var hex = emojiraw[0].unified.split('-')
|
||||
if (hex.length === 2) {
|
||||
emoji = twemoji.convert.fromCodePoint(hex[0]) + twemoji.convert.fromCodePoint(hex[1])
|
||||
} else {
|
||||
emoji = twemoji.convert.fromCodePoint(hex[0])
|
||||
}
|
||||
var now = $('#textarea').val()
|
||||
var before = now.substr(0, selin)
|
||||
var after = now.substr(selin, now.length)
|
||||
var newt = before + emoji + after
|
||||
$('#textarea').val(newt)
|
||||
$('#textarea').focus()
|
||||
}
|
||||
function faicon() {
|
||||
var json = faicons;
|
||||
var emojis = "";
|
||||
Object.keys(json).forEach(function (key) {
|
||||
var emoji = json[key];
|
||||
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>';
|
||||
});
|
||||
$("#emoji-list").html(emojis);
|
||||
$("#now-emoji").text("faicon");
|
||||
$(".emoji-control").addClass("hide");
|
||||
}
|
||||
var json = faicons
|
||||
var emojis = ''
|
||||
Object.keys(json).forEach(function(key) {
|
||||
var emoji = json[key]
|
||||
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>'
|
||||
})
|
||||
$('#emoji-list').html(emojis)
|
||||
$('#now-emoji').text('faicon')
|
||||
$('.emoji-control').addClass('hide')
|
||||
}
|
||||
|
|
|
@ -380,9 +380,7 @@ function ckdb(acct_id) {
|
|||
localStorage.setItem('imas', 'true')
|
||||
$('.imasonly').show()
|
||||
}
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var bbcode = domain + '_bbcode'
|
||||
var letters = domain + '_letters'
|
||||
var quoteMarker = domain + '_quote'
|
||||
if (localStorage.getItem('instance')) {
|
||||
var json = JSON.parse(localStorage.getItem('instance'))
|
||||
|
@ -580,10 +578,10 @@ function multiSelector(parseC) {
|
|||
//バージョンエンコ
|
||||
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, '')
|
||||
ver = ver.replace(/\(/g, '-')
|
||||
ver = ver.replace(/\)/g, '')
|
||||
ver = ver.replace(/\[/g, '_')
|
||||
ver = ver.replace(/\]/g, '')
|
||||
return ver
|
||||
}
|
||||
//インスタンスティッカー
|
||||
|
|
|
@ -318,13 +318,7 @@ function support() {
|
|||
var instance = idata[key]
|
||||
if (instance == 'instance') {
|
||||
var templete =
|
||||
'<a onclick="login(\'' +
|
||||
key +
|
||||
'\')" class="collection-item pointer transparent">' +
|
||||
idata[key + '_name'] +
|
||||
'(' +
|
||||
key +
|
||||
')</a>'
|
||||
`<a onclick="login('${key}')" class="collection-item pointer transparent">${idata[key + '_name']}(${key})</a>`
|
||||
$('#support').append(templete)
|
||||
}
|
||||
})
|
||||
|
@ -332,8 +326,6 @@ function support() {
|
|||
|
||||
//URL指定してポップアップ
|
||||
function login(url) {
|
||||
var multi = localStorage.getItem('multi')
|
||||
var obj = JSON.parse(multi)
|
||||
if ($('#misskey:checked').val() == 'on') {
|
||||
$('#misskey').prop('checked', true)
|
||||
misskeyLogin(url)
|
||||
|
@ -939,7 +931,6 @@ function multisel() {
|
|||
} else {
|
||||
var obj = JSON.parse(multi)
|
||||
}
|
||||
var templete
|
||||
var last = localStorage.getItem('main')
|
||||
var sel
|
||||
if (obj.length < 1) {
|
||||
|
@ -948,19 +939,16 @@ function multisel() {
|
|||
} else {
|
||||
Object.keys(obj).forEach(function(key) {
|
||||
var acct = obj[key]
|
||||
var list = key * 1 + 1
|
||||
if (key == last) {
|
||||
sel = 'selected'
|
||||
var mainb = '(' + lang.lang_manager_def + ')'
|
||||
var domain = localStorage.getItem('domain_' + key)
|
||||
var profimg = localStorage.getItem('prof_' + key)
|
||||
var domain = localStorage.getItem('domain_' + key)
|
||||
if (!profimg) {
|
||||
profimg = '../../img/missing.svg'
|
||||
}
|
||||
} else {
|
||||
sel = ''
|
||||
mainb = ''
|
||||
var mainb = ''
|
||||
}
|
||||
var template = `
|
||||
<option value="${key}" data-icon="${acct.prof}" class="left circle" ${sel}>
|
||||
|
|
Loading…
Reference in New Issue
Block a user