K-Meleon

KMeleonWiki > Resources > MacroLibrary > KmmTinyURL

Submitted by: rstlne



Notes:

Generate a short URL from a page or link using TinyURL. To invoke, use the TinyURL command in the document or link popup menus.

This macro is similar to the bookmarklet provided by TinyURL. The difference is the macro works even if you've set your bookmark options so that bookmarks open in a new layer. That setting breaks the bookmarklet.




Open your User Macro Folder (Edit > Configuration > User-Defined Macros) or your Macro Folder (Edit > Configuration > Macros) and create the following text file(s):

tinyurl.kmm

# tinyurl.kmm
#
# Macros for generating a short URL from a page or link using TinyURL.

_tinyurl{
$OpenURL="http://tinyurl.com/create.php?url=".$_tinyurl_url;
&OpenURL_InNew;
}

tinyurl_page{
menugrayed=(hostname($URL)=="");
$_tinyurl_url=$URL; &_tinyurl;
}

tinyurl_link{
$_tinyurl_url=$LinkURL; &_tinyurl;
}

_tinyurl_buildmenu{
setmenu(Document,macro,"TinyURL of page",tinyurl_page,-1);
setmenu(LinkPopup,macro,"TinyURL of link",tinyurl_link,-1);
setmenu(FrameLinkPopup,macro,"TinyURL of link",tinyurl_link,-1);
}

$OnInit=$OnInit."_tinyurl_buildmenu;";
$macroModules=$macroModules."tinyurl;";

# vim:set tw=0:
# -- The End --


Comments & Questions

K-Meleon

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