scripts.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. $(function() {
  2. $('[data-toggle="tooltip"]').tooltip()
  3. // Play initial animations on page load.
  4. $(window).on('load', function() {
  5. window.setTimeout(function() {
  6. $('body').removeClass('is-preload');
  7. }, 100);
  8. });
  9. });
  10. $(function() {
  11. $('.lazy').Lazy();
  12. });
  13. $('body').scrollspy({
  14. target: '.resources-sidebar>.sticky-top>ul'
  15. })
  16. // Twitter Widget
  17. ! function(d, s, id) {
  18. var js, fjs = d.getElementsByTagName(s)[0];
  19. if (!d.getElementById(id)) {
  20. js = d.createElement(s);
  21. js.id = id;
  22. js.src = "https://platform.twitter.com/widgets.js";
  23. fjs.parentNode.insertBefore(js, fjs);
  24. }
  25. }(document, "script", "twitter-wjs");
  26. // Twitch Widget
  27. (function() {
  28. var user_name, api_key, twitch_widget;
  29. user_name = "startbootstrap";
  30. api_key = "5j0r5b7qb7kro03fvka3o8kbq262wwm";
  31. twitch_widget = $("#twitch-widget");
  32. twitch_widget.attr("href", "https://twitch.tv/" + user_name);
  33. $.getJSON('https://api.twitch.tv/kraken/streams/' + user_name + '?client_id=' + api_key + '&callback=?', function(data) {
  34. if (data.stream) {
  35. twitch_widget.html('<div class="py-3 bg-twitch shadow-sm"><div class="container d-flex align-items-center justify-content-center"><span class="badge text-uppercase mr-3 text-white"><i class="fas fa-circle fa-sm text-danger"></i> Live</span> Start Bootstrap is live on Twitch.tv! Click here to watch and to chat with the developer!</div></div>');
  36. } else {
  37. twitch_widget.html('');
  38. }
  39. });
  40. })();