with acct lookup

This commit is contained in:
cutls 2021-06-02 15:59:36 +09:00
parent 5621ffbe42
commit 36ad187296
8 changed files with 2174 additions and 2120 deletions

8
.prettierrc Normal file
View File

@ -0,0 +1,8 @@
{
"tabWidth": 4,
"useTabs": true,
"semi": false,
"singleQuote": true,
"printWidth": 200,
"jsxBracketSameLine": true
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,436 +1,437 @@
//通知 //通知
//取得+Streaming接続 //取得+Streaming接続
function notf(acct_id, tlid, sys) { function notf(acct_id, tlid, sys) {
if (sys == 'direct') { if (sys == 'direct') {
notfColumn(acct_id, tlid, sys) notfColumn(acct_id, tlid, sys)
} else { } else {
notfCommon(acct_id, tlid, sys) notfCommon(acct_id, tlid, sys)
} }
} }
function notfColumn(acct_id, tlid, sys) { function notfColumn(acct_id, tlid, sys) {
todo('Notifications Loading...') todo('Notifications Loading...')
var native = localStorage.getItem('nativenotf') var native = localStorage.getItem('nativenotf')
var at = localStorage.getItem('acct_' + acct_id + '_at') var at = localStorage.getItem('acct_' + acct_id + '_at')
if (!native) { if (!native) {
native = 'yes' native = 'yes'
} }
var domain = localStorage.getItem('domain_' + acct_id) var domain = localStorage.getItem('domain_' + acct_id)
var httpreq = new XMLHttpRequest() var httpreq = new XMLHttpRequest()
if (localStorage.getItem('mode_' + domain) == 'misskey') { if (localStorage.getItem('mode_' + domain) == 'misskey') {
var misskey = true var misskey = true
var start = 'https://' + domain + '/api/i/notifications' var start = 'https://' + domain + '/api/i/notifications'
httpreq.open('POST', start, true) httpreq.open('POST', start, true)
httpreq.setRequestHeader('Content-Type', 'application/json') httpreq.setRequestHeader('Content-Type', 'application/json')
var body = JSON.stringify({ var body = JSON.stringify({
i: at i: at,
}) })
} else { } else {
var misskey = false var misskey = false
if (localStorage.getItem('exclude-' + tlid)) { if (localStorage.getItem('exclude-' + tlid)) {
var exc = localStorage.getItem('exclude-' + tlid) var exc = localStorage.getItem('exclude-' + tlid)
} else { } else {
var exc = '' var exc = ''
} }
var start = 'https://' + domain + '/api/v1/notifications' + exc var start = 'https://' + domain + '/api/v1/notifications' + exc
httpreq.open('GET', start, true) httpreq.open('GET', start, true)
httpreq.setRequestHeader('Content-Type', 'application/json') httpreq.setRequestHeader('Content-Type', 'application/json')
httpreq.setRequestHeader('Authorization', 'Bearer ' + at) httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
var body = '' var body = ''
} }
httpreq.responseType = 'json' httpreq.responseType = 'json'
httpreq.send(body) httpreq.send(body)
httpreq.onreadystatechange = function() { httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) { if (httpreq.readyState === 4) {
var json = httpreq.response var json = httpreq.response
if (this.status !== 200) { if (this.status !== 200) {
$('#landing_' + tlid).append(`<div>${this.status}</div><div>${escapeHTML(this.response)}`) $('#landing_' + tlid).append(`<div>${this.status}</div><div>${escapeHTML(this.response)}`)
setLog(start, this.status, this.response) setLog(start, this.status, this.response)
} }
var max_id = httpreq.getResponseHeader('link') var max_id = httpreq.getResponseHeader('link')
if (max_id) { if (max_id) {
max_id = max_id.match(/[?&]{1}max_id=([0-9]+)/)[1] max_id = max_id.match(/[?&]{1}max_id=([0-9]+)/)[1]
} }
if (json[0]) { if (json[0]) {
var templete = '' var templete = ''
var lastnotf = localStorage.getItem('lastnotf_' + acct_id) var lastnotf = localStorage.getItem('lastnotf_' + acct_id)
localStorage.setItem('lastnotf_' + acct_id, json[0].id) localStorage.setItem('lastnotf_' + acct_id, json[0].id)
Object.keys(json).forEach(function(key) { Object.keys(json).forEach(function(key) {
var obj = json[key] var obj = json[key]
if (lastnotf == obj.id && key > 0 && native == 'yes') { if (lastnotf == obj.id && key > 0 && native == 'yes') {
var ct = key var ct = key
if (key > 14) { if (key > 14) {
ct = '15+' ct = '15+'
} }
var os = localStorage.getItem('platform') var os = localStorage.getItem('platform')
var options = { var options = {
body: ct + lang.lang_notf_new, body: ct + lang.lang_notf_new,
icon: localStorage.getItem('prof_' + acct_id) icon: localStorage.getItem('prof_' + acct_id),
} }
var n = new Notification('TheDesk:' + domain, options) var n = new Notification('TheDesk:' + domain, options)
} }
var mute = getFilterTypeByAcct(acct_id, 'notif') var mute = getFilterTypeByAcct(acct_id, 'notif')
//Pleromaにはmoveというtypeがあるらしい。何が互換APIじゃ //Pleromaにはmoveというtypeがあるらしい。何が互換APIじゃ
if (obj.type != 'follow' && obj.type != 'move' && obj.type != 'follow_request') { if (obj.type != 'follow' && obj.type != 'move' && obj.type != 'follow_request') {
if (misskey) { if (misskey) {
templete = templete + misskeyParse([obj], 'notf', acct_id, tlid, -1, mute) templete = templete + misskeyParse([obj], 'notf', acct_id, tlid, -1, mute)
} else { } else {
templete = templete + parse([obj], 'notf', acct_id, tlid, -1, mute) templete = templete + parse([obj], 'notf', acct_id, tlid, -1, mute)
} }
} else if (obj.type == 'follow_request') { } else if (obj.type == 'follow_request') {
templete = templete + userparse([obj.account], 'request', acct_id, tlid, -1) templete = templete + userparse([obj.account], 'request', acct_id, tlid, -1)
} else { } else {
if (misskey) { if (misskey) {
templete = templete + misskeyUserparse([obj], 'notf', acct_id, tlid, -1, mute) templete = templete + misskeyUserparse([obj], 'notf', acct_id, tlid, -1, mute)
} else { } else {
templete = templete + userparse([obj.account], obj.type, acct_id, tlid, -1) templete = templete + userparse([obj.account], obj.type, acct_id, tlid, -1)
} }
} }
}) })
templete = templete + '<div class="hide notif-marker" data-maxid="' + max_id + '"></div>' templete = templete + '<div class="hide notif-marker" data-maxid="' + max_id + '"></div>'
$('#timeline_' + tlid).html(templete) $('#timeline_' + tlid).html(templete)
// $('#landing_' + tlid).hide() // $('#landing_' + tlid).hide()
jQuery('time.timeago').timeago() jQuery('time.timeago').timeago()
} }
$('#notf-box').addClass('fetched') $('#notf-box').addClass('fetched')
todc() todc()
//Markers //Markers
var markers = localStorage.getItem('markers') var markers = localStorage.getItem('markers')
if (markers == 'yes') { if (markers == 'yes') {
markers = true markers = true
} else { } else {
markers = false markers = false
} }
if (markers) { if (markers) {
getMarker(tlid, 'notf', acct_id) getMarker(tlid, 'notf', acct_id)
} }
} }
} }
if (!misskey) { if (!misskey) {
if (localStorage.getItem('streaming_' + acct_id)) { if (localStorage.getItem('streaming_' + acct_id)) {
var wss = localStorage.getItem('streaming_' + acct_id) var wss = localStorage.getItem('streaming_' + acct_id)
} else { } else {
var wss = 'wss://' + domain var wss = 'wss://' + domain
} }
var start = wss + '/api/v1/streaming/?stream=user&access_token=' + at var start = wss + '/api/v1/streaming/?stream=user&access_token=' + at
} else { } else {
var start = 'wss://' + domain + '/?i=' + at var start = 'wss://' + domain + '/?i=' + at
} }
} }
function notfCommon(acct_id, tlid, sys, stream) { function notfCommon(acct_id, tlid, sys, stream) {
todo('Notifications Loading...') todo('Notifications Loading...')
var native = localStorage.getItem('nativenotf') var native = localStorage.getItem('nativenotf')
var at = localStorage.getItem('acct_' + acct_id + '_at') var at = localStorage.getItem('acct_' + acct_id + '_at')
if (!native) { if (!native) {
native = 'yes' native = 'yes'
} }
var domain = localStorage.getItem('domain_' + acct_id) var domain = localStorage.getItem('domain_' + acct_id)
if (localStorage.getItem('mode_' + domain) == 'misskey') { if (localStorage.getItem('mode_' + domain) == 'misskey') {
var misskey = true var misskey = true
var start = 'https://' + domain + '/api/i/notifications' var start = 'https://' + domain + '/api/i/notifications'
var i = { var i = {
method: 'POST', method: 'POST',
headers: { headers: {
'content-type': 'application/json' 'content-type': 'application/json',
}, },
body: JSON.stringify({ body: JSON.stringify({
i: at i: at,
}) }),
} }
} else { } else {
var misskey = false var misskey = false
var start = 'https://' + domain + '/api/v1/notifications' var start = 'https://' + domain + '/api/v1/notifications'
var i = { var i = {
method: 'GET', method: 'GET',
headers: { headers: {
'content-type': 'application/json', 'content-type': 'application/json',
Authorization: 'Bearer ' + at Authorization: 'Bearer ' + at,
} },
} }
} }
if(stream == 'only') { if (stream == 'only') {
notfWS(misskey, acct_id, tlid, domain, at) notfWS(misskey, acct_id, tlid, domain, at)
return false return false
} }
fetch(start, i) fetch(start, i)
.then(function(response) { .then(function(response) {
console.log('header to get param:' + response.headers.get('link')) console.log('header to get param:' + response.headers.get('link'))
if (!response.ok) { if (!response.ok) {
response.text().then(function(text) { response.text().then(function(text) {
console.log('notf error', 'div[data-notf=' + acct_id + '] .landing') console.log('notf error', 'div[data-notf=' + acct_id + '] .landing')
$('div[data-notf=' + acct_id + '] .landing').append(`<div>${response.status}</div><div>${escapeHTML(text)}`) $('div[data-notf=' + acct_id + '] .landing').append(`<div>${response.status}</div><div>${escapeHTML(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) todo(error)
setLog(start, 'JSON', error) setLog(start, 'JSON', error)
console.error(error) console.error(error)
}) })
.then(function(json) { .then(function(json) {
if (json[0]) { if (json[0]) {
var templete = '' var templete = ''
var lastnotf = localStorage.getItem('lastnotf_' + acct_id) var lastnotf = localStorage.getItem('lastnotf_' + acct_id)
localStorage.setItem('lastnotf_' + acct_id, json[0].id) localStorage.setItem('lastnotf_' + acct_id, json[0].id)
Object.keys(json).forEach(function(key) { Object.keys(json).forEach(function(key) {
var obj = json[key] var obj = json[key]
if (lastnotf == obj.id && key > 0 && native == 'yes') { if (lastnotf == obj.id && key > 0 && native == 'yes') {
var ct = key var ct = key
if (key > 14) { if (key > 14) {
ct = '15+' ct = '15+'
} }
var os = localStorage.getItem('platform') var os = localStorage.getItem('platform')
var options = { var options = {
body: ct + lang.lang_notf_new, body: ct + lang.lang_notf_new,
icon: localStorage.getItem('prof_' + acct_id) icon: localStorage.getItem('prof_' + acct_id),
} }
var n = new Notification('TheDesk:' + domain, options) var n = new Notification('TheDesk:' + domain, options)
} }
var mute = getFilterTypeByAcct(acct_id, 'notif') var mute = getFilterTypeByAcct(acct_id, 'notif')
//Pleromaにはmoveというtypeがあるらしい。何が互換APIじゃ //Pleromaにはmoveというtypeがあるらしい。何が互換APIじゃ
if (obj.type != 'follow' && obj.type != 'move') { if (obj.type != 'follow' && obj.type != 'move') {
if (misskey) { if (misskey) {
templete = templete + misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute) templete = templete + misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute)
} else { } else {
templete = templete + parse([obj], 'notf', acct_id, 'notf', -1, mute) templete = templete + parse([obj], 'notf', acct_id, 'notf', -1, mute)
} }
} else { } else {
if (misskey) { if (misskey) {
templete = templete + misskeyUserparse([obj], 'notf', acct_id, 'notf', -1, mute) templete = templete + misskeyUserparse([obj], 'notf', acct_id, 'notf', -1, mute)
} else { } else {
templete = templete + userparse([obj.account], obj.type, acct_id, 'notf', -1) templete = templete + userparse([obj.account], obj.type, acct_id, 'notf', -1)
} }
} }
}) })
$('div[data-notf=' + acct_id + ']').html(templete) $('div[data-notf=' + acct_id + ']').html(templete)
// $('#landing_' + tlid).hide() // $('#landing_' + tlid).hide()
jQuery('time.timeago').timeago() jQuery('time.timeago').timeago()
} }
$('#notf-box').addClass('fetched') $('#notf-box').addClass('fetched')
todc() todc()
if(stream != 'no') notfWS(misskey, acct_id, tlid, domain, at) if (stream != 'no') notfWS(misskey, acct_id, tlid, domain, at)
}) })
} }
function notfWS(misskey, acct_id, tlid, domain, at) {
if(mastodonBaseWsStatus[domain] == 'available') return false
if (!misskey) {
if (localStorage.getItem('streaming_' + acct_id)) {
var wss = localStorage.getItem('streaming_' + acct_id)
} else {
var wss = 'wss://' + domain
}
var start = wss + '/api/v1/streaming/?stream=user&access_token=' + at
var wsid = websocketNotf.length function notfWS(misskey, acct_id, tlid, domain, at) {
websocketNotf[acct_id] = new WebSocket(start) if (mastodonBaseWsStatus[domain] == 'available') return false
websocketNotf[acct_id].onopen = function(mess) { if (!misskey) {
console.table({ if (localStorage.getItem('streaming_' + acct_id)) {
acct_id: acct_id, var wss = localStorage.getItem('streaming_' + acct_id)
type: 'Connect Streaming API(Notf)', } else {
domain: domain, var wss = 'wss://' + domain
message: [mess] }
}) var start = wss + '/api/v1/streaming/?stream=user&access_token=' + at
$('i[data-notf=' + acct_id + ']').removeClass('red-text')
} var wsid = websocketNotf.length
websocketNotf[acct_id].onmessage = function(mess) { websocketNotf[acct_id] = new WebSocket(start)
$('#landing_' + tlid).hide() websocketNotf[acct_id].onopen = function(mess) {
//console.log(["Receive Streaming API(Notf):" + acct_id + "(" + domain + ")", JSON.parse(JSON.parse(mess.data).payload)]); console.table({
var popup = localStorage.getItem('popup') acct_id: acct_id,
if (!popup) { type: 'Connect Streaming API(Notf)',
popup = 0 domain: domain,
} message: [mess],
var obj = JSON.parse(JSON.parse(mess.data).payload) })
var type = JSON.parse(mess.data).event $('i[data-notf=' + acct_id + ']').removeClass('red-text')
if (type == 'notification') { }
var templete = '' websocketNotf[acct_id].onmessage = function(mess) {
localStorage.setItem('lastnotf_' + acct_id, obj.id) $('#landing_' + tlid).hide()
if (!$('#unread_' + tlid + ' .material-icons').hasClass('teal-text')) { //console.log(["Receive Streaming API(Notf):" + acct_id + "(" + domain + ")", JSON.parse(JSON.parse(mess.data).payload)]);
//markers show中はダメ var popup = localStorage.getItem('popup')
if (obj.type != 'follow' && obj.type != 'follow_request') { if (!popup) {
templete = parse([obj], 'notf', acct_id, 'notf', popup) popup = 0
} else if (obj.type == 'follow_request') { }
templete = userparse([obj.account], 'request', acct_id, 'notf', -1) var obj = JSON.parse(JSON.parse(mess.data).payload)
} else { var type = JSON.parse(mess.data).event
templete = userparse([obj], obj.type, acct_id, 'notf', popup) if (type == 'notification') {
} var templete = ''
if (!$('div[data-notfIndv=' + acct_id + '_' + obj.id + ']').length) { localStorage.setItem('lastnotf_' + acct_id, obj.id)
$('div[data-notf=' + acct_id + ']').prepend(templete) if (!$('#unread_' + tlid + ' .material-icons').hasClass('teal-text')) {
$('div[data-const=notf_' + acct_id + ']').prepend(templete) //markers show中はダメ
} if (obj.type != 'follow' && obj.type != 'follow_request') {
jQuery('time.timeago').timeago() templete = parse([obj], 'notf', acct_id, 'notf', popup)
} } else if (obj.type == 'follow_request') {
} else if (type == 'delete') { templete = userparse([obj.account], 'request', acct_id, 'notf', -1)
$('[toot-id=' + obj + ']').hide() } else {
$('[toot-id=' + obj + ']').remove() templete = userparse([obj], obj.type, acct_id, 'notf', popup)
} }
} if (!$('div[data-notfIndv=' + acct_id + '_' + obj.id + ']').length) {
websocketNotf[acct_id].onerror = function(error) { $('div[data-notf=' + acct_id + ']').prepend(templete)
console.error('WebSocket Error ', error) $('div[data-const=notf_' + acct_id + ']').prepend(templete)
errorct++ }
console.log(errorct) jQuery('time.timeago').timeago()
if (errorct < 3) { }
notfWS(misskey, acct_id, tlid, domain, at) } else if (type == 'delete') {
} $('[toot-id=' + obj + ']').hide()
} $('[toot-id=' + obj + ']').remove()
websocketNotf[acct_id].onclose = function(error) { }
console.error('WebSocket Close ', error) }
errorct++ websocketNotf[acct_id].onerror = function(error) {
console.log(errorct) console.error('WebSocket Error ', error)
if (errorct < 3) { errorct++
notfWS(misskey, acct_id, tlid, domain, at) console.log(errorct)
} if (errorct < 3) {
} notfWS(misskey, acct_id, tlid, domain, at)
} }
}
websocketNotf[acct_id].onclose = function(error) {
console.error('WebSocket Close ', error)
errorct++
console.log(errorct)
if (errorct < 3) {
notfWS(misskey, acct_id, tlid, domain, at)
}
}
}
} }
//一定のスクロールで発火 //一定のスクロールで発火
function notfmore(tlid) { function notfmore(tlid) {
console.log({ status: 'kicked', status: moreloading }) console.log({ status: 'kicked', status: moreloading })
var multi = localStorage.getItem('column') var multi = localStorage.getItem('column')
var obj = JSON.parse(multi) var obj = JSON.parse(multi)
var acct_id = obj[tlid].domain var acct_id = obj[tlid].domain
if (!type) { if (!type) {
var type = obj[tlid].type var type = obj[tlid].type
} else { } else {
var data var data
} }
var sid = $('#timeline_' + tlid + ' .notif-marker') var sid = $('#timeline_' + tlid + ' .notif-marker')
.last() .last()
.attr('data-maxid') .attr('data-maxid')
var at = localStorage.getItem('acct_' + acct_id + '_at') var at = localStorage.getItem('acct_' + acct_id + '_at')
var domain = localStorage.getItem('domain_' + acct_id) var domain = localStorage.getItem('domain_' + acct_id)
if (sid && !moreloading) { if (sid && !moreloading) {
moreloading = true moreloading = true
var httpreq = new XMLHttpRequest() var httpreq = new XMLHttpRequest()
if (localStorage.getItem('mode_' + domain) == 'misskey') { if (localStorage.getItem('mode_' + domain) == 'misskey') {
var misskey = true var misskey = true
var start = 'https://' + domain + '/api/i/notifications' var start = 'https://' + domain + '/api/i/notifications'
httpreq.open(POST, start, true) httpreq.open(POST, start, true)
httpreq.setRequestHeader('Content-Type', 'application/json') httpreq.setRequestHeader('Content-Type', 'application/json')
var body = JSON.stringify({ var body = JSON.stringify({
i: at, i: at,
untilID: sid untilID: sid,
}) })
} else { } else {
var misskey = false var misskey = false
if (localStorage.getItem('exclude-' + tlid)) { if (localStorage.getItem('exclude-' + tlid)) {
var exc = localStorage.getItem('exclude-' + tlid) + '&max_id=' + sid var exc = localStorage.getItem('exclude-' + tlid) + '&max_id=' + sid
} else { } else {
var exc = '?max_id=' + sid var exc = '?max_id=' + sid
} }
var start = 'https://' + domain + '/api/v1/notifications' + exc var start = 'https://' + domain + '/api/v1/notifications' + exc
httpreq.open('GET', start, true) httpreq.open('GET', start, true)
httpreq.setRequestHeader('Content-Type', 'application/json') httpreq.setRequestHeader('Content-Type', 'application/json')
httpreq.setRequestHeader('Authorization', 'Bearer ' + at) httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
var body = '' var body = ''
} }
httpreq.responseType = 'json' httpreq.responseType = 'json'
httpreq.send(body) httpreq.send(body)
httpreq.onreadystatechange = function() { httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) { if (httpreq.readyState === 4) {
var json = httpreq.response var json = httpreq.response
if (this.status !== 200) { if (this.status !== 200) {
setLog(start, this.status, this.response) setLog(start, this.status, this.response)
} }
console.log(['More notifications on ' + tlid, json]) console.log(['More notifications on ' + tlid, json])
var max_id = httpreq.getResponseHeader('link').match(/[?&]{1}max_id=([0-9]+)/)[1] var max_id = httpreq.getResponseHeader('link').match(/[?&]{1}max_id=([0-9]+)/)[1]
if (json[0]) { if (json[0]) {
var templete = '' var templete = ''
var lastnotf = localStorage.getItem('lastnotf_' + acct_id) var lastnotf = localStorage.getItem('lastnotf_' + acct_id)
localStorage.setItem('lastnotf_' + acct_id, json[0].id) localStorage.setItem('lastnotf_' + acct_id, json[0].id)
Object.keys(json).forEach(function(key) { Object.keys(json).forEach(function(key) {
var obj = json[key] var obj = json[key]
var mute = getFilterTypeByAcct(acct_id, 'notif') var mute = getFilterTypeByAcct(acct_id, 'notif')
if (obj.type != 'follow') { if (obj.type != 'follow') {
if (misskey) { if (misskey) {
templete = templete + misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute) templete = templete + misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute)
} else { } else {
templete = templete + parse([obj], 'notf', acct_id, 'notf', -1, mute) templete = templete + parse([obj], 'notf', acct_id, 'notf', -1, mute)
} }
} else { } else {
if (misskey) { if (misskey) {
templete = templete + misskeyUserparse([obj], 'notf', acct_id, 'notf', -1, mute) templete = templete + misskeyUserparse([obj], 'notf', acct_id, 'notf', -1, mute)
} else { } else {
templete = templete + userparse([obj.account], obj.type, acct_id, 'notf', -1) templete = templete + userparse([obj.account], obj.type, acct_id, 'notf', -1)
} }
} }
}) })
moreloading = false moreloading = false
templete = templete + '<div class="hide notif-marker" data-maxid="' + max_id + '"></div>' templete = templete + '<div class="hide notif-marker" data-maxid="' + max_id + '"></div>'
$('#timeline_' + tlid).append(templete) $('#timeline_' + tlid).append(templete)
// $('#landing_' + tlid).hide() // $('#landing_' + tlid).hide()
jQuery('time.timeago').timeago() jQuery('time.timeago').timeago()
} }
$('#notf-box').addClass('fetched') $('#notf-box').addClass('fetched')
todc() todc()
} }
} }
} }
} }
//通知トグルボタン //通知トグルボタン
function notfToggle(acct, tlid) { function notfToggle(acct, tlid) {
if ($('#notf-box_' + tlid).hasClass('column-hide')) { if ($('#notf-box_' + tlid).hasClass('column-hide')) {
$('#notf-box_' + tlid).css('display', 'block') $('#notf-box_' + tlid).css('display', 'block')
$('#notf-box_' + tlid).animate( $('#notf-box_' + tlid).animate({
{ height: '400px',
height: '400px' }, {
}, duration: 300,
{ complete: function() {
duration: 300, $('#notf-box_' + tlid).css('overflow-y', 'scroll')
complete: function() { $('#notf-box_' + tlid).removeClass('column-hide')
$('#notf-box_' + tlid).css('overflow-y', 'scroll') },
$('#notf-box_' + tlid).removeClass('column-hide') })
} } else {
} $('#notf-box_' + tlid).css('overflow-y', 'hidden')
) $('#notf-box_' + tlid).animate({
} else { height: '0',
$('#notf-box_' + tlid).css('overflow-y', 'hidden') }, {
$('#notf-box_' + tlid).animate( duration: 300,
{ complete: function() {
height: '0' $('#notf-box_' + tlid).addClass('column-hide')
}, $('#notf-box_' + tlid).css('display', 'none')
{ },
duration: 300, })
complete: function() { }
$('#notf-box_' + tlid).addClass('column-hide') notfCanceler(acct)
$('#notf-box_' + tlid).css('display', 'none')
}
}
)
}
notfCanceler(acct)
} }
function notfCanceler(acct) { function notfCanceler(acct) {
$('.notf-reply_' + acct).text(0) $('.notf-reply_' + acct).text(0)
localStorage.removeItem('notf-reply_' + acct) localStorage.removeItem('notf-reply_' + acct)
$('.notf-reply_' + acct).addClass('hide') $('.notf-reply_' + acct).addClass('hide')
$('.notf-fav_' + acct).text(0) $('.notf-fav_' + acct).text(0)
localStorage.removeItem('notf-fav_' + acct) localStorage.removeItem('notf-fav_' + acct)
$('.notf-fav_' + acct).addClass('hide') $('.notf-fav_' + acct).addClass('hide')
$('.notf-bt_' + acct).text(0) $('.notf-bt_' + acct).text(0)
localStorage.removeItem('notf-bt_' + acct) localStorage.removeItem('notf-bt_' + acct)
$('.notf-bt_' + acct).addClass('hide') $('.notf-bt_' + acct).addClass('hide')
$('.notf-follow_' + acct).text(0) $('.notf-follow_' + acct).text(0)
localStorage.removeItem('notf-follow_' + acct) localStorage.removeItem('notf-follow_' + acct)
$('.notf-follow_' + acct).addClass('hide') $('.notf-follow_' + acct).addClass('hide')
$('.notf-icon_' + acct).removeClass('red-text') $('.notf-icon_' + acct).removeClass('red-text')
var id = $('#announce_' + acct + ' .announcement').first().attr('data-id') var id = $('#announce_' + acct + ' .announcement')
$('.notf-announ_' + acct + '_ct').text("") .first()
$(`.boxIn[data-acct=${acct}] .notice-box`).removeClass('has-notf') .attr('data-id')
if(id) { $('.notf-announ_' + acct + '_ct').text('')
localStorage.setItem('announ_' + acct, id) $(`.boxIn[data-acct=${acct}] .notice-box`).removeClass('has-notf')
} if (id) {
localStorage.setItem('announ_' + acct, id)
}
} }
function allNotfRead() { function allNotfRead() {
var multi = localStorage.getItem('multi') var multi = localStorage.getItem('multi')
if (multi) { if (multi) {
var obj = JSON.parse(multi) var obj = JSON.parse(multi)
Object.keys(obj).forEach(function(key) { Object.keys(obj).forEach(function(key) {
notfCanceler(key) notfCanceler(key)
}) })
} }
} }
allNotfRead() allNotfRead()

View File

@ -544,12 +544,7 @@ function insertFont(name) {
} }
function copyColor(from, to) { function copyColor(from, to) {
let props = [ let props = ['background', 'subcolor', 'text', 'accent', 'modal', 'modalFooter', 'third', 'forth', 'bottom', 'emphasized', 'postbox', 'active', 'selected', 'selectedWithShared']
'background', 'subcolor', 'text', 'accent',
'modal', 'modalFooter', 'third', 'forth',
'bottom', 'emphasized', 'postbox', 'active',
'selected', 'selectedWithShared'
]
let i = 0 let i = 0
let color let color
for (tag of props) { for (tag of props) {
@ -589,11 +584,7 @@ function customComp(preview) {
var textC = $('#color-picker1_value').val() var textC = $('#color-picker1_value').val()
var accentC = $('#color-picker3_value').val() var accentC = $('#color-picker3_value').val()
var multi = localStorage.getItem('multi') var multi = localStorage.getItem('multi')
let advanced = [ let advanced = ['modal', 'modalFooter', 'third', 'forth', 'bottom', 'emphasized', 'postbox', 'active', 'selected', 'selectedWithShared']
'modal', 'modalFooter', 'third', 'forth',
'bottom', 'emphasized', 'postbox', 'active',
'selected', 'selectedWithShared'
]
var advanceTheme = {} var advanceTheme = {}
let i = 4 let i = 4
for (tag of advanced) { for (tag of advanced) {
@ -606,9 +597,7 @@ function customComp(preview) {
var my = JSON.parse(multi)[0].name var my = JSON.parse(multi)[0].name
var id = $('#custom-edit-sel').val() var id = $('#custom-edit-sel').val()
const defaults = [ const defaults = ['black', 'blue', 'brown', 'green', 'indigo', 'polar', 'snow', 'white']
'black', 'blue', 'brown', 'green', 'indigo', 'polar', 'snow', 'white'
]
if (id == 'add_new' || defaults.includes(id)) { if (id == 'add_new' || defaults.includes(id)) {
id = makeCID() id = makeCID()
} }
@ -622,11 +611,11 @@ function customComp(preview) {
background: bgC, background: bgC,
subcolor: subcolorC, subcolor: subcolorC,
text: textC, text: textC,
accent: accentC accent: accentC,
}, },
advanced: advanceTheme, advanced: advanceTheme,
id: id, id: id,
version: '2' version: '2',
} }
$('#custom_json').val(JSON.stringify(json)) $('#custom_json').val(JSON.stringify(json))
if (preview) { if (preview) {
@ -640,7 +629,6 @@ function customComp(preview) {
}) })
postMessage(['themeJsonCreate', JSON.stringify(json)], '*') postMessage(['themeJsonCreate', JSON.stringify(json)], '*')
} }
} }
function deleteIt() { function deleteIt() {
@ -710,16 +698,11 @@ function customConnect(raw) {
$('#color-picker2_value').val(args.primary.subcolor) $('#color-picker2_value').val(args.primary.subcolor)
//Accent //Accent
$('#color-picker3_value').val(args.primary.accent) $('#color-picker3_value').val(args.primary.accent)
let advanced = [ let advanced = ['modal', 'modalFooter', 'third', 'forth', 'bottom', 'emphasized', 'postbox', 'active', 'selected', 'selectedWithShared']
'modal', 'modalFooter', 'third', 'forth',
'bottom', 'emphasized', 'postbox', 'active',
'selected', 'selectedWithShared'
]
let i = 4 let i = 4
for (tag of advanced) { for (tag of advanced) {
if (args.advanced[tag]) { if (args.advanced[tag]) {
$(`#color-picker${i}_value`).val(args.advanced[tag]) $(`#color-picker${i}_value`).val(args.advanced[tag])
} }
$(`#use-color_${i}`).prop('checked', true) $(`#use-color_${i}`).prop('checked', true)
i++ i++
@ -765,7 +748,7 @@ function customSoundSave(key, file) {
} }
function pluginLoad() { function pluginLoad() {
$('#plugin-edit-sel').val('add_new') $('#plugin-edit-sel').val('add_new')
$(".plugin_delete").addClass('disabled') $('.plugin_delete').addClass('disabled')
var template = '' var template = ''
var pgns = localStorage.getItem('plugins') var pgns = localStorage.getItem('plugins')
var args = JSON.parse(pgns ? pgns : '[]') var args = JSON.parse(pgns ? pgns : '[]')
@ -783,9 +766,9 @@ function pluginEdit() {
$('#plugin').attr('data-id', id) $('#plugin').attr('data-id', id)
if (id == 'add_new') { if (id == 'add_new') {
editor.setValue('', -1) editor.setValue('', -1)
$(".plugin_delete").addClass('disabled') $('.plugin_delete').addClass('disabled')
} else { } else {
$(".plugin_delete").removeClass('disabled') $('.plugin_delete').removeClass('disabled')
var pgns = localStorage.getItem('plugins') var pgns = localStorage.getItem('plugins')
var args = JSON.parse(pgns ? pgns : '[]') var args = JSON.parse(pgns ? pgns : '[]')
Object.keys(args).forEach(function (key) { Object.keys(args).forEach(function (key) {
@ -823,7 +806,7 @@ function completePlugin(comp) {
id = makeCID() id = makeCID()
args.push({ args.push({
id: id, id: id,
content: inputPlugin content: inputPlugin,
}) })
} else { } else {
Object.keys(args).forEach(function (key) { Object.keys(args).forEach(function (key) {
@ -857,7 +840,7 @@ async function deletePlugin() {
const alert = await Swal.fire({ const alert = await Swal.fire({
title: 'delete', title: 'delete',
icon: 'warning', icon: 'warning',
showCancelButton: true showCancelButton: true,
}) })
if (!alert) return false if (!alert) return false
editor.setValue('', -1) editor.setValue('', -1)
@ -959,4 +942,6 @@ function lastFmSet() {
M.toast({ html: 'Complete: last.fm', displayLength: 3000 }) M.toast({ html: 'Complete: last.fm', displayLength: 3000 })
} }
function stopVideo() { return false } function stopVideo() {
return false
}

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,7 @@
<body class=""> <body class="">
<script> <script>
var ver = '22.2.0 (Koume)' var ver = '22.2.0 (Koume)'
var gitHash = '9758a2a7d8f1b504193126c20fd96ccf42945cd8' var gitHash = '5621ffbe42a1de361ccee0e679c97d30da436aab'
//betaを入れるとバージョンチェックしない //betaを入れるとバージョンチェックしない
//var ver="beta"; //var ver="beta";
var acct_id = 0 var acct_id = 0

View File

@ -688,7 +688,7 @@
style="width:100%; max-width:40rem;"><img src="../../img/desk_full.svg" class="left" width="25" style="width:100%; max-width:40rem;"><img src="../../img/desk_full.svg" class="left" width="25"
style="padding-top:5px;">Main author: Cutls@1m.cutls.com</a> style="padding-top:5px;">Main author: Cutls@1m.cutls.com</a>
<br> <br>
TheDesk @ <a href="https://github.com/cutls/TheDesk/commits/9758a2a7d8f1b504193126c20fd96ccf42945cd8">9758a2a7d8f1b504193126c20fd96ccf42945cd8</a> - <a TheDesk @ <a href="https://github.com/cutls/TheDesk/commits/5621ffbe42a1de361ccee0e679c97d30da436aab">5621ffbe42a1de361ccee0e679c97d30da436aab</a> - <a
onclick="checkupd(); return localStorage.removeItem('new-ver-skip'); location.href='index.html';" onclick="checkupd(); return localStorage.removeItem('new-ver-skip'); location.href='index.html';"
class="pointer pwa">Sprawdź aktualizacje</a><br> class="pointer pwa">Sprawdź aktualizacje</a><br>
<br> <br>
@ -698,7 +698,7 @@
<img src="https://status.cutls.com/badge-service?site=thedesk.top"> <img src="https://status.cutls.com/badge-service?site=thedesk.top">
</a><br> </a><br>
<h5>OSS License</h5> <h5>OSS License</h5>
<a href="https://app.fossa.com/projects/git%2Bgithub.com%2Fcutls%2FTheDesk/refs/branch/master/9758a2a7d8f1b504193126c20fd96ccf42945cd8" <a href="https://app.fossa.com/projects/git%2Bgithub.com%2Fcutls%2FTheDesk/refs/branch/master/5621ffbe42a1de361ccee0e679c97d30da436aab"
alt="FOSSA Status"><img alt="FOSSA Status"><img
src="https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcutls%2FTheDesk.svg?type=small" /></a> src="https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcutls%2FTheDesk.svg?type=small" /></a>
<br> <br>