Sha256: 270a475086d02ba5e96ded3a20e5040710b51027fec32b985310f54578682ad4

Contents?: true

Size: 1.63 KB

Versions: 68

Compression:

Stored size: 1.63 KB

Contents

/*Thought Tracker Class
=
= enableViz: load the viz data and attempt to draw the viz in the 
= 	correctly named locations if present
= page: a string indicating what kind of view to deal with, currently:
== "home:(link_to_solo)" - Show the top 3 distortions if present, no tooltips, links to solo
== "solo" - Show a large version with all distortions with at least 3 thoughts per
==		distortion.
*/

sc.thoughtTracker = function(enableViz, page){
	var self = this, thePage = page, resizeTimer;

	if($("small").first().text().trim() == "Thought Distortions"){
		thePage = page = "solo";
	}

	this.reRenderViz = function(page){
		self.menuViz = new scThoughtTrackerMenuViz(thoughtsWithPatterns,page.substr(0,4));

		//forceCloseVizTooltip
		$("div.thoughtviz_tooltip")
			.on("click", this.menuViz.forceCloseVizTooltip);

		//handleVizShowTooltipModal
		$("g#ThoughtVizSvg text, g#ThoughtVizSvg circle")
			.on("click", this.menuViz.handleVizTooltipModal);

		// //handleVizTooltipLeave
		// $("g#ThoughtVizSvg text, g#ThoughtVizSvg circle, .thoughtviz_tooltip")
		// 	.on("mouseout focusout", this.menuViz.handleVizTooltipLeave);

		if (page.substr(0,4) == "home"){
			$("g#ThoughtVizSvg text, g#ThoughtVizSvg circle").off("click")
				.on("click", function(){ location.pathname = page.substr(5); });
		}
	}

	this.timedReRender = function(page){
		clearTimeout(resizeTimer);
		resizeTimer = setTimeout(function(){self.reRenderViz(page);}, 1000);
	}

	if(enableViz){
		self.reRenderViz(thePage);

		//Event Handelers

		//handle change viz ratio
		$(window).off('.scThoughtTracker');
		$(window).on('resize.scThoughtTracker', function(){self.timedReRender(thePage)});
	}
};

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
think_feel_do_engine-3.22.9 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.22.8 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.22.7 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.22.6 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.22.5 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.22.4 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.22.2 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.22.1 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.22.0 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.21.2 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.21.1 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.21.0 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.20.1 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.19.9 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.19.8 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.19.7 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.19.6 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.19.5 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.19.4 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js
think_feel_do_engine-3.19.3 app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js