Source Viewer

View Source Code of any homepage

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

  1. // ==UserScript==
  2. // @name Source Viewer
  3. // @namespace http://scriptz.de.to/
  4. // @description View Source Code of any homepage
  5. // @include *://*
  6. // @version 6.7.0.2
  7. // @icon http://www.chip.de/ii/8/8/3/8/0/6/0/99e7dc2dba159b09.jpg
  8. // @icon64 http://www.chip.de/ii/8/8/3/8/0/6/0/99e7dc2dba159b09.jpg
  9. // @author Scriptz
  10. // @grant GM_addStyle
  11. // @grant unsafeWindow
  12. // @copyright 2013+ , Scriptz
  13. // ==/UserScript==
  14.  
  15. 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;}");
  16.  
  17. // ==Source==
  18. unsafeWindow.viewthesource = function(){
  19. window.location="view-source:"+window.location;
  20. };
  21. // ==============
  22.  
  23. // ==Body==
  24. body = document.body;
  25. if(body !== null) {
  26. div2 = document.createElement("div");
  27. div2.setAttribute('id','viewthesource');
  28. 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>";
  29. body.appendChild(div2);
  30. }
  31. // ==============
  32.  
  33. // ==Hide/Show==
  34. unsafeWindow.hide = function(){
  35. var a = new Date();
  36. a = new Date(a.getTime() +1000*60*60*24*365);
  37. document.cookie = 'sourcefunction=hide; path=/; expires='+a.toGMTString()+';';
  38. console.info('Set "sourcefunction=hide" cookie for '+window.location);
  39. 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;}");
  40. document.getElementById("viewthesource").innerHTML = "<center><img alt='Show' src='http://fs2.directupload.net/images/150909/7tae9l8k.png' onclick='javascript:show()'></center>";
  41. };
  42. if (document.cookie.indexOf("sourcefunction=hide") >= 0) {
  43. 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;}");
  44. document.getElementById("viewthesource").innerHTML = "<center><img alt='Show' src='http://fs2.directupload.net/images/150909/7tae9l8k.png' onclick='javascript:show()'></center>";
  45. }
  46. unsafeWindow.show = function(){
  47. document.cookie = 'sourcefunction=hide; path=/; expires=Thu, 01-Jan-70 00:00:01 GMT;';
  48. console.warn('Delete "sourcefunction=hide" cookie for '+window.location);
  49. 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;}");
  50. 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>";
  51. };
  52. // ==============

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址