Bug 667607 (Fill the tab bar after closing a tab)

[userChromeJS] Resize tabs to fill the tab bar immediately after closing a tab (Firefox 4 feature).

  1. // ==UserScript==
  2. // @name Bug 667607 (Fill the tab bar after closing a tab)
  3. // @name:ja Bug 667607 (タブを閉じた時の隙間を埋める)
  4. // @namespace https://userscripts.org/users/347021
  5. // @version 1.3.0
  6. // @description [userChromeJS] Resize tabs to fill the tab bar immediately after closing a tab (Firefox 4 feature).
  7. // @description:ja [userChromeJS] タブを閉じた時、タブバーの右端に生じる隙間をすぐに埋めます。 (Firefox 4 の機能)
  8. // @include main
  9. // @license CC-BY-4.0
  10. // @contributionURL https://github.com/sponsors/esperecyan
  11. // @incompatible Edge
  12. // @compatible Firefox userChromeJS用スクリプト です (※GreasemonkeyスクリプトでもuserChromeES用スクリプトでもありません) / This script is for userChromeJS (* neither Greasemonkey nor userChromeES)
  13. // @incompatible Opera
  14. // @incompatible Chrome
  15. // @author 100の人
  16. // @homepageURL https://greatest.deepsurf.us/scripts/267
  17. // ==/UserScript==
  18.  
  19. (function () {
  20. 'use strict';
  21.  
  22. gBrowser.removeTab = new Proxy(gBrowser.removeTab, {
  23. apply(func, tabbrowser, argumentList)
  24. {
  25. const aParams = argumentList[1];
  26. if (aParams?.triggeringEvent?.mozInputSource === MouseEvent.MOZ_SOURCE_MOUSE) {
  27. argumentList[1]
  28. = (new aParams.triggeringEvent.constructor(aParams.triggeringEvent.type, aParams.triggeringEvent));
  29. }
  30. Reflect.apply(func, tabbrowser, argumentList);
  31. },
  32. });
  33.  
  34. })();