情人節驚喜

僞裝成百度新聞的情人節驚喜

  1. // ==UserScript==
  2. // @name Valentine's Day
  3. // @name:zh-CN 情人节惊喜
  4. // @name:zh-TW 情人節驚喜
  5. // @namespace hoothin
  6. // @version 0.1
  7. // @description A script to make a surprise for Valentine's Day
  8. // @description:zh-CN 伪装成百度新闻的情人节惊喜
  9. // @description:zh-TW 僞裝成百度新聞的情人節驚喜
  10. // @author hoothin
  11. // @license MIT License
  12. // @include *://www.baidu.com/
  13. // @include *://www.baidu.com/home*
  14. // @include *://www.baidu.com/?tn=*
  15. // @include *://www.baidu.com/index.php*
  16. // @include *://www.baidu.com/s?wd=Valentine*
  17. // @grant GM_openInTab
  18. // ==/UserScript==
  19.  
  20. (function() {
  21. 'use strict';
  22. var valentinName = "小青"; //情人名字
  23. var myName = "许仙"; //自己名字
  24. var time = "2007 1 29"; //恋爱纪念日
  25. var valentineWords = "小青:颜值对我来说不是问题"; //新闻标题
  26. var valentinePhotoUrl = "http://n1.itc.cn/img8/wb/smccloud/fetch/2015/03/06/194736305359888206.GIF"; //新闻图链接
  27. var date=new Date();
  28. var dateDay=date.getDate(),dateMonth=date.getMonth()+1;
  29. if(dateDay!=14||dateMonth!=2)return;
  30. if(/wd=Valentine/.test(location.href)){
  31. var dayArr=time.split(" ");
  32. var html=`
  33. <!DOCTYPE HTML>
  34. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  35. <head>
  36. <title>Our Love Story</title>
  37. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  38. <link href="https://cdn.rawgit.com/hoothin/UserScripts/master/Valentine's%20Day/css/default.css" type="text/css" rel="stylesheet">
  39. <script type="text/javascript" src="https://cdn.rawgit.com/hoothin/UserScripts/master/Valentine's%20Day/js/jquery.js"></script>
  40. <script type="text/javascript" src="https://cdn.rawgit.com/hoothin/UserScripts/master/Valentine's%20Day/js/garden.js"></script>
  41. <script type="text/javascript" src="https://cdn.rawgit.com/hoothin/UserScripts/master/Valentine's%20Day/js/functions.js"></script>
  42. </head>
  43. <body>
  44. <div id="mainDiv">
  45. <div id="content">
  46. <div id="loveHeart">
  47. <canvas id="garden"></canvas>
  48. <div id="words">
  49. <div id="messages">
  50. ${valentinName}, I have fallen in love with you for
  51. <div id="elapseClock"></div>
  52. </div>
  53. <div id="loveu">
  54. Love u forever and ever.<br/>
  55. <div class="signature">- ${myName}</div>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. <script type="text/javascript">
  62. var offsetX = $("#loveHeart").width() / 2;
  63. var offsetY = $("#loveHeart").height() / 2 - 55;
  64. var together = new Date();
  65. together.setFullYear(${dayArr[0]}, ${dayArr[1]}, ${dayArr[2]});
  66. together.setHours(20);
  67. together.setMinutes(0);
  68. together.setSeconds(0);
  69. together.setMilliseconds(0);
  70. if (!document.createElement('canvas').getContext) {
  71. var msg = document.createElement("div");
  72. msg.id = "errorMsg";
  73. msg.innerHTML = "Your browser doesn't support HTML5!<br/>Recommend use Chrome 14+/IE 9+/Firefox 7+/Safari 4+";
  74. document.body.appendChild(msg);
  75. document.execCommand("stop");
  76. } else {
  77. startHeartAnimation();
  78. timeElapse(together);
  79. setInterval(function () {
  80. timeElapse(together);
  81. }, 500);
  82. }
  83. </script>
  84. </body>
  85. </html>`;
  86. GM_openInTab('data:text/html;charset=utf-8,' + encodeURIComponent(html),false);
  87. }else{
  88. var listWrapper=document.querySelector(".s-news-list-wrapper");
  89. if(listWrapper){
  90. var valentineItem=document.createElement("div");
  91. valentineItem.className="s-news-special s-news-item s-news-special-item-tpl-2 s-opacity-blank8";
  92. valentineItem.innerHTML=`<div class="s-pic-content"><div class="s-pic-content-own"> <ul class="s-news-content-imgs clearfix"> <li class="item-img-wrap"> <a href="https://www.baidu.com/s?wd=Valentine" target="_blank" title="${valentineWords}"> <img class="s-news-img" src="${valentinePhotoUrl}" height="119" width="179"> </a> </li></ul></div></div> <div class="s-block-container"> <div class="s-block-container-own"> <div class="s-text-content"> <h2><a href="https://www.baidu.com/s?wd=Valentine" title="${valentineWords}" target="_blank" class="s-title-yahei">${valentineWords}</a><a href="javascript:;" class="del"></a></h2> </div> <div class="from"> <span class="src-net"> <a href="http://ent.chinadaily.com.cn" target="_blank" data-src="1" data-click="LOG_LINK"> 中国日报网 </a> </span> <span class="src-time">02-11 15:58</span> <div class="dustbin" data-click="LOG_BTN_DUSTBIN"></div></div> </div> </div>`;
  93. listWrapper.insertBefore(valentineItem,listWrapper.firstChild);
  94. }
  95. }
  96. })();

QingJ © 2025

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