<commit_before><script type="text/javascript">
	
	// pageChanged & sizeChanged functions are needed in every model file
	// other functions for model should also be in here to avoid conflicts
	var flickr = new function() {
		var $pageContents,
			$panel,
			maxImageWidth,
			maxImageHeight;

		// function called every time the page is viewed after it has initially loaded
		this.pageChanged = function() {
			this.$pageContents = $("#pageContents");
			this.$panel = $("#pageContents .panel");
			
			this.setMaxSizes();
		};

		// function called every time the size of the LO is changed
		this.sizeChanged = function() {
			var currentImg = $("#pictureHolder img");
			currentImg
				.width("0px")
				.height("0px");
			
			this.setPanelSize();
			this.setMaxSizes();
			
			x_scaleImg(currentImg[0], this.maxImageWidth, this.maxImageHeight, true, false, true);
		};
		
		this.setPanelSize = function(firstLoad) {
			this.$panel.height($x_pageHolder.height() - parseInt($x_pageDiv.css("padding-top")) * 2 - parseInt(this.$panel.css("padding-top")) * 2 - 5);
			
			var $btnHolder = $("#btnHolder");
			$("#flickrHolder").height(this.$panel.height() - $btnHolder.height() - parseInt($btnHolder.css("margin-top")));
			
			if (firstLoad == 1) {
				$btnHolder.hide();
			}
		}
		
		this.setMaxSizes = function() {
			this.maxImageWidth = $("#flickrHolder").width();
			this.maxImageHeight = $("#flickrHolder").height() - $("#headerHolder").height() - $("#licenseHolder").height() - 10;
		}
		
		
		this.init = function() {
			this.$pageContents = $("#pageContents");
			this.$panel = $("#pageContents .panel");

			x_pageInfo[x_currentPage].savedData = {
				pictureFeed  : undefined,
				pictureInfo  : undefined,
				pictureStore : [],
				pictureIndex : 0
			};
			
			
			var prevBtnTxt = x_currentPageXML.getAttribute("prevTipTxt");
			if (prevBtnTxt == undefined) {
				prevBtnTxt = "Previous Image";
			}
			
			var nextBtnTxt = x_currentPageXML.getAttribute("nextTipTxt");
			if (nextBtnTxt == undefined) {
				nextBtnTxt = "Next Image";
			}
			
			$("#prevBtn")
				.button({
					icons: {
						primary: "ui-icon-carat-1-w"
					},
					label:	prevBtnTxt,
					text:	false
				})
				.click(function() {
					flickr.proceed(Math.max(0, x_pageInfo[x_currentPage].savedData.pictureIndex-1));
				});
			
			$("#nextBtn")
				.button({
					icons: {
						primary: "ui-icon-carat-1-e"
					},
					label:	nextBtnTxt,
					text:	false
				})
				.click(function() {
					flickr.proceed(Math.min(x_pageInfo[x_currentPage].savedData.pictureIndex+1, x_pageInfo[x_currentPage].savedData.pictureFeed.length-1));
				});
			
			
			$("#textHolder").html(x_addLineBreaks($(x_currentPageXML).text()));
			$("#loadingSpinner p").html(x_getLangInfo(x_languageData.find("fetchResults")[0], "label", "Fetching results..."));

			this.setPanelSize(1);
			this.callAjax();
			
			
			// call this function in every model once everything is loaded
			x_pageLoaded();
		}
		<commit_msg>Fix to allow Flickr to choose correct image size on first load (on first load always chose max size before)<commit_after><script type="text/javascript">
	
	// pageChanged & sizeChanged functions are needed in every model file
	// other functions for model should also be in here to avoid conflicts
	var flickr = new function() {
		var $pageContents,
			$panel,
			maxImageWidth,
			maxImageHeight;

		// function called every time the page is viewed after it has initially loaded
		this.pageChanged = function() {
			this.$pageContents = $("#pageContents");
			this.$panel = $("#pageContents .panel");
			
			this.setMaxSizes();
		};

		// function called every time the size of the LO is changed
		this.sizeChanged = function() {
			var currentImg = $("#pictureHolder img");
			currentImg
				.width("0px")
				.height("0px");
			
			this.setPanelSize();
			this.setMaxSizes();
			
			x_scaleImg(currentImg[0], this.maxImageWidth, this.maxImageHeight, true, false, true);
		};
		
		this.setPanelSize = function(firstLoad) {
			this.$panel.height($x_pageHolder.height() - parseInt($x_pageDiv.css("padding-top")) * 2 - parseInt(this.$panel.css("padding-top")) * 2 - 5);
			
			var $btnHolder = $("#btnHolder");
			$("#flickrHolder").height(this.$panel.height() - $btnHolder.height() - parseInt($btnHolder.css("margin-top")));
			
			if (firstLoad == 1) {
				$btnHolder.hide();
			}
		}
		
		this.setMaxSizes = function() {
			this.maxImageWidth = $("#flickrHolder").width();
			this.maxImageHeight = $("#flickrHolder").height() - $("#headerHolder").height() - $("#licenseHolder").height() - 10;
		}
		
		
		this.init = function() {
			this.$pageContents = $("#pageContents");
			this.$panel = $("#pageContents .panel");

			x_pageInfo[x_currentPage].savedData = {
				pictureFeed  : undefined,
				pictureInfo  : undefined,
				pictureStore : [],
				pictureIndex : 0
			};
			
			
			var prevBtnTxt = x_currentPageXML.getAttribute("prevTipTxt");
			if (prevBtnTxt == undefined) {
				prevBtnTxt = "Previous Image";
			}
			
			var nextBtnTxt = x_currentPageXML.getAttribute("nextTipTxt");
			if (nextBtnTxt == undefined) {
				nextBtnTxt = "Next Image";
			}
			
			$("#prevBtn")
				.button({
					icons: {
						primary: "ui-icon-carat-1-w"
					},
					label:	prevBtnTxt,
					text:	false
				})
				.click(function() {
					flickr.proceed(Math.max(0, x_pageInfo[x_currentPage].savedData.pictureIndex-1));
				});
			
			$("#nextBtn")
				.button({
					icons: {
						primary: "ui-icon-carat-1-e"
					},
					label:	nextBtnTxt,
					text:	false
				})
				.click(function() {
					flickr.proceed(Math.min(x_pageInfo[x_currentPage].savedData.pictureIndex+1, x_pageInfo[x_currentPage].savedData.pictureFeed.length-1));
				});
			
			
			$("#textHolder").html(x_addLineBreaks($(x_currentPageXML).text()));
			$("#loadingSpinner p").html(x_getLangInfo(x_languageData.find("fetchResults")[0], "label", "Fetching results..."));

			this.setPanelSize(1);
			this.setMaxSizes();
			this.callAjax();
			
			
			// call this function in every model once everything is loaded
			x_pageLoaded();
		}
		
{'fraction_non_alphanumeric': 0.15928912292249464, 'fraction_numerical': 0.0059239756458779, 'mean_word_length': 3.2893436838390966, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3633427', 'n_tokens_mistral': 2432, 'n_tokens_neox': 1941, 'n_words': 388}