K-Meleon Lua macros for Shadows
Jan. 12th, 2006 01:07 amShadows is a social bookmarks manager.
In accel.cfg:
In accel.cfg:
%ifplugin luamacros VK_F7 = luamacros(ShadowsTagIt) SHIFT VK_F7 = luamacros(ShadowsShowPage) %endifLua code:
-- Lua macros for Shadows
local function encode2(url)
return string.gsub(url, "([^a-zA-Z0-9_%.%-])", function (s)
return string.format("%%%02X", string.byte(s))
end)
end
local function EE2(str)
return encode2(EncodeUTF8(str))
end
local function GotoNew(hwnd, url)
NavigateTo(url, OPEN_NEW, hwnd)
end
function ShadowsTagIt(hwnd)
local title, url = GetDocInfo(hwnd)
url = url or ""
if title == nil or title == "" then
title = url
end
GotoNew(hwnd, "http://www.shadows.com/features/tcr.htm?url=" .. EE2(url) ..
"&title=" .. EE2(title))
end
function ShadowsShowPage(hwnd)
local title, url = GetDocInfo(hwnd)
url = url or ""
GotoNew(hwnd, "http://www.shadows.com/shadows.aspx?url=" .. EE2(url))
end