Source Viewer

View the HTML source code of any online web page. (use the Tampermonkey Command Menu)

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

  1. // ==UserScript==
  2. // @version 6.7.2.7
  3. // @name Source Viewer
  4. // @name:de Seitenquelltext anzeigen
  5. // @description View the HTML source code of any online web page. (use the Tampermonkey Command Menu)
  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. // @namespace https://greasyfork.org/users/4792
  10. // @supportURL https://greasyfork.org/scripts/4611/feedback
  11. // @license CC BY-NC-ND 4.0; http://creativecommons.org/licenses/by-nc-nd/4.0/
  12. // @noframes
  13. // @compatible Chrome tested with Tampermonkey
  14. // @contributionURL https://www.paypal.com/donate?hosted_button_id=9JEGCDFJJHWU8
  15. // @contributionAmount €1.00
  16. // @resource meta https://greasyfork.org/scripts/4611/code/meta.js
  17. // @grant GM_registerMenuCommand
  18. // @grant GM_notification
  19. // @grant GM_getResourceText
  20. // @include *
  21. // ==/UserScript==
  22.  
  23. /* jshint esversion: 9 */
  24.  
  25. GM_registerMenuCommand("view-source:" + window.location, function () {
  26. if (GM_getResourceText("meta").indexOf(GM_info.script.version) > -1) { //nothing
  27. }
  28. else {
  29. console.warn("Please download " + GM_getResourceText("meta").replace(/.*(?=v.*\d\D\d\D\d\D\d)/gims, '').split('/')[0] + GM_info.script.supportURL.replace("feedback", ""));
  30. GM_notification({
  31. title: "Update",
  32. text: "Please download " + GM_getResourceText("meta").replace(/.*(?=v.*\d\D\d\D\d\D\d)/gims, '').split('/')[0],
  33. onclick: function () {
  34. location.href = GM_info.script.supportURL.replace("feedback", "");
  35. },
  36. });
  37. }
  38. var source = "<html>";
  39. source += document.getElementsByTagName('html')[0].innerHTML;
  40. source += "</html>";
  41. source = source.replace(/</g, "&lt;").replace(/>/g, "&gt;");
  42. source = "<pre>" + source + "</pre>";
  43. var sourceWindow = window.open();
  44. sourceWindow.document.write(source);
  45. sourceWindow.document.close();
  46. if (window.focus) sourceWindow.focus();
  47. });
  48. // ==============