K-Meleon

KMeleonWiki > Resources > MacroLibrary > KmmGShared

Submitted by: rstlne



Notes:

Google Shared Stuff is a Google service for sharing links to web pages. This macro is equivalent to the Google Shared Stuff bookmarklet except that it works even if you have your bookmark options set to open bookmarks in a new layer. Invoke the macro from the Document popup menu on the web page you wish to share.




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

gshared.kmm

# gshared.kmm
#
# Macro equivalent for the "Email / Share" bookmarklet from Google Shared
# Stuff. It is the same as the bookmarklet provided by Google, except that the
# macro works even if you have set your bookmark options to open bookmarks in a
# new layer.

gshared_go{
# Temporarily turn off popup blocking.
$__blockpref="dom.disable_open_during_load";
$__b=getpref(BOOL,$__blockpref);
setpref(BOOL,$__blockpref,false);

$__s="(function(){var a=document,b=a.createElement('script'),w=window,g={};";
$__s=$__s."g.altWindow=w.open('','_blank','height=370px,width=720px,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');";
$__s=$__s."setTimeout(function(){g.altWindow.focus()},1000);";
$__s=$__s."function f(o){";
$__s=$__s."try{var d=new google.share.EmailWidget(g);d.display()}";
$__s=$__s."catch(e){if(o>20)return;setTimeout(function(){f(o+1)},o<10?1<<o:1000)}};";
$__s=$__s."b.src='http://www.google.com/s2/sharing/js?script=socialsharing&key=AAAAJ--gdtJYHC_fJptEAHT5Bf1XRhCI6M48Ig6M4CLzvOVLLnmNSTnmZt345-lmRuknqw';";
$__s=$__s."a.body.appendChild(b);f(0)})();";
injectJS($__s);

# Restore popup blocking if it was turned on previously.
setpref(BOOL,$__blockpref,$__b);
}

_gshared_buildmenu{
setmenu(Document,macro,"Share in Google Shared Stuff",gshared_go,-1);
}

$OnInit=$OnInit."_gshared_buildmenu;";
$macroModules=$macroModules."gshared;";

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


Comments & Questions

K-Meleon

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