Source Viewer

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

目前为 2020-11-11 提交的版本。查看 最新版本

// ==UserScript==
// @version 6.7.2.7
// @name Source Viewer
// @name:de Seitenquelltext anzeigen
// @description View the HTML source code of any online web page. (use the Tampermonkey Command Menu)
// @description:de Schauen Sie sich den Seitenquelltext von jeder beliebigen Website an.
// @author wack.3gp
// @copyright 2019+ , wack.3gp (https://greasyfork.org/users/4792)
// @namespace https://greasyfork.org/users/4792
// @supportURL https://greasyfork.org/scripts/4611/feedback
// @license CC BY-NC-ND 4.0; http://creativecommons.org/licenses/by-nc-nd/4.0/
// @noframes
// @compatible Chrome tested with Tampermonkey
// @contributionURL https://www.paypal.com/donate?hosted_button_id=9JEGCDFJJHWU8
// @contributionAmount €1.00
// @resource meta https://greasyfork.org/scripts/4611/code/meta.js
// @grant GM_registerMenuCommand
// @grant GM_notification
// @grant GM_getResourceText
// @include *
// ==/UserScript==

/* jshint esversion: 9 */

GM_registerMenuCommand("view-source:" + window.location, function () {
  if (GM_getResourceText("meta").indexOf(GM_info.script.version) > -1) { //nothing
  }
  else {
    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", ""));
    GM_notification({
      title: "Update",
      text: "Please download " + GM_getResourceText("meta").replace(/.*(?=v.*\d\D\d\D\d\D\d)/gims, '').split('/')[0],
      onclick: function () {
        location.href = GM_info.script.supportURL.replace("feedback", "");
      },
    });
  }
  var source = "<html>";
  source += document.getElementsByTagName('html')[0].innerHTML;
  source += "</html>";
  source = source.replace(/</g, "&lt;").replace(/>/g, "&gt;");
  source = "<pre>" + source + "</pre>";
  var sourceWindow = window.open();
  sourceWindow.document.write(source);
  sourceWindow.document.close();
  if (window.focus) sourceWindow.focus();
});
// ==============