Advertisement
Guest User

Untitled

a guest
Jul 1st, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. $('a.introVid').click(function () {
  2. autoPlayVideo('XGSy3_Czz8k', '420', '345');
  3. });
  4.  
  5. function autoPlayVideo(vcode, width, height) {
  6. first = true;
  7. startTime();
  8. "use strict";
  9. $("#videoContainer").html('<iframe width="' + width + '" height="' + height + '" src="https://www.youtube.com/embed/' + vcode + '?autoplay=1&loop=1&rel=0&wmode=transparent" frameborder="0" allowfullscreen wmode="Opaque"></iframe>');
  10. }
  11.  
  12. var h1,m1,s1 = 0;
  13. var first = true;
  14. function startTime() {
  15. var today=new Date();
  16. h=today.getHours();
  17. m=today.getMinutes();
  18. s=today.getSeconds();
  19. if (first)
  20. {
  21. h1 = h;
  22. m1 = m;
  23. s1 = s;
  24. first = false;
  25. }
  26. h -= h1;
  27. m -= m1;
  28. s -= s1;
  29. m = checkTime(m);
  30. s = checkTime(s);
  31. document.getElementById('txt').innerHTML = h + ":" + m + ":" + s;
  32. var t = setTimeout(function(){startTime()},500);
  33. }
  34.  
  35. function checkTime(i) {
  36. if (i<10) {i = "0" + i}; // add zero in front of numbers < 10
  37. return i;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement