2018-01-28 23:22:43 +11:00
|
|
|
//検索
|
|
|
|
//検索ボックストグル
|
2019-03-15 06:48:01 +11:00
|
|
|
function searchMenu() {
|
2019-11-09 00:52:54 +11:00
|
|
|
$('#src-contents').html('')
|
|
|
|
trend()
|
2020-04-22 00:56:04 +10:00
|
|
|
$('#left-menu a').removeClass('active')
|
2019-11-09 00:52:54 +11:00
|
|
|
$('#searchMenu').addClass('active')
|
|
|
|
$('.menu-content').addClass('hide')
|
|
|
|
$('#src-box').removeClass('hide')
|
2019-08-07 13:14:07 +10:00
|
|
|
//$('ul.tabs').tabs('select_tab', 'src-sta');
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
//検索取得
|
2019-08-30 02:46:19 +10:00
|
|
|
function src(mode, offset) {
|
2019-09-30 03:21:18 +10:00
|
|
|
if (!offset) {
|
2021-05-20 16:16:58 +10:00
|
|
|
$('#src-contents').html(`
|
|
|
|
<div class="preloader-wrapper small active" style="margin-left: calc(50% - 36px);">
|
|
|
|
<div class="spinner-layer spinner-blue-only">
|
|
|
|
<div class="circle-clipper left">
|
|
|
|
<div class="circle"></div>
|
|
|
|
</div>
|
|
|
|
<div class="gap-patch">
|
|
|
|
<div class="circle"></div>
|
|
|
|
</div>
|
|
|
|
<div class="circle-clipper right">
|
|
|
|
<div class="circle"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
`)
|
2019-11-09 00:52:54 +11:00
|
|
|
var add = ''
|
2019-09-30 03:21:18 +10:00
|
|
|
} else {
|
2022-04-03 19:19:44 +10:00
|
|
|
var add = '&type=accounts&offset=' + $('#src-accts .cusr').length
|
2019-08-30 02:46:19 +10:00
|
|
|
}
|
2019-09-30 03:21:18 +10:00
|
|
|
|
2019-11-09 00:52:54 +11:00
|
|
|
var q = $('#src').val()
|
|
|
|
var acct_id = $('#src-acct-sel').val()
|
|
|
|
if (acct_id == 'tootsearch') {
|
|
|
|
tsAdd(q)
|
|
|
|
return false
|
2018-03-18 02:00:53 +11:00
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
localStorage.setItem('last-use', acct_id)
|
|
|
|
var domain = localStorage.getItem('domain_' + acct_id)
|
|
|
|
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
|
|
|
var m = q.match(/^#(.+)$/)
|
2019-11-04 03:10:06 +11:00
|
|
|
if (m) {
|
2019-11-09 00:52:54 +11:00
|
|
|
q = m[1]
|
2019-11-04 03:10:06 +11:00
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
if (user == '--now') {
|
|
|
|
var user = $('#his-data').attr('user-id')
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
if (!mode) {
|
2020-01-27 01:55:07 +11:00
|
|
|
var start = 'https://' + domain + '/api/v2/search?resolve=true&q=' + encodeURIComponent(q) + add
|
2019-05-19 17:39:30 +10:00
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
var start = 'https://' + domain + '/api/v1/search?q=' + q
|
2018-06-12 01:44:28 +10:00
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
console.log('Try to search at ' + start)
|
2018-01-28 23:22:43 +11:00
|
|
|
fetch(start, {
|
2019-11-09 00:52:54 +11:00
|
|
|
method: 'GET',
|
2018-01-28 23:22:43 +11:00
|
|
|
headers: {
|
2019-11-09 00:52:54 +11:00
|
|
|
'content-type': 'application/json',
|
|
|
|
Authorization: 'Bearer ' + at
|
2019-10-31 02:30:26 +11:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
})
|
2021-05-20 16:16:58 +10:00
|
|
|
.then(function (response) {
|
|
|
|
if (!offset) {
|
|
|
|
$('#src-contents').html(``)
|
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
if (!response.ok) {
|
2021-05-20 16:16:58 +10:00
|
|
|
response.text().then(function (text) {
|
2019-11-09 00:52:54 +11:00
|
|
|
setLog(response.url, response.status, text)
|
|
|
|
})
|
2019-11-04 03:10:06 +11:00
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
return response.json()
|
2019-11-04 03:10:06 +11:00
|
|
|
})
|
2021-05-20 16:16:58 +10:00
|
|
|
.catch(function (error) {
|
2019-11-09 00:52:54 +11:00
|
|
|
src('v1')
|
|
|
|
return false
|
2019-11-04 03:10:06 +11:00
|
|
|
})
|
2021-05-20 16:16:58 +10:00
|
|
|
.then(function (json) {
|
2019-11-09 00:52:54 +11:00
|
|
|
console.log(['Search', json])
|
2019-11-04 03:10:06 +11:00
|
|
|
//ハッシュタグ
|
|
|
|
if (json.hashtags[0]) {
|
2019-11-09 00:52:54 +11:00
|
|
|
var tags = ''
|
2021-05-20 16:16:58 +10:00
|
|
|
Object.keys(json.hashtags).forEach(function (key4) {
|
2019-11-09 00:52:54 +11:00
|
|
|
var tag = json.hashtags[key4]
|
2019-11-04 03:10:06 +11:00
|
|
|
if (mode) {
|
2019-11-09 00:52:54 +11:00
|
|
|
tags =
|
|
|
|
tags +
|
|
|
|
`<a onclick="tl('tag','${tag}','${acct_id}','add')" class="pointer">
|
|
|
|
#${escapeHTML(tag)}
|
|
|
|
</a>
|
|
|
|
<br> `
|
2022-04-03 19:19:44 +10:00
|
|
|
} else if (!tag.history) {
|
|
|
|
tags+=`<a onclick="tl('tag','${tag.name}','${acct_id}','add')" class="pointer">
|
|
|
|
#${escapeHTML(tag.name)}
|
|
|
|
</a>
|
|
|
|
<br> `
|
2019-11-04 03:10:06 +11:00
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
tags = tags + graphDraw(tag, acct_id)
|
2019-11-04 03:10:06 +11:00
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
})
|
|
|
|
$('#src-contents').append('Tags<br>' + tags)
|
2019-11-04 03:10:06 +11:00
|
|
|
}
|
|
|
|
//トゥート
|
|
|
|
if (json.statuses[0]) {
|
2019-11-09 00:52:54 +11:00
|
|
|
var templete = parse(json.statuses, '', acct_id)
|
|
|
|
$('#src-contents').append('<br>Mentions<br>' + templete)
|
2019-11-04 03:10:06 +11:00
|
|
|
}
|
|
|
|
//アカウント
|
|
|
|
if (json.accounts[0]) {
|
2019-11-09 00:52:54 +11:00
|
|
|
var templete = userparse(json.accounts, '', acct_id)
|
2019-11-04 03:10:06 +11:00
|
|
|
if (!offset) {
|
2019-11-09 00:52:54 +11:00
|
|
|
$('#src-contents').append(
|
|
|
|
`<br>Accounts<div id="src-accts">
|
|
|
|
${templete}
|
|
|
|
</div><a onclick="src(false,'more')" class="pointer">more...</a>`
|
|
|
|
)
|
2019-05-19 17:39:30 +10:00
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
$('#src-accts').append(templete)
|
2018-06-12 01:44:28 +10:00
|
|
|
}
|
2019-08-30 02:46:19 +10:00
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
jQuery('time.timeago').timeago()
|
|
|
|
})
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function tsAdd(q) {
|
|
|
|
var add = {
|
|
|
|
domain: acct_id,
|
2019-11-09 00:52:54 +11:00
|
|
|
type: 'tootsearch',
|
2019-05-19 17:39:30 +10:00
|
|
|
data: q
|
2019-11-09 00:52:54 +11:00
|
|
|
}
|
|
|
|
var multi = localStorage.getItem('column')
|
|
|
|
var obj = JSON.parse(multi)
|
|
|
|
localStorage.setItem('card_' + obj.length, 'true')
|
|
|
|
obj.push(add)
|
|
|
|
var json = JSON.stringify(obj)
|
|
|
|
localStorage.setItem('column', json)
|
|
|
|
parseColumn('add')
|
2019-04-10 00:12:11 +10:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function tootsearch(tlid, q) {
|
2021-05-20 16:16:58 +10:00
|
|
|
if (!q || q == 'undefined') {
|
2020-04-08 16:30:20 +10:00
|
|
|
return false
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
var start = 'https://tootsearch.chotto.moe/api/v1/search?from=0&sort=created_at%3Adesc&q=' + q
|
2020-04-08 16:30:20 +10:00
|
|
|
console.log('Toot search at ' + start)
|
2019-11-09 00:52:54 +11:00
|
|
|
$('#notice_' + tlid).text('tootsearch(' + q + ')')
|
|
|
|
$('#notice_icon_' + tlid).text('search')
|
2018-03-18 02:00:53 +11:00
|
|
|
fetch(start, {
|
2019-11-09 00:52:54 +11:00
|
|
|
method: 'GET',
|
2018-03-18 02:00:53 +11:00
|
|
|
headers: {
|
2019-11-09 00:52:54 +11:00
|
|
|
'content-type': 'application/json'
|
2019-10-31 02:30:26 +11:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
})
|
2021-05-20 16:16:58 +10:00
|
|
|
.then(function (response) {
|
2019-11-04 03:10:06 +11:00
|
|
|
if (!response.ok) {
|
2021-05-20 16:16:58 +10:00
|
|
|
response.text().then(function (text) {
|
2019-11-09 00:52:54 +11:00
|
|
|
setLog(response.url, response.status, text)
|
|
|
|
})
|
2019-11-04 03:10:06 +11:00
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
return response.json()
|
2019-11-04 03:10:06 +11:00
|
|
|
})
|
2021-05-20 16:16:58 +10:00
|
|
|
.catch(function (error) {
|
2019-11-09 00:52:54 +11:00
|
|
|
todo(error)
|
|
|
|
setLog(start, 'JSON', error)
|
|
|
|
console.error(error)
|
2019-11-04 03:10:06 +11:00
|
|
|
})
|
2021-05-20 16:16:58 +10:00
|
|
|
.then(function (raw) {
|
2019-11-09 00:52:54 +11:00
|
|
|
var templete = ''
|
|
|
|
var json = raw.hits.hits
|
|
|
|
var max_id = raw['hits'].length
|
2019-11-04 03:10:06 +11:00
|
|
|
for (var i = 0; i < json.length; i++) {
|
2019-11-09 00:52:54 +11:00
|
|
|
var toot = json[i]['_source']
|
2019-11-04 03:10:06 +11:00
|
|
|
if (lastid != toot.uri) {
|
|
|
|
if (toot && toot.account) {
|
2019-11-09 00:52:54 +11:00
|
|
|
templete = templete + parse([toot], 'noauth', null, tlid, 0, [], 'tootsearch')
|
2019-11-04 03:10:06 +11:00
|
|
|
}
|
2018-03-18 02:00:53 +11:00
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
var lastid = toot.uri
|
2018-03-18 02:00:53 +11:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
if (!templete) {
|
2019-11-09 00:52:54 +11:00
|
|
|
templete = lang.lang_details_nodata
|
2019-11-04 03:10:06 +11:00
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
templete = templete + `<div class="hide ts-marker" data-maxid="${max_id}"></div>`
|
2019-11-04 03:10:06 +11:00
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
$('#timeline_' + tlid).html(templete)
|
2019-04-10 00:12:11 +10:00
|
|
|
|
2019-11-09 00:52:54 +11:00
|
|
|
jQuery('time.timeago').timeago()
|
|
|
|
})
|
2018-06-12 01:44:28 +10:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function moreTs(tlid, q) {
|
2019-11-09 00:52:54 +11:00
|
|
|
var sid = $('#timeline_' + tlid + ' .ts-marker')
|
2019-11-04 03:10:06 +11:00
|
|
|
.last()
|
2019-11-09 00:52:54 +11:00
|
|
|
.attr('data-maxid')
|
|
|
|
moreloading = true
|
|
|
|
var start =
|
|
|
|
'https://tootsearch.chotto.moe/api/v1/search?from=' + sid + '&sort=created_at%3Adesc&q=' + q
|
|
|
|
$('#notice_' + tlid).text('tootsearch(' + q + ')')
|
|
|
|
$('#notice_icon_' + tlid).text('search')
|
2019-04-11 13:52:38 +10:00
|
|
|
fetch(start, {
|
2019-11-09 00:52:54 +11:00
|
|
|
method: 'GET',
|
2019-04-11 13:52:38 +10:00
|
|
|
headers: {
|
2019-11-09 00:52:54 +11:00
|
|
|
'content-type': 'application/json'
|
2019-10-31 02:30:26 +11:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
})
|
2021-05-20 16:16:58 +10:00
|
|
|
.then(function (response) {
|
2019-11-04 03:10:06 +11:00
|
|
|
if (!response.ok) {
|
2021-05-20 16:16:58 +10:00
|
|
|
response.text().then(function (text) {
|
2019-11-09 00:52:54 +11:00
|
|
|
setLog(response.url, response.status, text)
|
|
|
|
})
|
2019-11-04 03:10:06 +11:00
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
return response.json()
|
2019-11-04 03:10:06 +11:00
|
|
|
})
|
2021-05-20 16:16:58 +10:00
|
|
|
.catch(function (error) {
|
2019-11-09 00:52:54 +11:00
|
|
|
todo(error)
|
|
|
|
setLog(start, 'JSON', error)
|
|
|
|
console.error(error)
|
2019-11-04 03:10:06 +11:00
|
|
|
})
|
2021-05-20 16:16:58 +10:00
|
|
|
.then(function (raw) {
|
2019-11-09 00:52:54 +11:00
|
|
|
var templete = ''
|
|
|
|
var json = raw.hits.hits
|
|
|
|
var max_id = raw['hits'].length
|
2019-11-04 03:10:06 +11:00
|
|
|
for (var i = 0; i < json.length; i++) {
|
2019-11-09 00:52:54 +11:00
|
|
|
var toot = json[i]['_source']
|
2019-11-04 03:10:06 +11:00
|
|
|
if (lastid != toot.uri) {
|
|
|
|
if (toot && toot.account) {
|
2019-11-09 00:52:54 +11:00
|
|
|
templete = templete + parse([toot], 'noauth', null, tlid, 0, [], 'tootsearch')
|
2019-11-04 03:10:06 +11:00
|
|
|
}
|
2019-04-11 13:52:38 +10:00
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
var lastid = toot.uri
|
2019-04-11 13:52:38 +10:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
if (!templete) {
|
2019-11-09 00:52:54 +11:00
|
|
|
templete = lang.lang_details_nodata
|
2019-11-04 03:10:06 +11:00
|
|
|
} else {
|
2019-11-09 00:52:54 +11:00
|
|
|
templete = templete + `<div class="hide ts-marker" data-maxid="${max_id}"></div>`
|
2019-11-04 03:10:06 +11:00
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
$('#timeline_' + tlid).append(templete)
|
2019-04-11 13:52:38 +10:00
|
|
|
|
2019-11-09 00:52:54 +11:00
|
|
|
jQuery('time.timeago').timeago()
|
|
|
|
})
|
2019-04-11 13:52:38 +10:00
|
|
|
}
|
2019-06-23 19:38:22 +10:00
|
|
|
function graphDraw(tag, acct_id) {
|
2019-11-09 00:52:54 +11:00
|
|
|
var tags = ''
|
|
|
|
var his = tag.history
|
2020-09-09 18:15:19 +10:00
|
|
|
return graphDrawCore(his, tag, acct_id)
|
2019-11-27 22:53:34 +11:00
|
|
|
}
|
2020-09-09 18:15:19 +10:00
|
|
|
function graphDrawCore(his, tag, acct_id) {
|
2019-11-09 00:52:54 +11:00
|
|
|
var max = Math.max.apply(null, [
|
|
|
|
his[0].uses,
|
|
|
|
his[1].uses,
|
|
|
|
his[2].uses,
|
|
|
|
his[3].uses,
|
|
|
|
his[4].uses,
|
|
|
|
his[5].uses,
|
|
|
|
his[6].uses
|
|
|
|
])
|
|
|
|
var six = 50 - (his[6].uses / max) * 50
|
|
|
|
var five = 50 - (his[5].uses / max) * 50
|
|
|
|
var four = 50 - (his[4].uses / max) * 50
|
|
|
|
var three = 50 - (his[3].uses / max) * 50
|
|
|
|
var two = 50 - (his[2].uses / max) * 50
|
|
|
|
var one = 50 - (his[1].uses / max) * 50
|
|
|
|
var zero = 50 - (his[0].uses / max) * 50
|
2019-11-27 22:53:34 +11:00
|
|
|
return `<div class="tagComp">
|
|
|
|
<div class="tagCompSvg">
|
|
|
|
<svg version="1.1" viewbox="0 0 60 50" width="60" height="50">
|
|
|
|
<g>
|
|
|
|
<path d="M0,${six} L10,${five} 20,${four} 30,${three} 40,${two} 50,${one} 60,${zero} 61,61 0,61"
|
|
|
|
style="stroke: #0f8c0c;fill: rgba(13,113,19,.25); stroke-width: 1;">
|
|
|
|
</path>
|
|
|
|
</g>
|
|
|
|
</svg>
|
|
|
|
</div>
|
|
|
|
<div class="tagCompToot">
|
|
|
|
<span style="font-size:200%">${his[0].uses}</span>
|
|
|
|
</div>
|
|
|
|
<div class="tagCompToots">
|
|
|
|
toot
|
|
|
|
</div>
|
|
|
|
<div class="tagCompTag">
|
2020-02-09 01:35:22 +11:00
|
|
|
<a onclick="tl('tag','${escapeHTML(
|
2021-05-20 16:16:58 +10:00
|
|
|
tag.name
|
|
|
|
)}','${acct_id}','add')" class="pointer" title="${escapeHTML(tag.name)}">
|
2019-11-27 22:53:34 +11:00
|
|
|
#${escapeHTML(tag.name)}
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div class="tagCompUser">
|
|
|
|
${his[0].accounts}
|
|
|
|
${lang.lang_src_people}
|
|
|
|
</div>
|
|
|
|
</div>`
|
2018-06-12 01:44:28 +10:00
|
|
|
}
|
2022-10-10 18:09:32 +11:00
|
|
|
async function trend() {
|
2019-11-09 00:52:54 +11:00
|
|
|
console.log('get trend')
|
|
|
|
$('#src-contents').html('')
|
|
|
|
var acct_id = $('#src-acct-sel').val()
|
|
|
|
if (acct_id == 'tootsearch') {
|
|
|
|
return false
|
2019-08-07 00:06:09 +10:00
|
|
|
}
|
2022-10-10 18:09:32 +11:00
|
|
|
const domain = localStorage.getItem('domain_' + acct_id)
|
|
|
|
const at = localStorage.getItem('acct_' + acct_id + '_at')
|
|
|
|
try {
|
|
|
|
const tagTrendUrl = 'https://' + domain + '/api/v1/trends'
|
|
|
|
const tagTrendResponse = await fetch(tagTrendUrl, {
|
|
|
|
method: 'GET',
|
|
|
|
headers: {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
Authorization: 'Bearer ' + at
|
2019-11-04 03:10:06 +11:00
|
|
|
}
|
|
|
|
})
|
2022-10-10 18:09:32 +11:00
|
|
|
if (!tagTrendResponse.ok) {
|
|
|
|
tagTrendResponse.text().then(function (text) {
|
|
|
|
setLog(tagTrendResponse.url, tagTrendResponse.status, text)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
const tagTrends = await tagTrendResponse.json()
|
|
|
|
let tags = ''
|
|
|
|
for (const tag of tagTrends) {
|
|
|
|
const his = tag.history
|
|
|
|
tags = tags + graphDrawCore(his, tag, acct_id)
|
|
|
|
}
|
|
|
|
$('#src-contents').append(`<div id="src-content-tag">Trend Tags<br />${tags || 'none'}</div>`)
|
|
|
|
} catch {
|
|
|
|
|
|
|
|
}
|
2019-08-07 00:06:09 +10:00
|
|
|
|
2022-10-10 18:09:32 +11:00
|
|
|
try {
|
|
|
|
const tootTrendUrl = 'https://' + domain + '/api/v1/trends/statuses'
|
|
|
|
const tootTrendResponse = await fetch(tootTrendUrl, {
|
|
|
|
method: 'GET',
|
|
|
|
headers: {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
Authorization: 'Bearer ' + at
|
|
|
|
}
|
|
|
|
})
|
|
|
|
if (!tootTrendResponse.ok) {
|
|
|
|
tootTrendResponse.text().then(function (text) {
|
|
|
|
setLog(tootTrendResponse.url, tootTrendResponse.status, text)
|
2019-11-09 00:52:54 +11:00
|
|
|
})
|
2022-10-10 18:09:32 +11:00
|
|
|
}
|
|
|
|
const tootTrends = await tootTrendResponse.json()
|
|
|
|
if (tootTrends.length) {
|
|
|
|
const templete = parse(tootTrends, '', acct_id)
|
|
|
|
$('#src-contents').append(`<div id="src-content-status">Trend Statuses<br />${templete}</div>`)
|
|
|
|
} else {
|
|
|
|
$('#src-contents').append(`<div id="src-content-status">Trend Statuses<br />none</div>`)
|
|
|
|
}
|
|
|
|
} catch {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
const linkTrendUrl = 'https://' + domain + '/api/v1/trends/links'
|
|
|
|
const linkTrendResponse = await fetch(linkTrendUrl, {
|
|
|
|
method: 'GET',
|
|
|
|
headers: {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
Authorization: 'Bearer ' + at
|
|
|
|
}
|
2019-11-09 00:52:54 +11:00
|
|
|
})
|
2022-10-10 18:09:32 +11:00
|
|
|
if (!linkTrendResponse.ok) {
|
|
|
|
linkTrendResponse.text().then(function (text) {
|
|
|
|
setLog(linkTrendResponse.url, linkTrendResponse.status, text)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
const linkTrends = await linkTrendResponse.json()
|
|
|
|
console.log(linkTrends)
|
|
|
|
let links = ''
|
|
|
|
for (const link of linkTrends) {
|
|
|
|
links = links + `<a href="${link.url}" target="_blank">${link.url}</a><br />` + cardHtml(link, acct_id, '') + `<br />`
|
|
|
|
}
|
|
|
|
$('#src-contents').append(`<div id="src-content-link">Trend Links<br />${links}</div>`)
|
|
|
|
} catch {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-11-04 03:10:06 +11:00
|
|
|
}
|
2020-02-09 01:35:22 +11:00
|
|
|
function srcBox(mode) {
|
|
|
|
if (mode == 'open') {
|
|
|
|
$('#pageSrc').removeClass('hide')
|
|
|
|
} else if (mode == 'close') {
|
2021-04-18 05:24:52 +10:00
|
|
|
$('#pageSrc').addClass('hide')
|
|
|
|
$('#pageSrc').removeClass('keep')
|
2020-02-09 01:35:22 +11:00
|
|
|
} else {
|
|
|
|
$('#pageSrc').toggleClass('hide')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function doSrc(type) {
|
2020-02-09 01:48:31 +11:00
|
|
|
$('#pageSrc').addClass('hide')
|
|
|
|
$('#pageSrc').removeClass('keep')
|
2021-04-18 05:24:52 +10:00
|
|
|
var q = $('.srcQ').text()
|
2021-05-20 16:16:58 +10:00
|
|
|
if (type == 'web') {
|
2020-02-09 01:48:31 +11:00
|
|
|
var start = localStorage.getItem('srcUrl')
|
2021-05-20 16:16:58 +10:00
|
|
|
if (!start) {
|
2020-02-09 01:48:31 +11:00
|
|
|
start = 'https://google.com/search?q={q}'
|
|
|
|
}
|
|
|
|
start = start.replace(/{q}/, q)
|
|
|
|
postMessage(["openUrl", start], "*")
|
2021-05-20 16:16:58 +10:00
|
|
|
} else if (type == 'ts') {
|
2020-02-09 01:35:22 +11:00
|
|
|
tsAdd(q)
|
2021-05-20 16:16:58 +10:00
|
|
|
} else if (type == 'copy') {
|
2021-04-18 05:24:52 +10:00
|
|
|
execCopy(q)
|
2021-05-20 16:16:58 +10:00
|
|
|
} else if (type == 'toot') {
|
2021-04-18 05:24:52 +10:00
|
|
|
brInsert(q)
|
2020-02-09 01:35:22 +11:00
|
|
|
}
|
|
|
|
}
|