summaryrefslogtreecommitdiffstats
path: root/askbot/skins/default/templates/meta/bottom_scripts.html
blob: de0df14268dde00aa9c71307482a1bd32ea52671 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
{# most, if not all javascripts should go here
   this template is included at the very bottow of the
   main template "base.html"
#}
<div id="no-javascript">
  <noscript class="noscript">
    {% trans app_name = settings.APP_SHORT_NAME %}Please note: {{app_name}} requires javascript to work properly, please enable javascript in your browser, <a href="{{noscript_url}}">here is how</a>{% endtrans %}
  </noscript>
</div>
<script type="text/javascript">
    var i18nLang = '{{settings.LANGUAGE_CODE}}';
    var scriptUrl = '/{{settings.ASKBOT_URL}}'
    var askbotSkin = '{{settings.ASKBOT_DEFAULT_SKIN}}';
    var enableMathJax = {% if settings.ENABLE_MATHJAX %}true{% else %}false{% endif %};
    askbot['urls']['mark_read_message'] = '{% url "read_message" %}';
    askbot['urls']['get_tags_by_wildcard'] = '{% url "get_tags_by_wildcard" %}';
    askbot['urls']['get_tag_list'] = '{% url "get_tag_list" %}';
    askbot['urls']['follow_user'] = '/followit/follow/user/{{'{{'}}userId{{'}}'}}/';
    askbot['urls']['unfollow_user'] = '/followit/unfollow/user/{{'{{'}}userId{{'}}'}}/';
    askbot['urls']['user_signin'] = '{{ settings.LOGIN_URL }}';
    askbot['settings']['static_url'] = '{{ settings.STATIC_URL }}';
</script>
<script 
    type="text/javascript"
    {% if settings.DEBUG %}
        src="{{"/js/jquery-1.7.2.min.js"|media}}"
    {% else %}
        src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"
    {% endif %}
></script>
<!-- History.js --> 
<script type='text/javascript' src="{{"/js/jquery.history.js"|media }}"></script>
<script type="text/javascript" src="{% url django.views.i18n.javascript_catalog %}"></script>
<script type='text/javascript' src="{{"/js/utils.js"|media }}"></script>
{% if settings.ENABLE_MATHJAX %}
    <script type='text/javascript' src="{{settings.MATHJAX_BASE_URL}}/MathJax.js">
        MathJax.Hub.Config({
            extensions: ["tex2jax.js"],
            jax: ["input/TeX","output/HTML-CSS"],
            tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]}
        });
    </script>
{% endif %}
{%if settings.GROUPS_ENABLED%}
<script type="text/javascript" src="{{'/bootstrap/js/bootstrap.js'|media}}" /></script>
{% endif %}
<script type="text/javascript">
    $(document).ready(function(){
        {% if active_tab == 'questions' %}
            if (Modernizr.history) {
                // history management works!
            } else {
                // no history support :(
                //hash = unescape(window.location.hash).replace('#','').split("?")[0]
                {# todo: fix this evil code!!! #}
                var hash = History.unescapeHash(window.location.hash).replace('#','').split("?")[0];
                var questions_url = askbot['urls']['questions'];
                if (hash.substring(0, questions_url.length) === questions_url) {
                    var url = hash;
                } else {
                    var url = questions_url + hash;
                }
                if (hash !== '' && hash !== undefined && url !== undefined){
                    {# was this causing strange redirects in IE??? #}
                    window.location = 'http://' + window.location.host + url;
                }
            }
        {% endif %}
        // focus input on the search bar endcomment
        {% if active_tab in ('users', 'questions', 'tags') %}
            $('#keywords').focus();
        {% elif active_tab == 'ask' %}
            $('#id_title').focus();
        {% else %}
            animateHashes();
        {% endif %}
        if (askbot['data']['userIsAdminOrMod']) {
            $('body').addClass('admin');
        }
        {%if settings.GROUPS_ENABLED%}
          $(".dropdown-toggle").dropdown();        
        {% endif %}
    });
{% if user_messages %}
    $('#validate_email_alert').click(function(){notify.close(true)})
    notify.show();
{% endif %}
    $('abbr.timeago').timeago();
</script>
{% if settings.USE_CUSTOM_JS %}
<script 
    src="{% url "custom_js"%}?v={{ settings.MEDIA_RESOURCE_REVISION }}"
    type="text/javascript"
></script>
{% endif %}
{% if settings.GOOGLE_ANALYTICS_KEY %}
<script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </script>
    <script type="text/javascript">
    try {
    var pageTracker = _gat._getTracker('{{ settings.GOOGLE_ANALYTICS_KEY }}');
    pageTracker._trackPageview();
    } catch(err) {}
</script>
{% endif %}