Main Page: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
Wuma (talk | contribs)
add emoticons at the end of the text
Line 1: Line 1:
__NOTOC__
// Based on the original emoticonsforblogger by Kuribo (http://www.kuribo.info/2006/04/emoticons-for-blogger.html)
'''GreaseSpot''' is community documentation for [[user script]]ing with [[Greasemonkey]]. Please [[GreaseSpot:Editor portal|contribute]].
// Modified by Wolverinex02 (http://wolverinex02.blogspot.com/) and Wuma http://wuma-wuma.blogspot.com/


== Getting Started ==
// FEATURES
Before writing a script or posting to the [[mailing list]] for help, '''every''' script writer should read Mark Pilgrim's [http://www.oreillynet.com/lpt/a/6257 Avoid Common Pitfalls in Greasemonkey].
// Works only in Compose modes
// Add the emoticons at the end of the text


* [[Greasemonkey Manual]]
// TODO
* [[Tutorials]]
// modify the script to insert the emoticon directly after the cursor
* [[Mailing list]]


== Scripting References ==
// ==UserScript==
// @name          Emoticons for Blogger
// @namespace      http://www.kuribo.info/
// @description    You can use emoticons in Blogger.
// @include        http://*.blogger.com/post-edit.g?*
// @include        http://*.blogger.com/post-create.g?*
// ==/UserScript==


* [[API reference]]
window.addEventListener("load", function(e) {
* [[Metadata block]]
* [[:Category:Scripting context|Scripting context]]
** [[Sandbox]]
** [[Global object]]
** [[XPCNativeWrapper]]
** [[Scriptable content]]
** [[DOMContentLoaded]]
* [[Security]]
** [[unsafeWindow]]


== Authoring Tips ==
* [[Useful Tools for Script Writers]]
* [[Troubleshooting]]
* [[0.7.20080121.0+ compatibility]]: Working around errors introduced by changes in Greasemonkey 0.7.20080121.0
* [[Code snippets]]: useful staple functions.
* [[Coding tips]]: things you might not have thought of.
* [[HTML injection tips]]: how to add your html anywhere, dodging page CSS invading yours
* [[:Category:Site-specific tips|Site-specific tips]]
** [[:Category:Ajax site tips|Ajax site tips]]
* [[Security tips]]
* [[Etiquette]]
* [[Cross-browser userscripting]]


== Extension Development ==
function setemoticons(domname)
{
var editbar = document.getElementById(domname);
  if (editbar) {


* [http://greasemonkey.devjavu.com/projects/greasemonkey/wiki/ContributeToGreasemonkey Contributing to Greasemonkey ]
    var buttons = "<br />";
buttons += emoticonButton("kawaiicloud", "http://martina.zancan.googlepages.com/kawaiicloud.gif");
buttons += emoticonButton("razzcloud", "http://martina.zancan.googlepages.com/razzcloud.gif");
buttons += emoticonButton("laughcloud", "http://martina.zancan.googlepages.com/laughcloud.gif");
buttons += emoticonButton("gaspcloud", "http://martina.zancan.googlepages.com/gaspcloud.gif");
buttons += emoticonButton("jawdrop", "http://martina.zancan.googlepages.com/jawdrop.gif");
buttons += emoticonButton("lolcloud", "http://martina.zancan.googlepages.com/lolcloud.gif");
        buttons += emoticonButton("angry", "http://martina.zancan.googlepages.com/angry.gif");
        buttons += emoticonButton("angrycloud", "http://martina.zancan.googlepages.com/angrycloud.gif");
        buttons += emoticonButton("argh", "http://martina.zancan.googlepages.com/argh.gif");     
        buttons += emoticonButton("arghcloud", "http://martina.zancan.googlepages.com/arghcloud.gif");
        buttons += emoticonButton("arghcookies", "http://martina.zancan.googlepages.com/arghcookies.gif");
        buttons += emoticonButton("befuddled", "http://martina.zancan.googlepages.com/angry.gif");
        buttons += emoticonButton("befuddledcloud", "http://martina.zancan.googlepages.com/befuddledcloud.gif");
        buttons += emoticonButton("biggrin", "http://martina.zancan.googlepages.com/biggrin.gif");
        buttons += emoticonButton("biggrincloud", "http://martina.zancan.googlepages.com/biggrincloud.gif");
        buttons += emoticonButton("biggrincookies", "http://martina.zancan.googlepages.com/biggrincookies.gif");
        buttons += emoticonButton("blushcloud", "http://martina.zancan.googlepages.com/blushcloud.gif");       
        buttons += emoticonButton("blushcookies", "http://martina.zancan.googlepages.com/blushcookies.gif");       
        buttons += emoticonButton("cry", "http://martina.zancan.googlepages.com/cry.gif");
        buttons += emoticonButton("crycloud", "http://martina.zancan.googlepages.com/crycloud.gif");
        buttons += emoticonButton("crycookies", "http://martina.zancan.googlepages.com/crycookies.gif");
        buttons += emoticonButton("dead", "http://martina.zancan.googlepages.com/dead.gif");
        buttons += emoticonButton("deadcloud", "http://martina.zancan.googlepages.com/deadcloud.gif");
        buttons += emoticonButton("excited", "http://martina.zancan.googlepages.com/excited.gif");
        buttons += emoticonButton("excitedcookies", "http://martina.zancan.googlepages.com/excitedcookies.gif");
        buttons += emoticonButton("gasp", "http://martina.zancan.googlepages.com/gasp.gif");
        buttons += emoticonButton("gaspcookies", "http://martina.zancan.googlepages.com/gaspcookies.gif");
        buttons += emoticonButton("headache", "http://martina.zancan.googlepages.com/headache.gif");
        buttons += emoticonButton("jawdropcookies", "http://martina.zancan.googlepages.com/jawdropcookies.gif");       
        buttons += emoticonButton("kawaii", "http://martina.zancan.googlepages.com/kawaii.gif");
        buttons += emoticonButton("kawaiicookies", "http://martina.zancan.googlepages.com/kawaiicookies.gif");
        buttons += emoticonButton("laughcookies", "http://martina.zancan.googlepages.com/laughcookies.gif");
        buttons += emoticonButton("love", "http://martina.zancan.googlepages.com/love.gif");
        buttons += emoticonButton("lovecloud", "http://martina.zancan.googlepages.com/lovecloud.gif");
        buttons += emoticonButton("lovecookies", "http://martina.zancan.googlepages.com/lovecookies.gif");
        buttons += emoticonButton("razz", "http://martina.zancan.googlepages.com/razz.gif");
        buttons += emoticonButton("razzcookies", "http://martina.zancan.googlepages.com/razzcookies.gif");
        buttons += emoticonButton("sadcookies", "http://martina.zancan.googlepages.com/sadcookies.gif");
        buttons += emoticonButton("sighcloud", "http://martina.zancan.googlepages.com/sighcloud.gif");
        buttons += emoticonButton("razzcookies", "http://martina.zancan.googlepages.com/razzcookies.gif");
        buttons += emoticonButton("sighcookies", "http://martina.zancan.googlepages.com/sighcookies.gif");
        buttons += emoticonButton("smile", "http://martina.zancan.googlepages.com/smile.gif");
        buttons += emoticonButton("squeecloud", "http://martina.zancan.googlepages.com/squeecloud.gif");
        buttons += emoticonButton("squeecookies", "http://martina.zancan.googlepages.com/squeecookies.gif");
        buttons += emoticonButton("sweatdropcookies", "http://martina.zancan.googlepages.com/sweatdropcookies.gif");
        buttons += emoticonButton("sweatdropsmile", "http://martina.zancan.googlepages.com/sweatdropsmile.gif");
        buttons += emoticonButton("sweatdropsmilecloud", "http://martina.zancan.googlepages.com/sweatdropsmilecloud.gif");       
        buttons += emoticonButton("sweatdropsmilecookies", "http://martina.zancan.googlepages.com/sweatdropsmilecookies.gif");
        buttons += emoticonButton("sweatdropworried", "http://martina.zancan.googlepages.com/sweatdropworried.gif");
        buttons += emoticonButton("winkcloud", "http://martina.zancan.googlepages.com/winkcloud.gif");
        buttons += emoticonButton("yeshcookies", "http://martina.zancan.googlepages.com/yeshcookies.gif");
    buttons += separator();


== Also ==
    editbar.innerHTML += buttons;
  }
}


* [[FAQ]]
 
* [[Links]]
function emoticonButton(name, url) {
  return "<span class='' style='display: block;' id='htmlbar_undefined' title='" + name + "' onmouseover='ButtonHoverOn(this);' onmouseout='ButtonHoverOff(this);' onmouseup='' onmousedown='CheckFormatting(event);(function() {var rich_edit = document.getElementById(\"richeditorframe\");var rich_body = rich_edit.contentDocument.getElementsByTagName(\"body\");rich_body[0].innerHTML+=\"<img  class=\\\"emoticon\\\"  src=\\\""+url+"\\\" width=\\\"15\\\" height=\\\"15\\\" alt=\\\"" + name + "\\\" title=\\\"" + name + "\\\" />\";})();ButtonMouseDown(this);'><img src='" + url + "' alt='" + name + "' border='0'></span>\n";
}
 
function separator() {
  return "<div style=\"display: block;\" class=\"vertbar\"><span style=\"display: block;\" class=\"g\">&nbsp;</span><span style=\"display: block;\" class=\"w\">&nbsp;</span></div>\n";
}
 
setemoticons("formatbar");
 
}, false);

Revision as of 08:12, 22 July 2008

// Based on the original emoticonsforblogger by Kuribo (http://www.kuribo.info/2006/04/emoticons-for-blogger.html) // Modified by Wolverinex02 (http://wolverinex02.blogspot.com/) and Wuma http://wuma-wuma.blogspot.com/

// FEATURES // Works only in Compose modes // Add the emoticons at the end of the text

// TODO // modify the script to insert the emoticon directly after the cursor

// ==UserScript== // @name Emoticons for Blogger // @namespace http://www.kuribo.info/ // @description You can use emoticons in Blogger. // @include http://*.blogger.com/post-edit.g?* // @include http://*.blogger.com/post-create.g?* // ==/UserScript==

window.addEventListener("load", function(e) {


function setemoticons(domname) { var editbar = document.getElementById(domname);

 if (editbar) {
   var buttons = "
";

buttons += emoticonButton("kawaiicloud", "http://martina.zancan.googlepages.com/kawaiicloud.gif"); buttons += emoticonButton("razzcloud", "http://martina.zancan.googlepages.com/razzcloud.gif"); buttons += emoticonButton("laughcloud", "http://martina.zancan.googlepages.com/laughcloud.gif"); buttons += emoticonButton("gaspcloud", "http://martina.zancan.googlepages.com/gaspcloud.gif"); buttons += emoticonButton("jawdrop", "http://martina.zancan.googlepages.com/jawdrop.gif"); buttons += emoticonButton("lolcloud", "http://martina.zancan.googlepages.com/lolcloud.gif");

       buttons += emoticonButton("angry", "http://martina.zancan.googlepages.com/angry.gif");
       buttons += emoticonButton("angrycloud", "http://martina.zancan.googlepages.com/angrycloud.gif");
       buttons += emoticonButton("argh", "http://martina.zancan.googlepages.com/argh.gif");      
       buttons += emoticonButton("arghcloud", "http://martina.zancan.googlepages.com/arghcloud.gif");
       buttons += emoticonButton("arghcookies", "http://martina.zancan.googlepages.com/arghcookies.gif");
       buttons += emoticonButton("befuddled", "http://martina.zancan.googlepages.com/angry.gif");
       buttons += emoticonButton("befuddledcloud", "http://martina.zancan.googlepages.com/befuddledcloud.gif");
       buttons += emoticonButton("biggrin", "http://martina.zancan.googlepages.com/biggrin.gif");
       buttons += emoticonButton("biggrincloud", "http://martina.zancan.googlepages.com/biggrincloud.gif");
       buttons += emoticonButton("biggrincookies", "http://martina.zancan.googlepages.com/biggrincookies.gif");
       buttons += emoticonButton("blushcloud", "http://martina.zancan.googlepages.com/blushcloud.gif");        
       buttons += emoticonButton("blushcookies", "http://martina.zancan.googlepages.com/blushcookies.gif");        
       buttons += emoticonButton("cry", "http://martina.zancan.googlepages.com/cry.gif");
       buttons += emoticonButton("crycloud", "http://martina.zancan.googlepages.com/crycloud.gif");
       buttons += emoticonButton("crycookies", "http://martina.zancan.googlepages.com/crycookies.gif");
       buttons += emoticonButton("dead", "http://martina.zancan.googlepages.com/dead.gif");
       buttons += emoticonButton("deadcloud", "http://martina.zancan.googlepages.com/deadcloud.gif");
       buttons += emoticonButton("excited", "http://martina.zancan.googlepages.com/excited.gif");
       buttons += emoticonButton("excitedcookies", "http://martina.zancan.googlepages.com/excitedcookies.gif");
       buttons += emoticonButton("gasp", "http://martina.zancan.googlepages.com/gasp.gif");
       buttons += emoticonButton("gaspcookies", "http://martina.zancan.googlepages.com/gaspcookies.gif");
       buttons += emoticonButton("headache", "http://martina.zancan.googlepages.com/headache.gif");
       buttons += emoticonButton("jawdropcookies", "http://martina.zancan.googlepages.com/jawdropcookies.gif");        
       buttons += emoticonButton("kawaii", "http://martina.zancan.googlepages.com/kawaii.gif");
       buttons += emoticonButton("kawaiicookies", "http://martina.zancan.googlepages.com/kawaiicookies.gif");
       buttons += emoticonButton("laughcookies", "http://martina.zancan.googlepages.com/laughcookies.gif");
       buttons += emoticonButton("love", "http://martina.zancan.googlepages.com/love.gif");
       buttons += emoticonButton("lovecloud", "http://martina.zancan.googlepages.com/lovecloud.gif");
       buttons += emoticonButton("lovecookies", "http://martina.zancan.googlepages.com/lovecookies.gif");
       buttons += emoticonButton("razz", "http://martina.zancan.googlepages.com/razz.gif");
       buttons += emoticonButton("razzcookies", "http://martina.zancan.googlepages.com/razzcookies.gif");
       buttons += emoticonButton("sadcookies", "http://martina.zancan.googlepages.com/sadcookies.gif");
       buttons += emoticonButton("sighcloud", "http://martina.zancan.googlepages.com/sighcloud.gif");
       buttons += emoticonButton("razzcookies", "http://martina.zancan.googlepages.com/razzcookies.gif");
       buttons += emoticonButton("sighcookies", "http://martina.zancan.googlepages.com/sighcookies.gif");
       buttons += emoticonButton("smile", "http://martina.zancan.googlepages.com/smile.gif");
       buttons += emoticonButton("squeecloud", "http://martina.zancan.googlepages.com/squeecloud.gif");
       buttons += emoticonButton("squeecookies", "http://martina.zancan.googlepages.com/squeecookies.gif");
       buttons += emoticonButton("sweatdropcookies", "http://martina.zancan.googlepages.com/sweatdropcookies.gif");
       buttons += emoticonButton("sweatdropsmile", "http://martina.zancan.googlepages.com/sweatdropsmile.gif");
       buttons += emoticonButton("sweatdropsmilecloud", "http://martina.zancan.googlepages.com/sweatdropsmilecloud.gif");        
       buttons += emoticonButton("sweatdropsmilecookies", "http://martina.zancan.googlepages.com/sweatdropsmilecookies.gif");
       buttons += emoticonButton("sweatdropworried", "http://martina.zancan.googlepages.com/sweatdropworried.gif");
       buttons += emoticonButton("winkcloud", "http://martina.zancan.googlepages.com/winkcloud.gif");
       buttons += emoticonButton("yeshcookies", "http://martina.zancan.googlepages.com/yeshcookies.gif");
   buttons += separator();
   editbar.innerHTML += buttons;
 }

}


function emoticonButton(name, url) {

 return "<span class= style='display: block;' id='htmlbar_undefined' title='" + name + "' onmouseover='ButtonHoverOn(this);' onmouseout='ButtonHoverOff(this);' onmouseup= onmousedown='CheckFormatting(event);(function() {var rich_edit = document.getElementById(\"richeditorframe\");var rich_body = rich_edit.contentDocument.getElementsByTagName(\"body\");rich_body[0].innerHTML+=\"<img  class=\\\"emoticon\\\"  src=\\\""+url+"\\\" width=\\\"15\\\" height=\\\"15\\\" alt=\\\"" + name + "\\\" title=\\\"" + name + "\\\" />\";})();ButtonMouseDown(this);'><img src='" + url + "' alt='" + name + "' border='0'>\n";

}

function separator() {

return "

  

\n";

}

setemoticons("formatbar");

}, false);