<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 pdf = new function() {		
		var $pageContents;

		// function called every time the page is viewed after it has initially loaded
		this.pageChanged = function() {
			pdf.setUp();
		}
		
		// function called every time the size of the LO is changed
		this.sizeChanged = function() {
			if (x_browserInfo.iOS == true) {
				this.setUp();
			} else {	
				$("#pdfDoc").height(pdf.calcHeight());
			}
		}
		
		this.init = function() {
			$pageContents = $("#pageContents");
			
			var textContents = x_addLineBreaks(x_currentPageXML.getAttribute("text")),
				pdfWidth = x_currentPageXML.getAttribute("pdfWidth");
			
			// Full screen or not?
			console.log([pdfWidth, textContents]);
			if (pdfWidth == undefined || pdfWidth == "" || textContents == undefined || textContents == "") {
				pdfWidth = "full";
			}
			console.log([pdfWidth, textContents]);

			// Set the with of the pdf
			if (pdfWidth == "full") {
				$("#pageContents .panel").appendTo($pageContents);
				$("#pageContents .splitScreen").remove();
			}
			else {
				$("#textHolder").html(textContents);
				if (pdfWidth == "small") {
					$("#pageContents .splitScreen").addClass("large"); // make text area on left large so panel on right is small
				} else if (pdfWidth == "large") {
					$("#pageContents .splitScreen").addClass("small");
				} else {
					$("#pageContents .splitScreen").addClass("medium");
				} 
			}

			pdf.setUp();
			x_pageLoaded();
		}
		
		this.setUp = function() {
			if (x_browserInfo.iOS == true) {
				$("#pdfPage").html('<div id="pdfCover" /><object onload="pdf.createCover()" "id="pdfDoc" data="' + x_evalURL(x_currentPageXML.getAttribute("url")) + '" type="application/pdf" width="' + pdf.calcWidth() + '" height="auto"><param name="src" value="' + x_evalURL(x_currentPageXML.getAttribute("url")) + '"></object>');
			} else {
				$("#pdfPage").html('<object id="pdfDoc" data="' + x_evalURL(x_currentPageXML.getAttribute("url")) + '" type="application/pdf" width="100%" height="' + pdf.calcHeight() + '"><param name="src" value="' + x_evalURL(x_currentPageXML.getAttribute("url")) + '"></object>');
			}
		}
		
		this.createCover = function() {
			setTimeout(function(){
				$("#link").remove();
				$("#pdfCover").css({
					width:	$("#pdfPage").width(),
					height: $("#pdfPage").height()
				});
				$("#pdfPage").append('<div id="link"><hr/><a id="pdfLink" href="' + x_evalURL(x_currentPageXML.getAttribute("url")) + '" target="_blank">' + (x_currentPageXML.getAttribute("open") == "" || x_currentPageXML.getAttribute("open") == undefined ? "Open PDF" : x_currentPageXML.getAttribute("open")) + '</a></div>');
			}, 1);
		}
		
		this.calcWidth = function() {
			return $x_pageHolder.width() - 10;
		}
		
		this.calcHeight = function() {
			var height;
			
			if (x_browserInfo.mobile == false) {
				height = $x_pageHolder.height() - (parseInt($x_pageDiv.css("padding-top")) * 2) - 3;
			} else {
				height = $x_mobileScroll.height() - $x_headerBlock.height() - $x_footerBlock.height() - (parseInt($x_pageDiv.css("padding-top")) * 2) - 3;
			}

			return height;
		}
	}
	
	pdf.init();
	
</script>


<div id="pageContents">
	
	<div class="splitScreen">
		
		<div id="textHolder" class="left">
			
		</div>
		
		<div class="right">
			<div class="panel">
				<div id="pdfPage"></div>
			</div>
		</div>
		
	</div>
	
</div><commit_msg>Fix bug where text doesn't show on PDF page unless PDF width optional property is added<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 pdf = new function() {		
		var $pageContents;

		// function called every time the page is viewed after it has initially loaded
		this.pageChanged = function() {
			pdf.setUp();
		}
		
		// function called every time the size of the LO is changed
		this.sizeChanged = function() {
			if (x_browserInfo.iOS == true) {
				this.setUp();
			} else {	
				$("#pdfDoc").height(pdf.calcHeight());
			}
		}
		
		this.init = function() {
			$pageContents = $("#pageContents");
			
			var textContents = x_addLineBreaks(x_currentPageXML.getAttribute("text")),
				pdfWidth = x_currentPageXML.getAttribute("pdfWidth");
			
			// Full screen or not?
			if (pdfWidth == undefined || pdfWidth == "") {
				if (textContents == undefined || textContents == "") {
					pdfWidth = "full";
				} else {
					pdfWidth = "medium";
				}
			}

			// Set the with of the pdf
			if (pdfWidth == "full") {
				$("#pageContents .panel").appendTo($pageContents);
				$("#pageContents .splitScreen").remove();
			}
			else {
				if (textContents != undefined && textContents != "") {
					$("#textHolder").html(textContents);
				} else {
					$("#textHolder").remove();
				}
				if (pdfWidth == "small") {
					$("#pageContents .splitScreen").addClass("large"); // make text area on left large so panel on right is small
				} else if (pdfWidth == "large") {
					$("#pageContents .splitScreen").addClass("small");
				} else {
					$("#pageContents .splitScreen").addClass("medium");
				} 
			}

			pdf.setUp();
			x_pageLoaded();
		}
		
		this.setUp = function() {
			if (x_browserInfo.iOS == true) {
				$("#pdfPage").html('<div id="pdfCover" /><object onload="pdf.createCover()" "id="pdfDoc" data="' + x_evalURL(x_currentPageXML.getAttribute("url")) + '" type="application/pdf" width="' + pdf.calcWidth() + '" height="auto"><param name="src" value="' + x_evalURL(x_currentPageXML.getAttribute("url")) + '"></object>');
			} else {
				$("#pdfPage").html('<object id="pdfDoc" data="' + x_evalURL(x_currentPageXML.getAttribute("url")) + '" type="application/pdf" width="100%" height="' + pdf.calcHeight() + '"><param name="src" value="' + x_evalURL(x_currentPageXML.getAttribute("url")) + '"></object>');
			}
		}
		
		this.createCover = function() {
			setTimeout(function(){
				$("#link").remove();
				$("#pdfCover").css({
					width:	$("#pdfPage").width(),
					height: $("#pdfPage").height()
				});
				$("#pdfPage").append('<div id="link"><hr/><a id="pdfLink" href="' + x_evalURL(x_currentPageXML.getAttribute("url")) + '" target="_blank">' + (x_currentPageXML.getAttribute("open") == "" || x_currentPageXML.getAttribute("open") == undefined ? "Open PDF" : x_currentPageXML.getAttribute("open")) + '</a></div>');
			}, 1);
		}
		
		this.calcWidth = function() {
			if ($("#textHolder").length > 0 && x_browserInfo.mobile == false) {
				return $x_pageHolder.width() - $("#textHolder").width() - parseInt($("div.right").css("margin-left")) - (parseInt($x_pageDiv.css("padding-left")) * 2) - (parseInt($("div.panel").css("padding-left")) * 2);
			} else {
				return $x_pageHolder.width() - (parseInt($x_pageDiv.css("padding-left")) * 2) - (parseInt($("div.panel").css("padding-left")) * 2);
			}
		}
		
		this.calcHeight = function() {
			var height;
			
			if (x_browserInfo.mobile == false) {
				height = $x_pageHolder.height() - (parseInt($x_pageDiv.css("padding-top")) * 2) - (parseInt($("div.panel").css("padding-top")) * 2) - (parseInt($("div.panel").css("border-top-width")) * 2) - 10;
			} else {
				height = $x_mobileScroll.height() - $x_headerBlock.height() - $x_footerBlock.height() - (parseInt($x_pageDiv.css("padding-top")) * 2) - 3;
			}
			
			return height;
		}
	}
	
	pdf.init();
	
</script>


<div id="pageContents">
	
	<div class="splitScreen">
		
		<div id="textHolder" class="left">
			
		</div>
		
		<div class="right">
			<div class="panel">
				<div id="pdfPage"></div>
			</div>
		</div>
		
	</div>
	
</div>
{'fraction_non_alphanumeric': 0.17667844522968199, 'fraction_numerical': 0.003640646750187386, 'mean_word_length': 3.7076612903225805, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 56, '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': '7486783', 'n_tokens_mistral': 3297, 'n_tokens_neox': 2823, 'n_words': 737}