Source Viewer

View Page Source of any Website.

Från och med 2020-10-30. Se den senaste versionen.

// ==UserScript==
// @version 6.7.2.0
// @name Source Viewer
// @name:de Seitenquelltext anzeiger
// @description  View Page Source of any Website.
// @description:de Schauen Sie sich den Seitenquelltext von jeder beliebigen Website an.
// @author wack.3gp
// @copyright 2019+ , wack.3gp (https://greasyforks.org/users/4792)
// @grant unsafeWindow
// @noframes
// @include *
// @license CC BY-NC-ND 4.0; http://creativecommons.org/licenses/by-nc-nd/4.0/
// @namespace https://greasyforks.org/users/4792
// @supportURL https://greasyforks.org/scripts/4611/feedback
// @compatible Chrome tested with Tampermonkey
// ==/UserScript==

unsafeWindow.viewsource = function () {
    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();
};
// ==============

var body = document.body;
if (body !== null) {
  var div = document.createElement("div");
  div.setAttribute('id', 'viewsource');
  div.innerHTML = "<center><button onclick='javascript:viewsource()'>Click to view source!</button></center>";
  body.appendChild(div);
  document.getElementById("viewsource").style = "position: fixed;right: 0;left: 0;bottom: 0px;margin: auto;";
}
// ==============
长期地址
遇到问题?请前往 GitHub 提 Issues。