onnotfocus unload everything

Final level of my onnotfocus series, this script is ultimate version of all those and it is really dangerous, it not only unload plugin animation, image animation, it also break textarea but save much more CPU than two previous version.

  1. // ==UserScript==
  2. // @name onnotfocus unload everything
  3. // @namespace onnotfocus unload everything
  4. // @description Final level of my onnotfocus series, this script is ultimate version of all those and it is really dangerous, it not only unload plugin animation, image animation, it also break textarea but save much more CPU than two previous version.
  5. // @include *
  6. // @version 1
  7. // @grant none
  8. // ==/UserScript==
  9. var STOREDHTML = document.body.outerHTML;
  10. document.addEventListener("visibilitychange", function() {
  11. if (document.visibilityState == "hidden") {
  12. document.body.outerHTML = "";
  13. }
  14. else
  15. {
  16. document.body.outerHTML = STOREDHTML;
  17. }
  18. });