Skip to content

Commit e6642b0

Browse files
committed
Visual Path: allow mp4 videos
1 parent 966448d commit e6642b0

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

system/application/views/melons/cantaloupe/css/common.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,13 @@ a:hover { text-decoration: underline; }
589589
.image_header.has_video {
590590
position:relative;
591591
}
592-
.splash .video_wrapper, .image_header .video_wrapper {
592+
.visual_path .sp-block.has_video h1, .visual_path .sp-block.has_video .sp-block__content {
593+
position:relative; z-index:1;
594+
}
595+
.visual_path .sp-block.has_video .video_wrapper {
596+
z-index:0;
597+
}
598+
.splash .video_wrapper, .image_header .video_wrapper, .visual_path .video_wrapper {
593599
position: absolute;
594600
top: 0; right:0; bottom:0; left:0;
595601
overflow: hidden;

system/application/views/melons/cantaloupe/js/scalarpage.jquery.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2939,13 +2939,24 @@
29392939
};
29402940
};
29412941
var default_view = pathContents[i].current.defaultView;
2942-
var media_urls = [];
29432942
$("[property='sioc:content']").append('<div class="sp-block sp-block-'+default_view+'" id="'+slug+'"><h1 class="padded-multiline"><a class="sp-title" href="'+base_url+slug+'">' + title + '</a></h1><div class="sp-block__content ' +slug+ '">' +((description.length)?description:'')+ '</div></div>');
29442943
// set background
2945-
$("#"+slug).css({ "background-image": 'url("'+((key.length)?key:'')+'")' }).find('.sp-block__content').append('<div><a class="nav_btn primary" href="'+base_url+slug+'">Continue</a></div>');
2946-
if (description.length) {
2947-
$("."+slug).css("background-color", "#fff");
2944+
if ('.mp4'==key.substr(key.length-4, 4)) { // The controller looks for ".mp4" so do the same here ~cd
2945+
$("#"+slug).addClass('has_video').prepend('<div class="video_wrapper"><video autoplay muted loop playsinline preload="none"><source src="'+key+'" type="video/mp4"></video></div>');
2946+
$("#"+slug).find('.video_wrapper video:first').on('loadedmetadata', function() {
2947+
var $video = $(this);
2948+
$video.data('orig_w', parseInt($video.get(0).videoWidth));
2949+
$video.data('orig_h', parseInt($video.get(0).videoHeight));
2950+
$(window).resize(function() {
2951+
cover_video.call($video.get(0));
2952+
}).trigger('resize');
2953+
});
2954+
} else {
2955+
$("#"+slug).css({ "background-image": 'url("'+((key.length)?key:'')+'")' });
29482956
};
2957+
// end set background
2958+
$('#'+slug).find('.sp-block__content').append('<div><a class="nav_btn primary" href="'+base_url+slug+'">Continue</a></div>')
2959+
if (description.length) $("."+slug).css("background-color", "#fff");
29492960
$("#"+slug).append('<div style="visibility:hidden; clear:both; height:1px; overflow:hidden;"></div>');
29502961
}
29512962
}

0 commit comments

Comments
 (0)