2023-07-27 14:31:52 +09:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2021-04-23 15:33:33 +09:00
|
|
|
import { Directive } from 'vue';
|
2023-09-19 16:37:43 +09:00
|
|
|
import { defaultStore } from '@/store.js';
|
2021-04-23 15:33:33 +09:00
|
|
|
|
|
|
|
export default {
|
2022-12-31 19:46:16 +09:00
|
|
|
mounted(el: HTMLElement, binding, vn) {
|
2021-09-23 23:01:32 +09:00
|
|
|
if (!defaultStore.state.animation) return;
|
|
|
|
|
2022-12-31 19:46:16 +09:00
|
|
|
const target = el.children[0];
|
|
|
|
|
|
|
|
if (target == null) return;
|
|
|
|
|
|
|
|
target.classList.add('_anime_bounce_standBy');
|
2021-04-24 18:38:38 +09:00
|
|
|
|
2021-04-23 15:33:33 +09:00
|
|
|
el.addEventListener('mousedown', () => {
|
2023-01-08 17:41:09 +09:00
|
|
|
target.classList.remove('_anime_bounce');
|
|
|
|
|
2022-12-31 19:46:16 +09:00
|
|
|
target.classList.add('_anime_bounce_standBy');
|
|
|
|
target.classList.add('_anime_bounce_ready');
|
2021-04-23 15:33:33 +09:00
|
|
|
|
2022-12-31 19:46:16 +09:00
|
|
|
target.addEventListener('mouseleave', () => {
|
|
|
|
target.classList.remove('_anime_bounce_ready');
|
2021-04-23 15:33:33 +09:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
el.addEventListener('click', () => {
|
2022-12-31 19:46:16 +09:00
|
|
|
target.classList.add('_anime_bounce');
|
2023-01-08 20:21:32 +09:00
|
|
|
target.classList.remove('_anime_bounce_ready');
|
2021-04-23 15:33:33 +09:00
|
|
|
});
|
|
|
|
|
|
|
|
el.addEventListener('animationend', () => {
|
2022-12-31 19:46:16 +09:00
|
|
|
target.classList.remove('_anime_bounce');
|
|
|
|
target.classList.add('_anime_bounce_standBy');
|
2021-04-23 15:33:33 +09:00
|
|
|
});
|
2022-12-22 16:01:59 +09:00
|
|
|
},
|
2021-04-23 15:33:33 +09:00
|
|
|
} as Directive;
|