您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Enhance your experience at CS.RIN.RU - Steam Underground Community.
当前为
// ==UserScript== // @name CS.RIN.RU Enhanced // @namespace Royalgamer06 // @version 0.1 // @description Enhance your experience at CS.RIN.RU - Steam Underground Community. // @author Royalgamer06 // @match http://cs.rin.ru/forum/* // @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js // @grant none // @run-at document-idle // ==/UserScript== // TURN ON/OFF FEATURES HERE const infinite_scrolling = true; const mentioning = true; const dynamic_who_is_online = true; const dynamic_time = true; // DO NOT TOUCH BELOW $("body").prepend("<img id='ajaxload' src='http://i.imgur.com/uyDmWvn.gif' style='opacity: 0.5; position: fixed; width: 250px; height: 25px; z-index: 2147483647; right: 20px; top: 3%; left: 50%; margin-left: -125px; display: none;'></div>"); $.ajaxSetup({ async: true, beforeSend: function() { if ($("#ajaxload")) $("#ajaxload").show("fast"); }, complete: function() { if ($("#ajaxload")) $("#ajaxload").hide("fast"); } }); // INFINITE SCROLLING if ($("[title='Click to jump to page…']").length > 0 && infinite_scrolling) { var selector = "#pagecontent > table.tablebg > tbody > tr:has(.row4 > img:not([src*=global], [src*=announce], [src*=sticky]))"; //viewforum.php if ($(selector).length === 0) selector = "#wrapcentre > form > table.tablebg > tbody > tr:not(:first, :last)"; //search.php if ($(selector).length === 0) selector = "#pagecontent > form > table.tablebg > tbody > tr:not(:first)"; //inbox if ($(selector).length === 0) selector = "#pagecontent > .tablebg:not(:first, :last)"; //viewtopic.php if (URLContains("viewtopic.php")) { $("[title='Subscribe topic']").first().parents().eq(7).after($(".cat:has(.btnlite)").parent().parent().parent()); $("[title='Reply to topic']").last().parents().eq(4).remove(); } else if (!URLContains("ucp.php")) { $(selector).parent().prepend($(".cat:has(.btnlite)").parent()); } var navElem = $("[title='Click to jump to page…']").first().parent(); var nextElem = $(navElem).find("strong").next().next(); if (nextElem.length == 1) { //If there is a next page var nextPage = $(nextElem).attr("href"); var ajaxDone = true; $(document).scroll(function() { if (window.innerHeight + window.scrollY + 1500 >= document.body.scrollHeight && nextElem.length > 0 && ajaxDone) { ajaxDone = false; $.get(nextPage, function(data) { $(selector).parent().append($(selector, data)); $(navElem).html($("[title='Click to jump to page…']", data).first().parent().html()); mentionify(); nextElem = $(navElem).find("strong").next().next(); nextPage = $(nextElem).attr("href"); ajaxDone = true; }); } }); } } // MENTIONING if (URLContains("posting.php" && "do=mention") && mentioning) { var p = URLParam("p"); var u = URLParam("u"); var a = URLParam("a"); var postBody = "@[url=http://cs.rin.ru/forum/memberlist.php?mode=viewprofile&u=" + u + "]" + a + "[/url], "; var ajaxDone = false; $("[name=message]").val(postBody); $("[name=postform]").submit(function() { if (!ajaxDone) { var subject = "I mentioned you"; var msg = "This PM serves as a notification for mentioning you [url=http://cs.rin.ru/forum/viewtopic.php?p=" + p + "#p" + p + "]here[/url]."; sendPM(u, subject, msg, function() { ajaxDone = true; $(".btnmain:nth-child(2)").click(); }); return false; } }); } mentionify(); // DYNAMIC var wisCond = $("div~ .tablebg").last().length > 0 && dynamic_who_is_online; var timeCond = $(".gensmall+ .gensmall").last().length > 0 && dynamic_time; if (wisCond || timeCond) { setInterval(function() { $.get(location.href, function(data) { if (timeCond) $("#datebar .gensmall+ .gensmall").html($("#datebar .gensmall+ .gensmall", data).html()); if (wisCond) $("div~ .tablebg").last().html($("div~ .tablebg", data).last().html()); }); }, wisCond ? 10000 : 60000); } // FUNCTIONS function mentionify() { if ($(".postbody").length > 0 && URLContains("viewtopic.php") && mentioning) { var replyLink = $("[title='Reply to topic']").parent().attr("href"); $(".gensmall div+ div:not(:has([title='Reply with mentioning']))").each(function() { var postElem = $(this).parents().eq(7); var postID = $(postElem).find("[title='Send private message']").parent().attr("href").split("p=")[1]; var author = $(postElem).find(".postauthor").text(); var authorID = $(postElem).find("[title=Profile]").parent().attr("href").split("u=")[1]; $(this).append("<a href='" + replyLink + "&do=mention&p=" + postID + "&u=" + authorID + "&a=" + encodeURIComponent(author) + "'><img src='http://i.imgur.com/uTA0dBI.png' alt='Reply with mentioning' title='Reply with mentioning'></a>"); }); } } // Can't make this fully work yet function sendPM(userid, subject, message, callback) { if (!callback) callback = function() {}; $.ajax({ contentType: "multipart/form-data; boundary=----WebKitFormBoundary", url: "http://cs.rin.ru/forum/ucp.php?i=pm&mode=compose&action=post", method: "POST", data: '------WebKitFormBoundary\nContent-Disposition: form-data; name="username_list"\n\n\n------WebKitFormBoundary\nContent-Disposition: form-data; name="address_list[u][{USERID}]"\n\nto\n------WebKitFormBoundary\nContent-Disposition: form-data; name="subject"\n\n{SUBJECT}\n------WebKitFormBoundary\nContent-Disposition: form-data; name="addbbcode20"\n\n100\n------WebKitFormBoundary\nContent-Disposition: form-data; name="helpbox"\n\nTip: Styles can be applied quickly to selected text.\n------WebKitFormBoundary\nContent-Disposition: form-data; name="message"\n\n{MESSAGE}\n------WebKitFormBoundary\nContent-Disposition: form-data; name="attach_sig"\n\noff\n------WebKitFormBoundary\nContent-Disposition: form-data; name="post"\n\nSubmit\n------WebKitFormBoundary\nContent-Disposition: form-data; name="fileupload"; filename=""\nContent-Type: application/octet-stream\n\n\n------WebKitFormBoundary\nContent-Disposition: form-data; name="filecomment"\n\n\n------WebKitFormBoundary\nContent-Disposition: form-data; name="lastclick"\n\n1481816018\n------WebKitFormBoundary\nContent-Disposition: form-data; name="status_switch"\n\n0\n------WebKitFormBoundary\nContent-Disposition: form-data; name="creation_time"\n\n1481816018\n------WebKitFormBoundary\nContent-Disposition: form-data; name="form_token"\n\n502913d663cf99ad10c2ba7055076dee7f925702\n------WebKitFormBoundary--'.replace("{USERID}", userid).replace("{SUBJECT}", subject).replace("{MESSAGE}", message), success: callback, beforeSend: function() { if ($("#ajaxload")) $("#ajaxload").show("fast"); }, complete: function() { if ($("#ajaxload")) $("#ajaxload").hide("fast"); } }); } function URLContains(match) { return window.location.href.indexOf(match) > -1; } function URLParam(name) { return (location.search.split(name + '=')[1] || '').split('&')[0]; }