site.js 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. $(function () {
  2. $("#newsletter").validate();
  3. var ads = [
  4. // {
  5. // quote: "<i class='fas fas-perfect fas-2x valign-middle margin-right'></i>Looking for the best icon sets? Check out <strong>Symbolset</strong>, <a href='https://articles.fortawesome.com/fort-awesome-acquires-symbolset-72229dab2c13'>now</a> from the maker of Font Awesome.",
  6. // class: "symbolset",
  7. // url: "https://symbolset.com/?utm_source=font_awesome_homepage&utm_medium=display&utm_content=ad_1_best_icons&utm_campaign=promo_4.7_update",
  8. // btn_text: "Gimme Some!"
  9. // },
  10. // {
  11. // quote: "<i class='fas fas-curate fas-2x valign-middle margin-right'></i>Need a different look for your icons? Check out <strong>Symbolset</strong>, <a href='https://articles.fortawesome.com/fort-awesome-acquires-symbolset-72229dab2c13'>now</a> from the maker of Font Awesome.",
  12. // class: "symbolset",
  13. // url: "https://symbolset.com/?utm_source=font_awesome_homepage&utm_medium=display&utm_content=ad_2_different_look&utm_campaign=promo_4.7_update",
  14. // btn_text: "Gimme Some!"
  15. // },
  16. // {
  17. // quote: "Take your icon game to the next level. Check out <strong>Fort Awesome</strong>, from the maker of Font Awesome.",
  18. // class: "fort-awesome",
  19. // url: "https://fortawesome.com/start?utm_source=font_awesome_homepage&utm_medium=display&utm_content=ad_1_next_level&utm_campaign=promo_4.7_update",
  20. // btn_text: "Gimme Some!"
  21. // },
  22. // {
  23. // quote: "Make your icons load 10x faster! Check out <strong>Fort Awesome</strong>, from the maker of Font Awesome.",
  24. // class: "fort-awesome",
  25. // url: "https://fortawesome.com/start?utm_source=font_awesome_homepage&utm_medium=display&utm_content=ad_3_faster_loading&utm_campaign=promo_4.7_update",
  26. // btn_text: "Gimme Some!"
  27. // },
  28. // {
  29. // quote: "Want to add your own icon? Check out <strong>Fort Awesome</strong>, from the maker of Font Awesome.",
  30. // class: "fort-awesome",
  31. // url: "https://fortawesome.com/start?utm_source=font_awesome_homepage&utm_medium=display&utm_content=ad_6_your_own_icon&utm_campaign=promo_4.7_update",
  32. // btn_text: "Gimme Some!"
  33. // }
  34. {
  35. quote: "Font Awesome 5. The most awesome-est Font Awesome ever!",
  36. class: "kickstarter",
  37. url: "https://www.kickstarter.com/projects/232193852/font-awesome-5?ref=fontawesome-banner",
  38. btn_text: "Check out the Kickstarter",
  39. },
  40. {
  41. quote: "Get 1,000+ more icons and SVG in Font Awesome 5 Pro!",
  42. class: "kickstarter",
  43. url: "https://www.kickstarter.com/projects/232193852/font-awesome-5?ref=fontawesome-banner",
  44. btn_text: "Check out the Kickstarter",
  45. },
  46. ];
  47. selectAd();
  48. // start the icon carousel
  49. $('#icon-carousel').carousel({
  50. interval: 5000
  51. });
  52. $('[data-toggle="tooltip"]').tooltip();
  53. $('[data-toggle="popover"]').popover();
  54. if (storageAvailable('localStorage') && !localStorage.seenKickstarterModal) {
  55. $('#modal-kickstarter')
  56. .modal('toggle')
  57. .on('hidden.bs.modal', function (e) {
  58. $('#kickstarter-iframe').remove();
  59. });
  60. ;
  61. }
  62. if (storageAvailable('localStorage')) {
  63. localStorage.seenKickstarterModal = true;
  64. // Yippee! We can use localStorage awesomeness
  65. }
  66. function storageAvailable(type) {
  67. try {
  68. var storage = window[type],
  69. x = '__storage_test__';
  70. storage.setItem(x, x);
  71. storage.removeItem(x);
  72. return true;
  73. }
  74. catch(e) {
  75. return false;
  76. }
  77. }
  78. function selectAd() {
  79. random_number = Math.floor(Math.random() * ads.length);
  80. random_ad = ads[random_number];
  81. $('#banner').addClass(random_ad.class);
  82. $('#rotating-message').html(random_ad.quote);
  83. $('#rotating-url').attr("href", random_ad.url);
  84. $('#rotating-url').html(random_ad.btn_text);
  85. $('#banner').collapse('show');
  86. }
  87. });