update
This commit is contained in:
@@ -131,11 +131,11 @@ AIO Launcher включает в себя интерпретатор LuaJ 3.0.1
|
|||||||
* `get_index(table, value)` - возвращает индекс элемента таблицы;
|
* `get_index(table, value)` - возвращает индекс элемента таблицы;
|
||||||
* `get_key(table, value)` - возвращает ключ элемента таблицы;
|
* `get_key(table, value)` - возвращает ключ элемента таблицы;
|
||||||
* `round(x, n)` - округляет число;
|
* `round(x, n)` - округляет число;
|
||||||
* `md_colors` - таблица цветов Material Design (исходник есть в этом репозитории, [справка](https://materialui.co/colors));
|
|
||||||
|
|
||||||
В комплект также входят:
|
В комплект также входят:
|
||||||
|
|
||||||
* url - функции для кодирования/декодирования строки в URL из библиотеки Lua Penlight;
|
* `md_colors` - модуль-таблица цветов Material Design (исходник есть в этом репозитории, [справка](https://materialui.co/colors));
|
||||||
|
* `url` - модуль с функциями для кодирования/декодирования строки в URL из библиотеки Lua Penlight;
|
||||||
* [luaDate](https://github.com/Tieske/date) - функции для работы со временем;
|
* [luaDate](https://github.com/Tieske/date) - функции для работы со временем;
|
||||||
* [json.lua](https://github.com/rxi/json.lua) - парзер JSON;
|
* [json.lua](https://github.com/rxi/json.lua) - парзер JSON;
|
||||||
* [SLAXDOM](https://github.com/Phrogz/SLAXML) - парзер XML;
|
* [SLAXDOM](https://github.com/Phrogz/SLAXML) - парзер XML;
|
||||||
|
|||||||
@@ -293,3 +293,5 @@ md_colors = {
|
|||||||
blue_grey_800="#37474F",
|
blue_grey_800="#37474F",
|
||||||
blue_grey_900="#263238",
|
blue_grey_900="#263238",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return md_colors
|
||||||
|
|||||||
51
lib/url.lua
Normal file
51
lib/url.lua
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
--- Python-style URL quoting library.
|
||||||
|
--
|
||||||
|
-- @module pl.url
|
||||||
|
|
||||||
|
local url = {}
|
||||||
|
|
||||||
|
local function quote_char(c)
|
||||||
|
return string.format("%%%02X", string.byte(c))
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Quote the url, replacing special characters using the '%xx' escape.
|
||||||
|
-- @string s the string
|
||||||
|
-- @bool quote_plus Also escape slashes and replace spaces by plus signs.
|
||||||
|
-- @return The quoted string, or if `s` wasn't a string, just plain unaltered `s`.
|
||||||
|
function url.quote(s, quote_plus)
|
||||||
|
if type(s) ~= "string" then
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
|
||||||
|
s = s:gsub("\n", "\r\n")
|
||||||
|
s = s:gsub("([^A-Za-z0-9 %-_%./])", quote_char)
|
||||||
|
if quote_plus then
|
||||||
|
s = s:gsub(" ", "+")
|
||||||
|
s = s:gsub("/", quote_char)
|
||||||
|
else
|
||||||
|
s = s:gsub(" ", "%%20")
|
||||||
|
end
|
||||||
|
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
|
||||||
|
local function unquote_char(h)
|
||||||
|
return string.char(tonumber(h, 16))
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Unquote the url, replacing '%xx' escapes and plus signs.
|
||||||
|
-- @string s the string
|
||||||
|
-- @return The unquoted string, or if `s` wasn't a string, just plain unaltered `s`.
|
||||||
|
function url.unquote(s)
|
||||||
|
if type(s) ~= "string" then
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
|
||||||
|
s = s:gsub("+", " ")
|
||||||
|
s = s:gsub("%%(%x%x)", unquote_char)
|
||||||
|
s = s:gsub("\r\n", "\n")
|
||||||
|
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
|
||||||
|
return url
|
||||||
@@ -4,6 +4,8 @@
|
|||||||
-- author = "Evgeny Zobnin (zobnin@gmail.com)"
|
-- author = "Evgeny Zobnin (zobnin@gmail.com)"
|
||||||
-- version = "1.0"
|
-- version = "1.0"
|
||||||
|
|
||||||
|
md_colors = require "md_colors"
|
||||||
|
|
||||||
function on_resume()
|
function on_resume()
|
||||||
actions_names = { "Drawer", "Search", "Notify", "Menu" }
|
actions_names = { "Drawer", "Search", "Notify", "Menu" }
|
||||||
actions_colors = { md_colors.purple_800, md_colors.purple_600, md_colors.purple_400, md_colors.purple_300 }
|
actions_colors = { md_colors.purple_800, md_colors.purple_600, md_colors.purple_400, md_colors.purple_300 }
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
md_colors = require "md_colors"
|
||||||
|
|
||||||
function on_resume()
|
function on_resume()
|
||||||
apps_names = { "Telegram", "WhatsApp", "Google PLay" }
|
apps_names = { "Telegram", "WhatsApp", "Google PLay" }
|
||||||
apps_pkgs = { "org.telegram.messenger.web", "com.whatsapp", "com.android.vending" }
|
apps_pkgs = { "org.telegram.messenger.web", "com.whatsapp", "com.android.vending" }
|
||||||
|
|||||||
Reference in New Issue
Block a user