minify + fix lzwfs ui bug
This commit is contained in:
@@ -38,7 +38,7 @@ local tab = UI.Tab {
|
||||
disableHeader = true,
|
||||
columns = { { key = 'value' } },
|
||||
autospace = true,
|
||||
sortColumn = 'index',
|
||||
sortColumn = 'value',
|
||||
help = 'double-click to remove',
|
||||
accelerators = {
|
||||
delete = 'remove',
|
||||
@@ -54,8 +54,8 @@ local tab = UI.Tab {
|
||||
|
||||
function tab:enable()
|
||||
self.grid.values = { }
|
||||
for k,v in ipairs(config.filters or { }) do
|
||||
table.insert(self.grid.values, { index = k, value = v })
|
||||
for _,v in ipairs(config.filters or { }) do
|
||||
table.insert(self.grid.values, { value = v })
|
||||
end
|
||||
self.grid:update()
|
||||
UI.Tab.enable(self)
|
||||
@@ -68,7 +68,6 @@ local function rewriteFiles(p)
|
||||
end
|
||||
else
|
||||
local function recurse(path)
|
||||
_G._syslog('rewriting: ' .. path)
|
||||
if fs.isDir(path) then
|
||||
for _, v in pairs(fs.listEx(path)) do
|
||||
if not v.isReadOnly then
|
||||
@@ -88,7 +87,6 @@ end
|
||||
function tab:eventHandler(event)
|
||||
if event.type == 'add_path' then
|
||||
table.insert(self.grid.values, {
|
||||
index = #self.grid.values + 1,
|
||||
value = self.entry.value,
|
||||
})
|
||||
self.entry:reset()
|
||||
@@ -100,7 +98,7 @@ function tab:eventHandler(event)
|
||||
elseif event.type == 'grid_select' or event.type == 'remove' then
|
||||
local selected = self.grid:getSelected()
|
||||
if selected then
|
||||
table.remove(self.grid.values, selected.index)
|
||||
Util.removeByValue(self.grid.values, selected)
|
||||
self.grid:update()
|
||||
self.grid:draw()
|
||||
end
|
||||
|
||||
6
minify/.package
Normal file
6
minify/.package
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
title = 'Lua minification',
|
||||
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/minify',
|
||||
description = [[ Minifies Lua files ]],
|
||||
license = 'MIT',
|
||||
}
|
||||
2949
minify/minify.lua
Normal file
2949
minify/minify.lua
Normal file
File diff suppressed because it is too large
Load Diff
25
minify/minifyDir.lua
Normal file
25
minify/minifyDir.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
local fs = _G.fs
|
||||
local shell = _ENV.shell
|
||||
|
||||
local function recurse(path)
|
||||
if fs.isDir(path) then
|
||||
for _, v in pairs(fs.listEx(path)) do
|
||||
if not v.isReadOnly then
|
||||
recurse(fs.combine(path, v.name))
|
||||
end
|
||||
end
|
||||
elseif path:match('%.lua$') and not fs.isReadOnly(path) then
|
||||
local sz = fs.getSize(path)
|
||||
shell.run('packages/minify/minify.lua minify ' .. path)
|
||||
print(string.format('%s : %.2f%%', path, (sz - fs.getSize(path)) / sz * 100))
|
||||
end
|
||||
end
|
||||
|
||||
local path = ({ ... })[1] or error('Syntax: minifyDir PATH')
|
||||
|
||||
path = fs.combine(path, '')
|
||||
if not fs.isDir(path) then
|
||||
error('Invalid path')
|
||||
end
|
||||
|
||||
recurse(path)
|
||||
@@ -13,6 +13,7 @@
|
||||
[ 'milo' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/milo/.package',
|
||||
[ 'miloApps' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/miloApps/.package',
|
||||
[ 'miners' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/miners/.package',
|
||||
[ 'minify' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/minify/.package',
|
||||
[ 'monitor' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/monitor/.package',
|
||||
[ 'neural' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/neural/.package',
|
||||
-- [ 'pickup' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/pickup/.package',
|
||||
|
||||
Reference in New Issue
Block a user