toogle with mouseover

This commit is contained in:
cutls 2020-09-11 21:25:27 +09:00
parent 81c476c1bb
commit 9f4f788519
3 changed files with 14 additions and 39 deletions

View File

@ -681,40 +681,8 @@ function staEx(mode) {
return
}
function toggleAction(id) {
console.log(document.getElementById(id))
var instance = M.Dropdown.init(document.getElementById(id));
const elm = document.getElementById(id)
const instance = M.Dropdown.init(elm);
console.log(instance.isOpen)
instance.open()
return
var height = ct * 39 + 6
var cont = elem.parents('.cvo').find('.contextMenu')
if (cont.hasClass('hide')) {
$('#contextWrap').removeClass('hide')
var left = elem.offset().left + 60
var top = elem.offset().top - height
if (top < 75) {
top = elem.offset().top + 45
cont.removeClass('bottom')
cont.addClass('top')
} else {
top = elem.offset().top - 105
cont.removeClass('top')
cont.addClass('bottom')
}
if (elem.parents('.cvo').attr('id') == 'toot-this') {
console.log($('#toot-this').offset().top, elem.offset().top)
left = $('#toot-this').offset().left + elem.offset().left + 10
top = $('#toot-this').offset().top - $('#toot-this').height() - height + 25
}
cont.css('top', top + 'px')
cont.css('right', `calc(100vw - ${left}px)`)
cont.removeClass('hide')
elem
.parents('.cvo')
.find('.act-icon')
.text('expand_less')
} else {
$('#contextWrap').addClass('hide')
$('.contextMenu').addClass('hide')
$('.act-icon').text('expand_more')
}
}

View File

@ -335,6 +335,13 @@ function cardCheck(tlid) {
}
function mov(id, tlid, type) {
const dropdownTrigger = `dropdown_${tlid}_${id}`
const elm = document.getElementById(dropdownTrigger)
const instance = M.Dropdown.getInstance(elm)
if(instance) {
if(instance.isOpen) return false
}
var click = false
if (tlid == 'notf') {
var tlide = '[data-notf=' + acct_id + ']'
@ -361,9 +368,9 @@ function mov(id, tlid, type) {
}
if (mouseover == 'hide') {
if (click) {
$(tlide + ' [toot-id=' + id + ']').toggleClass('hide-actions')
$(tlide + ' [unique-id=' + id + ']').toggleClass('hide-actions')
} else {
$(tlide + ' [toot-id=' + id + ']').removeClass('hide-actions')
$(tlide + ' [unique-id=' + id + ']').removeClass('hide-actions')
}
//$(tlide + " [toot-id=" + id + "] .area-vis").toggleClass("hide")

View File

@ -1032,8 +1032,8 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
'unix'
)}"
${if_notf}
onmouseover="mov('${toot.id}','${tlid}','mv')"
onclick="mov('${toot.id}','${tlid}','cl')"
onmouseover="mov('${uniqueid}','${tlid}','mv')"
onclick="mov('${uniqueid}','${tlid}','cl')"
onmouseout="resetmv('mv')"
>
<div class="area-notice grid"><span class="gray sharesta">${notice}${home}</span></div>