Move useless scripts to samples

This commit is contained in:
Evgeny
2024-04-28 21:07:43 +04:00
parent 28e0e9baf5
commit eb118bf32a
6 changed files with 218 additions and 216 deletions

View File

@@ -4,38 +4,40 @@
-- type = "search"
-- lang = "ru"
-- author = "Andrey Gavrilov"
-- version = "1.0"
local num = ""
-- version = "1.1"
function on_search(input)
num = input:match("^n (.+)")
local num = input:match("^(+?7?%d%d%d%d%d%d%d%d%d%d+)$")
if not num then
return
end
search:show({"Оператор "..num})
show_operator(num)
end
function on_click()
local uri = "http://rosreestr.subnets.ru/?get=num&format=json&num=" .. num:gsub("%D", "")
http:get(uri)
return false
end
function on_network_result(result)
function show_operator(num)
local json = require "json"
local t = json.decode(result)
local uri = "http://rosreestr.subnets.ru/?get=num&format=json&num=" .. num:gsub("%D", "")
local tab = {}
local result = shttp:get(uri)
if not result.error then
local t = json.decode(result.body)
if not t.error then
if not t["0"].country then
if not t["0"].moved2operator then
search:show({t["0"].operator, t["0"].region})
table.insert(tab, t["0"].operator)
else
search:show({t["0"].moved2operator, t["0"].region})
table.insert(tab, t["0"].moved2operator)
end
table.insert(tab, t["0"].region)
else
table.insert(tab, t["0"].country)
table.insert(tab, t["0"].description)
end
else
search:show({t["0"].country, t["0"].description})
table.insert(tab, t.error)
end
else
search:show({t.error})
table.insert(tab, result.error)
end
search:show_lines({table.concat(tab, ", ")}, {aio:colors().button})
end

View File

@@ -1,6 +1,6 @@
-- name = "Sudoku"
-- description = "Sudoku games"
-- type = "Game"
-- type = "widget"
-- author = "Andrey Gavrilov"
-- version = "1.0"