qazarius

sendgift-page.user.js

Dec 11th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name Steam Web Tools Sendgift Page MOD
  3. // @include http://store.steampowered.com/checkout/*
  4. // @include https://store.steampowered.com/checkout/*
  5. // ==/UserScript==
  6.  
  7.  
  8. function init() {
  9.     if(!window.g_bIsGiftForm) return; // only on send gift page
  10.     var divs = document.querySelectorAll('.friend_block.disabled');
  11.     var rbtns = document.querySelectorAll('.friend_block_radio input[disabled]');
  12.     for (var i=0; i < divs.length; i++){
  13.         divs[i].removeClassName('disabled');
  14.         rbtns[i].disabled = false;
  15.     }
  16.    
  17.  
  18.     if(window.location.hash && window.location.hash.substr(1,9)=='multisend'){
  19.         var gifts = window.location.hash.substr(11,window.location.hash.lenght);
  20.         gifts = JSON.parse(decodeURIComponent(gifts))
  21.         var el=document.querySelector('.checkout_tab');
  22.         var gids=[], names=[], str='';
  23.         for(x in gifts){
  24.             gids.push(x);
  25.             names.push(gifts[x]);
  26.             str+='<p>'+gifts[x]+'</p>'
  27.         }
  28.         el.innerHTML='<p><b>Гифты для отправки: '+gids.length+'</b></p>'+str+'';
  29.    
  30.         var curGift = 0;
  31.         window.g_gidGift = gids[0];
  32.        
  33.         var OnSendGiftSuccess_old = window.OnSendGiftSuccess;
  34.         window.OnSendGiftSuccess = function(){
  35.  
  36.             alert('Гифт #'+(curGift+1)+' '+names[curGift]+' отправлен.')
  37.             var r = OnSendGiftSuccess_old.apply(this, arguments);
  38.            
  39.             window.g_gidGift = gids[++curGift];
  40.             window.SendGift();
  41.            
  42.             return r;
  43.         }
  44.    
  45.     }
  46.  
  47.    
  48. }
  49.  
  50.  
  51. var state = window.document.readyState;
  52. if((state == 'interactive')||(state == 'complete')) // for chrome
  53.     init();
  54. else
  55.     window.addEventListener("DOMContentLoaded", init,false); //for opera
Advertisement
Add Comment
Please, Sign In to add comment