您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Restores the old upvote/downvote count for submissions.
当前为
- // ==UserScript==
- // @name Reddit submission votes
- // @namespace Redditvotes
- // @include *reddit.com*
- // @exclude *adzerk.net*
- // @version 1
- // @grant none
- // @description Restores the old upvote/downvote count for submissions.
- // ==/UserScript==
- var votepoints = $(".linkinfo > .score > .number").text();
- var likepercent = $(".linkinfo > .score").text();
- var url = $(location).attr('href');
- var votepoints2 = +votepoints.replace(',', '')
- //alert(url + ", " + votepoints + ", " + likepercent);
- var percentstring = likepercent.substr(likepercent.indexOf("(") + 1);
- var percent = percentstring.substr(0, percentstring.indexOf("%"));
- var downpercent = 100 - percent;
- var totalvotes = (votepoints2 / (percent - downpercent)) * 100;
- var upvotes = Math.round((totalvotes / 100) * percent);
- var downvotes = Math.round((totalvotes / 100) * downpercent);
- //alert("percent: " + percent + ", downpercent " + downpercent + ", totalvotes: " + totalvotes + ", upvotes: " + upvotes + ", downvotes: " + downvotes);
- $.fn.digits = function(){
- return this.each(function(){
- $(this).text( $(this).text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,") );
- })
- }
- $("head").append("<style>.linkinfo .upvotes {color: orangered; font-size: 80%;} .linkinfo .downvotes {color: #5F99CF; font-size: 80%;}</style>");
- if (votepoints2 > 0) {
- $(".linkinfo > .score").replaceWith("<div class=\"score\"><span class=\"number\">" + votepoints + "</span><span class=\"word\"> points</span> (" + percent + "% like it)</div><span class=\"upvotes\"><span class=\"number\">" + upvotes + "</span><span class=\"word\"> upvotes</span></span> <span class=\"downvotes\"><span class=\"number\">" + downvotes + "</span><span class=\"word\"> downvotes</span></span>");
- } else {
- $(".linkinfo > .score").replaceWith("<div class=\"score\"><span class=\"number\">" + votepoints + "</span><span class=\"word\"> points</span> (" + percent + "% like it)</div><span class=\"upvotes\"><span class=\"number\">?</span><span class=\"word\"> upvotes</span></span> <span class=\"downvotes\"><span class=\"number\">?</span><span class=\"word\"> downvotes</span></span>");
- }
- $(".number").digits();