Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function url_decode(str)
- str = string.gsub (str, "+", " ")
- str = string.gsub (str, "%%(%x%x)",
- function(h) return string.char(tonumber(h,16)) end)
- str = string.gsub (str, "\r\n", "\n")
- return str
- end
- if form and form:IsValid() then
- form:Remove()
- end
- form=vgui.Create'DFrame'
- form.Paint=function() end
- html=vgui.Create'HTML'
- html:SetParent(form)
- local w=495
- local h=29
- form:SetSize(w,h)
- html:SetSize(w,h)
- form:SetMouseInputEnabled(true)
- form:SetKeyboardInputEnabled(true)
- html:SetMouseInputEnabled(true)
- html:SetKeyboardInputEnabled(true)
- html:RequestFocus()
- html:SetVerticalScrollbarEnabled(false)
- html:SetHTML[[
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <script type="text/javascript">
- var formInUse = false;
- function setFocus()
- {
- if(!formInUse) {
- document.a.b.focus();
- document.body.style.margin = '0';
- document.body.style.padding = '0';
- document.body.style.border = '0';
- document.body.style.background = '#000000';
- document.body.style.overflow = 'hidden';
- }
- }
- </script>
- <STYLE TYPE="text/css">
- body {margin: 0px; padding: 0px; }
- input{width:490px;}
- </STYLE>
- </head>
- <body onload="setFocus()">
- <form name="a" action="http://trap" method="get">
- <input type="text" name="b" size="25"></input>
- </form>
- </body>
- </html>]]
- html.OpeningURL=function(a,b)
- form:Remove()
- --print(a,b)
- b=string.gsub(b,'http%:%/%/trap%/%?b%=','')
- local decoded=url_decode(b)
- --print(decoded,string.byte(decoded),b)
- RunConsoleCommand("say",decoded)
- --print(url_decode("%C3%84"))
- end
- form:MakePopup()
- form:SetPos(5,ScrH()*0.666666)
Advertisement
Add Comment
Please, Sign In to add comment