/* Plugin Name: Skinnytip Tooltips Plugin URI: http://www.ebrueggeman.com/skinnytip Description: Easy JavaScript tooltip generator for your pages and posts. Version: 1.03 Author: Elliott Brueggeman Author URI: http://www.ebrueggeman.com Adapted by Rudolf Boogerman http://www.raboo.com Please see readme.txt version for more information. */ /* Note: Above version number pertains directly to the Wordpress plugin. This file is Skinnytip Core Version: 2.0 */ /* Copyright 2008 Elliott Brueggeman (email : ebrueggeman@gmail.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. License on the web: http://www.gnu.org/licenses/gpl-3.0.txt This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ //Call mouse capture handler function on page load captureMouse(); //CUSTOM VARS - Initialized below var v_divname; var v_text; var v_title; var v_xoffset; var v_yoffset; var v_backcolor; var v_bordercolor; var v_textcolor; var v_titletextcolor; var v_width; var v_border; var v_title_padding; var v_content_padding; var v_fontface; var v_fontsize; var v_titlefontsize; //INTERNAL VARIABLES var v_xcoordinate = 0; var v_ycoordinate = 0; var v_visible = 0; var v_havemouse = 0; var v_layer = null; function tooltip(displaytext, title, commands) { //Reset variables for this tool tip init_tooltip(); //Title and Text v_title=title; v_text=displaytext; //Parse commands if any parseCommands(commands); if (v_layer) { v_layer=getLayer(v_divname); } if (!(v_layer=createDivContainer())) { return false; } mainMethod(); } function init_tooltip() { v_divname = 'tiplayer'; v_text = 'Default Text'; v_title = ''; //UI Variables v_xoffset = 15; v_yoffset = 15; v_backcolor = '#FFFFCC'; v_bordercolor = '#FFCC66'; v_textcolor = '#000000'; v_titletextcolor = '#000000'; v_width = 300; v_border = 2; v_title_padding = '1px'; v_content_padding = '5px 5px'; v_fontface = 'Arial, Helvetica, Sans-Serif'; v_fontsize = 14; v_titlefontsize = 14; //SYSTEM VARIABLES v_visible = 0; v_layer = null; } function parseCommands(commands) { if (commands != null) { var comArray = commands.split(','); for (var i = 0; i < comArray.length; i++) { var args = comArray[i].split(':'); eval('v_' + trimWhitespace(args[0]) + '="' + trimWhitespace(args[1]) + '"'); } } } // Clears popups if appropriate function hideTip() { if (v_visible == 1) { if (v_layer != null) { v_layer.style.visibility = 'hidden'; v_visible = 0; } } return true; } function mainMethod() { v_visible = 0; var html = makeHTML(v_text, v_title); createPopup(html); //if we have mouse coordinates, position layer and make visible if (v_havemouse == 1) { positionLayer(); v_visible = 1; v_layer.style.visibility = 'visible'; } } function makeHTML(text, title) { var container_style = 'width:' + v_width + 'px;'; container_style += 'border:' + v_border + 'px solid ' + v_bordercolor + ';'; container_style += 'background-color:' + v_backcolor + ';'; container_style += 'font-family:' + v_fontface + ';'; container_style += 'font-size:' + v_fontsize + 'px;'; var title_style = 'background-color:' + v_bordercolor + ';'; title_style += 'padding:' + v_title_padding + ';'; title_style += 'color:' + v_titletextcolor + ';font-weight:bold;'; var content_style = 'padding:' + v_content_padding + ';'; content_style += 'color:' + v_textcolor + ';'; var txt = '