150 likes | 260 Views
stuff we did and used in ilikeil. Client code. {% extends "main.html" %} {% block search %} < div id =" searchdiv " class =" searchdiv "> < form action ="/search" method ="get">
E N D
Client code • {% extends "main.html" %} • {% block search %} • <div id="searchdiv" class="searchdiv"> • <form action="/search" method="get"> • <input autocomplete="off" name="q" id="q" type="text" tabindex="1" value="{{query}}"/> • <script type="text/javascript" src="/static/slideshow/scripts.js"></script> • <script type="text/javascript"> • function showTopics(){ • document.getElementById('topics').style.visibility='visible'; • document.getElementById('random-topics').style.display='none'; • } • $(document).ready(function() { • $("#q").autocomplete( • [ {%for keyw in allkeywords%} • "{{keyw}}", • {%endfor%}''], • { • delay:1, • minChars:1, • matchSubset:1, • autoFill:true, • maxItemsToShow:10, • multiple:true, • multipleSeparator: " " • } • ); • });
Client code • </script> • <input type="submit" value="Search" /> • </form> • <span class="hottopics"> • <span id="random-topics" class="keywords"> • Hot topics: • {%for keyw in hotkeywords|slice:"3"%} • <a href="?q={{keyw}}">{{keyw}}</a> • {%endfor%} • <a href="/" onclick="showTopics();">more...</a> • <br> • </span> • <!-- • <span id="topics" style="visibility:hidden" class="keywords"> • {%for keyw in hotkeywords|slice:"20"%} • <a href="?q={{keyw}}">{{keyw}}</a> • {%endfor%} • </span>--> • </span> • </div> • {% endblock %}