Merge branch 'master' into use-strict
This commit is contained in:
commit
2583c3b80a
|
@ -10,24 +10,21 @@ function additional(acct_id, tlid) {
|
|||
$('#timeline-container .hashtag, #timeline-container [rel=tag]').each(function(i, elem) {
|
||||
var tags = $(this)
|
||||
.attr('href')
|
||||
.match(/https?:\/\/([-a-zA-Z0-9@.]+)\/tags\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/)
|
||||
.match(/https?:\/\/([-a-zA-Z0-9@.]+)\/tags?\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/)
|
||||
if (tags) {
|
||||
var tagThis = tags[2]
|
||||
} else {
|
||||
var tagThis = $(this).attr('data-tag')
|
||||
var tagThis = $(this).attr('data-regTag')
|
||||
}
|
||||
|
||||
if (tagThis) {
|
||||
$(this).attr('onclick', "tagShow('" + tagThis + "')")
|
||||
$(this).attr('href', '#')
|
||||
$(this).attr('href', "javascript:tagShow('" + tagThis + "')")
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
//トゥートサムネ
|
||||
$('#timeline_' + tlid + ' .toot a:not(.parsed)').each(function(i, elem) {
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var card = localStorage.getItem('card_' + tlid)
|
||||
var text = $(this).attr('href')
|
||||
if (text) {
|
||||
if (text.indexOf('twimg.com') === -1) {
|
||||
|
@ -49,48 +46,6 @@ function additional(acct_id, tlid) {
|
|||
}
|
||||
if (urls) {
|
||||
$(this).remove()
|
||||
} else if (!card) {
|
||||
var id = $(this)
|
||||
.parents('.cvo')
|
||||
.attr('toot-id')
|
||||
if (localStorage.getItem('mode_' + domain) == 'misskey') {
|
||||
var start = 'https://' + domain + '/url?url=' + text
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
}
|
||||
//body: JSON.stringify({})
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json.title) {
|
||||
$('[toot-id=' + id + '] .additional').html(
|
||||
'<span class="gray">URL' +
|
||||
lang.lang_cards_check +
|
||||
':<br>Title:' +
|
||||
escapeHTML(json.title) +
|
||||
'<br>' +
|
||||
escapeHTML(json.description) +
|
||||
'</span>'
|
||||
)
|
||||
$('[toot-id=' + id + '] a:not(.parsed)').addClass('parsed')
|
||||
$('[toot-id=' + id + ']').addClass('parsed')
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
$(this).attr('title', text)
|
||||
}
|
||||
|
@ -140,8 +95,7 @@ function additional(acct_id, tlid) {
|
|||
var id = $(this)
|
||||
.parents('.cvo')
|
||||
.attr('toot-id')
|
||||
$(this).attr('href', '#')
|
||||
$(this).attr('onclick', "imgv('" + id + "','" + i + "')")
|
||||
$(this).attr('href', `javascript:imgv('${id}','${i}')`)
|
||||
$(this).attr('data-type', 'image')
|
||||
$(this).attr('id', id + '-image-' + i)
|
||||
$(this).attr('data-url', ilink)
|
||||
|
|
|
@ -520,7 +520,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
|||
if (tagck) {
|
||||
Object.keys(toot.tags).forEach(function (key4) {
|
||||
var tag = toot.tags[key4];
|
||||
var tags = '<a onclick="tagShow(\'' + tag + '\')" class="pointer parsed">#' + tag + '</a><span class="hide" data-tag="' + tag + '">#' + tag + ':<a onclick="tl(\'tag\',\'' + tag + '\',' + acct_id +
|
||||
var tags = '<a onclick="tagShow(\'' + tag + '\')" class="pointer parsed">#' + tag + '</a><span class="hide" data-tag="' + tag + '" data-regTag="'+tag.toLowerCase()+'">#' + tag + ':<a onclick="tl(\'tag\',\'' + tag + '\',' + acct_id +
|
||||
',\'add\')" class="pointer parsed" title="' + lang.lang_parse_tagTL.replace("{{tag}}", '#' + tag) + '">TL</a> <a onclick="brInsert(\'#' + tag + '\')" class="pointer parsed" title="' + lang.lang_parse_tagtoot.replace("{{tag}}", '#' + tag) + '">Toot</a> ' +
|
||||
'<a onclick="tagPin(\'' + tag + '\')" class="pointer parsed" title="' + lang.lang_parse_tagpin.replace("{{tag}}", '#' + tag) + '">Pin</a></span> ';
|
||||
content = content.replace("#" + tag, tags);
|
||||
|
|
|
@ -689,7 +689,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
|
|||
var featured = ` <a onclick="tagFeature('${tag.name}','${acct_id}')" class="pointer" title="add it to Featured tags">Feature</a> `
|
||||
tags =
|
||||
tags +
|
||||
`<span class="hide" data-tag="${tag.name}">#${tag.name}:
|
||||
`<span class="hide" data-tag="${tag.name}" data-regTag="${tag.name.toLowerCase()}">#${tag.name}:
|
||||
<a onclick="tl('tag','${tag.name}','${acct_id}','add')" class="pointer"
|
||||
title="${lang.lang_parse_tagTL.replace(
|
||||
'{{tag}}',
|
||||
|
@ -700,7 +700,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
|
|||
'{{tag}}',
|
||||
'#' + tag.name
|
||||
)}
|
||||
">Pin</a></span> `
|
||||
">Pin</a>${featured}</span> `
|
||||
})
|
||||
tags = '<div style="float:right">' + tags + '</div>'
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@ if (location.search) {
|
|||
}
|
||||
//よく使うタグ
|
||||
function tagShow(tag) {
|
||||
$('[data-tag=' + decodeURI(tag).toLowerCase() + ']').toggleClass('hide')
|
||||
console.log('[data-regTag=' + decodeURI(tag).toLowerCase() + ']')
|
||||
$('[data-regTag=' + decodeURI(tag).toLowerCase() + ']').toggleClass('hide')
|
||||
}
|
||||
//タグ追加
|
||||
function tagPin(tag) {
|
||||
|
@ -69,7 +70,7 @@ function favTag() {
|
|||
tags =
|
||||
tags +
|
||||
`<a onclick="tagShow('${tag}')" class="pointer">#${tag}</a>
|
||||
${nowon}<span class="hide" data-tag="${tag}">
|
||||
${nowon}<span class="hide" data-tag="${tag}" data-regTag="${tag.toLowerCase()}">
|
||||
<a onclick=\"tagTL('tag','${tag}',false,'add')" class="pointer" title="${lang.lang_parse_tagTL.replace('{{tag}}', '#' + tag)}">
|
||||
TL
|
||||
</a>
|
||||
|
@ -124,7 +125,7 @@ function trendTag() {
|
|||
tags =
|
||||
tags +
|
||||
`<a onclick="tagShow('${tag}')" class="pointer">#${tag}</a>
|
||||
<span class="hide" data-tag="${tag}">
|
||||
<span class="hide" data-tag="${tag}" data-regTag="${tag.toLowerCase()}">
|
||||
<a onclick=\"tagTL('tag','${tag}',false,'add')" class="pointer" title="#${tag}のタイムライン">TL</a>
|
||||
<a onclick="show();brInsert('#${tag}')" class="pointer" title="#${tag}でトゥート">
|
||||
Toot
|
||||
|
|
|
@ -111,7 +111,7 @@ function trendTagonTip() {
|
|||
`<a onclick="tagShow('${tag}')" class="pointer">
|
||||
#${escapeHTML(tag)}
|
||||
</a>
|
||||
<span class="hide" data-tag="${tag}">
|
||||
<span class="hide" data-tag="${tag}" data-regTag="${tag.toLowerCase()}">
|
||||
<a onclick="tagTL('tag','${tag}',false,'add')" class="pointer" title="#${tag}のタイムライン">TL</a>
|
||||
<a onclick="show();brInsert('#${tag}')" class="pointer" title="#${tag}でトゥート">Toot</a>
|
||||
</span><br>`
|
||||
|
|
Loading…
Reference in New Issue
Block a user