Advertisement
Guest User

Untitled

a guest
Apr 14th, 2024
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Content Script - SteamGifts Giveaways
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Content script for retrieving table column headings from SteamGifts Giveaways page
  6. // @author Your Name
  7. // @match https://www.steamgifts.com/giveaways/entered
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. console.log('Content script loaded.');
  15.  
  16. // Create the result display
  17. const resultDisplay = document.createElement('div');
  18. resultDisplay.style.position = 'fixed';
  19. resultDisplay.style.left = '10px';
  20. resultDisplay.style.bottom = '50px';
  21. resultDisplay.style.zIndex = '9999';
  22. resultDisplay.style.backgroundColor = 'white';
  23. resultDisplay.style.padding = '10px';
  24. resultDisplay.style.border = '1px solid #ccc';
  25. resultDisplay.style.overflow = 'auto';
  26. resultDisplay.style.maxHeight = '300px';
  27. document.body.appendChild(resultDisplay);
  28.  
  29. // Listen for messages from the background script
  30. window.addEventListener('message', event => {
  31. if (event.source !== window) return;
  32. if (event.data.type && event.data.type === 'SG_COLUMN_HEADINGS_RESULT') {
  33. console.log('Received column headings result from background script.');
  34. // Update the result display with the retrieved column headings
  35. resultDisplay.textContent = event.data.headings;
  36. }
  37. });
  38.  
  39. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement