]> git.parisson.com Git - telemeta.git/commitdiff
add effect on the search result display
authorafilsaime <shadow_kungfu@hotmail.fr>
Wed, 10 Jun 2015 10:39:22 +0000 (12:39 +0200)
committerafilsaime <shadow_kungfu@hotmail.fr>
Wed, 10 Jun 2015 10:39:22 +0000 (12:39 +0200)
telemeta/templates/search/search.html

index 2a96d37e51ea1af93199e4596abecc9d6a985444..84300f02d5fdb11827e92cb3a051570516b8a198 100644 (file)
 
             <form method="POST" action="{% url "haystack_playlist" type %} ">{% csrf_token %}
              {% with object_list as items %}
-                <div class="fullpage">
+                <div class="fullpage" style="display:none">
                     {% ifequal type 'item' %}
                         {% include "search/mediaitem_listhaystack.html" %}
                     {% else %}
                         {%endifequal%}
                     {%endifequal%}
                 </div>
+                <noscript>
+                    <div class="fullpage">
+                        {% ifequal type 'item' %}
+                            {% include "search/mediaitem_listhaystack.html" %}
+                        {% else %}
+                            {% ifequal type 'collection' %}
+                                {% include "search/mediacollection_listhaystack.html" %}
+                            {%endifequal%}
+                        {%endifequal%}
+                    </div>
+                </noscript>
 
             {% endwith %}
             {% if user.is_authenticated %}
     <script src="{{ STATIC_URL }}telemeta/js/jquery-ui.min.js" type="text/javascript"></script>
     <script>
         $(function() {
+
+            function getPrevUrlParameter(sParam){
+                var sPageURL = document.referrer.substring(1);
+                var sURLVariables = sPageURL.split('&');
+                for (var i = 0; i < sURLVariables.length; i++)
+                {
+                    var sParameterName = sURLVariables[i].split('=');
+                    if (sParameterName[0] == sParam)
+                    {
+                        return sParameterName[1];
+                    }
+                }
+            };
+
+            function getCurrUrlParameter(sParam){
+                var sPageURL = window.location.search.substring(1);
+                var sURLVariables = sPageURL.split('&');
+                for (var i = 0; i < sURLVariables.length; i++)
+                {
+                    var sParameterName = sURLVariables[i].split('=');
+                    if (sParameterName[0] == sParam)
+                    {
+                        return sParameterName[1];
+                    }
+                }
+            };
+
+            var prev = getPrevUrlParameter("page");
+            var curr = getCurrUrlParameter("page");
+            if(prev<curr){
+                $(".fullpage").show( "slide", {direction:"left"} );
+            }
+            else if(!curr){
+                $(".fullpage").fadeIn(500);
+            }
+            else if(!prev){
+                $(".fullpage").show( "slide", {direction:"left"} );
+            }
+            else{
+                $(".fullpage").show( "slide", {direction:"right"} );
+            };
+
+            //alert("prev = "+ prev +" curr = "+ curr);
+
             var nouvellesIcones = {
                 header : 'ui-icon-carat-1-e',
                 activeHeader : 'ui-icon-carat-1-s',
                 }
             });
 
-            $(document).ready(function() {
             $("#results-per-page").selectmenu({
                 icons : {button: "ui-icon-carat-2-n-s"},
                 change : function(){
             }).selectmenu("menuWidget").addClass("overflow");
 
         });
-        });
     </script>
 {% endblock %}