Ticket #5443: 0006-Theater-mode-for-mediagoblin.patch
File 0006-Theater-mode-for-mediagoblin.patch, 8.3 KB (added by , 9 years ago) |
---|
-
new file mediagoblin/static/css/theater.css
From 05c9aeb2662a91da4b642973c3db1f4cf3eeca87 Mon Sep 17 00:00:00 2001 From: saksham1115 <saksham115@gmail.com> Date: Mon, 21 Mar 2016 16:46:09 +0530 Subject: [PATCH 6/6] Theater mode for mediagoblin --- mediagoblin/static/css/theater.css | 12 ++++ mediagoblin/static/js/theater.js | 68 ++++++++++++++++++++++ mediagoblin/templates/mediagoblin/base.html | 4 +- .../mediagoblin/media_displays/video.html | 18 ++++-- .../templates/mediagoblin/user_pages/media.html | 6 +- 5 files changed, 99 insertions(+), 9 deletions(-) create mode 100644 mediagoblin/static/css/theater.css create mode 100644 mediagoblin/static/js/theater.js diff --git a/mediagoblin/static/css/theater.css b/mediagoblin/static/css/theater.css new file mode 100644 index 0000000..6b5006f
- + 1 .vjs-default-skin .vjs-control.vjs-toggle-button { 2 display: block; 3 font-size: 1.5em; 4 line-height: 2; 5 position: relative; 6 top: 0; 7 float:right; 8 left: 10px; 9 height: 100%; 10 text-align: center; 11 cursor: pointer; 12 } -
new file mediagoblin/static/js/theater.js
diff --git a/mediagoblin/static/js/theater.js b/mediagoblin/static/js/theater.js new file mode 100644 index 0000000..ad1ea61
- + 1 function Theatertoggle() { 2 var toggle = false; 3 videojs.toggle = videojs.Button.extend({ 4 init: function(player, options) { 5 videojs.Button.call(this, player, options); 6 this.on('click', this.onClick); 7 } 8 }); 9 10 function hide(elements) { 11 elements = elements.length ? elements : [elements]; 12 for (var index = 0; index < elements.length; index++) { 13 console.log(elements[index]); 14 } 15 } 16 videojs.toggle.prototype.onClick = function() { 17 if (toggle) { 18 // $(".container").css("opacity",0.5); 19 var sidebar = document.getElementById("TheaterToggle_2"); 20 var video_div = document.getElementById("TheaterToggle_1") 21 var comments = document.getElementById("TheaterToggle_3"); 22 video_div.style.width = "100%"; 23 comments.style.display = "inline-block"; 24 video_div.appendChild(sidebar); 25 sidebar.style.cssFloat = "right"; 26 toggle = false; 27 hide(document.getElementById('wrap')); 28 console.log("1"); 29 } else { 30 var sidebar = document.getElementById("TheaterToggle_2"); 31 var comments = document.getElementById("TheaterToggle_3"); 32 var video_div = document.getElementById("TheaterToggle_1"); 33 var clear = document.getElementById("clear"); 34 $("#TheaterToggle_2").appendTo('#mediagoblin_content'); 35 $("#TheaterToggle_2").insertAfter("#TheaterToggle_1"); 36 video_div.style.width = ""; 37 comments.style.display = ""; 38 sidebar.style.cssFloat = ""; 39 toggle = true; 40 console.log('2'); 41 } 42 43 }; 44 var createToggleButton = function() { 45 var props = { 46 className: 'vjs-toggle-button vjs-control', 47 innerHTML: '<div class="vjs-control-content">' + ('[__]') + '</div>', 48 role: 'button', 49 tabIndex: 0 50 }; 51 52 return videojs.Component.prototype.createEl(null, props); 53 }; 54 videojs.plugin('toggle', function() { 55 var options = { 56 'el': createToggleButton() 57 }; 58 toggle = new videojs.toggle(this, options); 59 this.controlBar.el().appendChild(toggle.el()); 60 }); 61 var vid = videojs("video1", { 62 plugins: { 63 toggle: {} 64 } 65 }); 66 67 } 68 Theatertoggle(); 69 No newline at end of file -
mediagoblin/templates/mediagoblin/base.html
diff --git a/mediagoblin/templates/mediagoblin/base.html b/mediagoblin/templates/mediagoblin/base.html index 9b0b716..fc4df64 100644
a b 72 72 <div class="row foot"> 73 73 <div class="header_left"> 74 74 {%- include "mediagoblin/bits/logo.html" -%} 75 75 {% template_hook("header_left") %} 76 76 {% block mediagoblin_header_title %}{% endblock %} 77 77 </div> 78 78 <div class="header_right"> … … 190 190 {% endblock %} 191 191 <div class="container"> 192 192 {% include 'mediagoblin/bits/above_content.html' %} 193 <div class="mediagoblin_content" >193 <div class="mediagoblin_content" id="mediagoblin_content"> 194 194 {% include "mediagoblin/utils/messages.html" %} 195 195 {% block mediagoblin_content %} 196 196 {% endblock mediagoblin_content %} -
mediagoblin/templates/mediagoblin/media_displays/video.html
diff --git a/mediagoblin/templates/mediagoblin/media_displays/video.html b/mediagoblin/templates/mediagoblin/media_displays/video.html index 5aac352..a36c886 100644
a b 31 31 <link href="{{ 32 32 request.staticdirect('/extlib/video-js/video-js.css') }}" 33 33 rel="stylesheet"> 34 34 <link href="{{ 35 request.staticdirect('/extlib/video-js/video-js.css') }}" 36 rel="stylesheet"> 37 <link href="{{ 38 request.staticdirect('/css/theater.css') }}" 39 rel="stylesheet"> 35 40 <style type="text/css"> 36 41 .vjs-default-skin .vjs-big-play-button 37 42 { … … 49 54 <div class="media_other_container"> 50 55 {% set display_type, display_path = media.get_display_media() %} 51 56 52 <video controls57 <video id="video1" controls 53 58 {% if global_config['plugins']['mediagoblin.media_types.video']['auto_play'] %}autoplay{% endif %} 54 59 preload="auto" class="video-js vjs-default-skin" 55 60 data-setup='{"height": {{ media.media_data.height }}, 56 "width": {{ media.media_data.width }} }' >61 "width": {{ media.media_data.width }} }' > 57 62 <source src="{{ request.app.public_store.file_url(display_path) }}" 58 63 {% if media.media_data %} 59 64 type="{{ media.media_data.source_type() }}" 60 65 {% else %} 61 66 type="{{ media.media_manager['default_webm_type'] }}" 62 67 {% endif %} /> 68 69 <track kind="captions" src="{{ 70 request.staticdirect('/subtitles/test.srt') }}" label="test"> 63 71 <div class="no_html5"> 64 72 {%- trans -%}Sorry, this video will not work because 65 your web browser does not support HTML5 73 your web browser does not support HTML5 66 74 video.{%- endtrans -%}<br/> 67 75 {%- trans -%} 68 76 We recommend you install a <a href="https://libreplanet.org/wiki/Libre_Browsers_Libre_Formats">freedom-respecting browser which supports free formats</a>! … … 70 78 </div> 71 79 </video> 72 80 </div> 81 <script type="text/javascript" src="{{ 82 request.staticdirect('/js/theater.js') }}"></script> 73 83 {% endblock %} 74 84 75 85 {% block mediagoblin_sidebar %} -
mediagoblin/templates/mediagoblin/user_pages/media.html
diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html index 37e1db8..07e1b3e 100644
a b 51 51 {% include "mediagoblin/utils/prev_next.html" %} 52 52 </div> 53 53 </div> 54 <div class="media_pane eleven columns" >54 <div class="media_pane eleven columns" id="TheaterToggle_1"> 55 55 {% block mediagoblin_media %} 56 56 <div class="media_image_container"> 57 57 {% set display_media = request.app.public_store.file_url( … … 98 98 {% endautoescape %} 99 99 </div> 100 100 {% if request.user and request.user.has_privilege('commenter') %} 101 <div class="media_comments" >101 <div class="media_comments" id="TheaterToggle_3"> 102 102 {% if app_config['allow_comments'] %} 103 103 <a 104 104 {% if not request.user %} … … 180 180 </div> 181 181 182 182 183 <div class="five columns media_sidebar" >183 <div class="five columns media_sidebar" id="TheaterToggle_2"> 184 184 <h3>{% trans %}Added{% endtrans %}</h3> 185 185 <p><span title="{{ media.created.strftime("%I:%M%p %Y-%m-%d") }}"> 186 186 {%- trans formatted_time=timesince(media.created) -%}