<commit_before>(function(){
	'use strict';

	// This could be used to fire page events that can then be picked up at various other parts of the code
	// Useful for analytics
	// window.pulpPageEvents = _.extend({}, Backbone.Events);

	var State = Backbone.Model.extend({
		initialize: function(){
			this.set('single-page-width', parseInt( $('#pages').css('max-width') ));
			this.set('format', {});
			this.set('zoom', null);
		},
		setPageFormat: function(page){
			this.set('format', this.determineLayoutInformation( page ) );
		},
		determineLayoutInformation: function(page){
			var bookend = this.determineBookend(page);
			var format = this.determinePageFormat();
			return { format: format, bookend: bookend };
		},
		determinePageFormat: function(windowWidth){
			windowWidth = windowWidth || $(window).width();
			var format;

			var dynamic_page_width = parseInt($('.page-container.viewing img').css('width')) || parseInt($('.page-container img').css('width')),
					static_page_width = this.get('single-page-width'),
					page_limit = settings.singlePageWidthLimit;

			// console.log(windowWidth, dynamic_page_width, dynamic_page_width*2 + settings.gutterWidth)
			// console.log(windowWidth > dynamic_page_width*2 + settings.gutterWidth)
			if (windowWidth > dynamic_page_width*2 + parseInt(settings.gutterWidth)) {
				// If the window is wide enough for two pages
				// Hint, if you want to disable double view, change this to 'single'
				format = 'double';
			} else if (windowWidth <= page_limit) {
				// If it's less than a single page
				format = 'mobile';
			} else {
				// Everything else
				format = 'single';
			}
			return format;
		},
		determineBookend: function(page){
			var this_page = page || states.currentPage,
					bookend;
			if (this_page == 1) {
				bookend = 'true';
			} else {
				bookend = 'false'
			}
			return bookend;
		}
	});

	var state = new State;

	var states = {
		currentPage: '1',
		currentHotspot: '',
		lastPage: '',
		lastHotspot: '',
		scaleMultiplier: 1,
		firstRun: true,
		showNavHelpers: true
	}

	var helpers = {
		setTransitionCss: function(property, value, transitionDuration){
			var css = {}, duration = 0;
			css[property] = value;
			css = helpers.addDuration(css, transitionDuration);
			return css;
		},
		addDuration: function(cssObj, transitionDuration, customDuration){
			// This function is a little at cross-purposes because we're adapting it to take a custom duration value while preserving its prior functionality taking a boolean
			var duration;
			if (customDuration) {
				duration = customDuration
			} else {
				duration = transitionDuration ? settings.transitionDuration : 0;
			}
			_.extend(cssObj, {'transition-duration': duration});
			return cssObj;
		},
		saveCurrentStates: function(page, hotspot, lastPage){
			var formatState = state.get('format'),
					format = formatState.format,
					bookend = formatState.bookend;

			if (format == 'double' && bookend == 'false' && page % 2 != 0) page = page - 1;
			if (page) states.currentPage = page;
			if (hotspot) states.currentHotspot = hotspot;
			if (lastPage) states.lastPage = lastPage;
		},
		hashToPageHotspotDict: function(hash){
			// If for some reason it has a slash as the last character, cut it so as to not mess up the split
			// if (hash.charAt(hash.length - 1) == '/') hash = hash.substring(0, hash.length -1);
			hash = hash.replace('#', '').split('/'); // `#1/3` -> ["1", "3"]
			hash = _.map(hash, function(val) { return Number(val)}); // Convert to number  ["1", "3"] -> [1, 3]
			return { page: hash[0], hotspot: hash[1] }
		},
		getNavDirection: function(e, code){
			var direction;
			// console.log(code)
			// Only allow this only one panel is visible, i.e. not during a transition
			if (code == 37 || code == 38 || code == 39 || code == 40 || code == 'swipeleft' || code == 'swiperight'){
				// Don't do the default behavior if it's an arrow, swipe or pinch
				e.preventDefault();
				e.stopPropagation();

				// Do this
				// Left arrow
				if (code == 37 || code == 'swiperight'){
					direction = 'prev';
				}
				// Right arrow
				else if (code == 39 || code == 'swipeleft'){
					direction = 'next';
				} 
				// Esc, up, down arrows
				else if (code == 27 || code == 38 || code == 40 ) {
					direction = false;
				}

				return direction;
			}
			return false;
		},
		toggleFullScreen: function(){
		  if ((document.fullScreenElement && document.fullScreenElement !== null) || (!document.mozFullScreen && !document.webkitIsFullScreen)) {
		    if (document.documentElement.requestFullScreen) {  
		      document.documentElement.requestFullScreen();  
		    } else if (document.documentElement.mozRequestFullScreen) {  
		      document.documentElement.mozRequestFullScreen();  
		    } else if (document.documentElement.webkitRequestFullScreen) {  
		      document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);  
		    }
		  } else {  
		    if (document.cancelFullScreen) {  
		      document.cancelFullScreen();  
		    } else if (document.mozCancelFullScreen) {  
		      document.mozCancelFullScreen();  
		    } else if (document.webkitCancelFullScreen) {  
		      document.webkitCancelFullScreen();  
		    }  
		  }  
		},
		sortByNumber: function(a,b) {
			return a.number - b.number;
		},
		toggleHoverZoom: function(){
			var $el = $('.header-item-container[data-btn="enable-zoom"]')
			$el.toggleClass('active')
			// Reset the page zoom and text zoom without a delay
			if (!$el.hasClass('active')) {
				$('.page-container.viewing img,.page-container.viewing .paragraph-text').css({'transform': 'translate(0,0)scale(1)','transition-delay': '0'})
			}
		}<commit_msg>Remove zoom on paragraph text<commit_after>(function(){
	'use strict';

	// This could be used to fire page events that can then be picked up at various other parts of the code
	// Useful for analytics
	// window.pulpPageEvents = _.extend({}, Backbone.Events);

	var State = Backbone.Model.extend({
		initialize: function(){
			this.set('single-page-width', parseInt( $('#pages').css('max-width') ));
			this.set('format', {});
			this.set('zoom', null);
		},
		setPageFormat: function(page){
			this.set('format', this.determineLayoutInformation( page ) );
		},
		determineLayoutInformation: function(page){
			var bookend = this.determineBookend(page);
			var format = this.determinePageFormat();
			return { format: format, bookend: bookend };
		},
		determinePageFormat: function(windowWidth){
			windowWidth = windowWidth || $(window).width();
			var format;

			var dynamic_page_width = parseInt($('.page-container.viewing img').css('width')) || parseInt($('.page-container img').css('width')),
					static_page_width = this.get('single-page-width'),
					page_limit = settings.singlePageWidthLimit;

			// console.log(windowWidth, dynamic_page_width, dynamic_page_width*2 + settings.gutterWidth)
			// console.log(windowWidth > dynamic_page_width*2 + settings.gutterWidth)
			if (windowWidth > dynamic_page_width*2 + parseInt(settings.gutterWidth)) {
				// If the window is wide enough for two pages
				// Hint, if you want to disable double view, change this to 'single'
				format = 'double';
			} else if (windowWidth <= page_limit) {
				// If it's less than a single page
				format = 'mobile';
			} else {
				// Everything else
				format = 'single';
			}
			return format;
		},
		determineBookend: function(page){
			var this_page = page || states.currentPage,
					bookend;
			if (this_page == 1) {
				bookend = 'true';
			} else {
				bookend = 'false'
			}
			return bookend;
		}
	});

	var state = new State;

	var states = {
		currentPage: '1',
		currentHotspot: '',
		lastPage: '',
		lastHotspot: '',
		scaleMultiplier: 1,
		firstRun: true,
		showNavHelpers: true
	}

	var helpers = {
		setTransitionCss: function(property, value, transitionDuration){
			var css = {}, duration = 0;
			css[property] = value;
			css = helpers.addDuration(css, transitionDuration);
			return css;
		},
		addDuration: function(cssObj, transitionDuration, customDuration){
			// This function is a little at cross-purposes because we're adapting it to take a custom duration value while preserving its prior functionality taking a boolean
			var duration;
			if (customDuration) {
				duration = customDuration
			} else {
				duration = transitionDuration ? settings.transitionDuration : 0;
			}
			_.extend(cssObj, {'transition-duration': duration});
			return cssObj;
		},
		saveCurrentStates: function(page, hotspot, lastPage){
			var formatState = state.get('format'),
					format = formatState.format,
					bookend = formatState.bookend;

			if (format == 'double' && bookend == 'false' && page % 2 != 0) page = page - 1;
			if (page) states.currentPage = page;
			if (hotspot) states.currentHotspot = hotspot;
			if (lastPage) states.lastPage = lastPage;
		},
		hashToPageHotspotDict: function(hash){
			// If for some reason it has a slash as the last character, cut it so as to not mess up the split
			// if (hash.charAt(hash.length - 1) == '/') hash = hash.substring(0, hash.length -1);
			hash = hash.replace('#', '').split('/'); // `#1/3` -> ["1", "3"]
			hash = _.map(hash, function(val) { return Number(val)}); // Convert to number  ["1", "3"] -> [1, 3]
			return { page: hash[0], hotspot: hash[1] }
		},
		getNavDirection: function(e, code){
			var direction;
			// console.log(code)
			// Only allow this only one panel is visible, i.e. not during a transition
			if (code == 37 || code == 38 || code == 39 || code == 40 || code == 'swipeleft' || code == 'swiperight'){
				// Don't do the default behavior if it's an arrow, swipe or pinch
				e.preventDefault();
				e.stopPropagation();

				// Do this
				// Left arrow
				if (code == 37 || code == 'swiperight'){
					direction = 'prev';
				}
				// Right arrow
				else if (code == 39 || code == 'swipeleft'){
					direction = 'next';
				} 
				// Esc, up, down arrows
				else if (code == 27 || code == 38 || code == 40 ) {
					direction = false;
				}

				return direction;
			}
			return false;
		},
		toggleFullScreen: function(){
		  if ((document.fullScreenElement && document.fullScreenElement !== null) || (!document.mozFullScreen && !document.webkitIsFullScreen)) {
		    if (document.documentElement.requestFullScreen) {  
		      document.documentElement.requestFullScreen();  
		    } else if (document.documentElement.mozRequestFullScreen) {  
		      document.documentElement.mozRequestFullScreen();  
		    } else if (document.documentElement.webkitRequestFullScreen) {  
		      document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);  
		    }
		  } else {  
		    if (document.cancelFullScreen) {  
		      document.cancelFullScreen();  
		    } else if (document.mozCancelFullScreen) {  
		      document.mozCancelFullScreen();  
		    } else if (document.webkitCancelFullScreen) {  
		      document.webkitCancelFullScreen();  
		    }  
		  }  
		},
		sortByNumber: function(a,b) {
			return a.number - b.number;
		},
		toggleHoverZoom: function(){
			var $el = $('.header-item-container[data-btn="enable-zoom"]')
			$el.toggleClass('active')
			// Reset the page zoom and text zoom without a delay
			if (!$el.hasClass('active')) {
				$('.page-container.viewing img,.page-container.viewing .paragraph-text').css({'transform': 'translate(0,0)scale(1)','transition-delay': '0'})
				$('.page-container.viewing .paragraph-text').css({'transform': 'translate(0,0)scale(1)','transition-delay': '0'})

				
			}
		}
{'fraction_non_alphanumeric': 0.14392231662909657, 'fraction_numerical': 0.008323218311080285, 'mean_word_length': 3.316991017964072, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '282276', 'n_tokens_mistral': 4164, 'n_tokens_neox': 3492, 'n_words': 924}