Python1320

Python1320

Jul 29th, 2010
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.84 KB | None | 0 0
  1. function url_decode(str)
  2.   str = string.gsub (str, "+", " ")
  3.   str = string.gsub (str, "%%(%x%x)",
  4.       function(h) return string.char(tonumber(h,16)) end)
  5.   str = string.gsub (str, "\r\n", "\n")
  6.   return str
  7. end
  8.  
  9.  
  10. if form and form:IsValid() then
  11.     form:Remove()
  12. end
  13. form=vgui.Create'DFrame'
  14.  
  15. form.Paint=function() end
  16.  
  17. html=vgui.Create'HTML'
  18. html:SetParent(form)
  19.  
  20. local w=495
  21. local h=29
  22. form:SetSize(w,h)
  23. html:SetSize(w,h)
  24.  
  25.  
  26. form:SetMouseInputEnabled(true)
  27. form:SetKeyboardInputEnabled(true)
  28.  
  29. html:SetMouseInputEnabled(true)
  30. html:SetKeyboardInputEnabled(true)
  31.  
  32. html:RequestFocus()
  33.  
  34. html:SetVerticalScrollbarEnabled(false)
  35. html:SetHTML[[
  36. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  37.  
  38. <html xmlns="http://www.w3.org/1999/xhtml">
  39. <head>
  40.    
  41.  
  42. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  43.     <script type="text/javascript">
  44.  
  45.         var formInUse = false;
  46.  
  47.         function setFocus()
  48.         {
  49.          if(!formInUse) {
  50.          document.a.b.focus();
  51.          document.body.style.margin = '0';
  52.             document.body.style.padding = '0';
  53.             document.body.style.border = '0';
  54.             document.body.style.background = '#000000';
  55.             document.body.style.overflow = 'hidden';
  56.          }
  57.         }
  58.  
  59.     </script>
  60.    
  61.     <STYLE TYPE="text/css">
  62.         body {margin: 0px; padding: 0px; }
  63.         input{width:490px;}
  64.     </STYLE>
  65.  
  66.  
  67.    
  68. </head>
  69.  
  70. <body onload="setFocus()">
  71.  
  72.     <form name="a" action="http://trap" method="get">
  73.         <input type="text" name="b" size="25"></input>
  74.     </form>
  75.  
  76. </body>
  77. </html>]]
  78.  
  79. html.OpeningURL=function(a,b)
  80.     form:Remove()
  81.     --print(a,b)
  82.     b=string.gsub(b,'http%:%/%/trap%/%?b%=','')
  83.    
  84.     local decoded=url_decode(b)
  85.     --print(decoded,string.byte(decoded),b)
  86.     RunConsoleCommand("say",decoded)
  87.     --print(url_decode("%C3%84"))
  88. end
  89.  
  90. form:MakePopup()
  91. form:SetPos(5,ScrH()*0.666666)
Advertisement
Add Comment
Please, Sign In to add comment