diff --git a/actions/qvitter.php b/actions/qvitter.php index 3d93785..a907a86 100644 --- a/actions/qvitter.php +++ b/actions/qvitter.php @@ -374,6 +374,21 @@ class QvitterAction extends ApiAction print 'window.qvitterProfilePrefs = false;'; } } + + // keyboard shortcuts can be disabled + $disable_keyboard_shortcuts = false; + if($logged_in_user) { + try { + $disable_keyboard_shortcuts = Profile_prefs::getData($logged_in_user->getProfile(), 'qvitter', 'disable_keyboard_shortcuts'); + if($disable_keyboard_shortcuts == '1' || $disable_keyboard_shortcuts == 1) { + $disable_keyboard_shortcuts = true; + } + } catch (Exception $e) { + // + } + } + print 'window.disableKeyboardShortcuts = '.var_export($disable_keyboard_shortcuts, true).';'; + ?> // available language files and their last update time @@ -485,8 +500,16 @@ class QvitterAction extends ApiAction
?Dieses Menu
jNächster Queet
kVorheriger Queet
+ +Keyboard shortcuts can be turned off on the Qvitter settings page.
diff --git a/doc/en/shortcuts.html b/doc/en/shortcuts.html index afd4ec4..e0067ce 100644 --- a/doc/en/shortcuts.html +++ b/doc/en/shortcuts.html @@ -11,3 +11,6 @@?This menu
jNext Queet
kPrevious Queet
+ +Keyboard shortcuts can be turned off on the Qvitter settings page.
diff --git a/doc/io/shortcuts.html b/doc/io/shortcuts.html index 62e92a2..9b8689e 100644 --- a/doc/io/shortcuts.html +++ b/doc/io/shortcuts.html @@ -11,3 +11,6 @@?Ica menuo
jSequanta mesajo
kPreiranta mesajo
+ +Keyboard shortcuts can be turned off on the Qvitter settings page.
diff --git a/doc/nb/shortcuts.html b/doc/nb/shortcuts.html index eac8c0b..636de69 100644 --- a/doc/nb/shortcuts.html +++ b/doc/nb/shortcuts.html @@ -11,3 +11,6 @@?Denne menyen
jNeste melding
kForrige melding
+ +Keyboard shortcuts can be turned off on the Qvitter settings page.
diff --git a/doc/sv/shortcuts.html b/doc/sv/shortcuts.html index 5065983..326648b 100644 --- a/doc/sv/shortcuts.html +++ b/doc/sv/shortcuts.html @@ -11,3 +11,6 @@?Denna meny
jNästa qvitter
kFöregående qvitter
+ +Kortkommandon kan avaktiveras på Qvitters inställningssida.
diff --git a/js/misc-functions.js b/js/misc-functions.js index 9163b5f..730babd 100644 --- a/js/misc-functions.js +++ b/js/misc-functions.js @@ -47,11 +47,11 @@ · · · · · · · · · */ function triggerClickOnInputFile(inputFile) { - if(bowser != 'undefined') { + if(typeof bowser != 'undefined') { var bowserIntVersion = parseInt(bowser.version,10); - if(bowser.chrome != 'undefined' && bowser.chrome === true && bowserIntVersion < 53 - || bowser.opera != 'undefined' && bowser.opera === true && bowserIntVersion < 39 - || bowser.safari != 'undefined' && bowser.safari === true && bowserIntVersion < 9) { + if(typeof bowser.chrome != 'undefined' && bowser.chrome === true && bowserIntVersion < 53 + || typeof bowser.opera != 'undefined' && bowser.opera === true && bowserIntVersion < 39 + || typeof bowser.safari != 'undefined' && bowser.safari === true && bowserIntVersion < 9) { var evt = document.createEvent("HTMLEvents"); evt.initEvent("click", true, true); inputFile[0].dispatchEvent(evt); diff --git a/js/qvitter.js b/js/qvitter.js index 02a4bb2..3db4271 100644 --- a/js/qvitter.js +++ b/js/qvitter.js @@ -3475,6 +3475,12 @@ $('body').on('keyup', 'div.queet-box-syntax', function(e) { // menu $('#shortcuts-link').click(function(){ + + // not if disabled + if($(this).hasClass('disabled')) { + return true; + } + popUpAction('popup-shortcuts', window.sL.keyboardShortcuts,'',false); getDoc('shortcuts',function(html){ $('#shortcuts-container').html(html); @@ -3484,6 +3490,12 @@ $('#shortcuts-link').click(function(){ // send queet on ctrl+enter or ⌘+enter (mac) $('body').on('keydown','.queet-box-syntax',function (e) { + + // do nothing if shortcuts are disabled + if(window.disableKeyboardShortcuts === true) { + return true; + } + if((e.ctrlKey && e.which == 13) || (e.metaKey && e.which == 13)) { e.preventDefault(); @@ -3495,6 +3507,11 @@ $('body').on('keydown','.queet-box-syntax',function (e) { $('body').keyup(function (e) { + // do nothing if shortcuts are disabled + if(window.disableKeyboardShortcuts === true) { + return true; + } + // only if queetbox is blurred, and we're not typing in any input, and we're logged in if($('.queet-box-syntax[contenteditable="true"]').length == 0 && $(":focus").length == 0