MCPcopy Create free account
hub / github.com/hoothin/UserScripts / keydown

Function keydown

Picviewer CE+/dist.user.js:27395–27438  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

27393
27394 let keypressing = false;
27395 function keydown(event) {
27396
27397 //if (ImgWindowC.showing) return;
27398 if (gallery && gallery.shown) return;
27399 if (inputActive(document)) {
27400 return;
27401 }
27402 var key = event.key;
27403 if(checkGlobalKeydown(event)){
27404 if (!keypressing) {
27405 globalMouseoverHandler(event);
27406 keypressing = true;
27407 }
27408 if(prefs.floatBar.keys.enable && key==prefs.floatBar.keys.gallery){
27409 openGallery();
27410 event.stopPropagation();
27411 event.preventDefault();
27412 globalFuncEnabled = !globalFuncEnabled;
27413 return true;
27414 }else if((!gallery || (!gallery.shown && !gallery.minimized)) && prefs.floatBar.globalkeys.type == "press"){
27415 globalFuncEnabled = !globalFuncEnabled;
27416 return true;
27417 }
27418 }
27419 if (!prefs.floatBar.keys.enable){
27420 return false;
27421 }
27422
27423 if (event) {
27424 if (event.ctrlKey || event.metaKey) {
27425 return false;
27426 }
27427 if (window.getSelection().toString()) return false;
27428 }
27429 if (floatBar && isKeyDownEffectiveTarget(event.target)) {
27430 Object.keys(prefs.floatBar.keys).some(function(action) {
27431 if (action == 'enable' || action == 'search') return;
27432 if (key == prefs.floatBar.keys[action]) {
27433 floatBar.open(event, action);
27434 return true;
27435 }
27436 });
27437 }
27438 }
27439
27440 function keyup(event) {
27441 keypressing = false;

Callers

nothing calls this directly

Calls 5

inputActiveFunction · 0.70
checkGlobalKeydownFunction · 0.70
globalMouseoverHandlerFunction · 0.70
openGalleryFunction · 0.70
isKeyDownEffectiveTargetFunction · 0.70

Tested by

no test coverage detected