IT之家-反恰客脚本

try to take over the world!

  1. // ==UserScript==
  2. // @name IT之家-反恰客脚本
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.84
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://quan.ithome.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. 'use strict';
  13.  
  14. if ($(".postcontent").length > 0 && $(".postcontent").html().indexOf("class=\"appmore\"") > 0) {
  15. $(".postcontent").html("<p>稍等一下,正在异步获取帖子数据。。。</p>");
  16. var _id = location.href.substring(location.href.indexOf("/0/") + 3, location.href.indexOf("/0/") + 6) + location.href.substring(location.href.indexOf("/0/") + 7, location.href.indexOf("/0/") + 10);
  17. $.ajax({
  18. url: "https://fxxkcar.com/getithomepost.php?id=" + _id,
  19. dataType: 'jsonp',
  20. jsonp: "CallBack",
  21. success: function (data) {
  22. var _content = data.content;
  23.  
  24. _content = replaceimg(_content, data.imgs);
  25. $(".postcontent").html(_content);
  26. var _repost = "<div id=\"ReplyList\"class=\"comment\"><div class=\"comm_title\"><div class=\"l\"><a style=\"color: red;\" target=\"_blank\" href=\"https://www.fxxkcar.com/ithome.html\">IT之家自动签到系统</a></div><div class=\"r\"><a class=\"order\">正序显示</a></div></div><ul class=\"comm_list\"id=\"ulcommentlist\"></ul><ul class=\"comm_list\"id=\"ulcommentlistorder\"style=\"display:none\"></ul><ul class=\"comm_list\"id=\"LoadArticleReply\"></ul><script>var replypage=1;$(function(){pagereply(replypage,20,$(\'.order\').text())});</script><input type=\"hidden\"id=\"postid\"value=\"" + _id + "\"/></div><div class=\"more_comm\"><a id=\"pagecomment\" href=\"javascript:pagereply(++replypage,95,$(\'.order\').text());\">查看更多回复 ...</a></div>";
  27. $("#content").after($(_repost));
  28.  
  29.  
  30.  
  31. var login = '';
  32.  
  33. login += ' <div class="answer" id="divanswer">';
  34. login += ' <div class="user_info"></div>';
  35. login += ' <div class="edit_form">';
  36. login += ' <input type="hidden" id="parentPostID" value="0" />';
  37. login += ' <script type="text/plain" id="myEditor" style="width:735px;height:220px;"></script>';
  38. login += ' <span id="replyMessage" style="color:red"></span>';
  39. login += ' <a href="javascript:;" class="answer_inpt" id="btnReply">回复</a>';
  40. login += ' </div>';
  41. login += ' </div>';
  42. login += ' <script src="//img.ithome.com/file/js/jquery/popwin.js"><\/script>';
  43. login += ' <script type="text/javascript" src="/statics/ueditor/ueditor.config.js?r=3"><\/script>';
  44. login += ' <script type="text/javascript" src="/statics/ueditor/ueditor.all.js?r=3"><\/script>';
  45. login += ' <script type="text/javascript" src="/statics/ueditor/lang/zh-cn/zh-cn.js?r=3"><\/script>';
  46. login += ' <link href="https://quan.ithome.com/statics/ueditor/themes/default/css/ueditor.css" type="text/css" rel="stylesheet">';
  47. login += ' <script src="https://quan.ithome.com/statics/ueditor/third-party/codemirror/codemirror.js" type="text/javascript" defer="defer"></script>';
  48. login += ' <link rel="stylesheet" type="text/css" href="https://quan.ithome.com/statics/ueditor/third-party/codemirror/codemirror.css">';
  49.  
  50. $("#ReplyList").append($(login));
  51.  
  52. window.editor = UE.getEditor('myEditor');
  53.  
  54. editor.placeholder("<span style=color:#bbb>政治、色情、喷骂、引战、机型喷、水军、广告等违法违规行为将被封号。</span>");
  55. haodadaimages();
  56. $(".comm_title").delegate(".order",
  57. "click",
  58. function (e) {
  59. e.preventDefault();
  60. if ($(".order").html() == "倒序显示") {
  61. $("#ulcommentlist").hide();
  62. $("#ulcommentlistorder").fadeIn("slow");
  63. $(".order").html("正序显示");
  64. if ($("#ulcommentlistorder").html() == "") {
  65. var new_item = $("<div/>").load("/quan/GetAjaxData.aspx",
  66. { "postid": $("#postid").val(), "type": "replypage", "page": 1, "order": "order" },
  67. function () {
  68. }).hide();
  69. $("#ulcommentlistorder").append(new_item);
  70. new_item.fadeIn("slow");
  71. }
  72. } else {
  73. $("#ulcommentlist").fadeIn("slow");
  74. $("#ulcommentlistorder").hide();
  75. $(".order").html("倒序显示");
  76. if ($("#ulcommentlist").html() == "") {
  77. var new_item = $("<div/>").load("/quan/GetAjaxData.aspx",
  78. { "postid": $("#postid").val(), "type": "replypage", "page": 1 },
  79. function () {
  80. }).hide();
  81. $("#ulcommentlist").append(new_item);
  82. new_item.fadeIn("slow");
  83. }
  84. }
  85.  
  86.  
  87. })
  88.  
  89. $(".comm_list").delegate(".reply_btn",
  90. "click",
  91. function () {
  92. oremarkbtn = $(this);
  93. modelreplyComment();
  94. addReply();
  95. $(".bbsmodal textarea").keydown(function (e) {
  96. if ((e.which === 13 || e.which === 10) && e.ctrlKey) {
  97. $(".answer_inpt").click()
  98. }
  99. })
  100. });
  101. $("#btnReply").click(function () { reply() });
  102. $("#btnModifyReply").click(function () { modifyReply() })
  103. $(".comm_title .order").click();
  104.  
  105. }
  106. })
  107.  
  108. }
  109. $(function () {
  110.  
  111. haodadaimages();
  112.  
  113.  
  114. });
  115.  
  116. function haodadaimages() {
  117. //添加按钮
  118. var _filebtn = '<label class="ui_button ui_button_primary" id="haodada_lab" for="haodada_file" style="display: block;cursor:pointer;margin-top: 10px;width: 90px;height: 40px;-webkit-border-radius: 2px;-moz-border-radius: 2px;border-radius: 2px;background: #d94141;color: #fff;text-align: center;text-decoration: none;line-height: 40px;">上传高清大图</label><input style="display:none;" type="file" id="haodada_file" name="profile_pic" multiple="multiple" accept=".jpg, .jpeg, .png, .gif">';
  119. if($("#divanswer>.user_info").length>0)$("#divanswer>.user_info").after(_filebtn);
  120. else if($(".pb_title").length>0)$(".pb_title").after(_filebtn);
  121. else if($("#postbox .edit_form").length>0)$("#postbox .edit_form").before(_filebtn);
  122. $(".sub_nav").append('<a style="color: red;" target="_blank" href="https://www.fxxkcar.com/ithome.html">IT之家自动签到系统</a>')
  123. var editor=typeof(editor)=="undefined"?UE.getEditor('myEditor'):editor;
  124. $("#haodada_file").change(function () {
  125. window.haodadafiles = $("#haodada_file")[0].files;
  126. window.haodadaimagesindex= 0;
  127. uploadimg();
  128.  
  129. });
  130. }
  131. function uploadimg(){
  132. $("#haodada_lab").text("正在上传");
  133. var formData = new FormData();
  134. formData.append("smfile", haodadafiles[haodadaimagesindex]);
  135. var _tempimg;
  136. $.ajax({
  137. url: 'https://www.fxxkcar.com/upload.php',
  138. type: 'POST',
  139. success: function (data) {
  140. console.log(data);
  141. editor.focus();
  142. editor.execCommand("inserthtml","<p><img src='"+data.trim()+"?ithome.com' _src='"+data.trim()+"?ithome.com'/></p>");
  143. haodadaimagesindex++;
  144. if(haodadaimagesindex<haodadafiles.length){
  145. uploadimg();
  146. }else{
  147. $("#haodada_lab").text("上传高清大图");
  148. }
  149. },
  150. error: function (data) {
  151. alert('图片上传失败 - ' + XMLHttpRequest.status);
  152. haodadaimagesindex++;
  153. if(haodadaimagesindex<haodadafiles.length){
  154. uploadimg();
  155. }else{
  156. $("#haodada_lab").text("上传高清大图");
  157. }
  158. console.error(XMLHttpRequest + textStatus + errorThrown);
  159. },
  160.  
  161. data: formData,
  162. cache: false,
  163. contentType: false,
  164. processData: false
  165.  
  166. });
  167. }
  168. function replaceimg(content, imgsArr) {
  169. var _rexArray = content.match(/(<!--IMG_)(\d|\d\d)-->/g);
  170. if (_rexArray == null) { return content; }
  171. for (var _i = 0; _i < _rexArray.length; _i++) {
  172. content = content.replace(_rexArray[_i], "<img src='" + imgsArr[_i] + "'/><br/>");
  173. }
  174. return content;
  175. }
  176. })();

QingJ © 2025

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