Steamgifts, Simplify list style

oo

  1. // ==UserScript==
  2. // @name Steamgifts, Simplify list style
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3
  5. // @description oo
  6. // @author You
  7. // @match https://www.steamgifts.com/*
  8. // @icon https://www.google.com/s2/favicons?domain=steamgifts.com
  9. // @grant none
  10. // @run-at document-start
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. const style = document.createElement("style");
  16. style.innerHTML =`
  17. .giveaway__row-outer-wrap {
  18. padding: 0;
  19. }
  20. .giveaway__row-outer-wrap + div:not(.giveaway__row-outer-wrap) {
  21. display: none !important;
  22. }
  23. .giveaway__row-inner-wrap {
  24. display: flex;
  25. }
  26. .giveaway__summary {
  27. display: flex;
  28. order: 2;
  29. margin-left: 16px;
  30. }
  31. .giveaway__heading,
  32. .giveaway__columns,
  33. .giveaway__links {
  34. display: inline-flex;
  35. order: 2;
  36. z-index: 1;
  37. }
  38. .giveaway__columns {
  39. margin-left: auto;
  40. }
  41. .giveaway__columns > * {
  42. display: inline-block;
  43. }
  44. .giveaway__columns > * {
  45. border: 0;
  46. box-shadow: none;
  47. line-height: unset;
  48. border: none !important;
  49. box-shadow: none !important;
  50. background: none !important;
  51. }
  52. .giveaway__columns > *:nth-child(2) {
  53. display: none;
  54. }
  55. giveaway__links {
  56. height: unset;
  57. }
  58. .giveaway__links > *:last-child {
  59. display: none;
  60. }
  61. .giveaway_image_thumbnail,
  62. .giveaway_image_thumbnail_missing {
  63. height: 32px;
  64. width: 82px;
  65. order: 1;
  66. }
  67.  
  68. .giveaway__summary {
  69. position: relative;
  70. }
  71. .giveaway__summary:after {
  72. display: block;
  73. position: absolute;
  74. right: 0;
  75. bottom: 0;
  76. background-color: green;
  77. height: 8px;
  78. width: calc(min(100%, var(--happy)));
  79. content: "";
  80. z-index: 0;
  81. opacity: 0.2;
  82. }
  83. `;
  84. document.body.appendChild(style);
  85.  
  86. window.addEventListener("load", function () {
  87. document.querySelectorAll(".giveaway__row-outer-wrap").forEach((element) => {
  88. var value = parseInt(element.querySelector(".giveaway__links a[href$='/entries']").innerText.replace(",", "").replace("entries", "")), m;
  89. const amount = element.querySelector(".giveaway__heading__thin");
  90.  
  91. if (amount && (m = amount.innerText.match(/(\d+) Copies/))) {
  92. value /= parseFloat(m[1]);
  93. }
  94. element.style.setProperty("--happy", (10000.0 / value) + "%");
  95. });
  96. });
  97. })();