PageInfo = {}
function PageInfo:getobjects_count()
local s = scl.stringlist:new()
s.text = tab.reslist
local c = s.count
s:release()
return c
end
function PageInfo:getobjects(tag)
local list = ''
local line = ''
local src = ''
local urlext = ''
local comburl = ''
local filename = ''
local html = scl.stringlist:new()
local p = scl.listparser:new()
p:load(tab.reslist)
while p:parsing() do
src = p.current
urlext = string.lower(scop.url.getfileext(src))
filename = scop.url.getfilename(src)
if stringop.beginswith(filename,'?') == false then
filename = stringop.before(filename,'?')
end
src = scop.html.escape(src)
if tag == 'option' then
line = ''
if html:indexof(line) == -1 then html:add(line) end
else
if scop.re.match(urlext,'.bmp|.gif|.ico|.jpg|.jpeg|.png|.svg') == true then
line = [[]]
if html:indexof(line) == -1 then html:add(line) end
end
end
end
html:sort()
list = html.text
p:release()
html:release()
return list
end
function PageInfo:requestdone(r)
local ct = scop.http.getheader(r.rcvdheaders,'Content-Type')
local urlext = string.lower(scop.url.getfileext(r.url))
if ct == '' then ct = urlext end
tab:showcodeedit(r.responsetext,ct)
end
function PageInfo:openobject(url)
local ui = self.ui
if url == '' then
url = ui.objlist.value
end
local urlext = string.lower(scop.url.getfileext(url))
if ReqViewer == nil then
Syhunt:dofile('Scripts/ReqViewer.lua')
end
ReqViewer:viewcached(url)
--[[if scop.re.match(urlext,'.bmp|.gif|.ico|.jpg|.jpeg|.png|.svg') == true then
browser.bottombar:loadx('','PageInfo.ui')
else
URLGet:get(url,PageInfo.requestdone)
end ]]
end
function PageInfo:load()
if Sandcat:IsURLLoaded(true) then
local html = Syhunt:getfile('Scripts/PageInfo_Objects.html')
html = stringop.replace(html,'',self:getobjects('option'))
browser.loadpagex('resexplorer',html,'PageInfo.ui')
end
end
function PageInfo:viewimages()
if Sandcat:IsURLLoaded(false) then
local html = Syhunt:getfile('Scripts/PageInfo_Images.html')
html = stringop.replace(html,'',scop.html.escape(tab.url))
html = stringop.replace(html,'',self:getobjects('picture'))
local j = {}
j.title = 'Images'
j.icon = 'url(Syhunt.scx#Images\\icon_image.png)'
j.activepage = 'browser'
if browser.newtabx(j) ~= 0 then
tab:gotourl('about:images',html)
end
end
end