hashtag
This commit is contained in:
parent
ce72432039
commit
b35ecbf79c
|
@ -9,24 +9,21 @@ function additional(acct_id, tlid) {
|
||||||
$('#timeline-container .hashtag, #timeline-container [rel=tag]').each(function(i, elem) {
|
$('#timeline-container .hashtag, #timeline-container [rel=tag]').each(function(i, elem) {
|
||||||
var tags = $(this)
|
var tags = $(this)
|
||||||
.attr('href')
|
.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) {
|
if (tags) {
|
||||||
var tagThis = tags[2]
|
var tagThis = tags[2]
|
||||||
} else {
|
} else {
|
||||||
var tagThis = $(this).attr('data-tag')
|
var tagThis = $(this).attr('data-regTag')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tagThis) {
|
if (tagThis) {
|
||||||
$(this).attr('onclick', "tagShow('" + tagThis + "')")
|
$(this).attr('href', "javascript:tagShow('" + tagThis + "')")
|
||||||
$(this).attr('href', '#')
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
//トゥートサムネ
|
//トゥートサムネ
|
||||||
$('#timeline_' + tlid + ' .toot a:not(.parsed)').each(function(i, elem) {
|
$('#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')
|
var text = $(this).attr('href')
|
||||||
if (text) {
|
if (text) {
|
||||||
if (text.indexOf('twimg.com') === -1) {
|
if (text.indexOf('twimg.com') === -1) {
|
||||||
|
@ -48,48 +45,6 @@ function additional(acct_id, tlid) {
|
||||||
}
|
}
|
||||||
if (urls) {
|
if (urls) {
|
||||||
$(this).remove()
|
$(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 {
|
} else {
|
||||||
$(this).attr('title', text)
|
$(this).attr('title', text)
|
||||||
}
|
}
|
||||||
|
@ -139,8 +94,7 @@ function additional(acct_id, tlid) {
|
||||||
var id = $(this)
|
var id = $(this)
|
||||||
.parents('.cvo')
|
.parents('.cvo')
|
||||||
.attr('toot-id')
|
.attr('toot-id')
|
||||||
$(this).attr('href', '#')
|
$(this).attr('href', `javascript:imgv('${id}','${i}')`)
|
||||||
$(this).attr('onclick', "imgv('" + id + "','" + i + "')")
|
|
||||||
$(this).attr('data-type', 'image')
|
$(this).attr('data-type', 'image')
|
||||||
$(this).attr('id', id + '-image-' + i)
|
$(this).attr('id', id + '-image-' + i)
|
||||||
$(this).attr('data-url', ilink)
|
$(this).attr('data-url', ilink)
|
||||||
|
|
|
@ -520,7 +520,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
||||||
if (tagck) {
|
if (tagck) {
|
||||||
Object.keys(toot.tags).forEach(function (key4) {
|
Object.keys(toot.tags).forEach(function (key4) {
|
||||||
var tag = toot.tags[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> ' +
|
',\'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> ';
|
'<a onclick="tagPin(\'' + tag + '\')" class="pointer parsed" title="' + lang.lang_parse_tagpin.replace("{{tag}}", '#' + tag) + '">Pin</a></span> ';
|
||||||
content = content.replace("#" + tag, tags);
|
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> `
|
var featured = ` <a onclick="tagFeature('${tag.name}','${acct_id}')" class="pointer" title="add it to Featured tags">Feature</a> `
|
||||||
tags =
|
tags =
|
||||||
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"
|
<a onclick="tl('tag','${tag.name}','${acct_id}','add')" class="pointer"
|
||||||
title="${lang.lang_parse_tagTL.replace(
|
title="${lang.lang_parse_tagTL.replace(
|
||||||
'{{tag}}',
|
'{{tag}}',
|
||||||
|
@ -700,7 +700,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
|
||||||
'{{tag}}',
|
'{{tag}}',
|
||||||
'#' + tag.name
|
'#' + tag.name
|
||||||
)}
|
)}
|
||||||
">Pin</a></span> `
|
">Pin</a>${featured}</span> `
|
||||||
})
|
})
|
||||||
tags = '<div style="float:right">' + tags + '</div>'
|
tags = '<div style="float:right">' + tags + '</div>'
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ if (location.search) {
|
||||||
}
|
}
|
||||||
//よく使うタグ
|
//よく使うタグ
|
||||||
function tagShow(tag) {
|
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) {
|
function tagPin(tag) {
|
||||||
|
@ -69,7 +70,7 @@ function favTag() {
|
||||||
tags =
|
tags =
|
||||||
tags +
|
tags +
|
||||||
`<a onclick="tagShow('${tag}')" class="pointer">#${tag}</a>
|
`<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)}">
|
<a onclick=\"tagTL('tag','${tag}',false,'add')" class="pointer" title="${lang.lang_parse_tagTL.replace('{{tag}}', '#' + tag)}">
|
||||||
TL
|
TL
|
||||||
</a>
|
</a>
|
||||||
|
@ -124,7 +125,7 @@ function trendTag() {
|
||||||
tags =
|
tags =
|
||||||
tags +
|
tags +
|
||||||
`<a onclick="tagShow('${tag}')" class="pointer">#${tag}</a>
|
`<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=\"tagTL('tag','${tag}',false,'add')" class="pointer" title="#${tag}のタイムライン">TL</a>
|
||||||
<a onclick="show();brInsert('#${tag}')" class="pointer" title="#${tag}でトゥート">
|
<a onclick="show();brInsert('#${tag}')" class="pointer" title="#${tag}でトゥート">
|
||||||
Toot
|
Toot
|
||||||
|
|
|
@ -111,7 +111,7 @@ function trendTagonTip() {
|
||||||
`<a onclick="tagShow('${tag}')" class="pointer">
|
`<a onclick="tagShow('${tag}')" class="pointer">
|
||||||
#${escapeHTML(tag)}
|
#${escapeHTML(tag)}
|
||||||
</a>
|
</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="tagTL('tag','${tag}',false,'add')" class="pointer" title="#${tag}のタイムライン">TL</a>
|
||||||
<a onclick="show();brInsert('#${tag}')" class="pointer" title="#${tag}でトゥート">Toot</a>
|
<a onclick="show();brInsert('#${tag}')" class="pointer" title="#${tag}でトゥート">Toot</a>
|
||||||
</span><br>`
|
</span><br>`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user