diff --git a/wp-content/plugins/bp-dedication/includes/css/bp-dedication.css b/wp-content/plugins/bp-dedication/includes/css/bp-dedication.css index 094b6f7..c2c4faf 100644 --- a/wp-content/plugins/bp-dedication/includes/css/bp-dedication.css +++ b/wp-content/plugins/bp-dedication/includes/css/bp-dedication.css @@ -52,6 +52,8 @@ form.standard-form .loading { border-radius: 3px; padding: 5px; background: #f5f5f5; + + display: none; } #user-list li { diff --git a/wp-content/plugins/bp-dedication/includes/js/dedication-script.js b/wp-content/plugins/bp-dedication/includes/js/dedication-script.js index 46160b4..39ef0e5 100644 --- a/wp-content/plugins/bp-dedication/includes/js/dedication-script.js +++ b/wp-content/plugins/bp-dedication/includes/js/dedication-script.js @@ -44,6 +44,12 @@ jQuery(document).ready(function(){ // Get youtube video's thumbnail url // using jYoutube jQuery plugin 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
j('#thumbs').html(j('')); diff --git a/wp-content/plugins/bp-dedication/includes/js/jquery.jyoutube.js.js b/wp-content/plugins/bp-dedication/includes/js/jquery.jyoutube.js.js index 5df814b..1d361f4 100644 --- a/wp-content/plugins/bp-dedication/includes/js/jquery.jyoutube.js.js +++ b/wp-content/plugins/bp-dedication/includes/js/jquery.jyoutube.js.js @@ -11,23 +11,47 @@ * */ (function($){ - $.extend({ - jYoutube: function( url, size ){ - if(url === null){ return ""; } + $.extend({ + jYoutube: function( url, size ){ + if(url === null){ + return ""; + } - size = (size === null) ? "big" : size; - var vid; - var results; + size = (size === null) ? "big" : size; + var vid; + 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]; - - if(size == "small"){ - return "http://img.youtube.com/vi/"+vid+"/2.jpg"; - }else { - return "http://img.youtube.com/vi/"+vid+"/0.jpg"; - } - } - }) -})(jQuery); \ No newline at end of file +function getYouTubeInfo(url, handleData) { + if(url === null){ + return ""; + } + var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/; + 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", + 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); + } + }); +} diff --git a/wp-content/themes/score/dedications/index.php b/wp-content/themes/score/dedications/index.php index 9c32814..8b2d18e 100644 --- a/wp-content/themes/score/dedications/index.php +++ b/wp-content/themes/score/dedications/index.php @@ -9,8 +9,9 @@ - - + + +
diff --git a/wp-content/themes/score/dedications/single/new-dedication.php b/wp-content/themes/score/dedications/single/new-dedication.php index f53ca4c..5ab0a40 100644 --- a/wp-content/themes/score/dedications/single/new-dedication.php +++ b/wp-content/themes/score/dedications/single/new-dedication.php @@ -9,11 +9,6 @@ global $bp;
    -
  1. - - - This dedication is private. -
  2. @@ -25,17 +20,22 @@ global $bp;
  3. +
  4. + + + This dedication is private. +
  5. - +
  6. - +