Created
May 13, 2012 11:08
-
-
Save jesseproudman/2687851 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
function fixVimeo() { | |
/* | |
Better Vimeo Embeds 2.1 by Matthew Buchanan | |
Modelled on the Vimeo Embedinator Script | |
http://mattbu.ch/tumblr/vimeo-embeds/ | |
Released under a Creative Commons attribution license: | |
http://creativecommons.org/licenses/by/3.0/nz/ | |
*/ | |
var color = "55cc55"; | |
var opts = "title=0&byline=0&portrait=0"; | |
$("iframe[src^='http://player.vimeo.com']").each(function() { | |
var src = $(this).attr("src"); | |
var w = $(this).attr("width"); | |
var h = $(this).attr("height"); | |
if (src.indexOf("?") == -1) { | |
$(this).replaceWith( | |
"<iframe src='"+src+"?"+opts+"&color="+ | |
color+"' width='"+w+"' height='"+h+ | |
"' frameborder='0'></iframe>" | |
); | |
} | |
}); | |
$("object[data^='http://vimeo.com']").each(function() { | |
var $obj = $(this); | |
var data = $obj.attr("data"); | |
var temp = data.split("clip_id=")[1]; | |
var id = temp.split("&")[0]; | |
var server = temp.split("&")[1]; | |
var w = $obj.attr("width"); | |
var h = $obj.attr("height"); | |
$obj.replaceWith( | |
"<iframe src='http://player.vimeo.com/video/" | |
+id+"?"+server+"&"+opts+"&color="+color+ | |
"' width='"+w+"' height='"+h+ | |
"' frameborder='0'></iframe>" | |
); | |
}); | |
} | |
$(function() { | |
fixVimeo(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment