Index: tools/scan-build/keyboard-shortcuts.js =================================================================== --- tools/scan-build/keyboard-shortcuts.js +++ tools/scan-build/keyboard-shortcuts.js @@ -1,8 +1,26 @@ +/* mousetrap v1.5.3 craig.is/killing/mice */ +(function(C,r,g){function t(a,b,h){a.addEventListener?a.addEventListener(b,h,!1):a.attachEvent("on"+b,h)}function x(a){if("keypress"==a.type){var b=String.fromCharCode(a.which);a.shiftKey||(b=b.toLowerCase());return b}return l[a.which]?l[a.which]:p[a.which]?p[a.which]:String.fromCharCode(a.which).toLowerCase()}function D(a){var b=[];a.shiftKey&&b.push("shift");a.altKey&&b.push("alt");a.ctrlKey&&b.push("ctrl");a.metaKey&&b.push("meta");return b}function u(a){return"shift"==a||"ctrl"==a||"alt"==a|| +"meta"==a}function y(a,b){var h,c,e,g=[];h=a;"+"===h?h=["+"]:(h=h.replace(/\+{2}/g,"+plus"),h=h.split("+"));for(e=0;em||l.hasOwnProperty(m)&&(k[l[m]]=m)}e=k[h]?"keydown":"keypress"}"keypress"==e&&g.length&&(e="keydown");return{key:c,modifiers:g,action:e}}function B(a,b){return null===a||a===r?!1:a===b?!0:B(a.parentNode,b)}function c(a){function b(a){a= +a||{};var b=!1,n;for(n in q)a[n]?b=!0:q[n]=0;b||(v=!1)}function h(a,b,n,f,c,h){var g,e,l=[],m=n.type;if(!d._callbacks[a])return[];"keyup"==m&&u(a)&&(b=[a]);for(g=0;g":".","?":"/","|":"\\"},z={option:"alt",command:"meta","return":"enter", +escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},k;for(g=1;20>g;++g)l[111+g]="f"+g;for(g=0;9>=g;++g)l[g+96]=g;c.prototype.bind=function(a,b,c){a=a instanceof Array?a:[a];this._bindMultiple.call(this,a,b,c);return this};c.prototype.unbind=function(a,b){return this.bind.call(this,a,function(){},b)};c.prototype.trigger=function(a,b){if(this._directMap[a+":"+b])this._directMap[a+":"+b]({},a);return this};c.prototype.reset=function(){this._callbacks={};this._directMap= +{};return this};c.prototype.stopCallback=function(a,b){return-1<(" "+b.className+" ").indexOf(" mousetrap ")||B(b,this.target)?!1:"INPUT"==b.tagName||"SELECT"==b.tagName||"TEXTAREA"==b.tagName||b.isContentEditable};c.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)};c.init=function(){var a=c(r),b;for(b in a)"_"!==b.charAt(0)&&(c[b]=function(b){return function(){return a[b].apply(a,arguments)}}(b))};c.init();C.Mousetrap=c;"undefined"!==typeof module&&module.exports&&(module.exports= +c);"function"===typeof define&&define.amd&&define(function(){return c})})(window,document); + + (function () { +'use strict'; function Jump(matchTarget, lastBlock) { - var match = document.location.hash.match(/Path\d+|EndPath/)[0]; - var matches = document.querySelectorAll('#' + match + ' .PathNav') + var match = document.location.hash.match(/Path\d+|EndPath/); + if (!match) { + document.location.hash = '#Path1'; + return; + } + var matches = document.querySelectorAll('#' + match[0] + ' .PathNav'); if (matches.length == 2) { document.location = matches[matchTarget].children[0].href; } else { @@ -10,32 +28,24 @@ document.location = matches[0].children[0].href; } } -}; +} function ShowHelp() { - alert("Keyboard shortcuts:\n\n" + - "Jump to next path: j\n" + - "Jump to previous path: k\n"); + alert('Keyboard shortcuts:\n\n' + + 'Jump to next path: j\n' + + 'Jump to previous path: k\n'); } -const KEYS = { - J: 74, - K: 75, - SLASH: 191 -} +Mousetrap.bind('j', function() { + Jump(1, '#EndPath'); +}); -document.onkeydown = function (e) { - switch(e.keyCode) { - case KEYS.J: - Jump(1, '#EndPath'); - break; - case KEYS.K: - Jump(0, '#Path1'); - break; - case KEYS.SLASH: - ShowHelp(); - break; - } -}; +Mousetrap.bind('k', function() { + Jump(0, '#Path1'); +}); + +Mousetrap.bind('?', function() { + ShowHelp(); +}); }());