Fixed scrolling behaviour with auto embed.
This commit is contained in:
parent
3247a46d19
commit
f4b43290bb
4 changed files with 90 additions and 78 deletions
src/mami.js
|
@ -195,10 +195,10 @@ Umi.Parsing = (function() {
|
|||
};
|
||||
|
||||
const toggleImage = function(element) {
|
||||
const url = element.parentElement.title,
|
||||
container = element.parentElement.getElementsByTagName('span')[0],
|
||||
anchor = container.getElementsByTagName('a')[0],
|
||||
isEmbedded = container.title !== 'link';
|
||||
const url = element.parentElement.title;
|
||||
const container = element.parentElement.getElementsByTagName('span')[0];
|
||||
const anchor = container.getElementsByTagName('a')[0];
|
||||
const isEmbedded = container.title !== 'link';
|
||||
|
||||
if(isEmbedded) {
|
||||
container.title = 'link';
|
||||
|
@ -220,6 +220,10 @@ Umi.Parsing = (function() {
|
|||
maxHeight: '50vh',
|
||||
verticalAlign: 'middle',
|
||||
},
|
||||
onload: () => {
|
||||
if(mami.settings.get('autoScroll'))
|
||||
container.scrollIntoView({ inline: 'end' });
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -234,9 +238,9 @@ Umi.Parsing = (function() {
|
|||
}
|
||||
};
|
||||
const toggleAudio = function(element) {
|
||||
const url = element.parentElement.title,
|
||||
container = element.parentElement.getElementsByTagName('span')[0],
|
||||
isEmbedded = container.title !== 'link';
|
||||
const url = element.parentElement.title;
|
||||
const container = element.parentElement.getElementsByTagName('span')[0];
|
||||
const isEmbedded = container.title !== 'link';
|
||||
|
||||
if(isEmbedded) {
|
||||
container.title = 'link';
|
||||
|
@ -263,14 +267,18 @@ Umi.Parsing = (function() {
|
|||
attrs: {
|
||||
src: url,
|
||||
controls: true,
|
||||
onloadedmetadata: () => {
|
||||
if(mami.settings.get('autoScroll'))
|
||||
container.scrollIntoView({ inline: 'end' });
|
||||
},
|
||||
},
|
||||
}));
|
||||
}
|
||||
};
|
||||
const toggleVideo = function(element) {
|
||||
const url = element.parentElement.title,
|
||||
container = element.parentElement.getElementsByTagName('span')[0],
|
||||
isEmbedded = container.title !== 'link';
|
||||
const url = element.parentElement.title;
|
||||
const container = element.parentElement.getElementsByTagName('span')[0];
|
||||
const isEmbedded = container.title !== 'link';
|
||||
|
||||
if(isEmbedded) {
|
||||
container.title = 'link';
|
||||
|
@ -301,6 +309,10 @@ Umi.Parsing = (function() {
|
|||
maxWidth: '800px',
|
||||
maxHeight: '600px',
|
||||
},
|
||||
onloadedmetadata: () => {
|
||||
if(mami.settings.get('autoScroll'))
|
||||
container.scrollIntoView({ inline: 'end' });
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -315,8 +327,8 @@ Umi.Parsing = (function() {
|
|||
}
|
||||
};
|
||||
const toggleSpoiler = function(element) {
|
||||
const container = element.parentElement,
|
||||
target = container.querySelector('span');
|
||||
const container = element.parentElement;
|
||||
const target = container.querySelector('span');
|
||||
|
||||
if(container.dataset.revealed === 'yes') {
|
||||
container.dataset.revealed = 'no';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue