SearchSource = {} SearchSource.uitable = 'SearchSource.ui' SearchSource.page = [[   

]] function SearchSource:go() local ui = self.ui self:search(ui.searchtext.value) end function SearchSource:match(substring,string,matchcase) local r = false if matchcase == false then substring = string.lower(substring) string = string.lower(string) end if string.find(substring,string) ~= nil then r = true else r = false end return r end function SearchSource:search(text) if self.ui == nil then self:load() end local ui = self.ui local p = scl.listparser:new() local html = scl.stringlist:new() local source = tab.source local hl = '' local matchcase = ui.matchcase.value local found = false if matchcase == '' then matchcase = true end p:load(source) html:add('') if text ~= '' then while p:parsing() do if self:match(p.current,text,matchcase) == true then hl = scop.html.escape(p.current) if matchcase == true then hl = stringop.replace(hl,text,''..text..'') end found = true html:add('') end end end html:add('
'..p.curindex..''..hl..'
') if text ~= '' then if found == false then html:add('Search string not found.') end end browser.bottombar:loadx(self.page..html.text,self.uitable) ui.searchtext.value = text ui.matchcase.value = matchcase html:release() p:release() end function SearchSource:load() browser.bottombar:loadx(self.page,self.uitable) end