This simple macro produces a usable internal link whose text changes whenever you mouseover it.
version.extensions.hoverlinkMacro={major:1,minor:1,revision:0};macros.hoverlink={handler:function(a,b,c){var d,l=Wikifier.createInternalLink(a,c[0]);
l.className+=" hoverLink";insertElement(l,"span",null,null,c[1]||c[0]);if(c[2]){d=insertElement(l,"span",null,null,c[2]);
d.style.display="none";}l.onmouseover=function(){if(this.childNodes.length>1){this.childNodes[0].style.display="none";
this.childNodes[1].style.display="inline";}};l.onmouseout=function(){if(this.childNodes.length>1){this.childNodes[1].style.display="none";
this.childNodes[0].style.display="inline";}};}};
This uses the << choice >> macro's parameter order - the destination passage name comes first. Then comes the visible label, then the hidden label.
Usage example: <<hoverlink "CryPassage" "Stand and fight, guns blazing" "Sit down and have a cry">>
For obvious reasons, this won't work on iPads!
Implementation details:
* The link has a class of "hoverLink" in addition to the standard internalLink/brokenLink classes.
* Each text label is a <span> inside the <a>, and the mouseover and mouseout events make one or the other visible.
Version history:
Comments
All these Twine blogposts
All these Twine blogposts are pretty great. Have you thought about posting about them somewhere else (like here, maybe), or have you already done that?
I've been tweeting them, but
I've been tweeting them, but otherwise no.