您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Highlights comments for Reddit stories based on comment points
当前为
// ==UserScript== // @description Highlights comments for Reddit stories based on comment points // @grant none // @match *://*.reddit.com/*/comments/* // @name Reddit Comment Highlighter (Chrome) // @namespace http://userscripts.org/scripts/show/120788 // @require http://code.jquery.com/jquery-latest.min.js // @version 1.5 // ==/UserScript== /* Author: Kilo G Updated version of Erik Wannebo's script (http://userscripts.org/scripts/show/84313) Version 1.5 Added @grant header Updated @match header Version 1.4 Added HTTPS match Updated to use external jQuery Version 1.3 Added Reddit Blue color and made it the default Updated jQuery to v2.0.2 Version 1.2 Updated jQuery to v1.7.2 */ var ChangeFontSize = true; var redditbluethresholds = {.75: '#edf5fc', .9: '#d9eafa', .95: '#c8e0f7', .98: '#b5d5f5' } var bluethresholds = {.75: '#ddddff', .9: '#ccccff', .95: '#bbbbff', .98: '#aaaaff' } var greenthresholds = {.75: '#ddf8dd', .9: '#bbf8bb', .95: '#aaf8aa', .98: '#99f899' } var yellowthresholds = {.75: '#f8f8dd', .9: '#f8f8bb', .95: '#f8f8aa', .98: '#f8f899' } var prevFontFactor = ""; var fontFactor = 2; var highlightColor = "redditblue"; function highlightComments() { var thresholds = redditbluethresholds; if (highlightColor == "blue") thresholds = bluethresholds; if (highlightColor == "green") thresholds = greenthresholds; if (highlightColor == "yellow") thresholds = yellowthresholds; var arRecs = new Array(); $(".nestedlisting .entry .score.unvoted").each(function() { var recs = $(this).text().split(' ')[0]; arRecs.push(parseInt(recs)); }); arRecs.sort(function(a, b) { return a - b; }); $(".nestedlisting .entry .score.unvoted").each(function() { var recs = $(this).text().split(' ')[0]; var numrecs = parseInt(recs); var newbgcolor = ''; var newfontsize = 13; for (t in thresholds) if (numrecs >= arRecs[Math.floor(arRecs.length * t)]) { newbgcolor = thresholds[t]; newfontsize += fontFactor; } else { break; } if (newbgcolor != '') { $(this).parents("div.entry").css( { backgroundColor: newbgcolor, '-moz-border-radius': '7px', 'webkit-border-radius': '7px', 'padding': '2px 2px 2px 6px', 'border': 'solid black 1px' }); if (fontFactor > 0 || prevFontFactor != "") { $(this).parents("div.entry").find(".md").css( { fontSize: newfontsize }); $(this).parents('.tagline').css( { fontSize: newfontsize, color: 'black' }); $(this).css( { fontSize: newfontsize, color: 'black' }); } } }); //drawHighlightColorSelect(); //drawFontFactorSelect(); } function changeHighlightColor() { highlightColor = $('#colorselect').val(); GM_setValue("reddithighlightcommentcolor", highlightColor); highlightComments(); } function changeFontFactor() { prevFontFactor = fontFactor; fontFactor = parseInt($('#fontfactorselect').val()); GM_setValue("reddithighlightcommentfontfactor", fontFactor); highlightComments(); } function drawHighlightColorSelect() { var colorselect = null; $('#colorselect').remove(); $('#colorselectlabel').remove(); var selecthtml = "<label id='colorselectlabel' for='colorselect'>Highlight Color:</label><select id='colorselect'>"; selecthtml += "<option value='redditblue' " + (highlightColor == 'redditblue' ? "selected" : "") + ">reddit blue</option>"; selecthtml += "<option value='blue' " + (highlightColor == 'blue' ? "selected" : "") + ">blue</option>"; selecthtml += "<option value='green' " + (highlightColor == 'green' ? "selected" : "") + ">green</option>"; selecthtml += "<option value='yellow' " + (highlightColor == 'yellow' ? "selected" : "") + ">yellow</option>"; selecthtml += "</select>"; colorselect = $(selecthtml).change(function() { changeHighlightColor() }); $('.menuarea').append(colorselect); } function drawFontFactorSelect() { var fontfactorselect = null; $('#fontfactorselect').remove(); $('#fontfactorselectlabel').remove(); var selecthtml = "<label id='fontfactorselectlabel' for='fontfactorselect'>Font Adjustment:</label><select id='fontfactorselect'>"; selecthtml += "<option value='0' " + (fontFactor == 0 ? "selected" : "") + ">0</option>"; selecthtml += "<option value='1' " + (fontFactor == 1 ? "selected" : "") + ">1</option>"; selecthtml += "<option value='2' " + (fontFactor == 2 ? "selected" : "") + ">2</option>"; selecthtml += "<option value='3' " + (fontFactor == 3 ? "selected" : "") + ">3</option>"; selecthtml += "</select>"; fontfactorselect = $(selecthtml).change(function() { changeFontFactor() }); $('.menuarea').append(fontfactorselect); } $(document).ready(function() { highlightComments(); }); // This is just a sample script. Paste your real code (javascript or HTML) here. if ('this_is' == /an_example/) { of_beautifer(); } else { var a = b ? (c % d) : e[f]; }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址