Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if SERVER then
- local function XMLToTable(xml)
- if !gxml then require'gxml' end
- if !gxml then error'no gxml found!' end
- local h = gxml.simpleTreeHandler()
- local x = gxml.xmlParser(h)
- x:parse(xml)
- return h.root
- end
- http.Get([[http://feeds.feedburner.com/failblog]],'',function(a,b)
- XML=XMLToTable(a)
- for num,xml in RandomPairs(XML.rss.channel.item) do
- local content=xml['media:content']
- content=content and content[2]
- content=content and content._attr
- content=content and content.url
- if content then
- umsg.Start('LOL')
- umsg.String(content)
- umsg.End()
- return
- end
- end
- end)
- return
- end
- usermessage.Hook('LOL',function(umsg)
- local content=tostring(umsg:ReadString())
- if content then
- local HTML=[[
- <!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" /></head>
- <style type="text/css">
- body { padding: 0; margin: 0; }
- </style>
- <body>
- <img src="]]..content..[[" height="1024" width="1024" />
- </body>
- </html>]]
- Browser:SetHTML(HTML)
- end
- end)
- local ENT=Entity(95)
- ENT.Width = 500
- ENT.Height = 350
- ENT.Scale = 0.5
- local vector_origin=vector_origin
- function ENT:Draw3D2D(wide,tall)
- if not self.BrowserMat then return end
- render.SetMaterial(self.BrowserMat)
- local x,y=self.Width/2,self.Height/2
- render.DrawQuad(
- Vector(x,y,0),
- Vector(x+self.Width, y, 0),
- Vector(x+self.Width, y+self.Height, 0),
- Vector(x, self.Height+y, 0))
- --[[ Ugh, draw order :(. Let's use 3d2d then.
- local r=self:GetRight()
- local u=self:GetUp()
- local f=self:GetForward()
- local wide=self.Width
- local tall=self.Height
- local p=self:GetPos()+u*tall/2+r*((wide/2))
- render.DrawQuad(
- p,
- p-r*wide,
- p-r*wide-u*tall,
- p-u*tall)--]]
- --[[
- 22:52 - Python132O: Don't draw them in 3d2d (HUGE leak) <- Does that also apply if you're using 3d2d and do render.DrawQuad with the html material?
- 22:53 - AzuiSleet: "Also, does anyone know why a large number of Lua MD5 mismatches occur (Even with default addons removed)"
- 22:53 - AzuiSleet: "using 3d2d and do render.DrawQuad with the html materia"
- AzuiSleet is now Offline.
- ]]
- end
- function ENT:OnThink()
- self.BrowserMat = Browser and Browser:GetHTMLMaterial()
- self:NextThink(CurTime() + 1)
- end
- if Browser and Browser:IsValid() then
- Browser:Remove()
- end
- Browser = vgui.Create("HTML")
- Browser:SetMouseInputEnabled(false)
- Browser:SetSize(1024, 1024)
- Browser:SetPaintedManually(true)
- Browser:SetVerticalScrollbarEnabled(false)
- Browser:OpenURL[[http://bing.com]]
Advertisement
Add Comment
Please, Sign In to add comment