<commit_before>/* InstantClick 2.1 | (C) 2014 <NAME> | http://instantclick.io/license.html */
var InstantClick = function(document, location) {
	// Internal variables
	var $currentLocationWithoutHash
	var $urlToPreload
	var $preloadTimer

	// Preloading-related variables
	var $history = {}
	var $xhr
	var $url = false
	var $title = false
	var $hasBody = true
	var $body = false
	var $timing = {}
	var $isPreloading = false
	var $isWaitingForCompletion = false

	// Variables defined by public functions
	var $useWhitelist
	var $preloadOnMousedown
	var $delayBeforePreload
	var $eventsCallbacks = {
		change: []
	}


	////////// HELPERS //////////


	function removeHash(url) {
		var index = url.indexOf('#')
		if (index < 0) {
			return url
		}
		return url.substr(0, index)
	}

	function getLinkTarget(target) {
		while (target.nodeName != 'A') {
			target = target.parentNode
		}
		return target
	}

	function triggerPageEvent(eventType) {
		for (var i = 0; i < $eventsCallbacks[eventType].length; i++) {
			$eventsCallbacks[eventType][i]()
		}
	}

	function changePage(title, body, newUrl, scrollY_) {
		var doc = document.implementation.createHTMLDocument('')
		doc.documentElement.innerHTML = body
		document.documentElement.replaceChild(doc.body, document.body)
		/* We cannot just use `document.body = doc.body` as it causes Safari 5.1, 6.0,
		   and Mobile 7.0 to execute script tags directly.
		*/

		var elem = document.createElement('i')
		elem.innerHTML = title
		document.title = elem.textContent

		if (newUrl) {
			history.pushState(null, null, newUrl)

			var hashIndex = newUrl.indexOf('#')
			var hashElem = hashIndex > -1 && document.getElementById(newUrl.substr(hashIndex + 1))
			var offset = 0
			if (hashElem) {
				for (; hashElem.offsetParent; hashElem = hashElem.offsetParent) {
					offset += hashElem.offsetTop
				}
			}
			scrollTo(0, offset)<commit_msg>[FIX] website_instantclick: this lib create some bug because the odoo assets are loaded in the body and some event are binded more of one time. Change the js lib  because the xml can't be change in 8.0. TODO: move assets into the head and fix js files and remove this commit in master<commit_after>/* InstantClick 2.1 | (C) 2014 <NAME> | http://instantclick.io/license.html */
var InstantClick = function(document, location) {
	// Internal variables
	var $currentLocationWithoutHash
	var $urlToPreload
	var $preloadTimer

	// Preloading-related variables
	var $history = {}
	var $xhr
	var $url = false
	var $title = false
	var $hasBody = true
	var $body = false
	var $timing = {}
	var $isPreloading = false
	var $isWaitingForCompletion = false

	// Variables defined by public functions
	var $useWhitelist
	var $preloadOnMousedown
	var $delayBeforePreload
	var $eventsCallbacks = {
		change: []
	}


	////////// HELPERS //////////


	function removeHash(url) {
		var index = url.indexOf('#')
		if (index < 0) {
			return url
		}
		return url.substr(0, index)
	}

	function getLinkTarget(target) {
		while (target.nodeName != 'A') {
			target = target.parentNode
		}
		return target
	}

	function triggerPageEvent(eventType) {
		for (var i = 0; i < $eventsCallbacks[eventType].length; i++) {
			$eventsCallbacks[eventType][i]()
		}
	}

	function changePage(title, body, newUrl, scrollY_) {
		// fix by odoo because the script assets are loaded in the body and not in the head
		// TODO: remove wen forward port in master
		$(document).off()
 		// end
 		
		var doc = document.implementation.createHTMLDocument('')
		doc.documentElement.innerHTML = body
		document.documentElement.replaceChild(doc.body, document.body)
		/* We cannot just use `document.body = doc.body` as it causes Safari 5.1, 6.0,
		   and Mobile 7.0 to execute script tags directly.
		*/

		var elem = document.createElement('i')
		elem.innerHTML = title
		document.title = elem.textContent

		if (newUrl) {
			history.pushState(null, null, newUrl)

			var hashIndex = newUrl.indexOf('#')
			var hashElem = hashIndex > -1 && document.getElementById(newUrl.substr(hashIndex + 1))
			var offset = 0
			if (hashElem) {
				for (; hashElem.offsetParent; hashElem = hashElem.offsetParent) {
					offset += hashElem.offsetTop
				}
			}
			scrollTo(0, offset)
{'fraction_non_alphanumeric': 0.12006657156443176, 'fraction_numerical': 0.009510223490252021, 'mean_word_length': 3.485074626865672, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, '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': '6000429', 'n_tokens_mistral': 1497, 'n_tokens_neox': 1322, 'n_words': 395}