qazarius

steam-store-game-page.user.js

Dec 11th, 2012
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name Steam Web Tools Steamstore Gamepage MOD
  3. // @include https://store.steampowered.com/app/*
  4. // @include http://store.steampowered.com/app/*
  5. // @include https://store.steampowered.com/sub/*
  6. // @include http://store.steampowered.com/sub/*
  7. // ==/UserScript==
  8.  
  9. window.addEventListener("DOMContentLoaded",
  10.     function() {
  11.        
  12.         var els = document.querySelectorAll('input[name="subid"]');
  13.  
  14.         var subid, el;
  15.         for(var i=0; i < els.length; i++){
  16.             el = els[i];
  17.             subid = el.value;
  18.             el.parentElement.parentElement.insertAdjacentHTML('beforeEnd', '<div>Subscription id = <a href="http://cdr.thebronasium.com/sub/'+subid+'">'+subid+'</a></div>');
  19.         }
  20.  
  21.         var res = String(window.location.href).match(/\/(sub|app)\/(\d+)/i);
  22.         var gamenameEl = document.querySelector('.game_title_area .game_name .blockbg');
  23.         if (!gamenameEl){
  24.             gamenameEl = document.querySelector('.apphub_AppName');
  25.         }
  26.         var gamename = encodeURIComponent(gamenameEl.textContent.trim());
  27.         el = document.querySelector('#main_content > .rightcol');
  28.  
  29.         links = [
  30.             {href:'http://steamgamesales.com/'+res[1]+'/'+res[2], icon:'http://steamgamesales.com/favicon.ico', text:'Посмотреть на SteamGameSales.com'},
  31.             {href:'http://www.steamprices.com/ru/'+res[1]+'/'+res[2], icon:'http://www.steamprices.com/favicon.png', text:'Посмотреть на SteamPrices.com'},
  32.             {href:'http://steammoney.com/?price=up&s='+gamename, icon:'http://steammoney.com/favicon.ico', text:'Искать на SteamMoney.com'},
  33.         ];
  34.  
  35.         el.insertAdjacentHTML('afterBegin', createBlock('Steam Web Tools', links));
  36.  
  37.     }
  38. ,false);
  39.  
  40.  
  41. // block
  42. function createBlock(title, links){
  43.     var out='<div class="block">\
  44. <div class="block_header"><h4>'+title+'</h4></div>\
  45. <div class="block_content"><div class="block_content_inner">';
  46.  
  47.     var link;
  48.     for (var i=0; i < links.length; i++) {
  49.         link = links[i];
  50.         out+='<a class="linkbar" href="'+link.href+'" target="_blank"><div class="rightblock">\
  51. <img src="'+link.icon+'" width="16" height="16" border="0" align="top"></div>'+link.text+'</a>'
  52.     }
  53.  
  54.     out+='</div></div></div>';
  55.  
  56.     return out;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment