返回首頁 

Karma display for old reddit

Displays karma in every post/title/comment


Install this script?
// ==UserScript==// @name         Karma display for old reddit// @version      1.0// @description  Displays karma in every post/title/comment// @author       Zenith005// @match        https://old.reddit.com/*// @license      none// @grant        GM_addStyle// @namespace https://greasyfork.org/users/1226710// ==/UserScript==(function() {'use strict';// Fetch User Karmafunction fetchUserKarma(username, callback) {const apiURL = `https://www.reddit.com/user/${username}/about.json`;fetch(apiURL).then(response => response.json()).then(data => {const karma = data.data.total_karma || 0;callback(karma);}).catch(error => {console.error('Error fetching user karma:', error);callback(0);});}// Display User Karmafunction displayUserKarma() {const usernames = document.querySelectorAll('a.author');usernames.forEach(username => {const user = username.textContent;fetchUserKarma(user, karma => {const karmaSpan = document.createElement('span');karmaSpan.textContent = ` (${karma} karma)`;karmaSpan.classList.add('user-karma');username.parentNode.insertBefore(karmaSpan, username.nextSibling);});});}// StylingGM_addStyle(`.user-karma {font-weight: bold;color: black;}`);})();