analytics.js 1.7 KB

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