In accel.cfg:
# --- del.icio.us hotkeys --- %ifplugin luamacros VK_F12 = luamacros(Delicious) SHIFT VK_F12 = luamacros(SetDelicious) VK_F10 = luamacros(BugMeNot) %endif # --- End del.icio.us hotkeys ---In macros.lua:
require "copyaslink" require "google" require "multiclip" require "groups" require "search" require "search_add" require "delicious"In delicious.lua:
-- Lua Macros for bookmarking a page with del.icio.us
local depref = "kmeleon.general.deliciousUser"
local function EE(str)
return encode(EncodeUTF8(str))
end
local function GotoNew(hwnd, url)
NavigateTo(url, OPEN_NEW, hwnd)
end
function SetDelicious(hwnd)
local username = prompt(hwnd, "Set del.icio.us username to: ",
"del.icio.us setup") or ""
if username ~= "" then
setpref(TYPE_STRING, depref, username)
end
return username
end
local function RunDelicious(hwnd, username)
local title, url = GetDocInfo(hwnd)
url = url or ""
if title == nil or title == "" then
title = url
end
GotoNew(hwnd, "http://del.icio.us/" .. EE(username) ..
"?v=3&jump=bookmarks&url=" .. EE(url) .. "&title=" .. EE(title))
end
function Delicious(hwnd)
local username = getpref(TYPE_STRING, depref) or ""
if username == "" then
username = SetDelicious(hwnd)
end
if username ~= "" then
RunDelicious(hwnd, username)
end
end
-- Lua macro for BugMeNot
function BugMeNot(hwnd)
local title, url = GetDocInfo(hwnd)
url = url or ""
GotoNew(hwnd, "http://www.bugmenot.com/view.php?url=" .. EE(url))
end