<commit_before><script type="text/javascript">
/**
 * Licensed to The Apereo Foundation under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for
 * additional information regarding copyright ownership.

 * The Apereo Foundation licenses this file to you 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.
 */
	
	// pageChanged & sizeChanged functions are needed in every model file
	// other functions for model should also be in here to avoid conflicts
	var menu = new function() {
		
		// function called every time the page is viewed after it has initially loaded
		this.pageChanged = function() {
			if (x_params.menuImage != undefined && x_params.menuImage != "" && x_params.navigation != "Linear" && x_params.menuImageProperties == "Full Screen") {
				this.setUpBg();
			}
		}
		
		// function called every time the size of the LO is changed
		this.sizeChanged = function() {
			
		}
		
		this.init = function() {
			var numOffset = 0;
			if (x_params.navigation != "Linear" && x_params.navigation != "Historic") { // 1st page is menu page - ignore this when making page list
				numOffset = 1;
			}
			
			var $menuItems = $("#menuItems"),
				$menuItem = $menuItems.find(".menuItem:first"),
				i;
			
			for (i=0; i<x_pages.length-numOffset; i++) {
				var $thisItem;
				if (i != 0) {
					$thisItem = $menuItem.clone().appendTo($menuItems);
				} else {
					$thisItem = $menuItem;
				}
				var pageNum = x_params.tocNumbers == "false" ? "" : (i+1) + ") ";
				$thisItem.html(pageNum + x_pages[i+numOffset].getAttribute("name"));
			}
			
			$("#menuItems .menuItem")
				.button()
				.click(function() {
					$this = $(this);
					$this.removeClass("ui-state-focus");
					$this.removeClass("ui-state-hover");
					x_changePage($this.index() + numOffset);
				});
			
			if (x_params.navigation != "Linear" && x_params.navigation != "Historic") { // 1st page is menu page
				
				if (x_params.menuImage != undefined && x_params.menuImage != "") {
					
					if (x_params.menuImageProperties != "Full Screen") { // use panel
						var imgMaxW;
						if (x_browserInfo.mobile == false) {
							imgMaxW = $("#menuHolder .right").width() - 80;
						} else {
							imgMaxW = $x_mobileScroll.width() - 40;
						}
						var imgMaxH = 450;
						
						$("#menuHolder .right").append('<img class="panel centre" />');
						
						$("#menuHolder .right img")
							.css("visibility", "hidden")
							.one("load", function() {
								x_scaleImg(this, imgMaxW, imgMaxH);
								x_pageLoaded();
							})
							.attr({
								"id":"pageImg",
								"src":x_evalURL(x_params.menuImage)
							})
							.each(function() { // called if loaded from cache as in some browsers load won't automatically trigger
								if (this.complete) {
									$(this).trigger("load");
								}
							});
						
					} else { // bg image
						this.setUpBg(true);
						x_pageLoaded();
					}
					
				} else { // no image
					$("#menuHolder").removeClass("splitScreen");
					if (x_browserInfo.mobile == false) {
						$menuItems.width("70%");
					}
					x_pageLoaded();
				}
				
			} else { // menu is in dialog
				$("#menuHolder").removeClass("splitScreen");
				this.showCurrent();
			}
		}
		
		// function called from xenith every time menu in popup appears - highlights current page in list
		this.showCurrent = function() {
			$("#menuItems").find(".current").removeClass("current");
			var $thisItem = $("#menuItems .menuItem:eq(" + x_currentPage + ")").addClass("current");
			$thisItem[0].scrollIntoView();
		}
		
		// function sets up full screen bg image
		this.setUpBg = function(firstLoad) {
			var $pageBg = $('<img id="pageBg"/>');
			$pageBg
				.hide()
				.one("load", function() {
					$(this).fadeIn();
					if (firstLoad == true) {
						x_pageLoaded();
					}
				})
				.attr("src", x_evalURL(x_params.menuImage))
				.each(function() { // called if loaded from cache as in some browsers load won't automatically trigger
					if (this.complete) {
						$(this).trigger("load");
					}
				});
			
			$x_background.append($pageBg);
		}
	}
	
	menu.init();
	
</script>

<style type="text/css"><commit_msg>Fixed bug where Table of Contents dialog wasn't always scrolling correctly to current page<commit_after><script type="text/javascript">
/**
 * Licensed to The Apereo Foundation under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for
 * additional information regarding copyright ownership.

 * The Apereo Foundation licenses this file to you 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.
 */
	
	// pageChanged & sizeChanged functions are needed in every model file
	// other functions for model should also be in here to avoid conflicts
	var menu = new function() {
		
		// function called every time the page is viewed after it has initially loaded
		this.pageChanged = function() {
			if (x_params.menuImage != undefined && x_params.menuImage != "" && x_params.navigation != "Linear" && x_params.menuImageProperties == "Full Screen") {
				this.setUpBg();
			}
		}
		
		// function called every time the size of the LO is changed
		this.sizeChanged = function() {
			
		}
		
		this.init = function() {
			var numOffset = 0;
			if (x_params.navigation != "Linear" && x_params.navigation != "Historic") { // 1st page is menu page - ignore this when making page list
				numOffset = 1;
			}
			
			var $menuItems = $("#menuItems"),
				$menuItem = $menuItems.find(".menuItem:first"),
				i;
			
			for (i=0; i<x_pages.length-numOffset; i++) {
				var $thisItem;
				if (i != 0) {
					$thisItem = $menuItem.clone().appendTo($menuItems);
				} else {
					$thisItem = $menuItem;
				}
				var pageNum = x_params.tocNumbers == "false" ? "" : (i+1) + ") ";
				$thisItem.html(pageNum + x_pages[i+numOffset].getAttribute("name"));
			}
			
			$("#menuItems .menuItem")
				.button()
				.click(function() {
					$this = $(this);
					$this.removeClass("ui-state-focus");
					$this.removeClass("ui-state-hover");
					x_changePage($this.index() + numOffset);
				});
			
			if (x_params.navigation != "Linear" && x_params.navigation != "Historic") { // 1st page is menu page
				
				if (x_params.menuImage != undefined && x_params.menuImage != "") {
					
					if (x_params.menuImageProperties != "Full Screen") { // use panel
						var imgMaxW;
						if (x_browserInfo.mobile == false) {
							imgMaxW = $("#menuHolder .right").width() - 80;
						} else {
							imgMaxW = $x_mobileScroll.width() - 40;
						}
						var imgMaxH = 450;
						
						$("#menuHolder .right").append('<img class="panel centre" />');
						
						$("#menuHolder .right img")
							.css("visibility", "hidden")
							.one("load", function() {
								x_scaleImg(this, imgMaxW, imgMaxH);
								x_pageLoaded();
							})
							.attr({
								"id":"pageImg",
								"src":x_evalURL(x_params.menuImage)
							})
							.each(function() { // called if loaded from cache as in some browsers load won't automatically trigger
								if (this.complete) {
									$(this).trigger("load");
								}
							});
						
					} else { // bg image
						this.setUpBg(true);
						x_pageLoaded();
					}
					
				} else { // no image
					$("#menuHolder").removeClass("splitScreen");
					if (x_browserInfo.mobile == false) {
						$menuItems.width("70%");
					}
					x_pageLoaded();
				}
				
			} else { // menu is in dialog
				$("#menuHolder").removeClass("splitScreen");
				this.showCurrent();
			}
		}
		
		// function called from xenith every time menu in popup appears - highlights current page in list
		this.showCurrent = function() {
			$("#menuItems").find(".current").removeClass("current");
			var $thisItem = $("#menuItems .menuItem:eq(" + x_currentPage + ")").addClass("current");
			if ($thisItem.position().top != $thisItem.parents("#x_menu").scrollTop()) {
				$thisItem.parents("#x_menu").scrollTop($thisItem.position().top - parseInt($thisItem.css("margin-bottom")));
			}
		}
		
		// function sets up full screen bg image
		this.setUpBg = function(firstLoad) {
			var $pageBg = $('<img id="pageBg"/>');
			$pageBg
				.hide()
				.one("load", function() {
					$(this).fadeIn();
					if (firstLoad == true) {
						x_pageLoaded();
					}
				})
				.attr("src", x_evalURL(x_params.menuImage))
				.each(function() { // called if loaded from cache as in some browsers load won't automatically trigger
					if (this.complete) {
						$(this).trigger("load");
					}
				});
			
			$x_background.append($pageBg);
		}
	}
	
	menu.init();
	
</script>

<style type="text/css">
{'fraction_non_alphanumeric': 0.14561586638830898, 'fraction_numerical': 0.0042797494780793316, 'mean_word_length': 2.800476001586672, 'pattern_counts': {'":': 4, '<': 15, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4823286', 'n_tokens_mistral': 3721, 'n_tokens_neox': 2806, 'n_words': 814}