app/js/tooltip.js
// Adds tooltip listeners to all jqtree nodes in the DOM
Adds tooltip listeners to all jqtree nodes in the DOM
Adds tooltip listeners to all jqtree nodes in the DOM
function addTreeTooltips(workspace) {
    let titles = document.getElementsByClassName("jqtree-element"); 
    for (let x = 0; x < titles.length; x++) {
        titles[x].onmousemove = function (e) {
            if (delay) {
                clearTimeout(delay);
            }
            delay = setTimeout(function () {
                let node = $('#' + workspace + '_tree').tree('getNodeByHtmlElement', e.target);
                let content = [node.name];
                if (node.source) {
                    content.push("<i>" + node.source + "</i>");
                }
                spawnTooltip(e, content);
            }, 600)
        }
        titles[x].onmouseleave = function (e) {
            if (delay) {
                clearTimeout(delay);
            }
        }
    }
}
function addTreeTooltips ( workspace ) { let titles = document . getElementsByClassName ( "jqtree-element" ) ; for ( let x = 0 ; x < titles . length ; x ++ ) { titles [ x ] . onmousemove = function ( e ) { if ( delay ) { clearTimeout ( delay ) ; } delay = setTimeout ( function ( ) { let node = $ ( '#' + workspace + '_tree' ) . tree ( 'getNodeByHtmlElement' , e . target ) ; let content = [ node . name ] ; if ( node . source ) { content . push ( "<i>" + node . source + "</i>" ) ; } spawnTooltip ( e , content ) ; } , 600 ) } titles [ x ] . onmouseleave = function ( e ) { if ( delay ) { clearTimeout ( delay ) ; } } } }
Adds tooltip listeners to all jqtree nodes in the DOM
Adds tooltip listeners to all jqtree nodes in the DOM
// jqtree-title (alt) // Clears global timeout on move // Begins new timeout // Gets the node corresponding to the element // Sets content for tooltip //content.push("(www.example.com)"); // TEMPORARY EXAMPLE // Spawns popup for tooltip // Prevents spawning of tooltip if hover breaks