K-Meleon

KMeleonWiki > Resources > MacroLibrary > MacroLibrary2 > Shadows luamacros

Submitted by: rstlne



Notes:

Macros for posting a bookmark and viewing the shadow page for a bookmark at Shadows, a social bookmarks manager. In the bookmarks posting macro, the title and url are taken from the current page and the form for posting to Shadows will open up in a new window, tab, or layer. In the shadow page viewing macro, a new window, tab, or layer will open up to the shadow page for the current url.

The luamacros plugin is required. This plugin can be found in K-MeleonCCF 0.04 Beta 3 or K-MeleonCCF ME 0.049 and later.


Save as shadows.lua:

-- 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


In macros.lua:

require "copyaslink"
require "google"
require "multiclip"
require "groups"
require "search"
require "search_add"
require "shadows"


In Menus:

View Page{
 :View Page Info
 macros(URLInIE, View Page In IE)
 macros(ietab, View Page In IE engine)
 #!cyberarticle
 macros(GoogleCache, View Google cache of page)
 %ifplugin luamacros
 -
 luamacros(ShadowsTagIt, Tag this page in Shadows)
 luamacros(ShadowsShowPage, Show shadow page)
 %endif
}


Comments & Questions

K-Meleon

(c) 2000-2010 kmeleonbrowser.org. All rights reserved.
design by splif.