client/settings: add ability to autoplay videos
This commit is contained in:
parent
bf0342df71
commit
81080da06f
6 changed files with 27 additions and 11 deletions
|
@ -12,16 +12,18 @@
|
|||
|
||||
<% } else if (ctx.post.type === 'video') { %>
|
||||
|
||||
<% if ((ctx.post.flags || []).includes('loop')) { %>
|
||||
<video id='video' controls loop='loop'>
|
||||
<% } else { %>
|
||||
<video id='video' controls>
|
||||
<% } %>
|
||||
|
||||
<source type='<%- ctx.post.mimeType %>' src='<%- ctx.post.contentUrl %>'/>
|
||||
|
||||
Your browser doesn't support HTML5 videos.
|
||||
</video>
|
||||
<%= ctx.makeElement(
|
||||
'video', {
|
||||
controls: true,
|
||||
loop: (ctx.post.flags || []).includes('loop'),
|
||||
autoplay: ctx.autoplay,
|
||||
},
|
||||
ctx.makeElement('source', {
|
||||
type: ctx.post.mimeType,
|
||||
src: ctx.post.contentUrl,
|
||||
}),
|
||||
'Your browser doesn\'t support HTML5 videos.')
|
||||
%>
|
||||
|
||||
<% } else { console.log(new Error('Unknown post type')); } %>
|
||||
|
||||
|
|
|
@ -56,6 +56,14 @@
|
|||
}) %>
|
||||
<p class='hint'>Shows a popup with suggested tags in edit forms.</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<%= ctx.makeCheckbox({
|
||||
text: 'Automatically play video posts',
|
||||
name: 'autoplay-videos',
|
||||
checked: ctx.browsingSettings.autoplayVideos,
|
||||
}) %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class='messages'></div>
|
||||
|
|
|
@ -102,7 +102,10 @@ class PostContentControl {
|
|||
}
|
||||
|
||||
_reinstall() {
|
||||
const newNode = this._template({post: this._post});
|
||||
const newNode = this._template({
|
||||
post: this._post,
|
||||
autoplay: settings.get().autoplayVideos,
|
||||
});
|
||||
if (settings.get().transparencyGrid) {
|
||||
newNode.classList.add('transparency-grid');
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ const defaultSettings = {
|
|||
transparencyGrid: true,
|
||||
fitMode: 'fit-both',
|
||||
tagSuggestions: true,
|
||||
autoplayVideos: false,
|
||||
postsPerPage: 42,
|
||||
};
|
||||
|
||||
|
|
|
@ -377,6 +377,7 @@ function getTemplate(templatePath) {
|
|||
makeUserLink: makeUserLink,
|
||||
makeFlexboxAlign: makeFlexboxAlign,
|
||||
makeAccessKey: makeAccessKey,
|
||||
makeElement: makeElement,
|
||||
makeCssName: misc.makeCssName,
|
||||
makeNumericInput: makeNumericInput,
|
||||
});
|
||||
|
|
|
@ -35,6 +35,7 @@ class SettingsView extends events.EventTarget {
|
|||
keyboardShortcuts: this._find('keyboard-shortcuts').checked,
|
||||
transparencyGrid: this._find('transparency-grid').checked,
|
||||
tagSuggestions: this._find('tag-suggestions').checked,
|
||||
autoplayVideos: this._find('autoplay-videos').checked,
|
||||
postsPerPage: this._find('posts-per-page').value,
|
||||
},
|
||||
}));
|
||||
|
|
Loading…
Reference in a new issue