Advertisement
jikamens

userChromeUnbindKey function for use with userChromeJS

Nov 22nd, 2024
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function userChromeUnbindKey(keyset_id, key_id) {
  2.   console.log("userChromeUnbindKey");
  3.   var keyset = document.getElementById(keyset_id);
  4.   if (!keyset) {
  5.     console.log("Could not find keyset " + keyset_id);
  6.     return;
  7.   }
  8.   var key = document.getElementById(key_id);
  9.   if (!key) {
  10.     console.log("Could not find key " + key_id);
  11.     return;
  12.   }
  13.   keyset.removeChild(key);
  14. }
  15.  
  16. // Example usage
  17. // Look in https://searchfox.org/comm-central/rev/7d1490648ebd27d61cfe7fe8272a8ebb7c9f8e5c/suite/mailnews/content/mailWindowOverlay.xul
  18. // (searchfor "<keyset") to find the names of keys to unbind.
  19. if (location.href.startsWith("chrome://messenger/content/messenger.x")) {
  20.   userChromeUnbindKey("mailKeys", "key_archive");
  21.   userChromeUnbindKey("mailKeys", "key_killThread");
  22.   userChromeUnbindKey("mailKeys", "key_killSubthread");
  23.   userChromeUnbindKey("mailKeys", "key_watchThread");
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement