Source Viewer

View Page Source of any Website.

当前为 2020-10-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @version 6.7.2.2
  3. // @name Source Viewer
  4. // @name:de Seitenquelltext anzeiger
  5. // @description View Page Source of any Website.
  6. // @description:de Schauen Sie sich den Seitenquelltext von jeder beliebigen Website an.
  7. // @author wack.3gp
  8. // @copyright 2019+ , wack.3gp (https://greasyfork.org/users/4792)
  9. // @grant unsafeWindow
  10. // @grant GM_registerMenuCommand
  11. // @noframes
  12. // @include *
  13. // @license CC BY-NC-ND 4.0; http://creativecommons.org/licenses/by-nc-nd/4.0/
  14. // @namespace https://greasyfork.org/users/4792
  15. // @supportURL https://greasyfork.org/scripts/4611/feedback
  16. // @compatible Chrome tested with Tampermonkey
  17. // ==/UserScript==
  18.  
  19. GM_registerMenuCommand("view-source:"+window.location, function () {
  20. var source = "<html>";
  21. source += document.getElementsByTagName('html')[0].innerHTML;
  22. source += "</html>";
  23. source = source.replace(/</g, "&lt;").replace(/>/g, "&gt;");
  24. source = "<pre>" + source + "</pre>";
  25. var sourceWindow = window.open();
  26. sourceWindow.document.write(source);
  27. sourceWindow.document.close();
  28. if (window.focus) sourceWindow.focus();
  29. });
  30. // ==============