site.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. $(function () {
  2. $("#newsletter").validate();
  3. var ads = [
  4. {
  5. quote: "Get 2,000+ icons with Font Awesome Pro and <strong>ALL</strong> KS rewards for just $60!",
  6. class: "fa5",
  7. url: "https://fontawesome.com/?utm_source=font_awesome_homepage&utm_medium=display&utm_campaign=fa5_released&utm_content=banner",
  8. btn_text: "Check out FA Pro &nbsp;<i class='fas fas-external-link'></i>",
  9. },
  10. ];
  11. // selectAd();
  12. // start the icon carousel
  13. $('#icon-carousel').carousel({
  14. interval: 5000
  15. });
  16. $('[data-toggle="tooltip"]').tooltip();
  17. $('[data-toggle="popover"]').popover();
  18. if (storageAvailable('localStorage') && !localStorage.seenFA5ReleasedModal) {
  19. $('#modal-fa5')
  20. .modal('toggle')
  21. .on('hidden.bs.modal', function (e) {
  22. $('#fa5-iframe').remove();
  23. });
  24. ;
  25. }
  26. if (storageAvailable('localStorage')) {
  27. localStorage.seenFA5ReleasedModal = true;
  28. // Yippee! We can use localStorage awesomeness
  29. }
  30. function storageAvailable(type) {
  31. try {
  32. var storage = window[type],
  33. x = '__storage_test__';
  34. storage.setItem(x, x);
  35. storage.removeItem(x);
  36. return true;
  37. }
  38. catch(e) {
  39. return false;
  40. }
  41. }
  42. function selectAd() {
  43. random_number = Math.floor(Math.random() * ads.length);
  44. random_ad = ads[random_number];
  45. $('#banner').addClass(random_ad.class);
  46. $('#rotating-message').html(random_ad.quote);
  47. $('#rotating-url').attr("href", random_ad.url);
  48. $('#rotating-url').html(random_ad.btn_text);
  49. $('#banner').collapse('show');
  50. }
  51. });