mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-25 07:50:23 +01:00
Merge pull request #231 from forklessanon/master
Support for youtube's 'start' and 'end' URL parameters
This commit is contained in:
commit
d75a119a7f
@ -999,8 +999,8 @@
|
|||||||
// It's very important that you match the entire input (with ^ and $) or things will not work correctly.
|
// It's very important that you match the entire input (with ^ and $) or things will not work correctly.
|
||||||
$config['embedding'] = array(
|
$config['embedding'] = array(
|
||||||
array(
|
array(
|
||||||
'/^https?:\/\/(\w+\.)?youtube\.com\/watch\?v=([a-zA-Z0-9\-_]{10,11})(&.+)?$/i',
|
'/^https?:\/\/(?:\w+\.)?(?:youtube\.com\/watch\?|youtu\.be\/)(?:(?:&?v=)?([a-zA-Z0-9\-_]{10,11})\??|&?(start=\d*)|&?(end=\d*)|(?:&?[^&]+))*$/i',
|
||||||
'<iframe style="float: left;margin: 10px 20px;" width="%%tb_width%%" height="%%tb_height%%" frameborder="0" id="ytplayer" src="http://www.youtube.com/embed/$2"></iframe>'
|
'<iframe style="float: left;margin: 10px 20px;" width="%%tb_width%%" height="%%tb_height%%" frameborder="0" id="ytplayer" src="http://youtube.com/embed/$1?$2$3"></iframe>'
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'/^https?:\/\/(\w+\.)?vimeo\.com\/(\d{2,10})(\?.+)?$/i',
|
'/^https?:\/\/(\w+\.)?vimeo\.com\/(\d{2,10})(\?.+)?$/i',
|
||||||
@ -1657,7 +1657,7 @@
|
|||||||
$config['board_regex'] = '[0-9a-zA-Z$_\x{0080}-\x{FFFF}]{1,58}';
|
$config['board_regex'] = '[0-9a-zA-Z$_\x{0080}-\x{FFFF}]{1,58}';
|
||||||
|
|
||||||
// Youtube.js embed HTML code
|
// Youtube.js embed HTML code
|
||||||
$config['youtube_js_html'] = '<div class="video-container" data-video="$2">'.
|
$config['youtube_js_html'] = '<div class="video-container" data-video="$1" data-params="&$2&$3">'.
|
||||||
'<a href="$0" target="_blank" class="file">'.
|
'<a href="$0" target="_blank" class="file">'.
|
||||||
'<img style="width:360px;height:270px;" src="//img.youtube.com/vi/$2/0.jpg" class="post-image"/>'.
|
'<img style="width:360px;height:270px;" src="//img.youtube.com/vi/$1/0.jpg" class="post-image"/>'.
|
||||||
'</a></div>';
|
'</a></div>';
|
||||||
|
@ -162,7 +162,7 @@
|
|||||||
|
|
||||||
$config['embedding'] = array(
|
$config['embedding'] = array(
|
||||||
array(
|
array(
|
||||||
'/^https?:\/\/(\w+\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9\-_]{10,11})(&.+)?$/i',
|
'/^https?:\/\/(?:\w+\.)?(?:youtube\.com\/watch\?|youtu\.be\/)(?:(?:&?v=)?([a-zA-Z0-9\-_]{10,11})\??|&?(start=\d*)|&?(end=\d*)|(?:&?[^&]+))*$/i',
|
||||||
$config['youtube_js_html']
|
$config['youtube_js_html']
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
@ -26,11 +26,9 @@
|
|||||||
onready(function(){
|
onready(function(){
|
||||||
var do_embed_yt = function(tag) {
|
var do_embed_yt = function(tag) {
|
||||||
$('div.video-container a', tag).click(function() {
|
$('div.video-container a', tag).click(function() {
|
||||||
var videoID = $(this.parentNode).data('video');
|
|
||||||
|
|
||||||
$(this.parentNode).html('<iframe style="float:left;margin: 10px 20px" type="text/html" '+
|
$(this.parentNode).html('<iframe style="float:left;margin: 10px 20px" type="text/html" '+
|
||||||
'width="360" height="270" src="//www.youtube.com/embed/' + videoID +
|
'width="360" height="270" src="//www.youtube.com/embed/' + $(this.parentNode).data('video') +
|
||||||
'?autoplay=1&html5=1" allowfullscreen frameborder="0"/>');
|
'?autoplay=1&html5=1'+ $(this.parentNode).data('params') +'" allowfullscreen frameborder="0"/>');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user