PDA

View Full Version : Smart Hints


El_Muerte
11-08-2005, 10:00 PM
Smart Hints is a javascript that will convert all HTML title attributes to javascript powered hints.
This grants you more power in the looks of the hint and also newline support for all browsers.

All most of you may be aware of is that vBulletin has a thread preview feature that adds some text of the thread to the title attribute. Only MSIE will properly show the newlines, this looks quite ugly and unreadable for other browsers.
This plugin will make it a bit more nicer. Without javascript nothing much happens, also no HTML is touched, it's all done via JavaScript. The plugin only adds two invisible lines to the end of the document.

This javascript file can easily be used in other websites. Hence I release this script under the terms of the GNU Lesser General Public License.

A live demo is available here: http://forum.magicball.net/forumdisplay.php?f=6

Installation\customization intrustions are in the README file in the zip archive.

Note: you can also install this mod for older vBulletin versions (pre 3.5), for that you will need to customize some templates to include the 2 HTML lines. The code to add would be:

<script type="text/javascript" src="http://el-muerte.student.utwente.nl/lba/forum/clientscript/smartHints.js"></script>
<div id="hintwindow" class="tborder" style="display: none; position: absolute;"><div id="hintwindowtext" class="alt1">&nbsp;</div></div>


Changes in v1.1
Changed the HTML code, removed all unimportant style data (e.g. color and stuff) and now uses default style classes. Previous method actually didn't allow proper customization. It now uses the tborder and alt1 classes, this makes the hint blend in with the forum directly. However I do suggest to add the following lines to the Additional CSS Definitions just to make it even nicer:
#hintwindow { padding: 1px; font-size: 80%; }
#hintwindowtext { padding: 1px; }
Known bug: Opera (8.5) doesn't show newlines, the reason for this that the title attribute doesn't contain newlines when requested via javascript (bug in Opera?).

Pyrix
11-09-2005, 12:02 PM
Safari really doesn't like your new tooltips by the looks of things... I just get black boxes on mouseover!

El_Muerte
11-09-2005, 12:06 PM
hmm.. that sucks. Don't have safari or an other KHTML based browser. Maybe it doesn't understand the standard colors used. Try customizing the hint window colors (as described in the readme).

Also Opera sures might suffer from some stupid Opera feature that will obstruct the hint with a tooltip containing the url of the link. And for some stupid reason Opera doesn't want to display the BR tags properly.

nexialys
11-09-2005, 12:31 PM
would be good from you to provide the origin of your javascript, so we can have some support from the originate coder...

TheProfessor
11-09-2005, 01:04 PM
I don't wann be lame, but this extension for vB 3.5 does it much better:

https://vborg.vbsupport.ru/showthread.php?t=99520

El_Muerte
11-09-2005, 02:20 PM
would be good from you to provide the origin of your javascript, so we can have some support from the originate coder...

The origin is me, I wrote this from scratch this morning.

I don't wann be lame, but this extension for vB 3.5 does it much better:

https://vborg.vbsupport.ru/showthread.php?t=99520

Well, maybe in some way. But my plugin does it for every "title" attribute on the page. On an other site we're using vbPortal that also uses title attributes for somethings (like an rss feed block), that will automatically profit from this plugin. Also no template changes are required.

yinyang
11-09-2005, 02:54 PM
I don't wann be lame, but this extension for vB 3.5 does it much better:

https://vborg.vbsupport.ru/showthread.php?t=99520

personally, i don't like the term "better" since it compares two equal things that perform differently. this hack is different and suits el muerte in what he needed accomplished. i think it is great that he would take the time to share his knowledge and work with us in his free time.

Snake
11-09-2005, 06:37 PM
Thanks!

El_Muerte
11-10-2005, 08:51 PM
A small update, I trashes the previous default style data for colors. It now uses a few predefined vBulletin style classes. I hope this also fixed the safari black box issue.

akanevsky
11-10-2005, 08:56 PM
It should cut out the title tags if javascript is enabled.
Cause otherwise they overlap. :(

El_Muerte
11-11-2005, 05:36 AM
The title attributes are made empty via javascript, so they shouldn't overlap. What browser are you using? I've tested it with Mozilla 1.0.7, MSIE 6.0 and Opera 8.5.

TheProfessor
11-11-2005, 10:10 AM
personally, i don't like the term "better" since it compares two equal things that perform differently. this hack is different and suits el muerte in what he needed accomplished. i think it is great that he would take the time to share his knowledge and work with us in his free time.

Sorry, but that was no offence ... I just said that I like the other extension much more ... nothing been said about this extension would be bulls**t ... next time please read twice ...