| 934 | }); |
| 935 | |
| 936 | function utilBarHandler(e) { |
| 937 | if (self.settings.button.bar !== "auto") { |
| 938 | return; |
| 939 | } |
| 940 | // Here we check if the mouse has moves more than 5px in any direction before triggering the mousemove code |
| 941 | // we do this for 2 reasons: |
| 942 | // 1. On Mac OS X lion when you scroll and it does the iOS like "jump" when it hits the top/bottom of the page itll fire off |
| 943 | // a mousemove of a few pixels depending on how hard you scroll |
| 944 | // 2. We give a slight buffer to the user in case he barely touches his touchpad or mouse and not trigger the UI |
| 945 | if (Math.abs(mousePos.y - e.pageY) >= 5 || Math.abs(mousePos.x - e.pageX) >= 5) { |
| 946 | utilBar.style.display = 'block'; |
| 947 | // if we have a timer already running, kill it out |
| 948 | if (utilBarTimer) { |
| 949 | clearTimeout(utilBarTimer); |
| 950 | } |
| 951 | |
| 952 | // begin a new timer that hides our object after 1000 ms |
| 953 | utilBarTimer = window.setTimeout(function () { |
| 954 | utilBar.style.display = 'none'; |
| 955 | }, 1000); |
| 956 | } |
| 957 | mousePos = { y: e.pageY, x: e.pageX }; |
| 958 | } |
| 959 | |
| 960 | // Add keyboard shortcuts for convenience. |
| 961 | function shortcutHandler(e) { |