* Clears all key and key combo binds containing a given key or keys. * @param keys
(keys)
| 404 | * @param keys |
| 405 | */ |
| 406 | function unbindKey(keys) { |
| 407 | |
| 408 | if(keys === 'all') { |
| 409 | keyBindingGroups = []; |
| 410 | return; |
| 411 | } |
| 412 | |
| 413 | keys = keys.replace(/\s/g, '').split(','); |
| 414 | |
| 415 | //loop through the key binding groups. |
| 416 | for(var iKCL = keyBindingGroups.length; iKCL > -1; iKCL -= 1) { |
| 417 | if(keyBindingGroups[iKCL]) { |
| 418 | var KeyBindingGroup = keyBindingGroups[iKCL]; |
| 419 | |
| 420 | //loop through the key bindings. |
| 421 | for(var iB = 0; iB < KeyBindingGroup.length; iB += 1) { |
| 422 | var keyBinding = KeyBindingGroup[iB], |
| 423 | remove = false; |
| 424 | |
| 425 | //loop through the current key binding keys. |
| 426 | for(var iKB = 0; iKB < keyBinding.keys.length; iKB += 1) { |
| 427 | var key = keyBinding.keys[iKB]; |
| 428 | |
| 429 | //loop through the keys to be removed |
| 430 | for(var iKR = 0; iKR < keys.length; iKR += 1) { |
| 431 | var keyToRemove = keys[iKR]; |
| 432 | if(keyToRemove === key) { |
| 433 | remove = true; |
| 434 | break; |
| 435 | } |
| 436 | } |
| 437 | if(remove) { break; } |
| 438 | } |
| 439 | if(remove) { |
| 440 | keyBindingGroups[iKCL].splice(iB, 1); iB -= 1; |
| 441 | if(keyBindingGroups[iKCL].length < 1) { |
| 442 | delete keyBindingGroups[iKCL]; |
| 443 | } |
| 444 | } |
| 445 | } |
| 446 | } |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | /** |
| 451 | * Gets an array of active keys |
nothing calls this directly
no outgoing calls
no test coverage detected