Ok, Been working on this since 8am and I've now got it to recognise a stock code and show a tooltip when the mouse hovers over it, the tooltip currently simply contains the regex match, so hovering over 1234567ABC will show a tooltip containing 1234567ABC. Not exactly setting the world on fire just yet.
I've been tearing apart the bugz and amazon code to get this far, and here's what I'm working with:
.XML
Code:
<zimlet name="uk_co_domain_stockcode" version="1.0" description="Stock Code">
<include>ZmStockObjectHandler.js</include>
<handlerObject>ZmStockObjectHandler</handlerObject>
<contentObject type="stock">
<matchOn>
<regex attrs="ig">(?:\d\d\d\d\d\d\d\D+)</regex>
</matchOn>
</contentObject>
</zimlet> .
js Code:
function ZmStockObjectHandler() {
}
ZmStockObjectHandler.prototype = new ZmZimletBase;
ZmStockObjectHandler.prototype.constructor = ZmStockObjectHandler;
ZmStockObjectHandler.prototype.toolTipPoppedUp =
function(spanElement, obj, context, canvas) {
canvas.innerHTML = "<b>ID: </b>"+context;
}; Could anyone point me in the right direction for the next stage, which is to replace the content of the tooltip with the result of a webpage, so a reasonably simple ajax call, but I'm struggling with the syntax.