Move useless scripts to samples
This commit is contained in:
@@ -4,38 +4,40 @@
|
|||||||
-- type = "search"
|
-- type = "search"
|
||||||
-- lang = "ru"
|
-- lang = "ru"
|
||||||
-- author = "Andrey Gavrilov"
|
-- author = "Andrey Gavrilov"
|
||||||
-- version = "1.0"
|
-- version = "1.1"
|
||||||
|
|
||||||
local num = ""
|
|
||||||
|
|
||||||
function on_search(input)
|
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
|
if not num then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
search:show({"Оператор "..num})
|
show_operator(num)
|
||||||
end
|
end
|
||||||
|
|
||||||
function on_click()
|
function show_operator(num)
|
||||||
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)
|
|
||||||
local json = require "json"
|
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.error then
|
||||||
if not t["0"].country then
|
if not t["0"].country then
|
||||||
if not t["0"].moved2operator then
|
if not t["0"].moved2operator then
|
||||||
search:show({t["0"].operator, t["0"].region})
|
table.insert(tab, t["0"].operator)
|
||||||
else
|
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
|
end
|
||||||
else
|
else
|
||||||
search:show({t["0"].country, t["0"].description})
|
table.insert(tab, t.error)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
search:show({t.error})
|
table.insert(tab, result.error)
|
||||||
end
|
end
|
||||||
|
search:show_lines({table.concat(tab, ", ")}, {aio:colors().button})
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
-- name = "Sudoku"
|
-- name = "Sudoku"
|
||||||
-- description = "Sudoku games"
|
-- description = "Sudoku games"
|
||||||
-- type = "Game"
|
-- type = "widget"
|
||||||
-- author = "Andrey Gavrilov"
|
-- author = "Andrey Gavrilov"
|
||||||
-- version = "1.0"
|
-- version = "1.0"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user