From 150bdc5ae01ac5fe2b650e14d47db03d51e876d2 Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Mon, 19 Oct 2015 19:00:46 -0400 Subject: [PATCH] analytics --- src/DotNetMashup.Web/Views/Home/Index.cshtml | 30 +--------------- .../Views/Shared/_Layout.cshtml | 1 - src/DotNetMashup.Web/wwwroot/js/site.js | 34 +++++++++++++++++++ 3 files changed, 35 insertions(+), 30 deletions(-) diff --git a/src/DotNetMashup.Web/Views/Home/Index.cshtml b/src/DotNetMashup.Web/Views/Home/Index.cshtml index 91c0745..e3dbd67 100644 --- a/src/DotNetMashup.Web/Views/Home/Index.cshtml +++ b/src/DotNetMashup.Web/Views/Home/Index.cshtml @@ -30,33 +30,5 @@ } @section scripts{ - + } \ No newline at end of file diff --git a/src/DotNetMashup.Web/Views/Shared/_Layout.cshtml b/src/DotNetMashup.Web/Views/Shared/_Layout.cshtml index 682bc8f..c6070ef 100644 --- a/src/DotNetMashup.Web/Views/Shared/_Layout.cshtml +++ b/src/DotNetMashup.Web/Views/Shared/_Layout.cshtml @@ -47,7 +47,6 @@ asp-fallback-test="_"> - @RenderSection("scripts", required: false) \ No newline at end of file diff --git a/src/DotNetMashup.Web/wwwroot/js/site.js b/src/DotNetMashup.Web/wwwroot/js/site.js index 82ecce7..47fdf39 100644 --- a/src/DotNetMashup.Web/wwwroot/js/site.js +++ b/src/DotNetMashup.Web/wwwroot/js/site.js @@ -1 +1,35 @@ // Write your Javascript code. +$(document).ready(function(){ + var page = @Model.CurrentPage; + $('img').addClass('img-responsive'); + $('.tile').addClass('show'); + var loading = false; + $(window).on('scroll', function () { + var loadingImage = $('.loadWheel'); + if($(window).scrollTop() + $(window).height() == $(document).height() && !loading ) { + loading = true + loadingImage.show(); + $.ajax('/Home/Tiles', {data:{page:page+1}}) + .done(function(data){ + page++; + loading = false; + loadingImage.hide(); + var resd = $(data); + resd.find('img').addClass('img-responsive'); + $('#tilesContainer').append(resd).find('.tile').addClass('show'); + }) + .error(function(){ + loadingImage.hide(); + }); + } + }); +}); +(function (i, s, o, g, r, a, m) { + i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () { + (i[r].q = i[r].q || []).push(arguments) + }, i[r].l = 1 * new Date(); a = s.createElement(o), + m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) +})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); + +ga('create', 'UA-48128396-3', 'auto'); +ga('send', 'pageview'); \ No newline at end of file