K-Meleon

KMeleonWiki > Resources > MacroLibrary > KmmGApplication

Original code by: Thanh Vu (baysao»gmail)
Submitted by: desga2



Notes:

In Firefox, there is sidebar that could use to display useful information. I was hearing in there, people using Google applications (Google Notebook, Gtalk, GReader, GMail, GDocument, GCalendar...) which has built for mobile application to display in sidebar. In K-Meleon, in this moment sidebar isn't, i think about using javascripts to popup small windows to view page contents. That is very similar sidebar in firefox.
You can make new post for blogging with Blogger and you can translate selected text or page with Google Translate to any language that Google is supported.
Macros make google applications more usefuls.
To use this macro, you have to turn off function Popup blocker or add exceptions rule to popup except www.google.com address.


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

GApplication.kmm

# K-Meleon Macros 

(http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

# ---------- Only Youtube videos without JS ----------------------------
#
# Dependencies        :  -
# Resources        : -
# Preferences        : -
#
# ----------------------------------------------------------------------

$_blogger_conf="kmeleon.general.bloggerID";
$_domain_conf="kmeleon.general.GoogleDomainID";

GNote{
   injectJS("window.open(\"http://www.google.com/notebook/ig?hl=__MSG_locale__\",\"popFrameless\",\"scrollbars,width=214,height=398\");");
}
GCalEvent{
  injectJS("window.open(\"http://www.google.com/calendar/m\",\"popFrameless\",\"scrollbars,width=214,height=398\");");
}
GBookmarks{
  menugrayed=(hostname($URL)=="");
  $__title=$TITLE==""?$URL:$TITLE;
  $OpenURL="http://www.google.com/bookmarks/mark?op=add&bkmk=";
  $OpenURL=$OpenURL.$URL;
  $OpenURL=$OpenURL."&title=".$__title;
  $link="window.open('";
  $link=$link.$OpenURL;
  $link=$link."','popFrameless','scrollbars,width=750,height=398')";
  injectJS($link);
}
GgTranslate{
  $OpenURL="http://translate.google.com/translate_t?langpair=en%7Cru";
  $link="window.open('";
  $link=$link.$OpenURL;
  $link=$link."','popFrameless','scrollbars,width=750,height=398')";
  injectJS($link);
}
GCal{
  injectJS("window.open(\"http://www.google.com/calendar/gadget?up_showAgenda=false&upt_showAgenda=hidden&up_calendarFeeds=(%7B%7D)&upt_calendarFeeds=hidden&up_firstDay=0&upt_firstDay=enum&up_dateFormat=0&upt_dateFormat=enum&up_timeFormat=1:00pm&upt_timeFormat=enum&up_calendarFeedsImported=0&upt_calendarFeedsImported=hidden&up_showCalendar2=1&upt_showCalendar2=bool&lang=en&country=us&.lang=en&.country=us&synd=ig&mid=0&parent=&libs=9yKJTwdwCZw/lib/libcore.js,DXEULJSfpLM/lib/libdynamic-height.js,c64nWSZKWFg/lib/libsetprefs.js\",\"popFrameless\",\"scrollbars,width=214,height=398\");");
}

GTalk{
  injectJS("window.open(\"http://talkgadget.google.com/talkgadget/client\",\"popFrameless\",\"scrollbars,width=214,height=398\");");
}
Gmail{
  $__domainid=getpref(STRING, $_domain_conf);
  $__domainid=="" ?&Gmail_domain_set : "";
  $__domainid=="" ? "":&Gmail_compose;
  }
GMail_compose{
#  $__domainid=getpref(STRING, $_domain_conf)
#  $__domainid=""?"":"a/".$__domainid;
#  $__domainid="";
  $link="popw='';Q='';x=document;y=window;if(x.selection) {Q=x.selection.createRange().text;} else if (y.getSelection) {Q=y.getSelection();} else if (x.getSelection) {Q=x.getSelection();}popw = y.open (' https://mail.google.com/";
  $link=$link.$__domainid;
  $link=$link."mail/?view=cm&tf=0&to=&su=' ,'gmailForm','scrollbars=yes,width=680,height=510,top=175,left=75,status=no,resizable=yes');if (!document.all) T = setTimeout(' popw.focus()',50);void(0);";
      injectJS($link);
}

Gmail_domain_set{
$__domainid=prompt("Set your Gmail Domain: ", "Gmail Domain setup");
$__domainid=="" ? "" : setpref(STRING, $_domain_conf, $__domainid);
}

Gmail_mailList{
  injectJS("window.open(\"http://m.gmail.com\",\"popFrameless\",\"scrollbars,width=214,height=398\");");
}
GDocs{
  injectJS("window.open(\"http://docs.google.com/m\",\"popFrameless\",\"scrollbars,width=214,height=398\");");
}
GReader{
  injectJS("window.open(\"http://www.google.com/reader/m/view\",\"popFrameless\",\"scrollbars,width=214,height=398\");");
}
Blogger{
$__userid=getpref(STRING, $_blogger_conf);
$__userid=="" ? &Blogger_set : "";
$__userid=="" ? "" : &Blogger_run;
}

Blogger_run{
   $OpenURL="http://www.blogger.com/post-create.g?blogID=".$__userid;
   $link="window.open('";
   $link=$link.$OpenURL;
   $link=$link."','popFrameless','scrollbars,width=750,height=398')";
   injectJS($link);
}

Blogger_set{
$__userid=prompt("Set your blog ID: ", "Blogger setup");
$__userid=="" ? "" : setpref(STRING, $_blogger_conf, $__userid);
}


GTranslate_ru{
  $lang="ru";&GTranslate;
}
GTranslate_en{
  $lang="en";&GTranslate;
}
GTranslate_fr{
  $lang="fr";&GTranslate;
}
GTranslate_es{
  $lang="es";&GTranslate;
}
GTranslate_pt{
  $lang="pt";&GTranslate;
}
GTranslate_de{
  $lang="de";&GTranslate;
}
GTranslate_nl{
  $lang="nl";&GTranslate;
}
GTranslate_it{
  $lang="it";&GTranslate;
}
GTranslate_el{
  $lang="el";&GTranslate;
}
GTranslate_ko{
  $lang="ko";&GTranslate;
}
GTranslate_ja{
  $lang="ja";&GTranslate;
}
GTranslate_zh{
  $lang="zh";&GTranslate;
}
GTranslate_zt{
  $lang="zt";&GTranslate;
}

GTranslate_other{
  $lang=prompt("Two-letter target language code:","Language code","vi");&GTranslate;
}
GTranslate{
  $lang="&langpair=auto|".$lang;
  $link="var t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));var e=(document.charset||document.characterSet);if(t!=''){window.open('http://translate.google.com/translate_t?text='+t+'&hl=en";
  $link=$link.$lang;
  $link=$link."&tbb=1&ie='+e,'popFrameless','scrollbars,width=750,height=398');}else{window.open('http://translate.google.com/translate?u='+escape(location.href)+'&hl=en";
  $link=$link.$lang;
  $link=$link."&tbb=1&ie='+e,'popFrameless','scrollbars,width=750,height=398');};";
  injectJS($link);
}

# ----- PRIVATE
$Gpopup_menu="&Google Application";
$g_selection="Google &Translate to";
$g_mail="Google &Mail";
$g_blog="Google &Blogger";
$g_selection_link="Google &Translate to";

_GPopup_BuildMenu{
  setmenu($Gpopup_menu,macro,"Google &Notebook",GNote);
  setmenu($Gpopup_menu,macro,"Google Calendar &QuickEvent",GCalEvent);
  setmenu($Gpopup_menu,macro,"Google &Calendar",GCal);
  setmenu($Gpopup_menu,macro,"Google &Talk",GTalk);
  setmenu($g_mail,macro,"Google &Domain set",Gmail_domain_set);
  setmenu($g_mail,macro,"Google &Mail compose",GMail_compose);
  setmenu($g_mail,macro,"Google &Mail list",Gmail_mailList);

  setmenu($Gpopup_menu,macro,"Google &Document",GDocs);
  setmenu($Gpopup_menu,macro,"Google &Reader",GReader);
  setmenu($g_blog,macro,"Set &ID Blogger",Blogger_set);
  setmenu($g_blog,macro,"Google &Blogger",Blogger);
  setmenu($Gpopup_menu,macro,"Google &Translate",GgTranslate);
  setmenu(Document,macro,"add Google &Bookmark",GBookmarks);

## google translate
  setmenu($g_selection,macro,"&English", GTranslate_en);
  setmenu($g_selection,macro,"&French", GTranslate_fr);
  setmenu($g_selection,macro,"&Russian", GTranslate_ru);
  setmenu($g_selection,macro,"&Spanish", GTranslate_es);
  setmenu($g_selection,macro,"&Portuguese", GTranslate_pt);
  setmenu($g_selection,macro,"&German", GTranslate_de);
  setmenu($g_selection,macro,"&Dutch", GTranslate_nl);
  setmenu($g_selection,macro,"&Italian", GTranslate_it);
  setmenu($g_selection,macro,"Gr&eek", GTranslate_el);
  setmenu($g_selection,macro,"&Korean", GTranslate_ko);
  setmenu($g_selection,macro,"&Japanese", GTranslate_ja);
  setmenu($g_selection,macro,"&Chinese (Traditional)", GTranslate_zt);
  setmenu($g_selection,macro,"Chi&nese (Simplified)", GTranslate_zh);
  setmenu($g_selection,macro,"(&Specify Language)...",GTranslate_other);
## end google translate

  setmenu($Gpopup_menu,popup,$g_selection);
  setmenu($Gpopup_menu,popup,$g_mail);
  setmenu($Gpopup_menu,popup,$g_blog);
  setmenu(Selection,popup,$g_selection);
#  setmenu(LinkSave,popup,$g_selection);
#  setmenu(Document,popup,$Gpopup_menu);
  setmenu(WebServices,popup,$Gpopup_menu);
}
_GPopup_BuildAccel{
  setaccel("CTRL ALT N","macros(GNote)");
  setaccel("CTRL ALT Q","macros(GCalEvent)");
  setaccel("CTRL ALT C","macros(GCal)");
  setaccel("CTRL ALT T","macros(GTalk)");
  setaccel("CTRL ALT S","macros(GgTranslate)");
  setaccel("CTRL ALT M","macros(GMail)");
  setaccel("CTRL ALT D","macros(GDocs)");
  setaccel("CTRL ALT R","macros(GReader)");
  setaccel("CTRL ALT B","macros(Blogger)");
  setaccel("CTRL ALT Y","macros(GMail_compose)");
}
$OnInit=$OnInit."_GPopup_BuildMenu;_GPopup_BuildAccel;";

# ------------------------------------------------------------------------------------------------------------------
$macroModules=$macroModules."GApplication;";


Comments & Questions

K-Meleon

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