Guest User

Reddit awards mouseover

a guest
Nov 3rd, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Explain Awards
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  try to take over the world!
  6. // @author       You
  7. // @match        https://old.reddit.com/*
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12.     'use strict';
  13.     setTimeout(function() {
  14.         $(".awarding-icon").each(function (i) {
  15.             var img = $(this).prop("src");
  16.             if (img.includes("award_images")) {
  17.                 img = img.substr(img.indexOf("award_images") + 12, img.length - img.indexOf("award_images"));
  18.                 img = img.substr(0, img.indexOf("."));
  19.                 img = img.split("").reverse().join("");
  20.                 img = img.substr(0, img.indexOf("_"));
  21.                 img = img.split("").reverse().join("");
  22.                 $(this).attr("title",img);
  23.             } else if (img.includes("redditstatic")) {
  24.              //https://www.redditstatic.com/gold/awards/icon/Train/Train_silver_48.png
  25.                 img = img.split("").reverse().join("");
  26.                 img = img.substr(0, img.indexOf("/"));
  27.                 img = img.split("").reverse().join("");
  28.                 img = img.substr(0, img.indexOf("."));
  29.                 img = img.replace(/_/g," ");
  30.                 $(this).attr("title",img);
  31.             }
  32.         });
  33.     }, 2000);
  34. })();
Add Comment
Please, Sign In to add comment