Source Viewer

View Page Source of any Website.

当前为 2016-07-17 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Source Viewer
  3. // @name:de Seitenquelltext anzeiger
  4. // @namespace http://scriptz.de.to/
  5. // @description View Page Source of any Website.
  6. // @description:de Schauen Sie sich den Seitenquelltext von jeder belieben Website an.
  7. // @include *://*
  8. // @version 6.7.0.5
  9. // @icon http://file1.npage.de/007324/77/bilder/favicon.ico
  10. // @author Scriptz
  11. // @grant GM_addStyle
  12. // @grant unsafeWindow
  13. // @supportURL mailto:scriptz@mail1a.de?subject=Source Viewer
  14. // @copyright 2013+ , Scriptz
  15. // @license Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License; http://creativecommons.org/licenses/by-nc-nd/3.0/
  16. // ==/UserScript==
  17.  
  18. /* CHANGELOG
  19.  
  20. 6.7.0.5 (7/17/2016)
  21. - name: [DE]
  22. - descripton: [DE]
  23.  
  24. 6.7.0.4 (7/16/2016)
  25. - added changelog
  26. - added license
  27. */
  28.  
  29. GM_addStyle("#viewthesource{border: solid 1px black;position: fixed;right: 0;left: 0;bottom: 0px;background-color: #9E9E9E;z-index: 9999;height: 33px;width: 130px;margin: auto;}");
  30.  
  31. // ==Source==
  32. unsafeWindow.viewthesource = function(){
  33. window.location="view-source:"+window.location;
  34. };
  35. // ==============
  36.  
  37. // ==Body==
  38. body = document.body;
  39. if(body !== null) {
  40. div2 = document.createElement("div");
  41. div2.setAttribute('id','viewthesource');
  42. div2.innerHTML = "<center><img alt='Hide' src='http://fs2.directupload.net/images/150909/sxcclyoz.png' onclick='javascript:hide()'></center>\n<a href='javascript:viewthesource()' onclick='javascript:viewthesource()'>Click to view source!</a>";
  43. body.appendChild(div2);
  44. }
  45. // ==============
  46.  
  47. // ==Hide==
  48. unsafeWindow.hide = function(){
  49. var a = new Date();
  50. a = new Date(a.getTime() +1000*60*60*24*365);
  51. document.cookie = 'sourcefunction=hide; path=/; expires='+a.toGMTString()+';';
  52. console.info('Set "sourcefunction=hide" cookie for '+window.location);
  53. GM_addStyle("#viewthesource{border: solid 1px black;position: fixed;right: 0;left: 0;bottom: 0px;background-color: #9E9E9E;z-index: 9999;height: 15px;width: 45px;margin: auto;}");
  54. document.getElementById("viewthesource").innerHTML = "<center><img alt='Show' src='http://fs2.directupload.net/images/150909/7tae9l8k.png' onclick='javascript:show()'></center>";
  55. };
  56. if (document.cookie.indexOf("sourcefunction=hide") >= 0) {
  57. GM_addStyle("#viewthesource{border: solid 1px black;position: fixed;right: 0;left: 0;bottom: 0px;background-color: #9E9E9E;z-index: 9999;height: 15px;width: 45px;margin: auto;}");
  58. document.getElementById("viewthesource").innerHTML = "<center><img alt='Show' src='http://fs2.directupload.net/images/150909/7tae9l8k.png' onclick='javascript:show()'></center>";
  59. }
  60. // ==Show==
  61. unsafeWindow.show = function(){
  62. document.cookie = 'sourcefunction=hide; path=/; expires=Thu, 01-Jan-70 00:00:01 GMT;';
  63. console.warn('Delete "sourcefunction=hide" cookie for '+window.location);
  64. GM_addStyle("#viewthesource{border: solid 1px black;position: fixed;right: 0;left: 0;bottom: 0px;background-color: #9E9E9E;z-index: 9999;height: 33px;width: 130px;margin: auto;}");
  65. document.getElementById("viewthesource").innerHTML = "<center><img alt='Hide' src='http://fs2.directupload.net/images/150909/sxcclyoz.png' onclick='javascript:hide()'></center>\n<a href='javascript:viewthesource()' onclick='javascript:viewthesource()'>Click to view source!</a>";
  66. };
  67. // ==============