Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Help Removing / Hiding mouse-over hover link text?

edited May 2016 in Help! with 2.0
Hello everyone,

I'm new to twine and very new to programming in general, it's been a steep learning curve and I've managed okay so far but I'd like to ask if anyone can help me with a small aesthetic issue. I'd like to remove / hide the text that appears when you hover over a link because it usually describes where the link goes and that could easily spoil things story-wise in twine.

Reading up on the issue I now know that it isn't a problem that can be solved with CSS as it is a part of most browsers' tooltip features (for security reasons) and would require removing title tags from elements in the html completely or using various JavaScript. Researching the second option seemed more reasonable and I came across this script on stackoverflow:
function DisableToolTip(elements) {
    for (var i = 0; i < elements.length; i++) {
        var element = elements[i];
        element.onmouseover = function() {
            this.setAttribute("org_title", this.title);
            this.title = "";
        };
        element.onmouseout = function() {
            this.title = this.getAttribute("org_title");
        };
    }
}
window.onload = function() {
    var links = document.getElementsByTagName("a");
    DisableToolTip(links);
    var images = document.getElementsByTagName("img");
    DisableToolTip(images);
};

which through setting up a generic function allows you to hide the tooltip based on the element's tag. However, this script still doesn't work on twine links which I assume are referred to by a different tag in the html that I'm struggling to suss out.
I image you would have to add an additional line to the last script such as
var ???? = document.getElementsByTagName("????");
 DisableToolTip(????);
filling in the ???? with the appropriate var and tag but I'm not sure what those would be.

Thank you very much to anyone who can help out :)

Comments

  • I am guessing that you are seeing the hover tool-tips when using the Test option because Harlowe uses the tw-expression/tw-hook element's title attribute to store debug information. Which element is used depends on which type of link you are using, some of the different types are.
    [[Go to the Second passage->Second]]
    
    |link>[Go to the Second passage](click: ?link)[(go-to: "Second")]
    
    (link: "Go to the Second passage")[(go-to: "Second")]
    
    (link-goto: "Go to the Second passage", "Second")
    

    This issue should not happen when you use the Play or Publish to File options because those don't include debug information, thus the relevant elements don't have title attributes which should mean no tool-tip.
  • Ah! Thank you Greyelf! Creating problems for myself as always ^^; I had always been using Test didn't think to check with Play. Thanks again :)
Sign In or Register to comment.