Plugin Directory

Changeset 2180645


Ignore:
Timestamp:
10/26/2019 02:10:28 PM (6 years ago)
Author:
instantpage
Message:

3.0.0

Location:
instant-page
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • instant-page/trunk/instantpage.js

    r2171778 r2180645  
    1 /*! instant.page v2.0.1 - (C) 2019 Alexandre Dieulot - https://instant.page/license */
    2 let t,e,n;const o=document.createElement("link"),s=o.relList&&o.relList.supports&&o.relList.supports("prefetch"),a=navigator.connection&&navigator.connection.saveData,i="instantAllowQueryString"in document.body.dataset,r="instantAllowExternalLinks"in document.body.dataset,d="instantWhitelist"in document.body.dataset;let c=65,u=!1,l=!1;if("instantIntensity"in document.body.dataset)if("mousedown"==document.body.dataset.instantIntensity.substr(0,"mousedown".length))u=!0,"mousedown-only"==document.body.dataset.instantIntensity&&(l=!0);else{const t=parseInt(document.body.dataset.instantIntensity);isNaN(t)||(c=t)}if(s&&!a){o.rel="prefetch",document.head.appendChild(o);const s={capture:!0,passive:!0};l||document.addEventListener("touchstart",function(e){n=performance.now();const o=e.target.closest("a");if(!m(o))return;o.addEventListener("touchcancel",f,{passive:!0}),o.addEventListener("touchend",f,{passive:!0}),t=o.href,p(o.href)},s),u?document.addEventListener("mousedown",function(e){const n=e.target.closest("a");if(!m(n))return;n.addEventListener("mouseout",h,{passive:!0}),t=n.href,p(n.href)},s):document.addEventListener("mouseover",function(o){if(performance.now()-n<1100)return;const s=o.target.closest("a");if(!m(s))return;s.addEventListener("mouseout",h,{passive:!0}),t=s.href,e=setTimeout(()=>{p(s.href),e=void 0},c)},s)}function f(){t=void 0,v()}function h(n){n.relatedTarget&&n.target.closest("a")==n.relatedTarget.closest("a")||(e&&(clearTimeout(e),e=void 0),t=void 0,v())}function m(e){if(e&&e.href&&t!=e.href&&(!d||"instant"in e.dataset)&&(r||e.origin==location.origin||"instant"in e.dataset)&&["http:","https:"].includes(e.protocol)&&("http:"!=e.protocol||"https:"!=location.protocol)&&(i||!e.search||"instant"in e.dataset)&&!(e.hash&&e.pathname+e.search==location.pathname+location.search||"noInstant"in e.dataset))return!0}function p(t){o.href=t}function v(){o.removeAttribute("href")}
     1/*! instant.page v3.0.0 - (C) 2019 Alexandre Dieulot - https://instant.page/license */
     2let t,e;const n=new Set,o=document.createElement("link"),s=o.relList&&o.relList.supports&&o.relList.supports("prefetch")&&window.IntersectionObserver&&"isIntersecting"in IntersectionObserverEntry.prototype,i="instantAllowQueryString"in document.body.dataset,r="instantAllowExternalLinks"in document.body.dataset,a="instantWhitelist"in document.body.dataset;let c=65,d=!1,l=!1,u=!1;if("instantIntensity"in document.body.dataset){const t=document.body.dataset.instantIntensity;if("mousedown"==t.substr(0,"mousedown".length))d=!0,"mousedown-only"==t&&(l=!0);else if("viewport"==t.substr(0,"viewport".length))navigator.connection&&(navigator.connection.saveData||navigator.connection.effectiveType.includes("2g"))||("viewport"==t?document.documentElement.clientWidth*document.documentElement.clientHeight<45e4&&(u=!0):"viewport-all"==t&&(u=!0));else{const e=parseInt(t);isNaN(e)||(c=e)}}if(s){const n={capture:!0,passive:!0};if(l||document.addEventListener("touchstart",function(t){e=performance.now();const n=t.target.closest("a");if(!f(n))return;h(n.href)},n),d?document.addEventListener("mousedown",function(t){const e=t.target.closest("a");if(!f(e))return;h(e.href)},n):document.addEventListener("mouseover",function(n){if(performance.now()-e<1100)return;const o=n.target.closest("a");if(!f(o))return;o.addEventListener("mouseout",m,{passive:!0}),t=setTimeout(()=>{h(o.href),t=void 0},c)},n),u){let t;(t=window.requestIdleCallback?t=>{requestIdleCallback(t,{timeout:1500})}:t=>{t()})(()=>{const t=new IntersectionObserver(e=>{e.forEach(e=>{if(e.isIntersecting){const n=e.target;t.unobserve(n),h(n.href)}})});document.querySelectorAll("a").forEach(e=>{f(e)&&t.observe(e)})})}}function m(e){e.relatedTarget&&e.target.closest("a")==e.relatedTarget.closest("a")||t&&(clearTimeout(t),t=void 0)}function f(t){if(t&&t.href&&(!a||"instant"in t.dataset)&&(r||t.origin==location.origin||"instant"in t.dataset)&&["http:","https:"].includes(t.protocol)&&("http:"!=t.protocol||"https:"!=location.protocol)&&(i||!t.search||"instant"in t.dataset)&&!(t.hash&&t.pathname+t.search==location.pathname+location.search||"noInstant"in t.dataset))return!0}function h(t){if(n.has(t))return;const e=document.createElement("link");e.rel="prefetch",e.href=t,document.head.appendChild(e),n.add(t)}
  • instant-page/trunk/instantpage.php

    r2171778 r2180645  
    55Description: Make your site’s pages instant in 1 minute.
    66Author: Alexandre Dieulot
    7 Version: 2.0.1
     7Version: 3.0.0
    88Author URI: https://dieulot.fr/
    99*/
     
    1313
    1414function instantpage_wp_enqueue_scripts() {
    15   wp_enqueue_script( 'instantpage', plugin_dir_url( __FILE__ ) . 'instantpage.js', array(), '2.0.1', true );
     15  wp_enqueue_script( 'instantpage', plugin_dir_url( __FILE__ ) . 'instantpage.js', array(), '3.0.0', true );
    1616}
    1717
Note: See TracChangeset for help on using the changeset viewer.