View the HTML source code of any online web page. (use the Tampermonkey Command Menu)
// ==UserScript==
// @version 6.8.0
// @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 JAS1998
// @copyright 2019+ , JAS1998 (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
// @grant GM_registerMenuCommand
// @grant GM_notification
// @match *://*/*
// ==/UserScript==
/* jshint esversion: 9 */
(function() {
'use strict';
GM_registerMenuCommand("🔍 View Source: " + window.location.hostname, function () {
if (!GM_info.script.copyright.includes("JAS1998") || GM_info.script.namespace !== "https://greasyfork.org/users/4792") {
alert("Integrity check failed. Please use the original version.");
location.href = "https://greasyfork.org/scripts/4611";
return;
}
const doctype = new XMLSerializer().serializeToString(document.doctype) || "";
let source = doctype + "\n" + document.documentElement.outerHTML;
source = source.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
const sourceWindow = window.open("");
sourceWindow.document.write(`
<html>
<head>
<title>Source: ${window.location.href}</title>
<style>
body { margin: 0; background: #1e1e1e; color: #d4d4d4; font-family: 'Consolas', 'Monaco', monospace; }
pre { padding: 20px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
</style>
</head>
<body>
<pre><code>${source}</code></pre>
</body>
</html>
`);
sourceWindow.document.close();
});
GM_registerMenuCommand("🎁 Donate now", function () {
if(confirm("Hello, I'm JAS1998!\n\nI develop this script as a hobby. If you find it useful, I would be very happy about a small donation.\n\nOpen PayPal now?")) {
window.open("https://www.paypal.com/donate?hosted_button_id=9JEGCDFJJHWU8", "_blank");
}
});
})();