server+client: added sound flag to video posts
This commit is contained in:
		
							parent
							
								
									c8fe0fcdff
								
							
						
					
					
						commit
						2235a72d2f
					
				@ -50,6 +50,11 @@
 | 
			
		||||
                    name: 'loop',
 | 
			
		||||
                    checked: ctx.post.flags.includes('loop'),
 | 
			
		||||
                }) %>
 | 
			
		||||
                <%= ctx.makeCheckbox({
 | 
			
		||||
                    text: 'Sound',
 | 
			
		||||
                    name: 'sound',
 | 
			
		||||
                    checked: ctx.post.flags.includes('sound'),
 | 
			
		||||
                }) %>
 | 
			
		||||
            </section>
 | 
			
		||||
        <% } %>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -14,6 +14,9 @@
 | 
			
		||||
                }[ctx.post.mimeType] %>
 | 
			
		||||
            </a>
 | 
			
		||||
            (<%- ctx.post.canvasWidth %>x<%- ctx.post.canvasHeight %>)
 | 
			
		||||
            <% if (ctx.post.flags.includes('sound')) { %>
 | 
			
		||||
                <i class='fa fa-volume-up'></i>
 | 
			
		||||
            <% } %>
 | 
			
		||||
        </section>
 | 
			
		||||
 | 
			
		||||
        <section class='upload-info'>
 | 
			
		||||
 | 
			
		||||
@ -331,9 +331,7 @@ class PostEditSidebarControl extends events.EventTarget {
 | 
			
		||||
                        .value.toLowerCase() :
 | 
			
		||||
                    undefined,
 | 
			
		||||
 | 
			
		||||
                flags: this._loopVideoInputNode ?
 | 
			
		||||
                    (this._loopVideoInputNode.checked ? ['loop'] : []) :
 | 
			
		||||
                    undefined,
 | 
			
		||||
                flags: this._videoFlags,
 | 
			
		||||
 | 
			
		||||
                tags: this._tagInputNode ?
 | 
			
		||||
                    misc.splitByWhitespace(this._tagInputNode.value) :
 | 
			
		||||
@ -375,6 +373,18 @@ class PostEditSidebarControl extends events.EventTarget {
 | 
			
		||||
        return this._formNode.querySelector('.flags input[name=loop]');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    get _soundVideoInputNode() {
 | 
			
		||||
        return this._formNode.querySelector('.flags input[name=sound]');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    get _videoFlags() {
 | 
			
		||||
        if (!this._loopVideoInputNode) return undefined;
 | 
			
		||||
        let ret = [];
 | 
			
		||||
        if (this._loopVideoInputNode.checked) ret.push('loop');
 | 
			
		||||
        if (this._soundVideoInputNode.checked) ret.push('sound');
 | 
			
		||||
        return ret;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    get _relationsInputNode() {
 | 
			
		||||
        return this._formNode.querySelector('.relations input');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -81,6 +81,7 @@ TYPE_MAP = {
 | 
			
		||||
 | 
			
		||||
FLAG_MAP = {
 | 
			
		||||
    model.Post.FLAG_LOOP: 'loop',
 | 
			
		||||
    model.Post.FLAG_SOUND: 'sound',
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -154,6 +154,7 @@ class Post(Base):
 | 
			
		||||
    TYPE_FLASH = 'flash'
 | 
			
		||||
 | 
			
		||||
    FLAG_LOOP = 'loop'
 | 
			
		||||
    FLAG_SOUND = 'sound'
 | 
			
		||||
 | 
			
		||||
    # basic meta
 | 
			
		||||
    post_id = sa.Column('id', sa.Integer, primary_key=True)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user