David Chambers avatar David Chambers committed 8754daa

Added `keypress` event handler to the base template. Pressing "R" is now
equivalent to clicking the "flush cache" link!

Comments (0)

Files changed (1)

templates/_base.dhtml

     </script>{% if request|internal %}
     <script type="text/javascript">
         (function () {
-            var link = document.createElement('a');
-            link.href = '{% url mango.handlers.flush_cache %}';
-            link.innerHTML = 'flush cache';
-            link.onclick = function (event) {
+            var flushcache, link;
+            flushcache = function (event) {
                 var req = new XMLHttpRequest();
                 req.open('GET', this.href, true);
                 req.onreadystatechange = function (event) {
                 req.send(null);
                 return false;
             };
+            link = document.createElement('a');
+            link.href = '{% url mango.handlers.flush_cache %}';
+            link.innerHTML = 'flush cache';
+            link.onclick = flushcache;
             document.getElementById('wrap').appendChild(link);
+            document.onkeypress = function (event) {
+                event || (event = window.event);
+                if ((event.charCode || event.keyCode) === 114) {
+                    flushcache.call(link);
+                }
+            };
         }());
     </script>{% endif %}{% endblock %}{% block analytics %}{% if GOOGLE_ANALYTICS_ID and not settings.DEBUG %}
     <script type="text/javascript">
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.