Advertisement
Guest User

patch for RaChart

a guest
Jan 26th, 2020
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.07 KB | None | 0 0
  1. --- RaChartEnhancer.user.js 2020-01-26 12:02:20.526260263 +0100
  2. +++ mine.js 2020-01-26 12:01:22.590109728 +0100
  3. @@ -8,6 +8,7 @@
  4.  // @supportURL https://www.steamgifts.com/discussion/riOvr/
  5.  // @namespace  Sighery
  6.  // @match      https://www.steamgifts.com/*
  7. +// @match      https://www.steamtrades.com/*
  8.  // @grant      GM_xmlhttpRequest
  9.  // @grant      GM_notification
  10.  // @grant      GM_setValue
  11. @@ -57,10 +58,10 @@
  12.  
  13.  // ==================== MAIN ====================
  14.  refactorStorage();
  15. -injectInterface();
  16. +injectInterface(window.location.hostname.match(/www.steamtrades.com/));
  17.  
  18. -if ((window.location.href.match("(\.steamgifts\.com\/discussion\/)|(\.steamgifts\.com\/giveaway\/)")) !== null && confirmAuthor()) {
  19. -   var apiKey = localStorage.getItem('APIKey');
  20. +if (((window.location.href.match("(\.steamgifts\.com\/discussion\/)|(\.steamgifts\.com\/giveaway\/)")) !== null && confirmAuthor() || window.location.href.match("(\.steamtrades\.com\/trade\/)"))) {
  21. +var apiKey = localStorage.getItem('APIKey');
  22.     var steamID64 = localStorage.getItem('SteamID64');
  23.     var bStoreMethod = localStorage.getItem('RCE-StoreMethod');
  24.     if (bStoreMethod !== undefined && bStoreMethod !== null) bStoreMethod = true;
  25. @@ -707,11 +708,11 @@
  26.  
  27.  
  28.  // ========== INJECT FUNCTIONS ==========
  29. -function injectInterface() {
  30. +function injectInterface(st) {
  31.     injectDlgStyle();
  32.     injectDialog();
  33.     injectFunctions();
  34. -   injectRow();
  35. +   injectRow(st);
  36.  }
  37.  
  38.  
  39. @@ -790,9 +791,9 @@
  40.  }
  41.  
  42.  
  43. -function injectRow() {
  44. -   var discDropdown = document.querySelector("a[class~='nav__button'][href^='/discussions']");
  45. -   var newRow;
  46. +function injectRow(st) {
  47. +   var discDropdown = document.querySelector(st ? "a[class~='nav_btn'][href='/']": "a[class~='nav__button'][href^='/discussions']");
  48. +    var newRow;
  49.  
  50.     if (discDropdown.previousElementSibling === null) {
  51.         // Not logged in, create a new button on the header
  52. @@ -807,11 +808,11 @@
  53.  
  54.     } else {
  55.         newRow = document.createElement('a');
  56. -       newRow.setAttribute('class', 'nav__row');
  57. +       newRow.setAttribute('class', st ? 'dropdown_btn': 'nav__row');
  58.         newRow.href = "javascript:void(0)";
  59.  
  60.         discDropdown = discDropdown.previousElementSibling.firstElementChild;
  61. -       discDropdown.insertBefore(newRow, discDropdown.querySelector("a[class='nav__row'][href='/discussions/created']").nextElementSibling);
  62. +       discDropdown.insertBefore(newRow, discDropdown.querySelector(st ? "a[class='dropdown_btn'][href~='/trades/new']": "a[class='nav__row'][href='/discussions/created']").nextElementSibling);
  63.  
  64.  
  65.         newRow.appendChild(document.createElement('i'));
  66. @@ -823,10 +824,11 @@
  67.         newRow.children[1].appendChild(document.createElement('p'));
  68.         newRow.children[1].children[0].setAttribute('class', 'nav__row__summary__name');
  69.         newRow.children[1].children[0].textContent = "RaChartâ„¢ Enhancer";
  70. -
  71. +        if (!st){
  72.         newRow.children[1].appendChild(document.createElement('p'));
  73.         newRow.children[1].children[1].setAttribute('class', 'nav__row__summary__description');
  74.         newRow.children[1].children[1].textContent = "Change the options for the enhancer.";
  75. +        }
  76.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement