Commits

Antonio Cuni committed 00a16d6

always "return false" in onclick() events: this prevents the link to be
followed, and fixes the annoying behaviour of firefox scrolling to the
beginning of the page when clicking on them

  • Participants
  • Parent commits 2bf2053

Comments (0)

Files changed (2)

templates/index.html

 <body>
   <header>
     <span>Menu</span><br/>
-    <a href="#" onClick="toggle()">Toggle operations</a>
+    <a href="/" onClick="toggle(); return false">Toggle operations</a>
     <div id="callstack">
     </div>
   </header>
     <ul>
       {% for is_entry_bridge, index, item in loops %}
       {% if is_entry_bridge %}
-        <li><span>Entry bridge: <a href="#" onClick="show_loop({{index}})">{{item.repr()}}</a> run {{item.count}} times</span></li>
+        <li><span>Entry bridge: <a href="/" onClick="show_loop({{index}}); return false">{{item.repr()}}</a> run {{item.count}} times</span></li>
       {% else %}
-        <li><span><a href="#" onClick="show_loop({{index}})">{{item.repr()}}</a> run {{item.count}} times</span></li>
+        <li><span><a href="/" onClick="show_loop({{index}}); return false">{{item.repr()}}</a> run {{item.count}} times</span></li>
       {% endif %}
       {% endfor %}
     </ul>

templates/loop.html

 {% if show_upper_path %}
-   <a href="#" onClick="show_loop({{current_loop}}, {{upper_path}})">&lt;-- Up</a>
+   <a href="/" onClick="show_loop({{current_loop}}, {{upper_path}}); return false">&lt;-- Up</a>
 {% endif %}
 {% for sourceline in source.lines %}
    {% if sourceline.in_loop %}
                    <span class="{{chunk.cssclass}}">{{chunk.html_repr()}}</span><br/>
                    {% for op in chunk.operations[1:] %}
                       {% if op.bridge %}
-                        <span id="loop-{{op.bridge.no}}" class="guard single-operation">{{op.html_repr()}}</span> <a href="#" onClick="replace_from(this, {{op.bridge.no}})">&gt;&gt;show bridge</a> (taken {{op.percentage}}%)<br/>
+                        <span id="loop-{{op.bridge.no}}" class="guard single-operation">{{op.html_repr()}}</span> <a href="/" onClick="replace_from(this, {{op.bridge.no}}); return false">&gt;&gt;show bridge</a> (taken {{op.percentage}}%)<br/>
                       {% else %}
                         <span class="single-operation {{op.extra_style()}}">{{op.html_repr()}}</span><br/>
                       {% endif %}
                    {% endfor %}
                  {% else %}
-                   <a class="inlined_call" onClick="show_loop({{current_loop}}, {{chunk.path}})" href="#">{{(chunk.html_repr())|safe}}</a><br/>
+                   <a class="inlined_call" onClick="show_loop({{current_loop}}, {{chunk.path}}); return false" href="/">{{(chunk.html_repr())|safe}}</a><br/>
                  {% endif %}
               {% endfor %}
           </div>