2015-09-02 02:52:06 +08:00
$ ( function ( ) {
2015-06-24 23:03:53 +08:00
$ ( "#newsletter" ) . validate ( ) ;
2015-01-23 02:55:45 +08:00
var ads = [
2016-08-11 04:03:32 +08:00
// {
2016-10-25 00:01:53 +08:00
// 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.",
2016-08-11 04:03:32 +08:00
// class: "symbolset",
2016-10-25 00:01:53 +08:00
// url: "https://symbolset.com/?utm_source=font_awesome_homepage&utm_medium=display&utm_content=ad_1_best_icons&utm_campaign=promo_4.7_update",
// btn_text: "Gimme Some!"
2016-08-11 04:03:32 +08:00
// },
// {
2016-10-25 00:01:53 +08:00
// 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.",
2016-08-11 04:03:32 +08:00
// class: "symbolset",
2016-10-25 00:01:53 +08:00
// url: "https://symbolset.com/?utm_source=font_awesome_homepage&utm_medium=display&utm_content=ad_2_different_look&utm_campaign=promo_4.7_update",
// btn_text: "Gimme Some!"
2016-08-11 04:03:32 +08:00
// },
// {
// quote: "Take your icon game to the next level. Check out <strong>Fort Awesome</strong>, from the maker of Font Awesome.",
// class: "fort-awesome",
2016-10-25 00:01:53 +08:00
// 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",
2016-08-11 04:03:32 +08:00
// btn_text: "Gimme Some!"
// },
// {
// quote: "Make your icons load 10x faster! Check out <strong>Fort Awesome</strong>, from the maker of Font Awesome.",
// class: "fort-awesome",
2016-10-25 00:01:53 +08:00
// 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",
2016-08-11 04:03:32 +08:00
// btn_text: "Gimme Some!"
// },
// {
// quote: "Want to add your own icon? Check out <strong>Fort Awesome</strong>, from the maker of Font Awesome.",
// class: "fort-awesome",
2016-10-25 00:01:53 +08:00
// 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",
2016-08-11 04:03:32 +08:00
// btn_text: "Gimme Some!"
2016-08-04 23:34:10 +08:00
// }
2016-10-25 00:01:53 +08:00
{
quote : "Font Awesome 5. The most awesome-est Font Awesome ever!" ,
class : "kickstarter" ,
2016-11-03 23:08:43 +08:00
url : "https://www.kickstarter.com/projects/232193852/font-awesome-5?ref=c92610" ,
2016-10-25 00:01:53 +08:00
btn _text : "Check out the Kickstarter" ,
} ,
{
2016-11-30 06:11:33 +08:00
quote : "Get 2,500+ more icons and SVG framework in Font Awesome 5 Pro!" ,
2016-10-25 00:01:53 +08:00
class : "kickstarter" ,
2016-11-03 23:08:43 +08:00
url : "https://www.kickstarter.com/projects/232193852/font-awesome-5?ref=c92610" ,
2016-10-25 00:01:53 +08:00
btn _text : "Check out the Kickstarter" ,
} ,
2016-10-28 04:53:09 +08:00
{
2016-11-03 23:08:43 +08:00
quote : "Early backer prices extended and tons of stretch goals already funded!" ,
2016-10-28 04:53:09 +08:00
class : "kickstarter" ,
2016-11-03 23:08:43 +08:00
url : "https://www.kickstarter.com/projects/232193852/font-awesome-5?ref=c92610" ,
2016-10-28 04:53:09 +08:00
btn _text : "Font Awesome 5 Kickstarter" ,
} ,
2015-01-23 02:55:45 +08:00
] ;
2016-03-11 02:49:53 +08:00
selectAd ( ) ;
2015-01-23 02:55:45 +08:00
2013-05-11 00:00:01 +08:00
// start the icon carousel
2013-10-23 23:12:39 +08:00
$ ( '#icon-carousel' ) . carousel ( {
2013-05-11 00:00:01 +08:00
interval : 5000
} ) ;
2015-01-23 02:55:45 +08:00
2016-01-09 07:03:37 +08:00
$ ( '[data-toggle="tooltip"]' ) . tooltip ( ) ;
2015-06-24 13:39:03 +08:00
$ ( '[data-toggle="popover"]' ) . popover ( ) ;
2016-10-26 00:34:36 +08:00
2016-10-25 00:01:53 +08:00
if ( storageAvailable ( 'localStorage' ) && ! localStorage . seenKickstarterModal ) {
2016-10-26 00:34:36 +08:00
$ ( '#modal-kickstarter' )
. modal ( 'toggle' )
. on ( 'hidden.bs.modal' , function ( e ) {
$ ( '#kickstarter-iframe' ) . remove ( ) ;
} ) ;
;
2016-10-25 00:01:53 +08:00
}
2015-06-24 13:39:03 +08:00
2016-10-25 00:01:53 +08:00
if ( storageAvailable ( 'localStorage' ) ) {
localStorage . seenKickstarterModal = true ;
// Yippee! We can use localStorage awesomeness
}
2016-11-30 06:11:33 +08:00
function timeLeft ( ) {
var now , ksEndsAt , hoursLeft , minutesLeft , humanized ;
try {
now = moment ( ) ;
ksEndsAt = moment ( "2016-12-01 12:01:00-05" ) ;
hoursLeft = ksEndsAt . diff ( now , "hours" ) ;
minutesLeft = ksEndsAt . diff ( now , "minutes" ) - hoursLeft * 60 ;
} catch ( e ) { }
if ( hoursLeft < 0 || minutesLeft < 0 ) {
return ;
}
humanized = hoursLeft + " " + ( ( hoursLeft === 1 ) ? "hour" : "hours" ) + ", " + minutesLeft + " " + ( ( minutesLeft === 1 ) ? "minute" : "minutes" ) ;
$ ( '#time-left-message' ) . html ( 'Just <span class="duration">' + humanized + '</span> left to support the Font Awesome 5 Kickstarter for $20' ) ;
setTimeout ( timeLeft , 2000 ) ;
}
2016-10-25 00:01:53 +08:00
function storageAvailable ( type ) {
try {
var storage = window [ type ] ,
x = '__storage_test__' ;
storage . setItem ( x , x ) ;
storage . removeItem ( x ) ;
return true ;
}
catch ( e ) {
return false ;
}
}
2016-11-30 06:11:33 +08:00
2016-03-11 02:49:53 +08:00
function selectAd ( ) {
2015-09-02 02:52:06 +08:00
random _number = Math . floor ( Math . random ( ) * ads . length ) ;
2015-01-23 02:55:45 +08:00
random _ad = ads [ random _number ] ;
2016-11-30 06:11:33 +08:00
timeLeft ( ) ;
2015-03-24 22:36:15 +08:00
$ ( '#banner' ) . addClass ( random _ad . class ) ;
2015-01-23 02:55:45 +08:00
$ ( '#rotating-message' ) . html ( random _ad . quote ) ;
2015-03-24 22:36:15 +08:00
$ ( '#rotating-url' ) . attr ( "href" , random _ad . url ) ;
$ ( '#rotating-url' ) . html ( random _ad . btn _text ) ;
$ ( '#banner' ) . collapse ( 'show' ) ;
2015-01-23 02:55:45 +08:00
}
2013-05-11 00:00:01 +08:00
} ) ;