Skip to content

Instantly share code, notes, and snippets.

@jasontucker
Created October 9, 2012 04:50
Show Gist options
  • Save jasontucker/3856679 to your computer and use it in GitHub Desktop.
Save jasontucker/3856679 to your computer and use it in GitHub Desktop.
Modify iFrame code to autoplay on Mondays, later I'll narrow it down to 11:00 11:30am
var $j = jQuery.noConflict();
function changeYoutube() {
$j('iframe').each(function () {
var that = $j(this);
var href = that.attr('src');
if (href.search('youtube.com') != -1) {
that.attr('src', href + '&autoplay=1');
// code to get id
var tmp = href.split("?");
var tmp2 = tmp[0].split("/");
var ID = tmp2[tmp2.length - 1];
}
});
}
var now = new Date();
if (now.getDay() == 1) // Monday
{
// between 11am and 11:30am
//if (now.getHours() == 11 && now.getMinutes() <= 30)
//{
$j(document).ready(function () {
changeYoutube();
});
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment