onnotfocus unload tab and save CPU!

This script detect if you are using a tab or not, if not it unload unused tab using display:none and save your CPU Usage, this script reduce CPU Usage drastically because it unload flash, gif, everything that cause animation and eat up your CPU Usage.

  1. // ==UserScript==
  2. // @name onnotfocus unload tab and save CPU!
  3. // @namespace onnotfocus unload tab and save CPU!
  4. // @description This script detect if you are using a tab or not, if not it unload unused tab using display:none and save your CPU Usage, this script reduce CPU Usage drastically because it unload flash, gif, everything that cause animation and eat up your CPU Usage.
  5. // @include *
  6. // @version 1
  7. // @grant none
  8. // @run-at document-start
  9. // ==/UserScript==
  10.  
  11. document.addEventListener("visibilitychange", function() {
  12. if (document.visibilityState == "hidden") {
  13. document.documentElement.style.display = "none";
  14. }
  15. else
  16. {
  17. document.documentElement.style.display = "block";
  18. }
  19. });

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址