Browse Source

Print shortcut: Ctrl + (Shift +) P only

The previous version interfered with the full screen shortcut
 (Ctrl + Alt + P).
The new version only intercepts Cmd/Ctrl + P (all browsers).
And Ctrl + Shift + P in Chrome / Opera (Presto and Chromium),
because these browsers also associate a Print operation with
the shortcut.
Rob Wu 11 years ago
parent
commit
9df998914d
  1. 5
      web/mozPrintCallback_polyfill.js

5
web/mozPrintCallback_polyfill.js

@ -98,7 +98,10 @@ @@ -98,7 +98,10 @@
var hasAttachEvent = !!document.attachEvent;
window.addEventListener('keydown', function(event) {
if (event.keyCode === 80/*P*/ && (event.ctrlKey || event.metaKey)) {
// Intercept Cmd/Ctrl + P in all browsers.
// Also intercept Cmd/Ctrl + Shift + P in Chrome and Opera
if (event.keyCode === 80/*P*/ && (event.ctrlKey || event.metaKey) &&
!event.altKey && (!event.shiftKey || window.chrome || window.opera)) {
window.print();
if (hasAttachEvent) {
// Only attachEvent can cancel Ctrl + P dialog in IE <=10

Loading…
Cancel
Save