Sult

example

Apr 30th, 2015
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.34 KB | None | 0 0
  1. {% extends "base.html" %}
  2.  
  3. {% block page_title %}Sheet{% endblock %}
  4.  
  5. {% block content %}
  6. <div class="panel panel-primary">
  7. <div class="panel-heading">{{ character.charactername|capfirst }} / Sheet</div>
  8. <div class="panel-body">
  9.     <div id="Content">
  10.         {% include "page_loading.html" %}
  11.     </div>
  12.     {% if not request.session.character_access.CharacterSheet %}
  13.         {% include "best_experience.html" %}
  14.     {% endif %}
  15. </div>
  16. </div>
  17. {% endblock %}
  18.  
  19. {% block js %}
  20. {% if request.session.character_access.CharacterSheet %}
  21. <script>
  22. $(function(){
  23. var refresher = function () {
  24.     $.getJSON( "{% url 'characters:sheet_json' %}", function(obj) {
  25.         refresh_timer = obj.refresh_timer * 1000;
  26.         setTimeout(refresher, refresh_timer);
  27.  
  28.         if (obj.content) {
  29.             // do shit with content and data
  30.             $("#Content").replaceWith("Jeej we got api data:D");
  31.  
  32.             //content will be a dict that you will use like this
  33.             // obj.content.balance = wallet balance
  34.             // obj.location = last known character location
  35.             // obj.charactername = charactername  
  36.             // for corp in obj.employment_history
  37.             // corp.name =
  38.             // etc
  39.         }
  40.     });
  41.   };
  42.  
  43.   setTimeout(refresher, 300); // 0.3 seconds
  44. });
  45. </script>
  46. {% endif %}
  47. {% endblock %}
Advertisement
Add Comment
Please, Sign In to add comment