// ==UserScript== // @name V2ex User Experience Enhance // @namespace http://tampermonkey.net/ // @version 0.51 // @description v2ex体验增强 // @author zjsxwc // @match https://www.v2ex.com/* // @include http*://*.v2ex.com/* // @include http*://v2ex.com/* // @grant none // @locale zh-CN // @downloadURL https://update.greasyfork.icu/scripts/31755/V2ex%20User%20Experience%20Enhance.user.js // @updateURL https://update.greasyfork.icu/scripts/31755/V2ex%20User%20Experience%20Enhance.meta.js // ==/UserScript== (function() { // $("#Search form").attr("onsubmit", "return tm_dispatch();"); var script = (function () {/* */}).toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1]; $('body').append($(script)); // // var isFromHomepage = (document.referrer == "https://www.v2ex.com/")||(document.referrer == "https://v2ex.com/"); (!isFromHomepage) && (function(){ var replyNo = null; var replyMatches = window.location.hash.match(/#reply(\d+)/); if (replyMatches) { replyNo = replyMatches[1]; } if (replyNo) { var targetReplyEle = null; $(".no").each(function(_,e){ var eHtml = $(e).html(); if (eHtml != replyNo) { return; } targetReplyEle = e; }); $('html, body').animate({ scrollTop: $(targetReplyEle).offset().top }, 666); } }()); // // function in_array(search,array){ for(var i in array){ if(array[i]==search){ return true; } } return false; } var currentPathName = window.location.pathname; var ignorePathNameList = [ "/signin", "/forgot", "/signup" ]; if (!in_array(currentPathName, ignorePathNameList)) { $.get("/mission/daily",function(r){ var m = r.match(/mission\/daily\/redeem\?once=(\w{5})/); if (!m) { return; } var code = m[1]; var url = "/mission/daily/redeem?once="+code; $.get(url); }); } // // var isInThread = !!window.location.href.match(/\/t\/\d+/); if (isInThread) { var $goBottomBtn = $('到底部'); $('.topic_buttons').append($goBottomBtn); var getReplyContentByNickname = function(nickname) { var replyContents = []; $("strong a").each(function(i,e){ var $el = $(e); var text =$el.text(); if (text.lastIndexOf(nickname) == 0) { var $parent = $el.closest("td"); var $content = $parent.find(".reply_content"); var $no = $parent.find(".no"); replyContents.push({ no: $no.text(), content: $content.text() }); } }); return replyContents; }; $(".reply_content a").each(function(_,e){ var $mayAtMan = $(e); var $parent = $mayAtMan.parent(); var parentText = $parent.text(); var mayNickname = $mayAtMan.text(); var mayAtManText = "@"+mayNickname; if (parentText.lastIndexOf(mayAtManText) !== -1) { $mayAtMan.mouseover(function(){ var replyContents = getReplyContentByNickname(mayNickname); var $allAtManReply = $("body").find(".js-at-man-reply"); if ($allAtManReply) { $allAtManReply.remove(); } var html = ""; $.each(replyContents,function(_,replyContent){ html += "

"+"#"+replyContent.no+" "+replyContent.content+"


"; }); html = "

"+mayNickname+":


"+html+"
"; $mayAtMan.parent().append($(html)); }); } }); } //
//标记楼主 代码来自ejin uid=document.getElementById("Rightbar").getElementsByTagName("a")[0].href.split("/member/")[1];//自己用户名 if (location.href.indexOf(".com/t/") != -1) { var lzname=document.getElementById("Main").getElementsByClassName("avatar")[0].parentNode.href.split("/member/")[1]; allname='@'+lzname+' '; all_elem = document.getElementsByClassName("dark"); for(var i=0; i@所有人"; if ( document.body.style.WebkitBoxShadow !== undefined ) { //允许调整回复框高度 document.getElementById("reply_content").style.resize="vertical"; } document.getElementById("reply_content").style.overflow="auto"; var magagers="@Livid @Kai @Olivia @GordianZ @sparanoid"; document.getElementById("reply_content").parentNode.innerHTML+="    @管理员"; } // 图片链接自动转换成图片 代码来自caoyue@v2ex function linksToImgs() { var links = document.links; for (x in links){ var link = links[x]; if (/^http.*\.(?:jpg|jpeg|jpe|bmp|png|gif)/i.test(link.href) && !/"; } } } linksToImgs(); })();