Main Page: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
(add emoticons at the end of the text)
mNo edit summary
 
(38 intermediate revisions by 23 users not shown)
Line 1: Line 1:
// 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]].
// Modified by Wolverinex02 (http://wolverinex02.blogspot.com/) and Wuma http://wuma-wuma.blogspot.com/


// FEATURES
<!-- I'm not fond of the mess of HTML here, but it's especially helpful to have an attractive and easy-to-use main page. -->
// Works only in Compose modes
<table style='min-width: 35em; max-width: 60em; margin: 1em auto; float: none;' class='infobox'>
// Add the emoticons at the end of the text
<tr>
<th style='width: 50%; text-align: center;'>For All Users</th>
<th style='width: 50%; text-align: center;'>For Script Authors</th>
</tr>
<tr>
<td>
* [[Greasemonkey Manual]]
* [[Troubleshooting (Users)]]
* [[User Script Hosting]]
</td>
<td>
* [[Greasemonkey Manual:API|API reference]]
* [[Troubleshooting (Script Authors)]]
* [[Security]]
* [[Tutorials]]
* [[:Category:Coding Tips]]
* [[:Category:Scripting context]]
</td>
</tr>
</table>


// TODO
Last resort?
// modify the script to insert the emoticon directly after the cursor
Try reading the [[Getting Help]] page.


// ==UserScript==
<!-- Things are slightly more attractive when the page isn't shorter than the left-side nav; pad it. -->
// @name          Emoticons for Blogger
<br><br><br><br><br><br><br><br><br><br><br><br>
// @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 = "<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();
 
    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'></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);

Latest revision as of 16:43, 3 November 2017