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'], '*') postMessage(['sendSinmpleIpc', 'custom-css-request'], '*')
function makeCID() { incrementid=0
return uuid() function makeCID()
{
return incrementid++
} }
function rgbToHex(color) { 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}` const dropdownTrigger = `dropdown_${rand}`
let elm = document.querySelector(`#timeline_${tlid} #${dropdownTrigger}`) let elm = document.querySelector(`#timeline_${tlid} #${dropdownTrigger}`)
if(tlid == 'notf') { 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-actions").toggleClass("hide")
//$(tlide + " [toot-id=" + id + "] .area-side").toggleClass("hide") //$(tlide + " [toot-id=" + id + "] .area-side").toggleClass("hide")
} }
} }*/
function resetmv(type) { function resetmv(type) {
var mouseover = localStorage.getItem('mouseover') var mouseover = localStorage.getItem('mouseover')

View File

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

View File

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

View File

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

View File

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