allura
Revision | 4996dea7f014388048b15dab8d52f892d40c60d9 (tree) |
---|---|
Time | 2012-05-10 04:01:29 |
Author | Dave Brondsema <dbrondsema@geek...> |
Commiter | Yaroslav Luzin |
[#4115] update highlighting if the hash changes
@@ -21,10 +21,15 @@ | ||
21 | 21 | {% block extra_js %} |
22 | 22 | {{ super() }} |
23 | 23 | <script type="text/javascript">(function() { |
24 | - var hash = window.location.hash.substring(1); | |
25 | - if (hash != '' && hash.substring(0, 1) == 'l' && !isNaN(hash.substring(1))) { | |
26 | - $('#' + hash).css('background-color', '#ffff99'); | |
27 | - } | |
24 | + $(window).bind('hashchange', function(e) { | |
25 | + var hash = window.location.hash.substring(1); | |
26 | + if ('originalEvent' in e && 'oldURL' in e.originalEvent) { | |
27 | + $('#' + e.originalEvent.oldURL.split('#')[1]).css('background-color', 'transparent'); | |
28 | + } | |
29 | + if (hash != '' && hash.substring(0, 1) == 'l' && !isNaN(hash.substring(1))) { | |
30 | + $('#' + hash).css('background-color', '#ffff99'); | |
31 | + } | |
32 | + }).trigger('hashchange'); | |
28 | 33 | |
29 | 34 | $('.code_block').each(function(index, element) { |
30 | 35 | $(element).bind('click', function() { |
@@ -69,7 +74,7 @@ | ||
69 | 74 | <div class="clip grid-19"> |
70 | 75 | <h3><span class="ico-l"><b data-icon="{{g.icons['table'].char}}" class="ico {{g.icons['table'].css}}"></b> {{h.really_unicode(blob.name)}}</span></h3> |
71 | 76 | {% if blob.has_pypeline_view %} |
72 | - {{h.render_any_markup(blob.name, blob.text, True)}} | |
77 | + {{h.render_any_markup(blob.name, blob.text, code_mode=True)}} | |
73 | 78 | {% else %} |
74 | 79 | {{g.highlight(blob.text, filename=blob.name)}} |
75 | 80 | {% endif %} |