mirror of https://github.com/lcpz/lain.git
Merge branch 'master' of https://github.com/lcpz/lain
This commit is contained in:
commit
f2d7b7c684
|
@ -17,7 +17,6 @@ local tconcat = table.concat
|
||||||
local type = type
|
local type = type
|
||||||
local tonumber = tonumber
|
local tonumber = tonumber
|
||||||
local tostring = tostring
|
local tostring = tostring
|
||||||
local utf8 = utf8
|
|
||||||
|
|
||||||
-- Calendar notification
|
-- Calendar notification
|
||||||
-- lain.widget.cal
|
-- lain.widget.cal
|
||||||
|
@ -61,7 +60,9 @@ local function factory(args)
|
||||||
local d = os.date("*t", t)
|
local d = os.date("*t", t)
|
||||||
local mth_days, st_day, this_month = d.day, (d.wday-d.day-cal.week_start+1)%7, os.date("%B %Y", t)
|
local mth_days, st_day, this_month = d.day, (d.wday-d.day-cal.week_start+1)%7, os.date("%B %Y", t)
|
||||||
local notifytable = { [1] = string.format("%s%s\n", string.rep(" ", floor((28 - this_month:len())/2)), markup.bold(this_month)) }
|
local notifytable = { [1] = string.format("%s%s\n", string.rep(" ", floor((28 - this_month:len())/2)), markup.bold(this_month)) }
|
||||||
for x = 0,6 do notifytable[#notifytable+1] = os.date("%a", os.time { year=2006, month=1, day=x+cal.week_start }):sub(1, utf8.offset(1, 3)) .. " " end
|
for day_num = 0, 6 do
|
||||||
|
notifytable[#notifytable+1] = string.format("%3s ", os.date("%a", os.time { year = 2006, month = 1, day = day_num + cal.week_start }))
|
||||||
|
end
|
||||||
notifytable[#notifytable] = string.format("%s\n%s", notifytable[#notifytable]:sub(1, -2), string.rep(" ", st_day*4))
|
notifytable[#notifytable] = string.format("%s\n%s", notifytable[#notifytable]:sub(1, -2), string.rep(" ", st_day*4))
|
||||||
local strx
|
local strx
|
||||||
for x = 1,mth_days do
|
for x = 1,mth_days do
|
||||||
|
|
|
@ -94,7 +94,7 @@ local function factory(args)
|
||||||
|
|
||||||
if not err and type(weather_now) == "table" and tonumber(weather_now["cod"]) == 200 then
|
if not err and type(weather_now) == "table" and tonumber(weather_now["cod"]) == 200 then
|
||||||
weather.notification_text = ""
|
weather.notification_text = ""
|
||||||
for i = 1, weather_now["cnt"], weather_now["cnt"]//cnt do
|
for i = 1, weather_now["cnt"], math.floor(weather_now["cnt"] / cnt) do
|
||||||
weather.notification_text = weather.notification_text ..
|
weather.notification_text = weather.notification_text ..
|
||||||
notification_text_fun(weather_now["list"][i])
|
notification_text_fun(weather_now["list"][i])
|
||||||
if i < weather_now["cnt"] then
|
if i < weather_now["cnt"] then
|
||||||
|
|
Loading…
Reference in New Issue