diff life_calendar/tooltip.js @ 86:a0fdf2cf1d53

add "selection" feature to life_calendar; fix minor typos in deer_crash
author paulo
date Sat, 17 Sep 2016 00:11:41 -0700
parents 256b8df1c686
children
line diff
     1.1 --- a/life_calendar/tooltip.js	Sat Jul 23 15:25:44 2016 -0600
     1.2 +++ b/life_calendar/tooltip.js	Sat Sep 17 00:11:41 2016 -0700
     1.3 @@ -9,7 +9,7 @@
     1.4  	return document.querySelector("#" + _tt_options.tooltipId);
     1.5  }
     1.6  
     1.7 -function adjustTooltip(evt, tooltipElm, title, text) {
     1.8 +function adjustTooltip(evt, tooltipElm, title, text, subtext) {
     1.9  	var offset = _tt_options.offsetDefault;
    1.10  	var scrollY = window.scrollY || window.pageYOffset;
    1.11  	var scrollX = window.scrollX || window.pageXOffset;
    1.12 @@ -22,37 +22,41 @@
    1.13  	tooltipElm.style.top = tooltipTop + "px";
    1.14  	tooltipElm.style.left = tooltipLeft + "px";
    1.15  
    1.16 -	setTooltipText(tooltipElm, title, text);
    1.17 +	setTooltipText(tooltipElm, title, text, subtext);
    1.18  }
    1.19  
    1.20  function removeTooltip() {
    1.21  	document.querySelector("body").removeChild(getTooltipElm());
    1.22  }
    1.23  
    1.24 -function createTooltip(evt, title, text) {
    1.25 +function createTooltip(evt, title, text, subtext) {
    1.26  	var tooltipElm = getTooltipElm();
    1.27  
    1.28  	if (!tooltipElm) {
    1.29  		tooltipElm = document.createElement("div");
    1.30  		tooltipElm.appendChild(document.createElement("h1"));
    1.31  		tooltipElm.appendChild(document.createElement("h2"));
    1.32 +		tooltipElm.appendChild(document.createElement("h3"));
    1.33  
    1.34 -		tooltipElm.style.position = "absolute";
    1.35 -		tooltipElm.setAttribute("id", _tt_options.tooltipId);
    1.36 +		tooltipElm.style.position = "absolute"; tooltipElm.setAttribute("id", _tt_options.tooltipId);
    1.37  
    1.38  		document.querySelector("body").appendChild(tooltipElm);
    1.39  	}
    1.40  
    1.41 -	adjustTooltip(evt, tooltipElm, title, text);
    1.42 +	adjustTooltip(evt, tooltipElm, title, text, subtext);
    1.43  }
    1.44  
    1.45 -function setTooltipText(tooltipElm, title, text) {
    1.46 +function setTooltipText(tooltipElm, title, text, subtext) {
    1.47  	var eTitle = tooltipElm.children[0];
    1.48  	var eText = tooltipElm.children[1];
    1.49 +	var eSubText = tooltipElm.children[2];
    1.50  	if (eTitle && title) {
    1.51  		eTitle.textContent = title;
    1.52  	}
    1.53  	if (eText && text) {
    1.54  		eText.textContent = text;
    1.55  	}
    1.56 +	if (eSubText) {
    1.57 +		eSubText.textContent = subtext;
    1.58 +	}
    1.59  }