mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 21:33:09 +02:00
wip
This commit is contained in:
parent
02be6a08f9
commit
b0c1ec3124
3 changed files with 17 additions and 19 deletions
|
@ -50,7 +50,7 @@
|
|||
this.mixin('api');
|
||||
this.mixin('i');
|
||||
|
||||
this.close = (e) => {
|
||||
this.close = e => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
|
@ -61,7 +61,6 @@
|
|||
no_donation: this.I.data.no_donation
|
||||
|
||||
this.unmount();
|
||||
|
||||
this.parent.parent.set-root-layout!
|
||||
};
|
||||
</script>
|
||||
</mk-donation>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<style>
|
||||
:scope
|
||||
display block
|
||||
position fixed
|
||||
position sticky
|
||||
top 0
|
||||
z-index 1024
|
||||
width 100%
|
||||
|
|
|
@ -9,29 +9,28 @@
|
|||
<style>
|
||||
:scope
|
||||
display block
|
||||
|
||||
</style>
|
||||
<script>
|
||||
this.mixin('i');
|
||||
|
||||
this.open-post-form = () => {
|
||||
riot.mount document.body.appendChild document.createElement 'mk-post-form-window'
|
||||
|
||||
this.set-root-layout = () => {
|
||||
this.root.style.padding-top = this.refs.header.root.client-height + 'px'
|
||||
this.openPostForm = () => {
|
||||
riot.mount(document.body.appendChild(document.createElement('mk-post-form-window');
|
||||
};
|
||||
|
||||
this.on('mount', () => {
|
||||
@set-root-layout!
|
||||
document.addEventListener 'keydown' this.onkeydown
|
||||
document.addEventListener('keydown', this.onkeydown);
|
||||
});
|
||||
|
||||
this.on('unmount', () => {
|
||||
document.removeEventListener 'keydown' this.onkeydown
|
||||
document.removeEventListener('keydown', this.onkeydown);
|
||||
});
|
||||
|
||||
this.onkeydown = (e) => {
|
||||
tag = e.target.tag-name.to-lower-case!
|
||||
if tag != 'input' and tag != 'textarea'
|
||||
if e.which == 80 or e.which == 78 // p or n
|
||||
this.onkeydown = e => {
|
||||
if (e.target.tagName == 'input' || e.target.tagName == 'textarea') return;
|
||||
|
||||
if (e.which == 80 || e.which == 78) { // p or n
|
||||
e.preventDefault();
|
||||
@open-post-form!
|
||||
this.openPostForm();
|
||||
};
|
||||
</script>
|
||||
</mk-ui>
|
||||
|
|
Loading…
Reference in a new issue