Welcome to mirror list, hosted at ThFree Co, Russian Federation.

site.js « js « assets « src - github.com/ForkAwesome/Fork-Awesome.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 90ab57a3257731f2a931e07d818b47b5d2d413da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
$(function () {
  $("#newsletter").validate();

  var ads = [
    {
      quote: "September is your last chance to get FA Pro and <strong>ALL</strong> KS rewards for $40.",
      class: "fa5",
      url: "https://fontawesome.com/?utm_source=font_awesome_homepage&utm_medium=display&utm_campaign=september_last_chance&utm_content=banner",
      btn_text: "Check out FA Pro! &nbsp;<i class='fas fas-external-link'></i>",
    },
  ];

  selectAd();

  // start the icon carousel
  $('#icon-carousel').carousel({
    interval: 5000
  });

  $('[data-toggle="tooltip"]').tooltip();
  $('[data-toggle="popover"]').popover();

  if (storageAvailable('localStorage') && !localStorage.seenFA5Modal3) {
    $('#modal-fa5')
      .modal('toggle')
      .on('hidden.bs.modal', function (e) {
        $('#fa5-iframe').remove();
      });
    ;
  }

  if (storageAvailable('localStorage')) {
    localStorage.seenFA5Modal3 = true;
  	// Yippee! We can use localStorage awesomeness
  }

  function timeLeft() {
    var now, ksEndsAt, hoursLeft, minutesLeft, humanized;

    try {
      now = moment();
      ksEndsAt = moment("2017-10-01 00:00: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 before the price goes up!');

    setTimeout(timeLeft, 2000);
  }

  function storageAvailable(type) {
  	try {
  		var storage = window[type],
  			x = '__storage_test__';
  		storage.setItem(x, x);
  		storage.removeItem(x);
  		return true;
  	}
  	catch(e) {
  		return false;
  	}
  }

  function selectAd() {
    random_number = Math.floor(Math.random() * ads.length);
    random_ad = ads[random_number];

    timeLeft();

    $('#banner').addClass(random_ad.class);
    $('#rotating-message').html(random_ad.quote);
    $('#rotating-url').attr("href", random_ad.url);
    $('#rotating-url').html(random_ad.btn_text);
    $('#banner').collapse('show');
  }
});