This commit is contained in:
Evgeny
2021-08-04 21:33:51 +03:00
parent 259ef63496
commit 5f893021ff
7 changed files with 87 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
-- name = "News"
-- description = "Simple news widget"
-- description = "Simple RSS news widget"
-- data_source = "https://rss-to-json-serverless-api.vercel.app/"
-- type = "widget"
-- author = "Andrey Gavrilov"
@@ -8,7 +8,7 @@
-- settings
local feed = "https://news.yandex.ru/index.rss"
local lines_num = 5
local auto_folding = false
local auto_folding = true
local api_url = "https://rss-to-json-serverless-api.vercel.app/api?feedURL="
local titles = {}
@@ -33,20 +33,18 @@ end
function on_network_result(result)
local t = json.decode(result)
local n = math.min(lines_num, #t.items)
for i = 1, n, 1 do
titles[i] = t.items[i].title
descs[i] = t.items[i].description
urls[i] = t.items[i].url
times[i] = os.date("%d.%m.%Y, %H:%M",t.items[i].created/1000)
end
ui:show_lines(titles)
end
function on_click(i)
url = urls[i]
ui:show_dialog(titles[i].." | "..times[i], descs[i], "Open in browser")
ui:show_dialog(titles[i].." | "..times[i], descs[i], "open in browser")
end
function on_dialog_action(i)