Okay, I've been reading through the Wiki, and I've gotten some ideas, but I'm still fairly clueless on some other things. Here's more or less what I need to do to get my floaty tooltip plugin to work as I envision it:
- The plugin needs to add some scripts into the header of the main index page, and also somewhere in the body section of the page as well, which define the tooltip styles and positioning, and define the div that will contain the tooltips. I know I can use wp_head to insert the code into the header, but not sure how I'll get the chunk of code that goes in the body section to show up (I usually stick that last chunk of code near the bottom of th epage, before the closing body tag). A dirty hack might be to write a filter that looks for some unique bit of HTML that WP always creates at the footer of the index page, and have the filter replace it with itself + extra code I need. However, I don't know how doable that might be what with the things different templates can insert, e.g. if a template might modify the HTML at the bottom of the main index page. Right now, on my blog, I have the codes hardcoded into the Main index file.
- The plugin would also need to make it possible for me to insert some onMouseOver and onMouseOut JS actions to tags in the posts in order to have the tooltips appear and dissapear. These actions could be inserted into pretty much any tag, not just links. Ideally, I would like for it to be a button I click on in the editing interface, like the link button, that pops up a dialog asking you for what text to show in the tooltip. I'm guessing I could write a filter that goes something like _TOOLTIP:"Text To Insert"_ and have it parse the 'Text To Insert' bit and replace the _TOOLTIP_ bits with the onMouse events, but I'm kinda hoping to avoid making the user type in _TOOLTIP_, I'd rather it be a button they can click that will insert the onMouse code, or the filter text, into the editing window. I don't quite see where I could hook into to insert the new button code, though. Right now, on my blog, I have it hard-coded into the quicktags.js file. I inserted a couple of new functions for parsing and inserting the onMouse code, and I had to modify a couple of the existing functions in there to get the button to show and assign it the proper functions to pop up the dialog asking for text. Also, I'd like to be able to give the user the choice to enter the background color and tooltip width at the same time, but that's not critical. My problem is that I don't really see where I could hook into quicktags.js or the editing interface through a plugin.
I'll keep digging, but if anyone has any suggestions for me, I'd appreciate it a lot.