analytics.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. $('.nav-toggle').on('touchstart click', function(e) {
  2. e.preventDefault();
  3. $( this ).toggleClass( 'active' );
  4. });
  5. $(function dw_hidenav() {
  6. var headerHeight = $('.navbar').height();
  7. $(window).on('scroll', { previousTop: 0 },
  8. function() {
  9. var currentTop = $(window).scrollTop();
  10. if (currentTop < this.previousTop) {
  11. if (currentTop > 0 && $('.navbar').hasClass('fixed')) {
  12. $('.navbar').addClass('visible');
  13. } else {
  14. $('.navbar').removeClass('visible fixed');
  15. }
  16. }
  17. else {
  18. $('.navbar').removeClass('visible');
  19. if (currentTop > headerHeight && !$('.navbar').hasClass('fixed')) $('.navbar').addClass('fixed');
  20. }
  21. this.previousTop = currentTop;
  22. }
  23. );
  24. });
  25. /* -----------------------------
  26. (function( $ ) {
  27. $.fn.timespent = function(options){
  28. var urla = "https://davidawindham.com/wik/index.php?module=API&method=UserCountry.getCity&format=json&idSite=1&period=month&date=yesterday&expanded=1&token_auth=d97e3e8f34071515ad1f6e345f6035af";
  29. var data = [];
  30. function isLoaded (recentElement) {
  31. for (var i = 0; i < country.length; i++){
  32. var markup = $("<li class='list-group-item'>" + data[i].label + " - <span class='artist'>" + data[i].nb_visits + " : " + data[i].sum_visit_length + "</li>");
  33. recentElement.append(markup);
  34. }
  35. }
  36. return this.each(function(){
  37. var $this = $(this);
  38. $.getJSON( urla, function(data){
  39. $(data).each(function(){
  40. data.push ({
  41. artist: this.label,
  42. title: this.nb_visits,
  43. album: this.sum_visit_length
  44. });
  45. });
  46. isLoadedr($this);
  47. });
  48. });
  49. };
  50. $('.time-spent').timespent();
  51. })( jQuery );
  52. ------ SAVE FOR LATER -------*/