- Mejora en el alta de una dedicatoria para detectar título y artista.
git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@15 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6
This commit is contained in:
parent
d62dbe2c0b
commit
f4f712a3c8
@ -52,6 +52,8 @@ form.standard-form .loading {
|
|||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
background: #f5f5f5;
|
background: #f5f5f5;
|
||||||
|
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#user-list li {
|
#user-list li {
|
||||||
|
|||||||
@ -44,6 +44,12 @@ jQuery(document).ready(function(){
|
|||||||
// Get youtube video's thumbnail url
|
// Get youtube video's thumbnail url
|
||||||
// using jYoutube jQuery plugin
|
// using jYoutube jQuery plugin
|
||||||
url = j.jYoutube(j('#video_url').val());
|
url = j.jYoutube(j('#video_url').val());
|
||||||
|
title = getYouTubeInfo(j('#video_url').val(),
|
||||||
|
function(artist, song){
|
||||||
|
j('#artist_name').val(artist);
|
||||||
|
j('#song_name').val(song);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
// Now append this image to <div id="thumbs">
|
// Now append this image to <div id="thumbs">
|
||||||
j('#thumbs').html(j('<img src="'+url+'" />'));
|
j('#thumbs').html(j('<img src="'+url+'" />'));
|
||||||
|
|||||||
@ -11,23 +11,47 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
(function($){
|
(function($){
|
||||||
$.extend({
|
$.extend({
|
||||||
jYoutube: function( url, size ){
|
jYoutube: function( url, size ){
|
||||||
if(url === null){ return ""; }
|
if(url === null){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
size = (size === null) ? "big" : size;
|
size = (size === null) ? "big" : size;
|
||||||
var vid;
|
var vid;
|
||||||
var results;
|
var results;
|
||||||
|
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
|
||||||
|
results = url.match(regExp);
|
||||||
|
|
||||||
results = url.match("[\\?&]v=([^&#]*)");
|
vid = (results && (results[7].length == 11 )) ? results[7] : "";
|
||||||
|
|
||||||
|
if(size == "small"){
|
||||||
|
return "http://img.youtube.com/vi/"+vid+"/2.jpg";
|
||||||
|
} else {
|
||||||
|
return "http://img.youtube.com/vi/"+vid+"/0.jpg";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})(jQuery);
|
||||||
|
|
||||||
vid = ( results === null ) ? url : results[1];
|
function getYouTubeInfo(url, handleData) {
|
||||||
|
if(url === null){
|
||||||
if(size == "small"){
|
return "";
|
||||||
return "http://img.youtube.com/vi/"+vid+"/2.jpg";
|
}
|
||||||
}else {
|
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
|
||||||
return "http://img.youtube.com/vi/"+vid+"/0.jpg";
|
var results = url.match(regExp);
|
||||||
}
|
var vid = (results && (results[7].length == 11 )) ? results[7] : "";
|
||||||
}
|
jQuery.ajax({
|
||||||
})
|
url: "http://gdata.youtube.com/feeds/api/videos/"+vid+"?v=2&alt=json",
|
||||||
})(jQuery);
|
dataType: "jsonp",
|
||||||
|
success: function (data) {
|
||||||
|
var otitle = data.entry[ "title" ].$t;
|
||||||
|
var ntitle = otitle.match('^(.*) - (.*)$');
|
||||||
|
|
||||||
|
var song = (ntitle && (ntitle[2].length > 0 )) ? ntitle[2] : "";
|
||||||
|
var artist = (ntitle && (ntitle[1].length > 0 )) ? ntitle[1] : otitle;
|
||||||
|
|
||||||
|
handleData(artist, song);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@ -9,8 +9,9 @@
|
|||||||
<?php global $bp, $post, $gp_settings; ?>
|
<?php global $bp, $post, $gp_settings; ?>
|
||||||
|
|
||||||
<?php get_header( 'buddypress' ); ?>
|
<?php get_header( 'buddypress' ); ?>
|
||||||
|
<?php if ( !bp_is_current_action( 'new-dedication' ) ) : ?>
|
||||||
<?php locate_template( array( 'video-slider.php' ), true ); ?>
|
<?php locate_template( array( 'video-slider.php' ), true ); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<div id="content<?php if ( !bp_is_current_action( 'new-dedication' ) ) { ?> fullwidth<?php } ?>">
|
<div id="content<?php if ( !bp_is_current_action( 'new-dedication' ) ) { ?> fullwidth<?php } ?>">
|
||||||
<div class="padder">
|
<div class="padder">
|
||||||
|
|||||||
@ -9,11 +9,6 @@ global $bp;
|
|||||||
|
|
||||||
<div class="columns two first blank text-left">
|
<div class="columns two first blank text-left">
|
||||||
<ol>
|
<ol>
|
||||||
<li>
|
|
||||||
<label for="dedication_text">Dedication text</label>
|
|
||||||
<textarea name="dedication_text" class="dedication_text required" id="dedication_text"></textarea>
|
|
||||||
<input name="private-dedication" type="checkbox" />This dedication is private.
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<label for="dedicate_to_input"><?php _e("Enter a member to dedicate:", 'bp-dedication') ?></label>
|
<label for="dedicate_to_input"><?php _e("Enter a member to dedicate:", 'bp-dedication') ?></label>
|
||||||
|
|
||||||
@ -25,17 +20,22 @@ global $bp;
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<label for="dedication_text">Dedication text</label>
|
||||||
|
<textarea name="dedication_text" class="dedication_text required" id="dedication_text"></textarea>
|
||||||
|
<input name="private-dedication" type="checkbox" />This dedication is private.
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label for="video_url">Video for dedication</label>
|
<label for="video_url">Video for dedication</label>
|
||||||
<input type="text" name="video_url" class="video_url required url" id="video_url" />
|
<input type="text" name="video_url" class="video_url required url" id="video_url" />
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label for="artist_name">Artist name</label>
|
<label for="artist_name">Artist name</label>
|
||||||
<input type="text" name="artist_name" class="artist_name required" id="artist_name"/>
|
<input type="text" name="artist_name" class="artist_name" id="artist_name"/>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label for="song_name">Song name</label>
|
<label for="song_name">Song name</label>
|
||||||
<input type="text" name="song_name" class="song_name required" id="song_name"/>
|
<input type="text" name="song_name" class="song_name" id="song_name"/>
|
||||||
</li>
|
</li>
|
||||||
<?php /*
|
<?php /*
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user