mirror of
https://github.com/wallabag/wallabag.git
synced 2026-03-14 17:37:37 +01:00
32 lines
684 B
JavaScript
32 lines
684 B
JavaScript
import { Controller } from '@hotwired/stimulus';
|
|
import M from '@materializecss/materialize';
|
|
|
|
export default class extends Controller {
|
|
connect() {
|
|
this.instance = M.FloatingActionButton.init(this.element, {
|
|
direction: 'left',
|
|
hoverEnabled: false,
|
|
});
|
|
}
|
|
|
|
autoDisplay() {
|
|
const scrolled = (window.innerHeight + window.scrollY) >= document.body.offsetHeight;
|
|
|
|
if (scrolled) {
|
|
this.toggleScroll = true;
|
|
this.instance.open();
|
|
} else if (this.toggleScroll === true) {
|
|
this.toggleScroll = false;
|
|
this.instance.close();
|
|
}
|
|
}
|
|
|
|
click() {
|
|
this.dispatch('click');
|
|
}
|
|
|
|
disconnect() {
|
|
this.instance.destroy();
|
|
}
|
|
}
|