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.
This commit is contained in:
parent
c5a804c43a
commit
9df998914d
@ -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…
Reference in New Issue
Block a user