# HG changeset patch # User cavaliet # Date 1386337091 -3600 # Node ID defe7ee70fa20a31aea32fc582f021bdfd90a721 # Parent cb7987ab3f80e64d39aefaba192642786f3396df v0.31 : 0018322 et 0018323 diff -r cb7987ab3f80 -r defe7ee70fa2 src/jocondelab/__init__.py --- a/src/jocondelab/__init__.py Thu Dec 05 18:56:29 2013 +0100 +++ b/src/jocondelab/__init__.py Fri Dec 06 14:38:11 2013 +0100 @@ -1,4 +1,4 @@ -VERSION = (0, 30, 0, "final", 0) +VERSION = (0, 31, 0, "final", 0) def get_version(): diff -r cb7987ab3f80 -r defe7ee70fa2 src/jocondelab/locale/fr/LC_MESSAGES/django.mo Binary file src/jocondelab/locale/fr/LC_MESSAGES/django.mo has changed diff -r cb7987ab3f80 -r defe7ee70fa2 src/jocondelab/locale/fr/LC_MESSAGES/django.po --- a/src/jocondelab/locale/fr/LC_MESSAGES/django.po Thu Dec 05 18:56:29 2013 +0100 +++ b/src/jocondelab/locale/fr/LC_MESSAGES/django.po Fri Dec 06 14:38:11 2013 +0100 @@ -302,7 +302,7 @@ #: templates/jocondelab/front_geo.html:37 #: templates/jocondelab/front_home.html:34 msgid "Mappemonde" -msgstr "Mappemonde" +msgstr "Carte du monde" #: templates/jocondelab/front_base.html:103 #: templates/jocondelab/front_home.html:41 diff -r cb7987ab3f80 -r defe7ee70fa2 src/jocondelab/static/jocondelab/js/front-search.js --- a/src/jocondelab/static/jocondelab/js/front-search.js Thu Dec 05 18:56:29 2013 +0100 +++ b/src/jocondelab/static/jocondelab/js/front-search.js Fri Dec 06 14:38:11 2013 +0100 @@ -26,4 +26,44 @@ im.addClass("visited"); } }); + + // Check if a dom element is the current viewport + // el is dom element, not jquery object + function isElementInViewport(el) { + var rect = el.getBoundingClientRect(); + return ( + rect.top >= 0 && + rect.left >= 0 && + rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /*or $(window).height() */ + rect.right <= (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */ + ); + } + var myTimeOut = false; + function startTimeOut(){ + myTimeOut = setInterval(function(){ testIfLastLiInViewport() }, 3000); + } + function testIfLastLiInViewport(){ + var el = $($(".results ul")[0]).children().last()[0]; + if ( isElementInViewport(el) ) { + // Last li is visible, so we have to call next page manually + if (typeof queryobj === "object" && queryobj) { + $(window).trigger("scroll.ajaxload"); + } + } + else{ + clearInterval(myTimeOut); + } + } + + if (window.addEventListener) { + //addEventListener('DOMContentLoaded', testIfLastLiInViewport(), false); + addEventListener('load', startTimeOut(), false); + //addEventListener('scroll', testIfLastLiInViewport(), false); + //addEventListener('resize', testIfLastLiInViewport(), false); + } else if (window.attachEvent) { + //attachEvent('DOMContentLoaded', testIfLastLiInViewport()); + attachEvent('load', startTimeOut()); + //attachEvent('scroll', testIfLastLiInViewport()); + //attachEvent('resize', testIfLastLiInViewport()); + } }); \ No newline at end of file diff -r cb7987ab3f80 -r defe7ee70fa2 src/jocondelab/views/front_office.py --- a/src/jocondelab/views/front_office.py Thu Dec 05 18:56:29 2013 +0100 +++ b/src/jocondelab/views/front_office.py Fri Dec 06 14:38:11 2013 +0100 @@ -153,8 +153,7 @@ context["page_count"] = paginator.num_pages ids = paginator.page(min(int(page),paginator.num_pages)) context["count"] = paginator.count - if paginator.count==0: - context["wkinfo"] = None + # Now that we have the list of ids ns = Notice.objects.filter(pk__in=ids).extra(select={'relative_url': '"core_noticeimage"."relative_url"'}).filter(image=True).filter(images__main=True).order_by('id')