// ==UserScript== // @name 反恰客脚本 // @namespace http://tampermonkey.net/ // @version 0.6 // @description try to take over the world! // @author You // @match https://quan.ithome.com/* // @grant none // @downloadURL none // ==/UserScript== (function () { 'use strict'; if ($(".postcontent").length>0&&$(".postcontent").html().indexOf("class=\"appmore\"") > 0) { $(".postcontent").html("

稍等一下,正在异步获取帖子数据。。。

"); 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); $.ajax({ url: "https://ithome.fxxkcar.com/getithomepost.php?id=" + _id, dataType: 'jsonp', jsonp: "CallBack", success: function (data) { var _content = data.content; _content = replaceimg(_content, data.imgs); $(".postcontent").html(_content); var _repost = "
我已经退出it圈子,请不要过度依赖此插件,以后不会再更新
查看更多回复 ...
"; $("#content").after($(_repost)); var login = ''; login += '
'; login += '
'; login += '
'; login += ' '; login += ' '; login += ' '; login += ' 回复'; login += '
'; login += '
'; login += ' '; login += ' '; $("#ReplyList").append($(login)); window.editor = UE.getEditor('myEditor'); editor.placeholder("政治、色情、喷骂、引战、机型喷、水军、广告等违法违规行为将被封号。"); haodadaimages(); $(".comm_title").delegate(".order", "click", function (e) { e.preventDefault(); if ($(".order").html() == "倒序显示") { $("#ulcommentlist").hide(); $("#ulcommentlistorder").fadeIn("slow"); $(".order").html("正序显示"); if ($("#ulcommentlistorder").html() == "") { var new_item = $("
").load("/quan/GetAjaxData.aspx", { "postid": $("#postid").val(), "type": "replypage", "page": 1, "order": "order" }, function () { }).hide(); $("#ulcommentlistorder").append(new_item); new_item.fadeIn("slow"); } } else { $("#ulcommentlist").fadeIn("slow"); $("#ulcommentlistorder").hide(); $(".order").html("倒序显示"); } }) $(".comm_list").delegate(".reply_btn", "click", function () { oremarkbtn = $(this); modelreplyComment(); addReply(); $(".bbsmodal textarea").keydown(function (e) { if ((e.which === 13 || e.which === 10) && e.ctrlKey) { $(".answer_inpt").click() } }) }); $("#btnReply").click(function () { reply() }); $("#btnModifyReply").click(function () { modifyReply() }) } }) } $(function () { haodadaimages(); }); function haodadaimages(){ //添加按钮 var _filebtn = ''; $("#divanswer>.user_info").after(_filebtn); $(".pb_title").after(_filebtn); $("#haodada_file").change(function () { var formData = new FormData(); var files = $("#haodada_file")[0].files; for (var _i = 0; _i < files.length; _i++) { $("#haodada_lab").text("正在上传"); formData.append("fileupload", files[_i]); var _tempimg; $.ajax({ url: "https://ssl.nn.tuiyouyou.com/test/upload.php", type: "post", data: formData, cache: false, processData: false, contentType: false, async: true, dataType: "json", success: function (data) { console.log(data); editor.focus(); editor.execCommand("inserthtml","

"); $("#haodada_lab").text("上传高清大图"); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert('图片上传失败 - ' + XMLHttpRequest.status); $("#haodada_lab").text("上传高清大图"); console.error(XMLHttpRequest + textStatus + errorThrown); } }) } }); } function replaceimg(content, imgsArr) { var _rexArray = content.match(/(/g); if (_rexArray == null) { return content; } for (var _i = 0; _i < _rexArray.length; _i++) { content = content.replace(_rexArray[_i], "
"); } return content; } })();