-
-
Save nucab/61f859aacbfc0e5f27f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* jYoutube 1.0 - YouTube video image getter plugin for jQuery | |
* | |
* Copyright (c) 2009 jQuery Howto | |
* | |
* Licensed under the GPL license: | |
* http://www.gnu.org/licenses/gpl.html | |
* | |
* Plugin home & Author URL: | |
* http://jquery-howto.blogspot.com | |
* | |
*/ | |
(function($){ | |
$.extend({ | |
jYoutube: function( url, size ){ | |
if(url === null){ return ""; } | |
size = (size === null) ? "big" : size; | |
var vid; | |
var results; | |
results = url.match("[\\?&]v=([^&#]*)"); | |
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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment