This commit is contained in:
Zergling_man 2022-12-26 18:30:30 +11:00
commit 7ece60d925
7 changed files with 66 additions and 23 deletions

View File

@ -103,8 +103,10 @@ function formattimeutc(date) {
}
postMessage(['sendSinmpleIpc', 'custom-css-request'], '*')
function makeCID() {
return uuid()
incrementid=0
function makeCID()
{
return incrementid++
}
function rgbToHex(color) {

View File

@ -335,7 +335,17 @@ function cardCheck(tlid) {
}
}
function mov(id, tlid, type, rand, target) {
function mov(id, tlid, type, rand, target)
{
mouseover=localStorage.getItem('mouseover')
switch (mouseover)
{
case 'yes': if (type=='mv') $(target).removeClass('hide-actions'); break;
case 'click': if (type=='cl') $(target).toggleClass('hide-actions'); break;
case 'no': break;
}
}
/*function mov(id, tlid, type, rand, target) {
const dropdownTrigger = `dropdown_${rand}`
let elm = document.querySelector(`#timeline_${tlid} #${dropdownTrigger}`)
if(tlid == 'notf') {
@ -383,7 +393,7 @@ function mov(id, tlid, type, rand, target) {
//$(tlide + " [toot-id=" + id + "] .area-actions").toggleClass("hide")
//$(tlide + " [toot-id=" + id + "] .area-side").toggleClass("hide")
}
}
}*/
function resetmv(type) {
var mouseover = localStorage.getItem('mouseover')

View File

@ -771,7 +771,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
} else {
var actemojick = false
}
var rand = uuid()
var rand = makeCID()
templete = templete + '<div id="pub_' + toot.id + '" class="cvo ' +
boostback + ' ' + fav_app + ' ' + rt_app + ' ' + hasmedia + '" toot-id="' + id + '" unique-id="' + uniqueid + '" data-medias="' + media_ids + ' " unixtime="' + date(obj[
key].created_at, 'unix') + '" ' + if_notf + ' onmouseover="mov(\'' + toot.id + '\',\'' + tlid + '\',\'mv\', \'' + rand + '\')" onclick="mov(\'' + toot.id + '\',\'' + tlid + '\',\'cl\', \'' + rand + '\')" onmouseout="resetmv(\'mv\')" reacted="' + reacted + '">' +

View File

@ -594,7 +594,6 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
if (toot.poll) {
var poll = pollParse(toot.poll, acct_id, false)
}
var mediack = toot.media_attachments[0]
//メディアがあれば
var media_ids = ''
@ -985,7 +984,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
menuct++
}
//このトゥート内のアクションを完了させるために、適当にIDを振る
var rand = uuid()
var rand = makeCID()
//プラグイン機構
var pluginBOT = plugins.buttonOnToot
var pluginHtml = ''
@ -1057,7 +1056,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
</a>
</div>
<div class="action ${disp['re']} ${noauth}">
<a onclick="re('${toot.id}','${to_mention}','${acct_id}','${visen}','${escapeHTML(toot.spoiler_text)}')"
<a onclick="re('${toot.id}','${to_mention}','${acct_id}','${visen}','${escapeHTML(toot.spoiler_text).replaceAll('\n','')}')"
class="waves-effect waves-dark btn-flat actct rep-btn"
data-men="${to_mention}" data-visen="${visen}" style="padding:0" title="${lang.lang_parse_replyto}">
<i class="fas fa-share"></i>
@ -1395,7 +1394,7 @@ function client(name) {
}
//Poll Parser
function pollParse(poll, acct_id, emojis) {
var rand = uuid()
var rand = makeCID()
var datetype = localStorage.getItem('datetype')
var anime = localStorage.getItem('animation')
if (anime == 'yes' || !anime) {

View File

@ -30,7 +30,7 @@ function src(mode, offset) {
`)
var add = ''
} else {
var add = '&type=accounts&offset=' + $('#src-accts .cvo').length
var add = '&type=accounts&offset=' + $('#src-accts .cusr').length
}
var q = $('#src').val()
@ -92,6 +92,11 @@ function src(mode, offset) {
#${escapeHTML(tag)}
</a>
<br> `
} else if (!tag.history) {
tags+=`<a onclick="tl('tag','${tag.name}','${acct_id}','add')" class="pointer">
#${escapeHTML(tag.name)}
</a>
<br> `
} else {
tags = tags + graphDraw(tag, acct_id)
}

View File

@ -285,6 +285,7 @@ function stremaingSubscribe(type, acct_id, data, unsubscribe) {
let name = data
if (data.name) name = data.name
arr.push(name)
console.log(data.any, data.all, acct_id, type)
if (data.any) arr = arr.concat(data.any.split(','))
if (data.all) arr = arr.concat(data.all.split(','))
for (const tag of arr) {

View File

@ -22,20 +22,40 @@ function imgv(id, key, acct_id) {
murl = ourl
}
$(document).ready(function () {
if (type == 'image') {
if (type == 'image') {display_image(murl,id,key)}
else if (type == 'video') {display_video(murl)}
else if (type == 'gifv')
{
if (remote_img == 'no') {display_video(murl)}
else
{
// Need to detect if it's a video or a gif, depends if it came from pleroma or mastodon
// Using extension is a bad idea but w/e
// Actually if it's from mastodon the extension will be mp4.
if (murl.endsWith('.mp4')) {display_video(murl)}
else {display_image(murl,id,key)}
}
}
})
}
function display_image(murl,id,key)
{
$('#imagemodal').modal('open')
imageXhr(id, key, murl)
$('#imagewrap').dragScroll() // ドラッグスクロール設定
$('#imgmodal').show()
$('#imagemodal').attr('data-key', key)
$('#imagemodal').attr('data-id', id)
} else if (type == 'video' || type == 'gifv') {
}
function display_video(murl,id=null,key=null)
{
$('#video').attr('src', murl)
$('#videomodal').modal('open')
$('#imgmodal').show()
}
})
}
//イメージビューワーの送り
function imgCont(type) {
var key = $('#imagemodal').attr('data-key')
@ -47,6 +67,9 @@ function imgCont(type) {
}
var murl = $('#' + id + '-image-' + key).attr('data-url')
var ourl = $('#' + id + '-image-' + key).attr('data-original')
if (!ourl || ourl == 'null') {
ourl = murl
}
var type = $('#' + id + '-image-' + key).attr('data-type')
$('#imagemodal').attr('data-id', id)
$('#imagemodal').attr('data-acct', acct_id)
@ -54,7 +77,7 @@ function imgCont(type) {
$('#imagemodal').attr('data-image', murl)
//表示はリモートを使うか(どちらにしろコピーはオリジナル)
var remote_img = localStorage.getItem('remote_img')
if (remote_img == 'yes' && ourl != 'null') {
if (remote_img == 'yes') {
murl = ourl
}
if (murl) {
@ -336,7 +359,10 @@ function openFinder(dir) {
postMessage(['openFinder', dir], '*')
}
function stopVideo() {
document.getElementById('video').pause()
video=document.getElementById('video')
video.pause()
video.src=''
//document.getElementById('video').pause()
}
function copyImgUrl() {
var murl = $('#imagemodal').attr('data-original')