<commit_before>/**
 * ScriptLoader.js
 *
 * Copyright 2009, Moxiecode Systems AB
 * Released under LGPL License.
 *
 * License: http://tinymce.moxiecode.com/license
 * Contributing: http://tinymce.moxiecode.com/contributing
 */

(function(tinymce) {
	tinymce.dom.ScriptLoader = function(settings) {
		var QUEUED = 0,
			LOADING = 1,
			LOADED = 2,
			states = {},
			queue = [],
			scriptLoadedCallbacks = {},
			queueLoadedCallbacks = [],
			loading = 0,
			undefined;

		/**
		 * Loads a specific script directly without adding it to the load queue.
		 *
		 * @method load
		 * @param {String} url Absolute URL to script to add.
		 * @param {function} callback Optional callback function to execute ones this script gets loaded.
		 * @param {Object} scope Optional scope to execute callback in.
		 */
		function loadScript(url, callback) {
			var t = this, dom = tinymce.DOM, elm, uri, loc, id;

			// Execute callback when script is loaded
			function done() {
				dom.remove(id);

				if (elm)
					elm.onreadystatechange = elm.onload = elm = null;

				callback();
			};

			id = dom.uniqueId();

			if (tinymce.isIE6) {
				uri = new tinymce.util.URI(url);
				loc = location;

				// If script is from same domain and we
				// use IE 6 then use XHR since it's more reliable
				if (uri.host == loc.hostname && uri.port == loc.port && (uri.protocol + ':') == loc.protocol) {
					tinymce.util.XHR.send({
						url : tinymce._addVer(uri.getURI()),
						success : function(content) {
							// Create new temp script element
							var script = dom.create('script', {
								type : 'text/javascript'
							});

							// Evaluate script in global scope
							script.text = content;
							document.getElementsByTagName('head')[0].appendChild(script);
							dom.remove(script);

							done();
						}
					});

					return;
				}
			}

			// Create new script element
			elm = dom.create('script', {
				id : id,
				type : 'text/javascript',
				src : tinymce._addVer(url)
			});

			// Add onload and readystate listeners
			elm.onload = done;
			elm.onreadystatechange = function() {
				var state = elm.readyState;

				// Loaded state is passed on IE 6 however there
				// are known issues with this method but we can't use
				// XHR in a cross domain loading
				if (state == 'complete' || state == 'loaded')
					done();
			};

			// Most browsers support this feature so we report errors
			// for those at least to help users track their missing plugins etc
			// todo: Removed since it produced error if the document is unloaded by navigating away, re-add it as an option
			/*elm.onerror = function() {
				alert('Failed to load: ' + url);
			};*/

			// Add script to document
			(document.getElementsByTagName('head')[0] || document.body).appendChild(elm);
		};

		/**
		 * Returns true/false if a script has been loaded or not.
		 *
		 * @method isDone
		 * @param {String} url URL to check for.
		 * @return [Boolean} true/false if the URL is loaded.
		 */
		this.isDone = function(url) {
			return states[url] == LOADED;
		};

		/**
		 * Marks a specific script to be loaded. This can be useful if a script got loaded outside
		 * the script loader or to skip it from loading some script.
		 *
		 * @method markDone
		 * @param {string} u Absolute URL to the script to mark as loaded.
		 */
		this.markDone = function(url) {
			states[url] = LOADED;
		};

		/**
		 * Adds a specific script to the load queue of the script loader.
		 *
		 * @method add
		 * @param {String} url Absolute URL to script to add.
		 * @param {function} callback Optional callback function to execute ones this script gets loaded.
		 * @param {Object} scope Optional scope to execute callback in.
		 */
		this.add = this.load = function(url, callback, scope) {
			var item, state = states[url];

			// Add url to load queue
			if (state == undefined) {
				queue.push(url);
				states[url] = QUEUED;
			}

			if (callback) {
				// Store away callback for later execution
				if (!scriptLoadedCallbacks[url])
					scriptLoadedCallbacks[url] = [];

				scriptLoadedCallbacks[url].push({
					func : callback,
					scope : scope || this
				});
			}
		};

		/**
		 * Starts the loading of the queue.
		 *
		 * @method loadQueue
		 * @param {function} callback Optional callback to execute when all queued items are loaded.
		 * @param {Object} scope Optional scope to execute the callback in.
		 */
		this.loadQueue = function(callback, scope) {
			this.loadScripts(queue, callback, scope);
		};

		/**
		 * Loads the specified queue of files and executes the callback ones they are loaded.
		 * This method is generally not used outside this class but it might be useful in some scenarios.
		 *
		 * @method loadScripts
		 * @param {Array} scripts Array of queue items to load.
		 * @param {function} callback Optional callback to execute ones all items are loaded.
		 * @param {Object} scope Optional scope to execute callback in.
		 */
		this.loadScripts = function(scripts, callback, scope) {
			var loadScripts;

			function execScriptLoadedCallbacks(url) {
				// Execute URL callback functions
				tinymce.each(scriptLoadedCallbacks[url], function(callback) {
					callback.func.call(callback.scope);
				});

				scriptLoadedCallbacks[url] = undefined;
			};

			queueLoadedCallbacks.push({
				func : callback,
				scope : scope || this
			});

			loadScripts = function() {
				var loadingScripts = tinymce.grep(scripts);

				// Current scripts has been handled
				scripts.length = 0;

				// Load scripts that needs to be loaded
				tinymce.each(loadingScripts, function(url) {
					// Script is already loaded then execute script callbacks directly
					if (states[url] == LOADED) {
						execScriptLoadedCallbacks(url);
						return;
					}

					// Is script not loading then start loading it
					if (states[url] != LOADING) {
						states[url] = LOADING;
						loading++;

						loadScript(url, function() {
							states[url] = LOADED;
							loading--;

							execScriptLoadedCallbacks(url);

							// Load more scripts if they where added by the recently loaded script
							loadScripts();
						});
					}
				});

				// No scripts are currently loading then execute all pending queue loaded callbacks
				if (!loading) {
					tinymce.each(queueLoadedCallbacks, function(callback) {
						callback.func.call(callback.scope);
					});

					queueLoadedCallbacks.length = 0;
				}
			};

			loadScripts();
		};
	};

	// Global script loader
	tinymce.ScriptLoader = new tinymce.dom.ScriptLoader();
})(tinymce);
<commit_msg>FIXED: When a plugin or other resource fails to load a message is logged to the console if available and the editor continues to load. Previously the editor would fail to load if any plugin wasn't found.<commit_after>/**
 * ScriptLoader.js
 *
 * Copyright 2009, Moxiecode Systems AB
 * Released under LGPL License.
 *
 * License: http://tinymce.moxiecode.com/license
 * Contributing: http://tinymce.moxiecode.com/contributing
 */

(function(tinymce) {
	tinymce.dom.ScriptLoader = function(settings) {
		var QUEUED = 0,
			LOADING = 1,
			LOADED = 2,
			states = {},
			queue = [],
			scriptLoadedCallbacks = {},
			queueLoadedCallbacks = [],
			loading = 0,
			undefined;

		/**
		 * Loads a specific script directly without adding it to the load queue.
		 *
		 * @method load
		 * @param {String} url Absolute URL to script to add.
		 * @param {function} callback Optional callback function to execute ones this script gets loaded.
		 * @param {Object} scope Optional scope to execute callback in.
		 */
		function loadScript(url, callback) {
			var t = this, dom = tinymce.DOM, elm, uri, loc, id;

			// Execute callback when script is loaded
			function done() {
				dom.remove(id);

				if (elm)
					elm.onreadystatechange = elm.onload = elm = null;

				callback();
			};

			function error() {
				// Report the error and then try to carry on anyway - it's probably just a plugin that will go missing.
				if (typeof(console) !== "undefined" && console.log)
					console.log("Failed to load: " + url);

				done();
			};

			id = dom.uniqueId();

			if (tinymce.isIE6) {
				uri = new tinymce.util.URI(url);
				loc = location;

				// If script is from same domain and we
				// use IE 6 then use XHR since it's more reliable
				if (uri.host == loc.hostname && uri.port == loc.port && (uri.protocol + ':') == loc.protocol) {
					tinymce.util.XHR.send({
						url : tinymce._addVer(uri.getURI()),
						success : function(content) {
							// Create new temp script element
							var script = dom.create('script', {
								type : 'text/javascript'
							});

							// Evaluate script in global scope
							script.text = content;
							document.getElementsByTagName('head')[0].appendChild(script);
							dom.remove(script);

							done();
						},

						error : error
					});

					return;
				}
			}

			// Create new script element
			elm = dom.create('script', {
				id : id,
				type : 'text/javascript',
				src : tinymce._addVer(url)
			});

			// Add onload and readystate listeners
			elm.onload = done;
			elm.onerror = error;
			elm.onreadystatechange = function() {
				var state = elm.readyState;

				// Loaded state is passed on IE 6 however there
				// are known issues with this method but we can't use
				// XHR in a cross domain loading
				if (state == 'complete' || state == 'loaded')
					done();
			};

			// Most browsers support this feature so we report errors
			// for those at least to help users track their missing plugins etc
			// todo: Removed since it produced error if the document is unloaded by navigating away, re-add it as an option
			/*elm.onerror = function() {
				alert('Failed to load: ' + url);
			};*/

			// Add script to document
			(document.getElementsByTagName('head')[0] || document.body).appendChild(elm);
		};

		/**
		 * Returns true/false if a script has been loaded or not.
		 *
		 * @method isDone
		 * @param {String} url URL to check for.
		 * @return [Boolean} true/false if the URL is loaded.
		 */
		this.isDone = function(url) {
			return states[url] == LOADED;
		};

		/**
		 * Marks a specific script to be loaded. This can be useful if a script got loaded outside
		 * the script loader or to skip it from loading some script.
		 *
		 * @method markDone
		 * @param {string} u Absolute URL to the script to mark as loaded.
		 */
		this.markDone = function(url) {
			states[url] = LOADED;
		};

		/**
		 * Adds a specific script to the load queue of the script loader.
		 *
		 * @method add
		 * @param {String} url Absolute URL to script to add.
		 * @param {function} callback Optional callback function to execute ones this script gets loaded.
		 * @param {Object} scope Optional scope to execute callback in.
		 */
		this.add = this.load = function(url, callback, scope) {
			var item, state = states[url];

			// Add url to load queue
			if (state == undefined) {
				queue.push(url);
				states[url] = QUEUED;
			}

			if (callback) {
				// Store away callback for later execution
				if (!scriptLoadedCallbacks[url])
					scriptLoadedCallbacks[url] = [];

				scriptLoadedCallbacks[url].push({
					func : callback,
					scope : scope || this
				});
			}
		};

		/**
		 * Starts the loading of the queue.
		 *
		 * @method loadQueue
		 * @param {function} callback Optional callback to execute when all queued items are loaded.
		 * @param {Object} scope Optional scope to execute the callback in.
		 */
		this.loadQueue = function(callback, scope) {
			this.loadScripts(queue, callback, scope);
		};

		/**
		 * Loads the specified queue of files and executes the callback ones they are loaded.
		 * This method is generally not used outside this class but it might be useful in some scenarios.
		 *
		 * @method loadScripts
		 * @param {Array} scripts Array of queue items to load.
		 * @param {function} callback Optional callback to execute ones all items are loaded.
		 * @param {Object} scope Optional scope to execute callback in.
		 */
		this.loadScripts = function(scripts, callback, scope) {
			var loadScripts;

			function execScriptLoadedCallbacks(url) {
				// Execute URL callback functions
				tinymce.each(scriptLoadedCallbacks[url], function(callback) {
					callback.func.call(callback.scope);
				});

				scriptLoadedCallbacks[url] = undefined;
			};

			queueLoadedCallbacks.push({
				func : callback,
				scope : scope || this
			});

			loadScripts = function() {
				var loadingScripts = tinymce.grep(scripts);

				// Current scripts has been handled
				scripts.length = 0;

				// Load scripts that needs to be loaded
				tinymce.each(loadingScripts, function(url) {
					// Script is already loaded then execute script callbacks directly
					if (states[url] == LOADED) {
						execScriptLoadedCallbacks(url);
						return;
					}

					// Is script not loading then start loading it
					if (states[url] != LOADING) {
						states[url] = LOADING;
						loading++;

						loadScript(url, function() {
							states[url] = LOADED;
							loading--;

							execScriptLoadedCallbacks(url);

							// Load more scripts if they where added by the recently loaded script
							loadScripts();
						});
					}
				});

				// No scripts are currently loading then execute all pending queue loaded callbacks
				if (!loading) {
					tinymce.each(queueLoadedCallbacks, function(callback) {
						callback.func.call(callback.scope);
					});

					queueLoadedCallbacks.length = 0;
				}
			};

			loadScripts();
		};
	};

	// Global script loader
	tinymce.ScriptLoader = new tinymce.dom.ScriptLoader();
})(tinymce);
<|endoftext|>


<commit_before>/**
 * NativeListBox.js
 *
 * Copyright, Moxiecode Systems AB
 * Released under LGPL License.
 *
 * License: http://www.tinymce.com/license
 * Contributing: http://www.tinymce.com/contributing
 */

(function(tinymce) {
	var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher, undef;

	/**
	 * This class is used to create list boxes/select list. This one will generate
	 * a native control the way that the browser produces them by default.
	 *
	 * @class tinymce.ui.NativeListBox
	 * @extends tinymce.ui.ListBox
	 */
	tinymce.create('tinymce.ui.NativeListBox:tinymce.ui.ListBox', {
		/**
		 * Constructs a new button control instance.
		 *
		 * @constructor
		 * @method NativeListBox
		 * @param {String} id Button control id for the button.
		 * @param {Object} s Optional name/value settings object.
		 */
		NativeListBox : function(id, s) {
			this.parent(id, s);
			this.classPrefix = 'mceNativeListBox';
		},

		/**
		 * Sets the disabled state for the control. This will add CSS classes to the
		 * element that contains the control. So that it can be disabled visually.
		 *
		 * @method setDisabled
		 * @param {Boolean} s Boolean state if the control should be disabled or not.
		 */
		setDisabled : function(s) {
			DOM.get(this.id).disabled = s;
			this.setAriaProperty('disabled', s);
		},

		/**
		 * Returns true/false if the control is disabled or not. This is a method since you can then
		 * choose to check some class or some internal bool state in subclasses.
		 *
		 * @method isDisabled
		 * @return {Boolean} true/false if the control is disabled or not.
		 */
		isDisabled : function() {
			return DOM.get(this.id).disabled;
		},

		/**
		 * Selects a item/option by value. This will both add a visual selection to the
		 * item and change the title of the control to the title of the option.
		 *
		 * @method select
		 * @param {String/function} va Value to look for inside the list box or a function selector.
		 */
		select : function(va) {
			var t = this, fv, f;

			if (va == undef)
				return t.selectByIndex(-1);

			// Is string or number make function selector
			if (va && typeof(va)=="function")
				f = va;
			else {
				f = function(v) {
					return v == va;
				};
			}

			// Do we need to do something?
			if (va != t.selectedValue) {
				// Find item
				each(t.items, function(o, i) {
					if (f(o.value)) {
						fv = 1;
						t.selectByIndex(i);
						return false;
					}
				});

				if (!fv)
					t.selectByIndex(-1);
			}
		},

		/**
		 * Selects a item/option by index. This will both add a visual selection to the
		 * item and change the title of the control to the title of the option.
		 *
		 * @method selectByIndex
		 * @param {String} idx Index to select, pass -1 to select menu/title of select box.
		 */
		selectByIndex : function(idx) {
			DOM.get(this.id).selectedIndex = idx + 1;
			this.selectedValue = this.items[idx] ? this.items[idx].value : null;
		},

		/**
		 * Adds a option item to the list box.
		 *
		 * @method add
		 * @param {String} n Title for the new option.
		 * @param {String} v Value for the new option.
		 * @param {Object} o Optional object with settings like for example class.
		 */
		add : function(n, v, a) {
			var o, t = this;

			a = a || {};
			a.value = v;

			if (t.isRendered())
				DOM.add(DOM.get(this.id), 'option', a, n);

			o = {
				title : n,
				value : v,
				attribs : a
			};

			t.items.push(o);
			t.onAdd.dispatch(t, o);
		},

		/**
		 * Executes the specified callback function for the menu item. In this case when the user clicks the menu item.
		 *
		 * @method getLength
		 */
		getLength : function() {
			return this.items.length;
		},

		/**
		 * Renders the list box as a HTML string. This method is much faster than using the DOM and when
		 * creating a whole toolbar with buttons it does make a lot of difference.
		 *
		 * @method renderHTML
		 * @return {String} HTML for the list box control element.
		 */
		renderHTML : function() {
			var h, t = this;

			h = DOM.createHTML('option', {value : ''}, '-- ' + t.settings.title + ' --');

			each(t.items, function(it) {
				h += DOM.createHTML('option', {value : it.value}, it.title);
			});

			h = DOM.createHTML('select', {id : t.id, 'class' : 'mceNativeListBox', 'aria-labelledby': t.id + '_aria'}, h);
			h += DOM.createHTML('span', {id : t.id + '_aria', 'style': 'display: none'}, t.settings.title);
			return h;
		},

		/**
		 * Post render handler. This function will be called after the UI has been
		 * rendered so that events can be added.
		 *
		 * @method postRender
		 */
		postRender : function() {
			var t = this, ch, changeListenerAdded = true;

			t.rendered = true;

			function onChange(e) {
				var v = t.items[e.target.selectedIndex - 1];

				if (v && (v = v.value)) {
					t.onChange.dispatch(t, v);

					if (t.settings.onselect)
						t.settings.onselect(v);
				}
			};

			Event.add(t.id, 'change', onChange);

			// Accessibility keyhandler
			Event.add(t.id, 'keydown', function(e) {
				var bf;

				Event.remove(t.id, 'change', ch);
				changeListenerAdded = false;

				bf = Event.add(t.id, 'blur', function() {
					if (changeListenerAdded) return;
					changeListenerAdded = true;
					Event.add(t.id, 'change', onChange);
					Event.remove(t.id, 'blur', bf);
				});

				//prevent default left and right keys on chrome - so that the keyboard navigation is used.
				if (tinymce.isWebKit && (e.keyCode==37 ||e.keyCode==39)) {
					return Event.prevent(e);
				}

				if (e.keyCode == 13 || e.keyCode == 32) {
					onChange(e);
					return Event.cancel(e);
				}
			});

			t.onPostRender.dispatch(t, DOM.get(t.id));
		}
	});
})(tinymce);
<commit_msg>Switched to DOM_VK variables instead of numbers for event codes<commit_after>/**
 * NativeListBox.js
 *
 * Copyright, Moxiecode Systems AB
 * Released under LGPL License.
 *
 * License: http://www.tinymce.com/license
 * Contributing: http://www.tinymce.com/contributing
 */

(function(tinymce) {
	var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher, undef;

	/**
	 * This class is used to create list boxes/select list. This one will generate
	 * a native control the way that the browser produces them by default.
	 *
	 * @class tinymce.ui.NativeListBox
	 * @extends tinymce.ui.ListBox
	 */
	tinymce.create('tinymce.ui.NativeListBox:tinymce.ui.ListBox', {
		/**
		 * Constructs a new button control instance.
		 *
		 * @constructor
		 * @method NativeListBox
		 * @param {String} id Button control id for the button.
		 * @param {Object} s Optional name/value settings object.
		 */
		NativeListBox : function(id, s) {
			this.parent(id, s);
			this.classPrefix = 'mceNativeListBox';
		},

		/**
		 * Sets the disabled state for the control. This will add CSS classes to the
		 * element that contains the control. So that it can be disabled visually.
		 *
		 * @method setDisabled
		 * @param {Boolean} s Boolean state if the control should be disabled or not.
		 */
		setDisabled : function(s) {
			DOM.get(this.id).disabled = s;
			this.setAriaProperty('disabled', s);
		},

		/**
		 * Returns true/false if the control is disabled or not. This is a method since you can then
		 * choose to check some class or some internal bool state in subclasses.
		 *
		 * @method isDisabled
		 * @return {Boolean} true/false if the control is disabled or not.
		 */
		isDisabled : function() {
			return DOM.get(this.id).disabled;
		},

		/**
		 * Selects a item/option by value. This will both add a visual selection to the
		 * item and change the title of the control to the title of the option.
		 *
		 * @method select
		 * @param {String/function} va Value to look for inside the list box or a function selector.
		 */
		select : function(va) {
			var t = this, fv, f;

			if (va == undef)
				return t.selectByIndex(-1);

			// Is string or number make function selector
			if (va && typeof(va)=="function")
				f = va;
			else {
				f = function(v) {
					return v == va;
				};
			}

			// Do we need to do something?
			if (va != t.selectedValue) {
				// Find item
				each(t.items, function(o, i) {
					if (f(o.value)) {
						fv = 1;
						t.selectByIndex(i);
						return false;
					}
				});

				if (!fv)
					t.selectByIndex(-1);
			}
		},

		/**
		 * Selects a item/option by index. This will both add a visual selection to the
		 * item and change the title of the control to the title of the option.
		 *
		 * @method selectByIndex
		 * @param {String} idx Index to select, pass -1 to select menu/title of select box.
		 */
		selectByIndex : function(idx) {
			DOM.get(this.id).selectedIndex = idx + 1;
			this.selectedValue = this.items[idx] ? this.items[idx].value : null;
		},

		/**
		 * Adds a option item to the list box.
		 *
		 * @method add
		 * @param {String} n Title for the new option.
		 * @param {String} v Value for the new option.
		 * @param {Object} o Optional object with settings like for example class.
		 */
		add : function(n, v, a) {
			var o, t = this;

			a = a || {};
			a.value = v;

			if (t.isRendered())
				DOM.add(DOM.get(this.id), 'option', a, n);

			o = {
				title : n,
				value : v,
				attribs : a
			};

			t.items.push(o);
			t.onAdd.dispatch(t, o);
		},

		/**
		 * Executes the specified callback function for the menu item. In this case when the user clicks the menu item.
		 *
		 * @method getLength
		 */
		getLength : function() {
			return this.items.length;
		},

		/**
		 * Renders the list box as a HTML string. This method is much faster than using the DOM and when
		 * creating a whole toolbar with buttons it does make a lot of difference.
		 *
		 * @method renderHTML
		 * @return {String} HTML for the list box control element.
		 */
		renderHTML : function() {
			var h, t = this;

			h = DOM.createHTML('option', {value : ''}, '-- ' + t.settings.title + ' --');

			each(t.items, function(it) {
				h += DOM.createHTML('option', {value : it.value}, it.title);
			});

			h = DOM.createHTML('select', {id : t.id, 'class' : 'mceNativeListBox', 'aria-labelledby': t.id + '_aria'}, h);
			h += DOM.createHTML('span', {id : t.id + '_aria', 'style': 'display: none'}, t.settings.title);
			return h;
		},

		/**
		 * Post render handler. This function will be called after the UI has been
		 * rendered so that events can be added.
		 *
		 * @method postRender
		 */
		postRender : function() {
			var t = this, ch, changeListenerAdded = true;

			t.rendered = true;

			function onChange(e) {
				var v = t.items[e.target.selectedIndex - 1];

				if (v && (v = v.value)) {
					t.onChange.dispatch(t, v);

					if (t.settings.onselect)
						t.settings.onselect(v);
				}
			};

			Event.add(t.id, 'change', onChange);

			// Accessibility keyhandler
			Event.add(t.id, 'keydown', function(e) {
				var bf;

				Event.remove(t.id, 'change', ch);
				changeListenerAdded = false;

				bf = Event.add(t.id, 'blur', function() {
					if (changeListenerAdded) return;
					changeListenerAdded = true;
					Event.add(t.id, 'change', onChange);
					Event.remove(t.id, 'blur', bf);
				});

				var DOM_VK_LEFT = 37, DOM_VK_RIGHT = 39, DOM_VK_UP = 38, DOM_VK_DOWN = 40, DOM_VK_RETURN = 13, DOM_VK_SPACE = 32;

				//prevent default left and right keys on chrome - so that the keyboard navigation is used.
				if (tinymce.isWebKit && (e.keyCode == DOM_VK_LEFT || e.keyCode == DOM_VK_RIGHT)) {
					return Event.prevent(e);
				}

				if (e.keyCode == DOM_VK_RETURN || e.keyCode == DOM_VK_SPACE) {
					onChange(e);
					return Event.cancel(e);
				}
			});

			t.onPostRender.dispatch(t, DOM.get(t.id));
		}
	});
})(tinymce);
<|endoftext|>


<commit_before>//functions for map.js
//add different maps based on the map view box selected
function addMapview () {
        //if point map selected
        if ($('input.checkview')[0].checked) {
            rebuild(sel_args);
            if (sel_args.rte && sel_args.dir) {
                rebuildPath(sel_args);
            }
        } else {
            //clear layers
            removeLayers(mymap);
            buildHeatmap(sel_args, addOriginHeatMap, addDestHeatMap);
        }
}

//remove layers
function removeLayers(map) {
    map.eachLayer(function(layer) {
        if (layer instanceof L.TileLayer == false) {
            map.removeLayer(layer);
            //console.log("removed layer!");
            //console.log(layer._leaflet_id);
        }
    })
}

//clear all points and path layers
function resetLayers() {
    origMarkersLayer.clearLayers();
    destMarkersLayer.clearLayers();
    odPairLayerGroup.clearLayers();
    boundaryLayer.clearLayers();
}

//add origin points heatmap to mymap
function addOriginHeatMap(originList) {
    originHeatGroup.clearLayers();
    var originHeat = L.heatLayer(originList, heatmapOptions);
    //add origin points heatmap to mymap
    originHeat.redraw();
    console.log("redraw heatmap!");
    originHeat.addTo(mymap);
    console.log("add origin heatmap executed!");
}

//add destination points heatmap to mymap
function addDestHeatMap(destinationList) {
    var destHeat = L.heatLayer(destinationList, heatmapOptions);
    //add origin points heatmap to mymap
    destHeat.redraw();
    console.log("redraw dest heatmap!");
    destHeat.addTo(mymap);
    console.log("add dest heatmap executed!");
}

// add route GeoJson to map based on sel_line and sel_dir
function addRouteJson(sel_line, sel_dir) {
    routeLayer.clearLayers();
    console.log(sel_line);
    console.log(sel_dir);

    if (sel_dir === undefined) {
        sel_dir = 0;
    }
    console.log(sel_dir);

    var routeJson = sel_line + '_' + sel_dir + '_routes.geojson';
    console.log(routeJson);
    var path = base + 'static/geojson/';

    $.getJSON(path + routeJson, function(data) {
        var route = L.geoJson(data, {
            style: function (feature) {
                return {
                        color: getBaseColor(feature.properties.rte),
                        weight: 2.5,
                        opacity: 0.80
                };
            }
        }).addTo(routeLayer);

        routeLayer.addTo(mymap);
        routeLayer.bringToFront();
        console.log("added to mymap!");
    })

}

//function to add geojson layer to map
function addLayer(geojson) {
    //console.log(geojson);
    var path = base + 'static/geojson/';

    $.getJSON(path + geojson, function(data) {
        console.log(data);
        var boundary = L.geoJson(data, {
            style: function (feature) {
                console.log(feature);
                if (geojson == 'tm_fill.geojson')
                {
                    return {
                        color: "#909090",
                        weight: 2.0,
                        opacity: 0.8,
                        fillOpacity: 0.0
                    }
                } else if (geojson == 'sep_bounds.geojson')
                {
                    return {
                        color: getBdyColor(sep_dict[feature.properties.label1]),
                        weight: 2.0,
                        opacity: 0.8,
                        fillOpacity: 0.6
                    }
                } else
                {
                    return {
                        color: getBdyColor(),
                        weight: 2.0,
                        opacity: 0.8,
                        fillOpacity: 0.6
                    }
                }
            }
        }).addTo(boundaryLayer);
        //console.log(boundary);

        boundaryLayer.addTo(mymap);
        boundaryLayer.bringToBack();
        console.log(geojson + " added to mymap!");
    })
}

//function to send query to map/_query to args and build the points map
function rebuild(args) {
    //clear previous orig and dest markers
    resetLayers();

    console.log(args);

    $.getJSON('map/_query', args, function(data) {
        //retrive origin and destination lat and lng
        console.log(data);

        $(data.data).each(function(index, item) {
            // get origin lat and long from data.data json
            var o_lat = item.o_lat;
            var o_lng = item.o_lng;
            // get destination lat and long
            var d_lat = item.d_lat;
            var d_lng = item.d_lng;

            // defines popup content for orig markers
            var orig_popup = L.popup().setLatLng([o_lat,o_lng]).setContent(
                "Route:" + " " + item.rte_desc + '
' +
                "Direction:" + " " + item.dir_desc + '
' +
                "Origin:" + " " + item.o_type);

            // defines popup content for destination markers
            var dest_popup = L.popup().setLatLng([d_lat,d_lng]).setContent(
                "Route:" + " " + item.rte_desc + '
' +
                "Direction:" + " " + item.dir_desc + '
' +
                "Destination:" + " " + item.d_type);
            // lat and lng for orig and dest markers
            var olatlng = L.latLng(o_lat,o_lng);
            var dlatlng = L.latLng(d_lat,d_lng);

            //defines orig marker
            var orig_marker = L.circleMarker(olatlng, omarkerStyle).bindPopup(orig_popup, {showOnMouseOver:true});
            //defines dest marker
            var dest_marker = L.circleMarker(dlatlng, dmarkerStyle).bindPopup(dest_popup, {showOnMouseOver:true});
            //add orig and dest markers to odPairLayerGroup
            odPairLayerGroup.addLayer(orig_marker);
            odPairLayerGroup.addLayer(dest_marker);
            // add odPairLayerGroup to mymap
            odPairLayerGroup.addTo(mymap);
        });
    });
    addLabel();
}

//function to send query to map/_data to return boundary summary data
function requestBoundaryData(args, geojson, callback) {

    console.log(args);

    $.getJSON('map/_data', args, function(data) {

        console.log(data);
        data = data.data;
        console.log(data);

        buildDict(data, 'sep');
        console.log(sep_dict);

        if(callback) {
            callback(geojson);
        }

    });
    //addLabel();
}

//function to loop through an array and build a dictionary
function buildDict(array,args) {
    len = array.length;
    for (var i = 0; i < len; i++) {
        if (args == 'sep') {
            key = array[i]["sep"];
            value = array[i]["percentage"];
            console.log(key, ' ', value);
            sep_dict[key] = value;
        }
    }
    return sep_dict;
}

//to build the origin and destination points arrays
function buildHeatmap(args, callback1, callback2) {

    odPairLayerGroup.clearLayers();
    console.log(args);

    $.getJSON('map/_query', args, function(data) {
        //clear the origin and destination points arrays
        originList.length = 0;
        console.log("origin list array cleared!");
        destinationList.length = 0;
        console.log("destinationList cleared!");

        console.log(data);

        $(data.data).each(function(index, item) {
            // get origin lat and long from data.data json
            var o_lat = item.o_lat;
            var o_lng = item.o_lng;
            // get destination lat and long
            var d_lat = item.d_lat;
            var d_lng = item.d_lng;

            //adds origin and dest objects to their corresponding lists
            originList.push([o_lat, o_lng]);
            destinationList.push([d_lat, d_lng]);

        });
        console.log(originList.length);
        console.log(destinationList.length);
        if($('input.checkview')[1].checked && callback1) {
            callback1(originList);
        }
        if ($('input.checkview')[2].checked && callback2) {
            callback2(destinationList);
        }
    });
}

//to add path between origin and destination points
function rebuildPath(args) {
    //clear layers
    odPairLayerGroup.clearLayers();

    console.log(args);

    $.getJSON('map/_query', args, function(data) {

        console.log(data);

        $(data.data).each(function(index, item) {
            // get origin lat and long from data.data json
            var o_lat = item.o_lat;
            var o_lng = item.o_lng;
            // get destination lat and long
            var d_lat = item.d_lat;
            var d_lng = item.d_lng;

            // lat and lng for orig and dest markers
            var olatlng = L.latLng([o_lat,o_lng]);
            var dlatlng = L.latLng([d_lat,d_lng]);
            //defines points pair list for the path
            var odPair = [olatlng, dlatlng];
            //defines the path that links orig and dest markers
            var pairPath = new L.Polyline(odPair, style);

            var popup = L. popup().setContent(
                "Route:" + " " + item.rte_desc + '
' +
                "Direction:" + " " + item.dir_desc + '
' +
                "Satisfaction:" + " " + item.satisfaction + '
' +
                "Travel Change:" + " " + item.travel_change + '
' +
                "Job Approval:" + " " + item.job_approval + '
' +
                "One Change:" + " " + item.one_change + '
' +
                "Origin:" + " " + item.o_type + '
' +
                "Destination:" + " " + item.d_type + '
' +
                "Ridership:" + " " + item.ridership + '
' +
                "Rider Years:" + " " + item.ride_years + '
' +
                "Age:" + " " + item.age + '
' +
                "Gender:" + " " + item.gender + '
' +
                "Income:" + " " + item.income
                );

            pairPath.bindPopup(popup);

            pairPath.on('mouseover', function(e) {

                var path = e.target;
                path.setStyle({
                    color:'purple',
                    opacity: 0.9,
                    weight:5,
                    dashArray: '10,10'
                });
                if (!L.Browser.ie && !L.Browser.opera && !L.Browser.edge) {
                    path.bringToFront();
                }
            });
            pairPath.on('mouseout', function(e) {
                var path = e.target;
                path.setStyle(style);
            });
            //defines orig marker
            var orig_marker = L.circleMarker(olatlng, omarkerStyle);
            //defines dest marker
            var dest_marker = L.circleMarker(dlatlng, dmarkerStyle);
            //adds the path to odPairLayerGroup
            odPairLayerGroup.addLayer(pairPath);
            odPairLayerGroup.addLayer(orig_marker);
            odPairLayerGroup.addLayer(dest_marker);
            //adds odPairLayerGroup to mymap
            odPairLayerGroup.addTo(mymap);
        });
    });
}

function removeHighlight() {
    //check for highlight
    if (highLight !== null) {
        //set default style
        highLight.setStyle(getDefaultStyle());
        //reset highLight
        highLight = null;
    }
}

function generateOriginHeatmap() {
    $('#origin-button').on('click', '#toggle', function(){
    console.log(this.value);

    resetLayers();
    console.log("reset points layers!")
    addOriginHeatMap(originList);
    console.log("added origin points heatmap!")
    });
}

//function for expanding/collapsing div content
function toggle_tb(){
    var div = $("#control-section");
    $('#toggle').unbind("click").click(function(){
         //div.slideToggle('fast');

         if ($(this).attr('value') == 'Hide') {
            console.log(this + 'hide selected')
            div.animate({
                height: '0%'
                }).hide()
            $(this).attr('value','Show')

        } else {
            console.log(this + 'show selected')
            div.animate({
                height: '100%'
                }).show()
            $(this).attr('value','Hide')

            }
       });
}

//add label to map
function addLabel() {

    if(hasLegend) {
        return
    }

    var legend = L.control({position: 'bottomleft'});

    legend.onAdd = function (map) {

        var div = L.DomUtil.create('div', 'info legend');
        categories = ['ORIGIN','DESTINATION'];

        for (var i = 0; i < categories.length; i++) {
            div.innerHTML +=
                ' ' +
                 (categories[i] ? categories[i] + '
' : '+');

        }

        return div;
    };

    legend.addTo(mymap);

    hasLegend = true;

}

function getColor(d) {
    return  d == 'ORIGIN' ? "#259CEF" :
            d == 'DESTINATION' ? "#4BF01B" :
                                 'red' ;
}

function getBaseColor(rte) {
    return rte == 90  ? '#d02c0f' :
           rte == 100 ? '#0069AA' :
           rte == 190 ? '#FFC425' :
           rte == 200 ? '#008752' :
           rte == 203 ? '#c044ec' :
           rte == 290 ? '#D15F27' :
                        '#1c4ca5' ;
}

function getBdyColor(pct) {
    return pct > 60 ? '#ff0000' :
            pct > 50 ? '#ff4000' :
            pct > 40 ? '#ff8000' :
            pct > 30 ? '#ffbf00' :
            pct > 20 ? '#ffff00' :
            pct > 10 ? '#bfff00' :
            pct > 5 ? '#80ff00' :
                       '#80ff00';
}<commit_msg>rewrote style functions, added interactivity<commit_after>//functions for map.js
//add different maps based on the map view box selected
function addMapview () {
        //if point map selected
        if ($('input.checkview')[0].checked) {
            rebuild(sel_args);
            if (sel_args.rte && sel_args.dir) {
                rebuildPath(sel_args);
            }
        } else {
            //clear layers
            removeLayers(mymap);
            buildHeatmap(sel_args, addOriginHeatMap, addDestHeatMap);
        }
}

//remove layers
function removeLayers(map) {
    map.eachLayer(function(layer) {
        if (layer instanceof L.TileLayer == false) {
            map.removeLayer(layer);
            //console.log("removed layer!");
            //console.log(layer._leaflet_id);
        }
    })
}

//clear all points and path layers
function resetLayers() {
    origMarkersLayer.clearLayers();
    destMarkersLayer.clearLayers();
    odPairLayerGroup.clearLayers();
    boundaryLayer.clearLayers();
}

//add origin points heatmap to mymap
function addOriginHeatMap(originList) {
    originHeatGroup.clearLayers();
    var originHeat = L.heatLayer(originList, heatmapOptions);
    //add origin points heatmap to mymap
    originHeat.redraw();
    console.log("redraw heatmap!");
    originHeat.addTo(mymap);
    console.log("add origin heatmap executed!");
}

//add destination points heatmap to mymap
function addDestHeatMap(destinationList) {
    var destHeat = L.heatLayer(destinationList, heatmapOptions);
    //add origin points heatmap to mymap
    destHeat.redraw();
    console.log("redraw dest heatmap!");
    destHeat.addTo(mymap);
    console.log("add dest heatmap executed!");
}

// add route GeoJson to map based on sel_line and sel_dir
function addRouteJson(sel_line, sel_dir) {
    routeLayer.clearLayers();
    console.log(sel_line);
    console.log(sel_dir);

    if (sel_dir === undefined) {
        sel_dir = 0;
    }
    console.log(sel_dir);

    var routeJson = sel_line + '_' + sel_dir + '_routes.geojson';
    console.log(routeJson);
    var path = base + 'static/geojson/';

    $.getJSON(path + routeJson, function(data) {
        var route = L.geoJson(data, {
            style: function (feature) {
                return {
                        color: getBaseColor(feature.properties.rte),
                        weight: 2.5,
                        opacity: 0.80
                };
            }
        }).addTo(routeLayer);

        routeLayer.addTo(mymap);
        routeLayer.bringToFront();
        console.log("added to mymap!");
    })

}

//function to add geojson layer to map
function addLayer(geojson) {
    //console.log(geojson);
    var path = base + 'static/geojson/';

    $.getJSON(path + geojson, function(data) {
        console.log(data);
        boundary = L.geoJson(data, {
            style: switchStyle(geojson),
            onEachFeature: onEachFeature
        }).addTo(boundaryLayer);
        //console.log(boundary);

        boundaryLayer.addTo(mymap);
        boundaryLayer.bringToFront();
        console.log(geojson + " added to mymap!");
    })
}

//function to zoom to a sep area
function zoomToFeature(e) {
    mymap.fitBounds(e.target.getBounds());
}

//function to pick a style based on boundary layer
function switchStyle(geojson) {
    if (geojson == tmLayer) {
        return style
    } else if (geojson == sepLayer){
        return sepStyle
    } else {
        return zipStyle
    }
}

//style function
function style(feature) {
    console.log(feature);
    return {
        color: "#909090",
        weight: 2.0,
        opacity: 0.8,
        fillOpacity: 0.0
    }
}

//style for sep
function sepStyle(feature){
    return {
        fillColor: getBdyColor(sep_dict[feature.properties.label1]),
        weight: 2.0,
        opacity: 0.8,
        color: 'white',
        fillOpacity: 0.6
    }
}

//style for zipcode
function zipStyle(feature){
    return {
        color: getBdyColor(),
        weight: 2.0,
        opacity: 0.8,
        fillOpacity: 0.6
    }
}

//function to highlight layer when a mouse hovers over
function highlightFeature(e) {
    var layer = e.target;

    layer.openPopup();

    layer.setStyle({
        weight: 5,
        color: '#666',
        dashArray: '',
        fillOpacity: 0.7
    });

    if (!L.Browser.ie && !L.Browser.opera && !L.Browser.edge) {
        layer.bringToFront();
    }
}

//reset style on mouseout
function resetHighlight(e) {
    var layer = e.target;
    boundary.resetStyle(layer);
    layer.closePopup();

}

//use onEachFeature option to add listeners on sep layers
function onEachFeature(feature, layer) {
    var popupContent = "SEP: " + feature.properties.label1;
    layer.bindPopup(popupContent);

    layer.on({
        mouseover: highlightFeature,
        mouseout: resetHighlight,
        click: zoomToFeature
    });
}

//function to send query to map/_query to args and build the points map
function rebuild(args) {
    //clear previous orig and dest markers
    resetLayers();

    console.log(args);

    $.getJSON('map/_query', args, function(data) {
        //retrive origin and destination lat and lng
        console.log(data);

        $(data.data).each(function(index, item) {
            // get origin lat and long from data.data json
            var o_lat = item.o_lat;
            var o_lng = item.o_lng;
            // get destination lat and long
            var d_lat = item.d_lat;
            var d_lng = item.d_lng;

            // defines popup content for orig markers
            var orig_popup = L.popup().setLatLng([o_lat,o_lng]).setContent(
                "Route:" + " " + item.rte_desc + '
' +
                "Direction:" + " " + item.dir_desc + '
' +
                "Origin:" + " " + item.o_type);

            // defines popup content for destination markers
            var dest_popup = L.popup().setLatLng([d_lat,d_lng]).setContent(
                "Route:" + " " + item.rte_desc + '
' +
                "Direction:" + " " + item.dir_desc + '
' +
                "Destination:" + " " + item.d_type);
            // lat and lng for orig and dest markers
            var olatlng = L.latLng(o_lat,o_lng);
            var dlatlng = L.latLng(d_lat,d_lng);

            //defines orig marker
            var orig_marker = L.circleMarker(olatlng, omarkerStyle).bindPopup(orig_popup, {showOnMouseOver:true});
            //defines dest marker
            var dest_marker = L.circleMarker(dlatlng, dmarkerStyle).bindPopup(dest_popup, {showOnMouseOver:true});
            //add orig and dest markers to odPairLayerGroup
            odPairLayerGroup.addLayer(orig_marker);
            odPairLayerGroup.addLayer(dest_marker);
            // add odPairLayerGroup to mymap
            odPairLayerGroup.addTo(mymap);
        });
    });
    addLabel();
}

//function to send query to map/_data to return boundary summary data
function requestBoundaryData(args, geojson, callback) {

    console.log(args);

    $.getJSON('map/_data', args, function(data) {

        console.log(data);
        data = data.data;
        console.log(data);

        buildDict(data, 'sep');
        console.log(sep_dict);

        if(callback) {
            callback(geojson);
        }

    });
    //addLabel();
}

//function to loop through an array and build a dictionary
function buildDict(array,args) {
    len = array.length;
    for (var i = 0; i < len; i++) {
        if (args == 'sep') {
            key = array[i]["sep"];
            value = array[i]["percentage"];
            console.log(key, ' ', value);
            sep_dict[key] = value;
        }
    }
    return sep_dict;
}

//to build the origin and destination points arrays
function buildHeatmap(args, callback1, callback2) {

    odPairLayerGroup.clearLayers();
    console.log(args);

    $.getJSON('map/_query', args, function(data) {
        //clear the origin and destination points arrays
        originList.length = 0;
        console.log("origin list array cleared!");
        destinationList.length = 0;
        console.log("destinationList cleared!");

        console.log(data);

        $(data.data).each(function(index, item) {
            // get origin lat and long from data.data json
            var o_lat = item.o_lat;
            var o_lng = item.o_lng;
            // get destination lat and long
            var d_lat = item.d_lat;
            var d_lng = item.d_lng;

            //adds origin and dest objects to their corresponding lists
            originList.push([o_lat, o_lng]);
            destinationList.push([d_lat, d_lng]);

        });
        console.log(originList.length);
        console.log(destinationList.length);
        if($('input.checkview')[1].checked && callback1) {
            callback1(originList);
        }
        if ($('input.checkview')[2].checked && callback2) {
            callback2(destinationList);
        }
    });
}

//to add path between origin and destination points
function rebuildPath(args) {
    //clear layers
    odPairLayerGroup.clearLayers();

    console.log(args);

    $.getJSON('map/_query', args, function(data) {

        console.log(data);

        $(data.data).each(function(index, item) {
            // get origin lat and long from data.data json
            var o_lat = item.o_lat;
            var o_lng = item.o_lng;
            // get destination lat and long
            var d_lat = item.d_lat;
            var d_lng = item.d_lng;

            // lat and lng for orig and dest markers
            var olatlng = L.latLng([o_lat,o_lng]);
            var dlatlng = L.latLng([d_lat,d_lng]);
            //defines points pair list for the path
            var odPair = [olatlng, dlatlng];
            //defines the path that links orig and dest markers
            var pairPath = new L.Polyline(odPair, style);

            var popup = L. popup().setContent(
                "Route:" + " " + item.rte_desc + '
' +
                "Direction:" + " " + item.dir_desc + '
' +
                "Satisfaction:" + " " + item.satisfaction + '
' +
                "Travel Change:" + " " + item.travel_change + '
' +
                "Job Approval:" + " " + item.job_approval + '
' +
                "One Change:" + " " + item.one_change + '
' +
                "Origin:" + " " + item.o_type + '
' +
                "Destination:" + " " + item.d_type + '
' +
                "Ridership:" + " " + item.ridership + '
' +
                "Rider Years:" + " " + item.ride_years + '
' +
                "Age:" + " " + item.age + '
' +
                "Gender:" + " " + item.gender + '
' +
                "Income:" + " " + item.income
                );

            pairPath.bindPopup(popup);

            pairPath.on('mouseover', function(e) {

                var path = e.target;
                path.setStyle({
                    color:'purple',
                    opacity: 0.9,
                    weight:5,
                    dashArray: '10,10'
                });
                if (!L.Browser.ie && !L.Browser.opera && !L.Browser.edge) {
                    path.bringToFront();
                }
            });
            pairPath.on('mouseout', function(e) {
                var path = e.target;
                path.setStyle(style);
            });
            //defines orig marker
            var orig_marker = L.circleMarker(olatlng, omarkerStyle);
            //defines dest marker
            var dest_marker = L.circleMarker(dlatlng, dmarkerStyle);
            //adds the path to odPairLayerGroup
            odPairLayerGroup.addLayer(pairPath);
            odPairLayerGroup.addLayer(orig_marker);
            odPairLayerGroup.addLayer(dest_marker);
            //adds odPairLayerGroup to mymap
            odPairLayerGroup.addTo(mymap);
        });
    });
}

function removeHighlight() {
    //check for highlight
    if (highLight !== null) {
        //set default style
        highLight.setStyle(getDefaultStyle());
        //reset highLight
        highLight = null;
    }
}

function generateOriginHeatmap() {
    $('#origin-button').on('click', '#toggle', function(){
    console.log(this.value);

    resetLayers();
    console.log("reset points layers!")
    addOriginHeatMap(originList);
    console.log("added origin points heatmap!")
    });
}

//function for expanding/collapsing div content
function toggle_tb(){
    var div = $("#control-section");
    $('#toggle').unbind("click").click(function(){
         //div.slideToggle('fast');

         if ($(this).attr('value') == 'Hide') {
            console.log(this + 'hide selected')
            div.animate({
                height: '0%'
                }).hide()
            $(this).attr('value','Show')

        } else {
            console.log(this + 'show selected')
            div.animate({
                height: '100%'
                }).show()
            $(this).attr('value','Hide')

            }
       });
}

//add label to map
function addLabel() {

    if(hasLegend) {
        return
    }

    var legend = L.control({position: 'bottomleft'});

    legend.onAdd = function (map) {

        var div = L.DomUtil.create('div', 'info legend');
        categories = ['ORIGIN','DESTINATION'];

        for (var i = 0; i < categories.length; i++) {
            div.innerHTML +=
                ' ' +
                 (categories[i] ? categories[i] + '
' : '+');

        }

        return div;
    };

    legend.addTo(mymap);

    hasLegend = true;

}

function getColor(d) {
    return  d == 'ORIGIN' ? "#259CEF" :
            d == 'DESTINATION' ? "#4BF01B" :
                                 'red' ;
}

function getBaseColor(rte) {
    return rte == 90  ? '#d02c0f' :
           rte == 100 ? '#0069AA' :
           rte == 190 ? '#FFC425' :
           rte == 200 ? '#008752' :
           rte == 203 ? '#c044ec' :
           rte == 290 ? '#D15F27' :
                        '#1c4ca5' ;
}

function getBdyColor(pct) {
    return pct > 60 ? '#ff0000' :
            pct > 50 ? '#ff4000' :
            pct > 40 ? '#ff8000' :
            pct > 30 ? '#ffbf00' :
            pct > 20 ? '#ffff00' :
            pct > 10 ? '#bfff00' :
            pct > 5 ? '#80ff00' :
                       '#80ff00';
}<|endoftext|>


<commit_before>function themeSchool() {

}
<commit_msg>Update themeChanger.js<commit_after>function themeSchool() {
 document.getElementById('stylingLink').href = "musicplayerSchool.css";
}

function themeOriginal() {
 document.getElementById('stylingLink').href = "musicplayerSchool.css";
}

function themeNoStyle() {
 document.getElementById('stylingLink').href = "";
}
<|endoftext|>


<commit_before>var TextBooks = {
    term: undefined,

    show_books: function(term, textbook) {
        //Navbar.render_navbar("nav-sub");
        TextBooks.term = term;
        showLoading();
        CommonLoading.render_init();
        WSData.fetch_book_data(term, TextBooks.render_books, TextBooks.render_error);
        WSData.fetch_course_data_for_term(TextBooks.term, TextBooks.render_books, TextBooks.render_error);
        WSData.fetch_instructed_course_data_for_term(TextBooks.term, TextBooks.render_books, TextBooks.render_error);
    },

    render_error: function() {
        var book_err_status = WSData.book_data_error_code(TextBooks.term);
        var course_err_status = WSData.course_data_error_code(TextBooks.term);
        var instructed_course_err_status = WSData.instructed_course_data_error_code(TextBooks.term);

        if (book_err_status === 543 || course_err_status === 543 || instructed_course_err_status === 543) {
            var raw = CardWithError.render("Textbooks");
            $("#main-content").html(raw);
        } else {
            TextBooks.render_books();
        }
    },

    process_book_data: function(book_data, course_data, instructed_course_data) {
        var template_data = {
            "teaching_sections": [],
            "enrolled_sections": [],
            "sections": [],
            "quarter": course_data ? course_data.quarter : instructed_course_data.quarter,
            "year": course_data ? course_data.year: instructed_course_data.year,
            "summer_term": course_data ? course_data.summer_term : instructed_course_data.summer_term
        };

        var has_books = false;
        if (book_data !== undefined && book_data[section.sln] !== undefined && book_data[section.sln].length > 0) {
            has_books = true;
        }

        var section_data = function (i, section, instructor) {
            var has_book_data = false;
            if (book_data && book_data[section.sln] && book_data[section.sln].length) {
                has_book_data = true;
            }
            return {
                index: i,
                section_title: section.course_title,
                curriculum: section.curriculum_abbr,
                course_number: section.course_number,
                section_id: section.section_id,
                color_id: section.color_id,
                sln: section.sln,
                books: has_book_data ? book_data[section.sln] : [],
                has_books: has_book_data,
                is_instructor: instructor,
                bothell_campus: section.course_campus.toLowerCase() === 'bothell',
                tacoma_campus: section.course_campus.toLowerCase() === 'tacoma'
            };
        };

        if (course_data) {
            $.each(course_data.sections, function (index) {
                var section = section_data(index, this, false);
                template_data.enrolled_sections.push(section);
                template_data.sections.push(section);
            });
        }

        if (myuwFeatureEnabled('instructor_textbooks') && instructed_course_data) {
            $.each(instructed_course_data.sections, function (index) {
                var section = section_data(index, this, true);
                template_data.teaching_sections.push(section);
                template_data.sections.push(section);
            });
        }

        // Determine if we need to collapse the textbook sections and whether the user is teaching
        var num_sections = template_data.enrolled_sections.length + template_data.teaching_sections.length;
        template_data.collapse_sections = num_sections > 10;
        template_data.is_teaching = template_data.teaching_sections.length > 0;

        template_data.verba_link = book_data ? book_data.verba_link : null;
        return template_data;
    },

    _has_all_data: function () {
        var book_data = WSData.book_data(TextBooks.term);
        var course_data = WSData.course_data_for_term(TextBooks.term);
        var instructed_course_data = WSData.instructed_course_data_for_term(TextBooks.term);
        var book_data_err_status = WSData.course_data_error_code(TextBooks.term);
        var course_err_status = WSData.course_data_error_code(TextBooks.term);
        var instructed_course_err_status = WSData.instructed_course_data_error_code(TextBooks.term);

        return ((book_data ||
                 (book_data === undefined && book_data_err_status === 404)) &&
                (course_data ||
                 (course_data === undefined && course_err_status === 404)) &&
                (instructed_course_data ||
                 (instructed_course_data === undefined && instructed_course_err_status === 404)));
    },

    render_books: function() {
        if(!TextBooks._has_all_data()){
            return;
        }
        var term = TextBooks.term;
        $('html,body').animate({scrollTop: 0}, 'fast');
        var source   = $("#textbooks").html();
        var template = Handlebars.compile(source);
        var template_data = TextBooks.process_book_data(WSData.book_data(term),
                                                        WSData.course_data_for_term(term),
                                                        WSData.instructed_course_data_for_term(term));
        if (template_data !== undefined){
            $("#main-content").html(template(template_data));
        }

        // Scroll to correct section
        element = $("a[name='" + location.hash.substring(1) + "']");
        if (element.length > 0) {
                $('html, body').animate({
                scrollTop: element.offset().top
            });
        }
    }
};

/* node.js exports */
if (typeof exports == "undefined") {
    var exports = {};
}
exports.TextBooks = TextBooks;
<commit_msg>sync textbooks change<commit_after>var TextBooks = {
    term: undefined,

    show_books: function(term, textbook) {
        //Navbar.render_navbar("nav-sub");
        TextBooks.term = term;
        showLoading();
        CommonLoading.render_init();
        WSData.fetch_book_data(term, TextBooks.render_books, TextBooks.render_error);
        WSData.fetch_course_data_for_term(TextBooks.term, TextBooks.render_books, TextBooks.render_error);
        WSData.fetch_instructed_course_data_for_term(TextBooks.term, TextBooks.render_books, TextBooks.render_error);
    },

    render_error: function() {
        var book_err_status = WSData.book_data_error_code(TextBooks.term);
        var course_err_status = WSData.course_data_error_code(TextBooks.term);
        var instructed_course_err_status = WSData.instructed_course_data_error_code(TextBooks.term);

        if (book_err_status === 543 || course_err_status === 543 || instructed_course_err_status === 543) {
            var raw = CardWithError.render("Textbooks");
            $("#main-content").html(raw);
        } else {
            TextBooks.render_books();
        }
    },

    process_book_data: function(book_data, course_data, instructed_course_data) {
        var template_data = {
            "teaching_sections": [],
            "enrolled_sections": [],
            "sections": [],
            "quarter": course_data ? course_data.quarter : instructed_course_data.quarter,
            "year": course_data ? course_data.year: instructed_course_data.year,
            "summer_term": course_data ? course_data.summer_term : instructed_course_data.summer_term
        };

        var has_books = false;
        if (book_data !== undefined && book_data[section.sln] !== undefined && book_data[section.sln].length > 0) {
            has_books = true;
        }

        var section_data = function (i, section, instructor) {
            var has_book_data = false;
            if (book_data && book_data[section.sln] && book_data[section.sln].length) {
                has_book_data = true;
            }
            return {
                index: i,
                section_title: section.course_title,
                curriculum: section.curriculum_abbr,
                course_number: section.course_number,
                section_id: section.section_id,
                color_id: section.color_id,
                sln: section.sln,
                has_books: has_book_data,
                books: has_book_data ? book_data[section.sln] : [],
                is_instructor: instructor,
                bothell_campus: section.course_campus.toLowerCase() === 'bothell',
                tacoma_campus: section.course_campus.toLowerCase() === 'tacoma'
            };
        };

        if (course_data) {
            $.each(course_data.sections, function (index) {
                var section = section_data(index, this, false);
                template_data.enrolled_sections.push(section);
                template_data.sections.push(section);
            });
        }

        if (myuwFeatureEnabled('instructor_textbooks') && instructed_course_data) {
            $.each(instructed_course_data.sections, function (index) {
                var section = section_data(index, this, true);
                template_data.teaching_sections.push(section);
                template_data.sections.push(section);
            });
        }

        // Determine if we need to collapse the textbook sections and whether the user is teaching
        var num_sections = template_data.enrolled_sections.length + template_data.teaching_sections.length;
        template_data.collapse_sections = num_sections > 10;
        template_data.is_teaching = template_data.teaching_sections.length > 0;

        template_data.verba_link = book_data ? book_data.verba_link : null;
        return template_data;
    },

    _has_all_data: function () {
        var book_data = WSData.book_data(TextBooks.term);
        var course_data = WSData.course_data_for_term(TextBooks.term);
        var instructed_course_data = WSData.instructed_course_data_for_term(TextBooks.term);
        var book_data_err_status = WSData.course_data_error_code(TextBooks.term);
        var course_err_status = WSData.course_data_error_code(TextBooks.term);
        var instructed_course_err_status = WSData.instructed_course_data_error_code(TextBooks.term);

        return ((book_data ||
                 (book_data === undefined && book_data_err_status === 404)) &&
                (course_data ||
                 (course_data === undefined && course_err_status === 404)) &&
                (instructed_course_data ||
                 (instructed_course_data === undefined && instructed_course_err_status === 404)));
    },

    render_books: function() {
        if(!TextBooks._has_all_data()){
            return;
        }
        var term = TextBooks.term;
        $('html,body').animate({scrollTop: 0}, 'fast');
        var source   = $("#textbooks").html();
        var template = Handlebars.compile(source);
        var template_data = TextBooks.process_book_data(WSData.book_data(term),
                                                        WSData.course_data_for_term(term),
                                                        WSData.instructed_course_data_for_term(term));
        if (template_data !== undefined){
            $("#main-content").html(template(template_data));
        }

        // Scroll to correct section
        element = $("a[name='" + location.hash.substring(1) + "']");
        if (element.length > 0) {
                $('html, body').animate({
                scrollTop: element.offset().top
            });
        }
    }
};

/* node.js exports */
if (typeof exports == "undefined") {
    var exports = {};
}
exports.TextBooks = TextBooks;
<|endoftext|>


<commit_before>/*
 * Copyright 2014 Mirantis, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License. You may obtain
 * a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
**/
define(function() {
    'use strict';

    return {
        baseUrl: 'static',
        waitSeconds: 60,
        paths: {
            jquery: 'js/libs/bower/jquery/jquery',
            'jquery-cookie': 'js/libs/bower/jquery-cookie/jquery.cookie',
            'jquery-ui': 'js/libs/bower/jquery-ui/ui',
            'jquery-autoNumeric': 'js/libs/bower/autoNumeric/autoNumeric',
            utils: 'js/utils',
            expression: 'js/expression',
            keystone_client: 'js/keystone_client',
            lodash: 'js/libs/bower/lodash/dist/lodash.compat',
            underscore: 'js/libs/bower/lodash/dist/lodash.compat',
            backbone: 'js/libs/bower/backbone/backbone',
            'backbone-lodash-monkeypatch': 'js/libs/custom/backbone-lodash-monkeypatch',
            classnames: 'js/libs/bower/classnames/index',
            react: 'js/libs/bower/react/react-with-addons',
            JSXTransformer: 'js/libs/bower/react/JSXTransformer',
            jsx: 'js/libs/bower/jsx-requirejs-plugin/js/jsx',
            'react.backbone': 'js/libs/custom/react.backbone',
            stickit: 'js/libs/bower/backbone.stickit/backbone.stickit',
            coccyx: 'js/libs/custom/coccyx',
            cocktail: 'js/libs/bower/cocktail/Cocktail',
            routefilter: 'js/libs/bower/routefilter/dist/backbone.routefilter.min',
            bootstrap: 'js/libs/custom/bootstrap.min',
            text: 'js/libs/bower/requirejs-text/text',
            json: 'js/libs/bower/requirejs-plugins/src/json',
            i18next: 'js/libs/bower/i18next/release/i18next-1.7.1',
            deepModel: 'js/libs/bower/backbone-deep-model/distribution/deep-model',
            lessLibrary: 'js/libs/bower/less/dist/less',
            'require-css': 'js/libs/bower/require-css',
            'require-less': 'js/require-less',
            i18n: 'js/i18n',
            dispatcher: 'js/dispatcher',
            app: 'js/app',
            models: 'js/models',
            backbone_view_wrapper: 'js/backbone_view_wrapper',
            views: 'js/views',
            view_mixins: 'js/view_mixins',
            component_mixins: 'js/component_mixins',
            controls: 'js/views/controls'
        },
        shim: {
            'expression/parser': {
                exports: 'parser'
            },
            coccyx: {
                deps: ['backbone', 'underscore'],
                exports: 'Coccyx'
            },
            classnames: {
                exports: 'classNames'
            },
            bootstrap: {
                deps: ['jquery']
            },
            i18next: {
                deps: ['jquery'],
                exports: 'i18n'
            },
            'jquery-ui': {
                deps: ['jquery']
            },
            'jquery-autoNumeric': {
                deps: ['jquery']
            }
        },
        map: {
            '*': {
                less: 'require-less'
            }
        },
        jsx: {
            fileExtension: '.jsx'
        }
    };
});
<commit_msg>Add back explicit underscore dependency for Backbone.DeepModel<commit_after>/*
 * Copyright 2014 Mirantis, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License. You may obtain
 * a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
**/
define(function() {
    'use strict';

    return {
        baseUrl: 'static',
        waitSeconds: 60,
        paths: {
            jquery: 'js/libs/bower/jquery/jquery',
            'jquery-cookie': 'js/libs/bower/jquery-cookie/jquery.cookie',
            'jquery-ui': 'js/libs/bower/jquery-ui/ui',
            'jquery-autoNumeric': 'js/libs/bower/autoNumeric/autoNumeric',
            utils: 'js/utils',
            expression: 'js/expression',
            keystone_client: 'js/keystone_client',
            lodash: 'js/libs/bower/lodash/dist/lodash.compat',
            underscore: 'js/libs/bower/lodash/dist/lodash.compat',
            backbone: 'js/libs/bower/backbone/backbone',
            'backbone-lodash-monkeypatch': 'js/libs/custom/backbone-lodash-monkeypatch',
            classnames: 'js/libs/bower/classnames/index',
            react: 'js/libs/bower/react/react-with-addons',
            JSXTransformer: 'js/libs/bower/react/JSXTransformer',
            jsx: 'js/libs/bower/jsx-requirejs-plugin/js/jsx',
            'react.backbone': 'js/libs/custom/react.backbone',
            stickit: 'js/libs/bower/backbone.stickit/backbone.stickit',
            coccyx: 'js/libs/custom/coccyx',
            cocktail: 'js/libs/bower/cocktail/Cocktail',
            routefilter: 'js/libs/bower/routefilter/dist/backbone.routefilter.min',
            bootstrap: 'js/libs/custom/bootstrap.min',
            text: 'js/libs/bower/requirejs-text/text',
            json: 'js/libs/bower/requirejs-plugins/src/json',
            i18next: 'js/libs/bower/i18next/release/i18next-1.7.1',
            deepModel: 'js/libs/bower/backbone-deep-model/distribution/deep-model',
            lessLibrary: 'js/libs/bower/less/dist/less',
            'require-css': 'js/libs/bower/require-css',
            'require-less': 'js/require-less',
            i18n: 'js/i18n',
            dispatcher: 'js/dispatcher',
            app: 'js/app',
            models: 'js/models',
            backbone_view_wrapper: 'js/backbone_view_wrapper',
            views: 'js/views',
            view_mixins: 'js/view_mixins',
            component_mixins: 'js/component_mixins',
            controls: 'js/views/controls'
        },
        shim: {
            'expression/parser': {
                // non-AMD module; gulp-jison supports generation of AMD
                // modules, but they have broken stacktrace
                exports: 'parser'
            },
            coccyx: {
                // non-AMD module
                deps: ['backbone', 'underscore'],
                exports: 'Coccyx'
            },
            classnames: {
                // non-AMD module
                exports: 'classNames'
            },
            bootstrap: {
                // non-AMD module, relies on global jQuery
                deps: ['jquery']
            },
            i18next: {
                // non-AMD module, relies on global jQuery; there is AMD
                // version, but we still use i18n var in lodash templates,
                // so we should use non-AMD version until we get rid of
                // Backbone.View's completely
                deps: ['jquery'],
                exports: 'i18n'
            },
            deepModel: {
                // even though deepmodel uses AMD format, it uses _.mixin
                // before define() call
                deps: ['underscore']
            },
            'jquery-autoNumeric': {
                // non-AMD module, relies on global jQuery
                deps: ['jquery']
            }
        },
        map: {
            '*': {
                less: 'require-less'
            }
        },
        jsx: {
            fileExtension: '.jsx'
        }
    };
});
<|endoftext|>


<commit_before>// Import Modules
const INDEX = require('../../index.js')

// Import Packages
const _ = require('lodash')
const merge = require('merge')

// Define helper variables
const ws = INDEX.connection
const mongo = INDEX.mongo
const dispatcher = INDEX.dispatcher

/**
 * Function to watch for updates on all collections
 */
const watchUpdates = () => {
  for (var model in mongo.models) {
    ws.subscribe(`connapp.server.${model.toLowerCase()}.update`, function(data) {
      mongo.models[model]
      .findOne({_id: data._id}).exec()
      .then(res => {
        // deletes save so it won't conflict on merging
        delete res.save

        // merges with new data
        merge(res, data)

        // Makes sure this is treated as an update by the post save hook
        res.isNew = false

        // saves Updated item
        return res.save()
      })
      .then(res => {
        console.log(res)
      })
      .catch(err => console.log(err))
    })
  }
}

/**
 * Function to watch for inserts on all collections
 */
const watchInserts = () => {
  for (var model in mongo.models) {
    ws.subscribe(`connapp.server.${model.toLowerCase()}.insert`, function(data) {
      let doc = new mongo.models[model](data)

      // Make sure this is treated as new by the post-save hook
      doc.isNew = true

      doc.save()
        .then(res => {
          console.log(res)
        })
        .catch(err => console.log(err))
    })
  }
}

/**
 * Function to watch for inserts on all collections
 */
const watchSync = () => {
  for (var model in mongo.models) {
    const uri = `connapp.server.${model.toLowerCase()}.fetch`
    console.log(uri)
    ws.subscribe(uri, (args) => {
      ids = args.argsList[0].argsList
      console.log(ids)
      console.log('Fetch was triggered')
      mongo.models[model]
        .find({}).exec()
        .then(data => {
          console.log('data found: ' + data)
          // If nothing is found, does nothing
          if (!data.length) return true
          console.log('is array? ' + Array.isArray(ids))
          // Loops through the found data and dispatch route accordingly
          data.forEach(item => {
            const _id = item._id.toString()

            if ( ids.indexOf(_id) == -1 ) {
              console.log('sent to insert '+ item)
              dispatcher.insertToApp(model, item)
            } else {
              console.log('sent to update '+ item)
              dispatcher.updateDocumentToApp(model, _id, item)
            }
          })
	      })
        .catch(err => console.log(err))
    })
  }
}

const watchersObj = {
  watchUpdates: watchUpdates,
  watchInserts: watchInserts,
  watchSync: watchSync
}

const runAllWatchers = () => _.mapValues(
  watchersObj,
  watcher => {
    var status = true

    try {
      watcher()
    } catch(e) {
      status = e
    }

    return status
  }
)

// Exports
module.exports = {
  list: watchersObj,
  watchersStatus: runAllWatchers()
}
<commit_msg>logs other args<commit_after>// Import Modules
const INDEX = require('../../index.js')

// Import Packages
const _ = require('lodash')
const merge = require('merge')

// Define helper variables
const ws = INDEX.connection
const mongo = INDEX.mongo
const dispatcher = INDEX.dispatcher

/**
 * Function to watch for updates on all collections
 */
const watchUpdates = () => {
  for (var model in mongo.models) {
    ws.subscribe(`connapp.server.${model.toLowerCase()}.update`, function(data) {
      mongo.models[model]
      .findOne({_id: data._id}).exec()
      .then(res => {
        // deletes save so it won't conflict on merging
        delete res.save

        // merges with new data
        merge(res, data)

        // Makes sure this is treated as an update by the post save hook
        res.isNew = false

        // saves Updated item
        return res.save()
      })
      .then(res => {
        console.log(res)
      })
      .catch(err => console.log(err))
    })
  }
}

/**
 * Function to watch for inserts on all collections
 */
const watchInserts = () => {
  for (var model in mongo.models) {
    ws.subscribe(`connapp.server.${model.toLowerCase()}.insert`, function(data) {
      let doc = new mongo.models[model](data)

      // Make sure this is treated as new by the post-save hook
      doc.isNew = true

      doc.save()
        .then(res => {
          console.log(res)
        })
        .catch(err => console.log(err))
    })
  }
}

/**
 * Function to watch for inserts on all collections
 */
const watchSync = () => {
  for (var model in mongo.models) {
    const uri = `connapp.server.${model.toLowerCase()}.fetch`
    console.log(uri)
    ws.subscribe(uri, (args1, args2) => {
      console.log(args1, args2)
      console.log('Fetch was triggered')
      mongo.models[model]
        .find({}).exec()
        .then(data => {
          console.log('data found: ' + data)
          // If nothing is found, does nothing
          if (!data.length) return true
          console.log('is array? ' + Array.isArray(ids))
          // Loops through the found data and dispatch route accordingly
          data.forEach(item => {
            const _id = item._id.toString()

            if ( ids.indexOf(_id) == -1 ) {
              console.log('sent to insert '+ item)
              dispatcher.insertToApp(model, item)
            } else {
              console.log('sent to update '+ item)
              dispatcher.updateDocumentToApp(model, _id, item)
            }
          })
	      })
        .catch(err => console.log(err))
    })
  }
}

const watchersObj = {
  watchUpdates: watchUpdates,
  watchInserts: watchInserts,
  watchSync: watchSync
}

const runAllWatchers = () => _.mapValues(
  watchersObj,
  watcher => {
    var status = true

    try {
      watcher()
    } catch(e) {
      status = e
    }

    return status
  }
)

// Exports
module.exports = {
  list: watchersObj,
  watchersStatus: runAllWatchers()
}
<|endoftext|>


<commit_before>module.exports = {
  scenarios: [
    {
      name: 'default',
      dependencies: { }
    },
    {
      name: 'ember-1.13.x',
      dependencies: { 'ember': '1.13.13' }
    },
    {
      name: 'ember-2.0.x',
      dependencies: { 'ember': '2.0.3' }
    },
    {
      name: 'ember-2.1.x',
      dependencies: { 'ember': '2.1.2' }
    },
    {
      name: 'ember-2.2.x',
      dependencies: { 'ember': '2.2.2' }
    },
    {
      name: 'ember-2.3.x',
      dependencies: { 'ember': '2.3.2' }
    },
    {
      name: 'ember-2.4.x',
      dependencies: { 'ember': '2.4.6' }
    },
    {
      name: 'ember-2.5.x',
      dependencies: { 'ember': '2.5.1' }
    },
    {
      name: 'ember-2.6.x',
      dependencies: { 'ember': '2.6.2' }
    },
    {
      name: 'ember-2.7.x',
      dependencies: { 'ember': '2.7.3' }
    },
    {
      name: 'ember-2.8.x',
      dependencies: { 'ember': '2.8.3' }
    },
    {
      name: 'ember-2.9.x',
      dependencies: { 'ember': '2.9.1' }
    },
    {
      name: 'ember-release',
      dependencies: { 'ember': 'components/ember#release' },
      resolutions: { 'ember': 'release' }
    },
    {
      name: 'ember-beta',
      dependencies: { 'ember': 'components/ember#beta' },
      resolutions: { 'ember': 'beta' }
    },
    {
      name: 'ember-canary',
      dependencies: { 'ember': 'components/ember#canary' },
      resolutions: { 'ember': 'canary' }
    }
  ]
};
<commit_msg>Updated ember version list<commit_after>module.exports = {
  scenarios: [
    {
      name: 'default',
      dependencies: { }
    },
    {
      name: 'ember-1.13.x',
      dependencies: { 'ember': '1.13.13' }
    },
    {
      name: 'ember-2.0.x',
      dependencies: { 'ember': '2.0.3' }
    },
    {
      name: 'ember-2.1.x',
      dependencies: { 'ember': '2.1.2' }
    },
    {
      name: 'ember-2.2.x',
      dependencies: { 'ember': '2.2.2' }
    },
    {
      name: 'ember-2.3.x',
      dependencies: { 'ember': '2.3.2' }
    },
    {
      name: 'ember-2.4.x',
      dependencies: { 'ember': '2.4.6' }
    },
    {
      name: 'ember-2.5.x',
      dependencies: { 'ember': '2.5.1' }
    },
    {
      name: 'ember-2.6.x',
      dependencies: { 'ember': '2.6.2' }
    },
    {
      name: 'ember-2.7.x',
      dependencies: { 'ember': '2.7.3' }
    },
    {
      name: 'ember-2.8.x',
      dependencies: { 'ember': '2.8.3' }
    },
    {
      name: 'ember-2.9.x',
      dependencies: { 'ember': '2.9.1' }
    },
    {
      name: 'ember-2.10.x',
      dependencies: { 'ember': '2.10.2' }
    },
    {
      name: 'ember-2.11.x',
      dependencies: { 'ember': '2.11.3' }
    },
    {
      name: 'ember-2.12.x',
      dependencies: { 'ember': '2.12.2' }
    },
    {
      name: 'ember-2.13.x',
      dependencies: { 'ember': '2.13.0' }
    },
    {
      name: 'ember-release',
      dependencies: { 'ember': 'components/ember#release' },
      resolutions: { 'ember': 'release' }
    },
    {
      name: 'ember-beta',
      dependencies: { 'ember': 'components/ember#beta' },
      resolutions: { 'ember': 'beta' }
    },
    {
      name: 'ember-canary',
      dependencies: { 'ember': 'components/ember#canary' },
      resolutions: { 'ember': 'canary' }
    }
  ]
};
<|endoftext|>


<commit_before>module.exports = {
  scenarios: [
    {
      name: 'default',
      dependencies: { }
    },
    {
      name: 'ember-release',
      dependencies: {
        'ember': 'components/ember#release',
        'ember-data': 'components/ember-data#1.13.4'
      },
      resolutions: {
        'ember': 'release',
        'ember-data': '1.13.4'
      }
    },
    {
      name: 'ember-beta',
      dependencies: {
        'ember': 'components/ember#beta'
      },
      resolutions: {
        'ember': 'beta'
      }
    },
    {
      name: 'ember-canary',
      dependencies: {
        'ember': 'components/ember#canary',
        'ember-data': 'components/ember-data#canary'
      },
      resolutions: {
        'ember': 'canary',
        'ember-data': 'canary'
      }
    }
  ]
};
<commit_msg>no ember-data beta currently exists.<commit_after>module.exports = {
  scenarios: [
    {
      name: 'default',
      dependencies: { }
    },
    {
      name: 'ember-release',
      dependencies: {
        'ember': 'components/ember#release',
        'ember-data': 'components/ember-data#1.13.4'
      },
      resolutions: {
        'ember': 'release',
        'ember-data': '1.13.4'
      }
    },
    {
      name: 'ember-beta',
      dependencies: {
        'ember': 'components/ember#beta',
        'ember-data': 'components/ember-data#canary'
      },
      resolutions: {
        'ember': 'beta',
        'ember-data': 'canary'
      }
    },
    {
      name: 'ember-canary',
      dependencies: {
        'ember': 'components/ember#canary',
        'ember-data': 'components/ember-data#canary'
      },
      resolutions: {
        'ember': 'canary',
        'ember-data': 'canary'
      }
    }
  ]
};
<|endoftext|>


<commit_before><commit_msg>No longer crash when processing @import "whatever.css" directives Fixes #37<commit_after><|endoftext|>


<commit_before><commit_msg>issue #19051: added caveat<commit_after><|endoftext|>