<commit_before>/**
	@public

	The _moon.MarqueeSupport_ mixin should be used with controls that contain
	multiple marquees whose animation behavior should be synchronized. Calling
	_this.startMarquee()_ or _this.stopMarquee()_ starts/stops all contained
	marquees.
*/
moon.MarqueeSupport = {
	name: "MarqueeSupport",
	//* @protected
	_marquee_Handlers: {
		onRequestStartMarquee: "_marquee_requestStartMarquee",
		onSpotlightFocus: "_marquee_spotlightFocus",
		onSpotlightBlur: "_marquee_spotlightBlur",
		onMarqueeEnded: "_marquee_marqueeEnded",
		onresize: "_marquee_resize"
	},
	marqueeActive: false,
	//* Initializes marquee timings.
	create: enyo.inherit(function (sup) {
		return function() {
			sup.apply(this, arguments);
			this.marqueeOnSpotlight = (this.marqueeOnSpotlight === undefined) ? true : this.marqueeOnSpotlight;
			this.marqueeSpeed =    (this.marqueeSpeed ===     undefined) ? 60 :    this.marqueeSpeed;
			this.marqueeDelay =    (this.marqueeDelay ===     undefined) ? 1000 :  this.marqueeDelay;
			this.marqueePause =    (this.marqueePause ===     undefined) ? 1000 :  this.marqueePause;
			this.marqueeHold  =    (this.marqueeHold  ===     undefined) ? 2000 :  this.marqueeHold;
			this.marqueeOnRender = (this.marqueeOnRender  === undefined) ? false : this.marqueeOnRender;
		};
	}),
	//* If _this.marqueeOnRender_ is true, kick off marquee animation
	rendered: enyo.inherit(function (sup) {
		return function() {
			sup.apply(this, arguments);
			if (this.marqueeOnRender) {
				this.startMarquee();
			}
		};
	}),
	dispatchEvent: enyo.inherit(function (sup) {
		return function(sEventName, oEvent, oSender) {
			if (!oEvent.delegate) {
				var handler = this._marquee_Handlers[sEventName];
				if (handler && this[handler](oSender, oEvent)) {
					return true;
				}
			}
			return sup.apply(this, arguments);
		};
	}),
	//* Handles external requests to kick off _marqueeStart_.
	_marquee_requestStartMarquee: function() {
		if (this.marqueeOnRender) {
			this.stopMarquee();
			this.startMarquee();
			return true;
		}
	},
	//* On focus, starts child marquees.
	_marquee_spotlightFocus: function(inSender, inEvent) {
		if (this.marqueeOnSpotlight) {
			this.startMarquee();
		}
	},
	//* On blur, halts child marquees.
	_marquee_spotlightBlur: function(inSender, inEvent) {
		if (this.marqueeOnSpotlight) {
			this.stopMarquee();
		}
	},
	/**
		When a child marquee animation completes, removes the child from
		_this.marqueeWaitList_.
	*/
	_marquee_marqueeEnded: function(inSender, inEvent) {
		if (this.marqueeActive) {
			enyo.remove(inEvent.originator, this.marqueeWaitList);
			if (this.marqueeWaitList.length === 0) {
				this._marquee_startHold();
				this.marqueeActive = false;
			}
		}
		return true;
	},
	_marquee_resize: function(inSender, inEvent) {
		if (this.marqueeOnSpotlight && this.marqueeActive) {
			this.marqueeActive = false;
			this._marquee_startHold();
		}
	},
	
	//* @public
	/**
		Starts timer to waterfall an _onRequestMarqueeStart_ event that kicks off
		marquee animation on all child marquees.
	*/
	startMarquee: function() {
		this._marquee_buildWaitList();

		if (this.marqueeWaitList.length === 0) {
			return;
		}
	
		this.marqueeActive = true;
		this.startJob("marqueeSupportJob", "_marquee_startChildMarquees", this.marqueeDelay);
	},
	/**
		Waterfalls an _onRequestMarqueeStop_ event to halt all running child
		marquees.
	*/
	stopMarquee: function() {
		this.stopJob("marqueeSupportJob");
		this.marqueeActive = false;
		this._marquee_stopChildMarquees();
	},
	//* Adds _inControl_ to _this.marqueeWaitList_.
	addMarqueeItem: function(inControl) {
		this.marqueeWaitList.push(inControl);
	},
	
	//* @protected
	
	//* Waterfalls request for child animations to build up _this.marqueeWaitList_.
	_marquee_buildWaitList: function() {
		this.marqueeWaitList = [];
		this.waterfall("onRequestMarquee", {originator: this, marqueePause: this.marqueePause, marqueeSpeed: this.marqueeSpeed});
	},
	//* Waterfalls event to kick off child marquee animations.
	_marquee_startChildMarquees: function() {
		this.waterfall("onRequestMarqueeStart");
	},
	//* Waterfalls event to halt child marquee animations.
	_marquee_stopChildMarquees: function() {
		this.waterfall("onRequestMarqueeStop");
	},
	//* Begins delayed restart of child marquee animations.
	_marquee_startHold: function() {
		this.startJob("marqueeSupportJob", "startMarquee", this.marqueeHold);
	}
};

/**
	@public

	The _moon.MarqueeSupport_ mixin is used to add marquee animation functionality
	to a control.
*/
moon.MarqueeItem = {
	//* @public
	events: {
		onMarqueeEnded:""
	},
	//* @protected
	_marqueeItem_Handlers: {
		onRequestMarquee: "_marquee_requestMarquee",
		onRequestMarqueeStart: "_marquee_startAnimation",
		onRequestMarqueeStop: "_marquee_stopAnimation",
		ontransitionend: "_marquee_animationEnded"
	},
	observers: {
		_marquee_contentChanged: ["content"]
	},
	classes: "moon-marquee",
	dispatchEvent: enyo.inherit(function (sup) {
		return function(sEventName, oEvent, oSender) {
			if (!oEvent.delegate) {
				var handler = this._marqueeItem_Handlers[sEventName];
				if (handler && this[handler](oSender, oEvent)) {
					return true;
				}
			}
			return sup.apply(this, arguments);
		};
	}),
	/**
		When the content of this control changes, updates the content of
	 _this.$.marqueeText_ (if it exists).
	 */
	_marquee_contentChanged: function() {
		if (this.$.marqueeText) {
			this.$.marqueeText.setContent(this.content);
			this._marquee_stopAnimation();
		}
	},
	//* If this control needs to marquee, lets the event originator know.
	_marquee_requestMarquee: function(inSender, inEvent) {
		if (!inEvent || !this._marquee_shouldAnimate()) {
			return;
		}
		<commit_msg>JSHint fix #2. Enyo-DCO-1.1-Signed-Off-By: <NAME> (<EMAIL>)<commit_after>/**
	@public

	The _moon.MarqueeSupport_ mixin should be used with controls that contain
	multiple marquees whose animation behavior should be synchronized. Calling
	_this.startMarquee()_ or _this.stopMarquee()_ starts/stops all contained
	marquees.
*/
moon.MarqueeSupport = {
	name: "MarqueeSupport",
	//* @protected
	_marquee_Handlers: {
		onRequestStartMarquee: "_marquee_requestStartMarquee",
		onSpotlightFocus: "_marquee_spotlightFocus",
		onSpotlightBlur: "_marquee_spotlightBlur",
		onMarqueeEnded: "_marquee_marqueeEnded",
		onresize: "_marquee_resize"
	},
	marqueeActive: false,
	//* Initializes marquee timings.
	create: enyo.inherit(function (sup) {
		return function() {
			sup.apply(this, arguments);
			this.marqueeOnSpotlight = (this.marqueeOnSpotlight === undefined) ? true : this.marqueeOnSpotlight;
			this.marqueeSpeed =    (this.marqueeSpeed ===     undefined) ? 60 :    this.marqueeSpeed;
			this.marqueeDelay =    (this.marqueeDelay ===     undefined) ? 1000 :  this.marqueeDelay;
			this.marqueePause =    (this.marqueePause ===     undefined) ? 1000 :  this.marqueePause;
			this.marqueeHold  =    (this.marqueeHold  ===     undefined) ? 2000 :  this.marqueeHold;
			this.marqueeOnRender = (this.marqueeOnRender  === undefined) ? false : this.marqueeOnRender;
		};
	}),
	//* If _this.marqueeOnRender_ is true, kick off marquee animation
	rendered: enyo.inherit(function (sup) {
		return function() {
			sup.apply(this, arguments);
			if (this.marqueeOnRender) {
				this.startMarquee();
			}
		};
	}),
	dispatchEvent: enyo.inherit(function (sup) {
		return function(sEventName, oEvent, oSender) {
			if (!oEvent.delegate) {
				var handler = this._marquee_Handlers[sEventName];
				if (handler && this[handler](oSender, oEvent)) {
					return true;
				}
			}
			return sup.apply(this, arguments);
		};
	}),
	//* Handles external requests to kick off _marqueeStart_.
	_marquee_requestStartMarquee: function() {
		if (this.marqueeOnRender) {
			this.stopMarquee();
			this.startMarquee();
			return true;
		}
	},
	//* On focus, starts child marquees.
	_marquee_spotlightFocus: function(inSender, inEvent) {
		if (this.marqueeOnSpotlight) {
			this.startMarquee();
		}
	},
	//* On blur, halts child marquees.
	_marquee_spotlightBlur: function(inSender, inEvent) {
		if (this.marqueeOnSpotlight) {
			this.stopMarquee();
		}
	},
	/**
		When a child marquee animation completes, removes the child from
		_this.marqueeWaitList_.
	*/
	_marquee_marqueeEnded: function(inSender, inEvent) {
		if (this.marqueeActive) {
			enyo.remove(inEvent.originator, this.marqueeWaitList);
			if (this.marqueeWaitList.length === 0) {
				this._marquee_startHold();
				this.marqueeActive = false;
			}
		}
		return true;
	},
	_marquee_resize: function(inSender, inEvent) {
		if (this.marqueeOnSpotlight && this.marqueeActive) {
			this.marqueeActive = false;
			this._marquee_startHold();
		}
	},
	
	//* @public
	/**
		Starts timer to waterfall an _onRequestMarqueeStart_ event that kicks off
		marquee animation on all child marquees.
	*/
	startMarquee: function() {
		this._marquee_buildWaitList();

		if (this.marqueeWaitList.length === 0) {
			return;
		}
	
		this.marqueeActive = true;
		this.startJob("marqueeSupportJob", "_marquee_startChildMarquees", this.marqueeDelay);
	},
	/**
		Waterfalls an _onRequestMarqueeStop_ event to halt all running child
		marquees.
	*/
	stopMarquee: function() {
		this.stopJob("marqueeSupportJob");
		this.marqueeActive = false;
		this._marquee_stopChildMarquees();
	},
	//* Adds _inControl_ to _this.marqueeWaitList_.
	addMarqueeItem: function(inControl) {
		this.marqueeWaitList.push(inControl);
	},
	
	//* @protected
	
	//* Waterfalls request for child animations to build up _this.marqueeWaitList_.
	_marquee_buildWaitList: function() {
		this.marqueeWaitList = [];
		this.waterfall("onRequestMarquee", {originator: this, marqueePause: this.marqueePause, marqueeSpeed: this.marqueeSpeed});
	},
	//* Waterfalls event to kick off child marquee animations.
	_marquee_startChildMarquees: function() {
		this.waterfall("onRequestMarqueeStart");
	},
	//* Waterfalls event to halt child marquee animations.
	_marquee_stopChildMarquees: function() {
		this.waterfall("onRequestMarqueeStop");
	},
	//* Begins delayed restart of child marquee animations.
	_marquee_startHold: function() {
		this.startJob("marqueeSupportJob", "startMarquee", this.marqueeHold);
	}
};

/**
	@public

	The _moon.MarqueeSupport_ mixin is used to add marquee animation functionality
	to a control.
*/
moon.MarqueeItem = {
	//* @public
	events: {
		onMarqueeEnded:""
	},
	//* @protected
	_marqueeItem_Handlers: {
		onRequestMarquee: "_marquee_requestMarquee",
		onRequestMarqueeStart: "_marquee_startAnimation",
		onRequestMarqueeStop: "_marquee_stopAnimation",
		ontransitionend: "_marquee_animationEnded"
	},
	observers: {
		_marquee_contentChanged: ["content"]
	},
	classes: "moon-marquee",
	dispatchEvent: enyo.inherit(function (sup) {
		return function(sEventName, oEvent, oSender) {
			if (!oEvent.delegate) {
				var handler = this._marqueeItem_Handlers[sEventName];
				if (handler && this[handler](oSender, oEvent)) {
					return true;
				}
			}
			return sup.apply(this, arguments);
		};
	}),
	/**
		When the content of this control changes, updates the content of
		_this.$.marqueeText_ (if it exists).
	*/
	_marquee_contentChanged: function() {
		if (this.$.marqueeText) {
			this.$.marqueeText.setContent(this.content);
			this._marquee_stopAnimation();
		}
	},
	//* If this control needs to marquee, lets the event originator know.
	_marquee_requestMarquee: function(inSender, inEvent) {
		if (!inEvent || !this._marquee_shouldAnimate()) {
			return;
		}
		
{'fraction_non_alphanumeric': 0.12261437908496732, 'fraction_numerical': 0.0030501089324618735, 'mean_word_length': 4.312962962962963, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1256959', 'n_tokens_mistral': 4547, 'n_tokens_neox': 3891, 'n_words': 793}