Source Viewer

View Page Source of any Website.

2020-10-30 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @version 6.7.2.1
// @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://greasyfork.org/users/4792)
// @grant unsafeWindow
// @grant GM_registerMenuCommand
// @noframes
// @include *
// @license CC BY-NC-ND 4.0; http://creativecommons.org/licenses/by-nc-nd/4.0/
// @namespace https://greasyfork.org/users/4792
// @supportURL https://greasyfork.org/scripts/4611/feedback
// @compatible Chrome tested with Tampermonkey
// ==/UserScript==

if (document.cookie.indexOf(GM_info.script.name + '=hide') >= 0) {
  console.info('Cookie is set for ' + GM_info.script.name);
  GM_registerMenuCommand("Show view-source Button", function () {
    document.cookie = GM_info.script.name + '=hide; path=/; expires=Thu, 01-Jan-70 00:00:01 GMT;';
    console.info('Cookie for ' + GM_info.script.name + ' deleted!');
    location.reload();
  });
  viewsourcediv.style.display = "none";
}
else {
  GM_registerMenuCommand("Hide view-source Button", function () {
    var cookie = new Date();
    cookie = new Date(cookie.getTime() + 1000 * 60 * 60 * 24 * 365);
    document.cookie = GM_info.script.name + '=hide; path=/; expires=' + cookie.toGMTString() + ';';
    console.info('Set cookie for ' + GM_info.script.name);
    viewsourcediv.style.display = "none";
  });
}

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 viewsourcediv = document.createElement("div");
  viewsourcediv.setAttribute('id', 'viewsource');
  viewsourcediv.innerHTML = "<center><button onclick='javascript:viewsource()'>Click to view source!</button></center>";
  body.appendChild(viewsourcediv);
  document.getElementById("viewsource").style = "position: fixed;right: 0;left: 0;bottom: 0px;margin: auto;";
}
// ==============