site.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. quote: "Save 50% with the early backer price until Monday! Just $20!",
  48. class: "kickstarter",
  49. url: "https://www.kickstarter.com/projects/232193852/font-awesome-5?ref=fontawesome-banner",
  50. btn_text: "Font Awesome 5 Kickstarter",
  51. },
  52. ];
  53. selectAd();
  54. // start the icon carousel
  55. $('#icon-carousel').carousel({
  56. interval: 5000
  57. });
  58. $('[data-toggle="tooltip"]').tooltip();
  59. $('[data-toggle="popover"]').popover();
  60. if (storageAvailable('localStorage') && !localStorage.seenKickstarterModal) {
  61. $('#modal-kickstarter')
  62. .modal('toggle')
  63. .on('hidden.bs.modal', function (e) {
  64. $('#kickstarter-iframe').remove();
  65. });
  66. ;
  67. }
  68. if (storageAvailable('localStorage')) {
  69. localStorage.seenKickstarterModal = true;
  70. // Yippee! We can use localStorage awesomeness
  71. }
  72. function storageAvailable(type) {
  73. try {
  74. var storage = window[type],
  75. x = '__storage_test__';
  76. storage.setItem(x, x);
  77. storage.removeItem(x);
  78. return true;
  79. }
  80. catch(e) {
  81. return false;
  82. }
  83. }
  84. function selectAd() {
  85. random_number = Math.floor(Math.random() * ads.length);
  86. random_ad = ads[random_number];
  87. $('#banner').addClass(random_ad.class);
  88. $('#rotating-message').html(random_ad.quote);
  89. $('#rotating-url').attr("href", random_ad.url);
  90. $('#rotating-url').html(random_ad.btn_text);
  91. $('#banner').collapse('show');
  92. }
  93. });