X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=addons%2Fwebsite_instantclick%2Fstatic%2Flib%2Finstantclick%2Finstantclick.js;fp=addons%2Fwebsite_instantclick%2Fstatic%2Flib%2Finstantclick%2Finstantclick.js;h=0000000000000000000000000000000000000000;hb=fcd06145dda957a83e687fd033ff294c407da5f4;hp=e5e4e3447d344675e1e27631a6ea2fc83a78c362;hpb=d9610efd979c974e540353716f8d0b9ecdb9d952;p=odoo%2Fodoo.git diff --git a/addons/website_instantclick/static/lib/instantclick/instantclick.js b/addons/website_instantclick/static/lib/instantclick/instantclick.js deleted file mode 100644 index e5e4e34..0000000 --- a/addons/website_instantclick/static/lib/instantclick/instantclick.js +++ /dev/null @@ -1,430 +0,0 @@ -/* InstantClick 2.1 | (C) 2014 Alexandre Dieulot | 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) - - $currentLocationWithoutHash = removeHash(newUrl) - } - else { - scrollTo(0, scrollY_) - } - - instantanize() - - triggerPageEvent('change') - } - - function setPreloadingAsHalted() { - $isPreloading = false - $isWaitingForCompletion = false - } - - - ////////// EVENT HANDLERS ////////// - - - function mousedown(e) { - preload(getLinkTarget(e.target).href) - } - - function mouseover(e) { - var a = getLinkTarget(e.target) - a.addEventListener('mouseout', mouseout) - if (!$delayBeforePreload) { - preload(a.href) - } - else { - $urlToPreload = a.href - $preloadTimer = setTimeout(preload, $delayBeforePreload) - } - } - - function click(e) { - if (e.which > 1 || e.metaKey || e.ctrlKey) { // Opening in new tab - return - } - e.preventDefault() - display(getLinkTarget(e.target).href) - } - - function mouseout() { - if ($preloadTimer) { - clearTimeout($preloadTimer) - $preloadTimer = false - return - } - - if (!$isPreloading || $isWaitingForCompletion) { - return - } - $xhr.abort() - setPreloadingAsHalted() - } - - function readystatechange() { - if ($xhr.readyState < 4) { - return - } - if ($xhr.status == 0) { - /* Request aborted */ - return - } - - $timing.ready = +new Date - $timing.start - - var text = $xhr.responseText - - var titleIndex = text.indexOf('