Merge branch 'master' of github.com:cutls/TheDesk
This commit is contained in:
commit
ed4431e15a
|
@ -1,7 +1,12 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv=”refresh” content=”0;URL=’./view/ja'” />
|
||||
<script>location.href = './view/ja';</script>
|
||||
<script>
|
||||
if (/^ja\b/.test(navigator.language)) {
|
||||
location.href = './view/ja'
|
||||
} else {
|
||||
location.href = './view/en'
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
|
@ -821,23 +821,9 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
|
|||
}
|
||||
//絵文字があれば
|
||||
if (emojick) {
|
||||
Object.keys(toot.emojis).forEach(function (key5) {
|
||||
var emoji = toot.emojis[key5]
|
||||
var shortcode = emoji.shortcode
|
||||
if (gif == 'yes') {
|
||||
var emoSource = emoji.url
|
||||
} else {
|
||||
var emoSource = emoji.static_url
|
||||
}
|
||||
var emoji_url = `
|
||||
<img draggable="false" src="${emoSource}" class="emoji-img" data-emoji="${shortcode}"
|
||||
alt=" :${shortcode}: " title="${shortcode}" onclick="this.classList.toggle('bigemoji');" loading="lazy">
|
||||
`
|
||||
var regExp = new RegExp(':' + shortcode + ':', 'g')
|
||||
content = content.replace(regExp, emoji_url)
|
||||
spoil = spoil.replace(regExp, emoji_url)
|
||||
poll = poll.replace(regExp, emoji_url)
|
||||
})
|
||||
content = this.customEmojiReplace(content, toot, gif);
|
||||
spoil = this.customEmojiReplace(spoil, toot, gif);
|
||||
poll = this.customEmojiReplace(poll, toot, gif);
|
||||
}
|
||||
//ニコフレ絵文字
|
||||
if (toot.profile_emojis) {
|
||||
|
@ -1531,7 +1517,51 @@ function pollParse(poll, acct_id, emojis) {
|
|||
</div>`
|
||||
return pollHtml
|
||||
}
|
||||
function customEmojiReplace(content, toot, gif) {
|
||||
var contentDiv = document.createElement('div');
|
||||
contentDiv.style.display = 'none';
|
||||
contentDiv.innerHTML = content;
|
||||
var replace = false;
|
||||
Object.keys(toot.emojis).forEach(function(key5) {
|
||||
var emoji = toot.emojis[key5]
|
||||
var shortcode = emoji.shortcode
|
||||
if (gif == 'yes') {
|
||||
var emoSource = emoji.url
|
||||
} else {
|
||||
var emoSource = emoji.static_url
|
||||
}
|
||||
var nodes = document.evaluate('//text()', contentDiv, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
|
||||
if ( nodes.snapshotLength == 0 ) return;
|
||||
|
||||
var shortcodeBracket = (':' + shortcode + ':');
|
||||
var img = document.createElement('img');
|
||||
img.setAttribute('draggable', 'false');
|
||||
img.setAttribute('src', emoSource);
|
||||
img.setAttribute('class', 'emoji-img');
|
||||
img.setAttribute('data-emoji', shortcode);
|
||||
img.setAttribute('alt', shortcodeBracket);
|
||||
img.setAttribute('title', shortcodeBracket);
|
||||
img.setAttribute('onclick', "this.classList.toggle('bigemoji');");
|
||||
|
||||
for ( var i=0; i < nodes.snapshotLength; i++ ) {
|
||||
var node = nodes.snapshotItem(i);
|
||||
var txt = node.textContent;
|
||||
var spos = txt.indexOf(shortcodeBracket);
|
||||
if (spos == -1) continue;
|
||||
|
||||
var txtBefore = document.createTextNode(txt.substr(0, spos));
|
||||
var txtAfter = document.createTextNode(txt.substr(spos + shortcodeBracket.length));
|
||||
|
||||
node.parentNode.insertBefore(txtBefore, node);
|
||||
node.parentNode.insertBefore(img, node);
|
||||
node.parentNode.insertBefore(txtAfter, node);
|
||||
node.textContent = '';
|
||||
replace = true;
|
||||
}
|
||||
})
|
||||
if (replace) contentDiv.innerHTML = this.customEmojiReplace(contentDiv.innerHTML, toot, gif);
|
||||
return contentDiv.innerHTML;
|
||||
}
|
||||
//MastodonBaseStreaming
|
||||
var mastodonBaseWs = {}
|
||||
var mastodonBaseWsStatus = {}
|
||||
|
|
Loading…
Reference in New Issue
Block a user