cropduster
Advanced tools
Comparing version 5.2.0 to 5.3.0
@@ -1,2 +0,2 @@ | ||
var CD=function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a="callbacks are deprecated in cropduster, prefer using promises for asynchronous operations",u={CORS_PROXY_SERVER:"http://cors.movableink.com",$:function(e,t){return t||(t=document),[].concat(r(t.querySelectorAll(e)))},_initParams:function(){u._urlParams={};for(var e=/([^&=]+)=?([^&]*)/g,t=u._searchString(),n=e.exec(t);n;)u._urlParams[decodeURIComponent(n[1])]=decodeURIComponent(n[2]),n=e.exec(t)},param:function(e){return u.params()[e]},params:function(e){var t=u._urlParams;return void 0===t&&(u._initParams(),t=u._urlParams),e?t[e]:t},_searchString:function(){return window.location.search.substring(1)},autofill:function(){u.param("init");var e=u._urlParams;for(var t in e)"undefined"!==e[t]&&e[t].length>0&&document.getElementById("autofill_"+t)&&(document.getElementById("autofill_"+t).innerHTML=e[t])},throwError:function(e){u.miCaptureFallback(function(){MICapture.error(e)},function(){u.log("Capturama error: "+e)})},cancelRequest:function(e){u.miCaptureFallback(function(){MICapture.cancel(e)},function(){u.log("Request canceled: "+e)})},setImageRedirect:function(e){var t=document.getElementById("mi-redirect-image")||document.createElement("a");return t.href=e,t.id="mi-redirect-image",t.style.display="none",document.body.appendChild(t),t},setClickthrough:function(e){var t=document.getElementById("mi_dynamic_link")||document.createElement("a");return t.href=e,t.id="mi_dynamic_link",t.style.display="none",document.body.appendChild(t),t},setExtraData:function(e){var t=document.getElementById("mi-data")||document.createElement("div");t.id="mi-data",t.style.display="none";var n=void 0;try{n=JSON.parse(t.getAttribute("data-mi-data"))||{}}catch(e){n={}}for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return t.setAttribute("data-mi-data",JSON.stringify(n)),document.body.appendChild(t),t},proxyUrl:function(e){var t=document.createElement("a");t.href=e;var n="";n="0"===t.port||""===t.port?"https:"===t.protocol?":443":"":":"+t.port;var r=t.hostname,o=t.pathname,a=t.search,i=t.hash;return u.CORS_PROXY_SERVER+"/"+r+n+o+a+i},_readyToCapture:!0,_reset:function(){u._readyToCapture=!0},pause:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"manual suspension";e&&(t+=", will end in "+e+"ms",setTimeout(function(){u.resume(t)},e)),u.miCaptureFallback(function(){MICapture.pause(t)},function(){u.log("paused: "+t)})},resume:function(e){u.miCaptureFallback(function(){MICapture.resume(e)},function(){u.log("resuming paused capture: "+e)})},getCORS:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];return"function"==typeof t&&(n=t,t={}),t.corsCacheTime=t.corsCacheTime||1e4,/cors.movableink.com/.test(e)||(e=u.proxyUrl(e)),t.headers=t.headers||{},t.headers["x-reverse-proxy-ttl"]=t.corsCacheTime/1e3,t.headers["x-mi-cbe"]=this._hashForRequest(e,t),u.get(e,t,n)},get:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];"function"==typeof t&&(n=t,t={});var r="xhr: "+e,o=function(){if(n&&"function"==typeof n)return u.log(a),n.apply(void 0,arguments)};u.pause(t.maxSuspension||0,r);var i=u._optionsForFetch(t);return fetch(e,i).then(function(e){if(!e.ok)throw new Error(e.statusText);return e.text().then(function(t){var n=e.status,r=e.headers.get("Content-Type");return o(t,n,r),{data:t,status:n,contentType:r}})}).then(function(e){return u.resume(r),e},function(t){throw u.log("Error encountered in CD.get for "+e+": "+t),u.resume(r),o(null),t})},getImage:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];"function"==typeof t&&(n=t,t={});var r=function(){if(n&&"function"==typeof n)return u.log(a),n.apply(void 0,arguments)},o="getImage: "+e;return new Promise(function(n,a){var i=new Image;i.onload=function(){u.resume(o),r(i),n(i)},i.onerror=function(e){u.resume(o),r(null),a(e)},u.pause(t.maxSuspension,o),i.src=e})},getImages:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this,r=arguments[2],o=arguments[3],i="getImages:";u.pause(t.maxSuspension,i),"function"==typeof t&&(o=r,r=t,t={});var c=e.map(function(e){return n.getImage(e,t.maxSuspension).then(function(e){return r&&r(e),e})});return Promise.all(c).then(function(e){return o&&(u.log(a),o(e)),u.resume(i),e},function(e){throw u.resume(i),new Error("Not all images loaded successfully")})},waitForAsset:function(e){u.miCaptureFallback(function(){MICapture.waitForAsset(e)},function(){u.log("Wait for asset: "+e)})},log:function(e){console.log(e)},miCaptureFallback:function(e,t){return!window.MICapture||"object"!==o(window.MICapture)?t():e()},_hashForRequest:function(e,t){var n=""+e+JSON.stringify(t),r=0;if(0===n.length)return r;for(var o=0;o<n.length;o++)r=(r<<5)-r+n.charCodeAt(o)&4294967295;return r.toString()},_optionsForFetch:function(e){var t={redirect:"follow",headers:new Headers(e.headers||{}),method:e.method||"GET",body:e.body,mode:"cors"};return e.withoutCredentials||(t.credentials="include"),t}};t.default=u}]); | ||
var CD=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n="callbacks are deprecated in cropduster, prefer using promises for asynchronous operations",o={CORS_PROXY_SERVER:"http://cors.movableink.com",$:(e,t)=>(t||(t=document),[...t.querySelectorAll(e)]),_initParams(){o._urlParams={};const e=/([^&=]+)=?([^&]*)/g,t=o._searchString();let r=e.exec(t);for(;r;)o._urlParams[decodeURIComponent(r[1])]=decodeURIComponent(r[2]),r=e.exec(t)},param:e=>o.params()[e],params(e){let t=o._urlParams;return void 0===t&&(o._initParams(),t=o._urlParams),e?t[e]:t},_searchString:()=>window.location.search.substring(1),autofill(){o.param("init");const e=o._urlParams;for(const t in e)"undefined"!==e[t]&&e[t].length>0&&document.getElementById(`autofill_${t}`)&&(document.getElementById(`autofill_${t}`).innerHTML=e[t])},throwError(e){o.miCaptureFallback(()=>{MICapture.error(e)},()=>{o.log("Capturama error: "+e)})},cancelRequest(e){o.miCaptureFallback(()=>{MICapture.cancel(e)},()=>{o.log(`Request canceled: ${e}`)})},setImageRedirect(e){const t=document.getElementById("mi-redirect-image")||document.createElement("a");return t.href=e,t.id="mi-redirect-image",t.style.display="none",document.body.appendChild(t),t},setClickthrough(e){const t=document.getElementById("mi_dynamic_link")||document.createElement("a");return t.href=e,t.id="mi_dynamic_link",t.style.display="none",document.body.appendChild(t),t},setExtraData(e){const t=document.getElementById("mi-data")||document.createElement("div");let r;t.id="mi-data",t.style.display="none";try{r=JSON.parse(t.getAttribute("data-mi-data"))||{}}catch(e){r={}}for(const n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return t.setAttribute("data-mi-data",JSON.stringify(r)),document.body.appendChild(t),t},proxyUrl(e){const t=document.createElement("a");t.href=e;let r="";r="0"===t.port||""===t.port?"https:"===t.protocol?":443":"":`:${t.port}`;const{hostname:n,pathname:a,search:s,hash:u}=t;return`${o.CORS_PROXY_SERVER}/${n}${r}${a}${s}${u}`},_readyToCapture:!0,_reset(){o._readyToCapture=!0},pause(e,t="manual suspension"){e&&(t+=`, will end in ${e}ms`,setTimeout(()=>{o.resume(t)},e)),o.miCaptureFallback(()=>{MICapture.pause(t)},()=>{o.log(`paused: ${t}`)})},resume(e){o.miCaptureFallback(()=>{MICapture.resume(e)},()=>{o.log(`resuming paused capture: ${e}`)})},getCORS(e,t={},r){return"function"==typeof t&&(r=t,t={}),t.corsCacheTime=t.corsCacheTime||1e4,/cors.movableink.com/.test(e)||(e=o.proxyUrl(e)),t.headers=t.headers||{},t.headers["x-reverse-proxy-ttl"]=t.corsCacheTime/1e3,t.headers["x-mi-cbe"]=this._hashForRequest(e,t),o.get(e,t,r)},get(e,t={},r){"function"==typeof t&&(r=t,t={});const a=`xhr: ${e}`,s=function(){if(r&&"function"==typeof r)return o.log(n),r(...arguments)};o.pause(t.maxSuspension||0,a);const u=o._optionsForFetch(t);return fetch(e,u).then(e=>{if(!e.ok)throw new Error(e.statusText);return e.text().then(t=>{const r=e.status,n=e.headers.get("Content-Type");return s(t,r,n),{data:t,status:r,contentType:n}})}).then(e=>(o.resume(a),e),t=>{throw o.log(`Error encountered in CD.get for ${e}: ${t}`),o.resume(a),s(null),t})},getImage(e,t={},r){"function"==typeof t&&(r=t,t={});const a=function(){if(r&&"function"==typeof r)return o.log(n),r(...arguments)},s=`getImage: ${e}`;return new Promise(function(r,n){const u=new Image;u.onload=function(){o.resume(s),a(u),r(u)},u.onerror=function(e){o.resume(s),a(null),n(e)},o.pause(t.maxSuspension,s),u.src=e})},getImages(e,t={},r,a){const s="getImages:";o.pause(t.maxSuspension,s),"function"==typeof t&&(a=r,r=t,t={});const u=e.map(e=>this.getImage(e,t.maxSuspension).then(e=>(r&&r(e),e)));return Promise.all(u).then(e=>(a&&(o.log(n),a(e)),o.resume(s),e),e=>{throw o.resume(s),new Error("Not all images loaded successfully")})},waitForAsset(e){o.miCaptureFallback(()=>{MICapture.waitForAsset(e)},()=>{o.log(`Wait for asset: ${e}`)})},log(e){console.log(e)},miCaptureFallback(e,t){const r=!!window.MICapture&&"object"==typeof window.MICapture;return r?e():t()},_hashForRequest(e,t){const r=`${e}${JSON.stringify(t)}`;let n=0;if(0===r.length)return n;for(let o=0;o<r.length;o++)n=(n<<5)-n+r.charCodeAt(o)&4294967295;return n.toString()},_optionsForFetch(e){const t={redirect:"follow",headers:new Headers(e.headers||{}),method:e.method||"GET",body:e.body,mode:"cors"};return e.withoutCredentials||(t.credentials="include"),t}};t.default=o}]); | ||
//# sourceMappingURL=cropduster.browser.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.cropduster=t():e.cropduster=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a="callbacks are deprecated in cropduster, prefer using promises for asynchronous operations",u={CORS_PROXY_SERVER:"http://cors.movableink.com",$:function(e,t){return t||(t=document),[].concat(r(t.querySelectorAll(e)))},_initParams:function(){u._urlParams={};for(var e=/([^&=]+)=?([^&]*)/g,t=u._searchString(),n=e.exec(t);n;)u._urlParams[decodeURIComponent(n[1])]=decodeURIComponent(n[2]),n=e.exec(t)},param:function(e){return u.params()[e]},params:function(e){var t=u._urlParams;return void 0===t&&(u._initParams(),t=u._urlParams),e?t[e]:t},_searchString:function(){return window.location.search.substring(1)},autofill:function(){u.param("init");var e=u._urlParams;for(var t in e)"undefined"!==e[t]&&e[t].length>0&&document.getElementById("autofill_"+t)&&(document.getElementById("autofill_"+t).innerHTML=e[t])},throwError:function(e){u.miCaptureFallback(function(){MICapture.error(e)},function(){u.log("Capturama error: "+e)})},cancelRequest:function(e){u.miCaptureFallback(function(){MICapture.cancel(e)},function(){u.log("Request canceled: "+e)})},setImageRedirect:function(e){var t=document.getElementById("mi-redirect-image")||document.createElement("a");return t.href=e,t.id="mi-redirect-image",t.style.display="none",document.body.appendChild(t),t},setClickthrough:function(e){var t=document.getElementById("mi_dynamic_link")||document.createElement("a");return t.href=e,t.id="mi_dynamic_link",t.style.display="none",document.body.appendChild(t),t},setExtraData:function(e){var t=document.getElementById("mi-data")||document.createElement("div");t.id="mi-data",t.style.display="none";var n=void 0;try{n=JSON.parse(t.getAttribute("data-mi-data"))||{}}catch(e){n={}}for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return t.setAttribute("data-mi-data",JSON.stringify(n)),document.body.appendChild(t),t},proxyUrl:function(e){var t=document.createElement("a");t.href=e;var n="";n="0"===t.port||""===t.port?"https:"===t.protocol?":443":"":":"+t.port;var r=t.hostname,o=t.pathname,a=t.search,i=t.hash;return u.CORS_PROXY_SERVER+"/"+r+n+o+a+i},_readyToCapture:!0,_reset:function(){u._readyToCapture=!0},pause:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"manual suspension";e&&(t+=", will end in "+e+"ms",setTimeout(function(){u.resume(t)},e)),u.miCaptureFallback(function(){MICapture.pause(t)},function(){u.log("paused: "+t)})},resume:function(e){u.miCaptureFallback(function(){MICapture.resume(e)},function(){u.log("resuming paused capture: "+e)})},getCORS:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];return"function"==typeof t&&(n=t,t={}),t.corsCacheTime=t.corsCacheTime||1e4,/cors.movableink.com/.test(e)||(e=u.proxyUrl(e)),t.headers=t.headers||{},t.headers["x-reverse-proxy-ttl"]=t.corsCacheTime/1e3,t.headers["x-mi-cbe"]=this._hashForRequest(e,t),u.get(e,t,n)},get:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];"function"==typeof t&&(n=t,t={});var r="xhr: "+e,o=function(){if(n&&"function"==typeof n)return u.log(a),n.apply(void 0,arguments)};u.pause(t.maxSuspension||0,r);var i=u._optionsForFetch(t);return fetch(e,i).then(function(e){if(!e.ok)throw new Error(e.statusText);return e.text().then(function(t){var n=e.status,r=e.headers.get("Content-Type");return o(t,n,r),{data:t,status:n,contentType:r}})}).then(function(e){return u.resume(r),e},function(t){throw u.log("Error encountered in CD.get for "+e+": "+t),u.resume(r),o(null),t})},getImage:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];"function"==typeof t&&(n=t,t={});var r=function(){if(n&&"function"==typeof n)return u.log(a),n.apply(void 0,arguments)},o="getImage: "+e;return new Promise(function(n,a){var i=new Image;i.onload=function(){u.resume(o),r(i),n(i)},i.onerror=function(e){u.resume(o),r(null),a(e)},u.pause(t.maxSuspension,o),i.src=e})},getImages:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this,r=arguments[2],o=arguments[3],i="getImages:";u.pause(t.maxSuspension,i),"function"==typeof t&&(o=r,r=t,t={});var c=e.map(function(e){return n.getImage(e,t.maxSuspension).then(function(e){return r&&r(e),e})});return Promise.all(c).then(function(e){return o&&(u.log(a),o(e)),u.resume(i),e},function(e){throw u.resume(i),new Error("Not all images loaded successfully")})},waitForAsset:function(e){u.miCaptureFallback(function(){MICapture.waitForAsset(e)},function(){u.log("Wait for asset: "+e)})},log:function(e){console.log(e)},miCaptureFallback:function(e,t){return!window.MICapture||"object"!==o(window.MICapture)?t():e()},_hashForRequest:function(e,t){var n=""+e+JSON.stringify(t),r=0;if(0===n.length)return r;for(var o=0;o<n.length;o++)r=(r<<5)-r+n.charCodeAt(o)&4294967295;return r.toString()},_optionsForFetch:function(e){var t={redirect:"follow",headers:new Headers(e.headers||{}),method:e.method||"GET",body:e.body,mode:"cors"};return e.withoutCredentials||(t.credentials="include"),t}};t.default=u}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.cropduster=t():e.cropduster=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n="callbacks are deprecated in cropduster, prefer using promises for asynchronous operations",o={CORS_PROXY_SERVER:"http://cors.movableink.com",$:(e,t)=>(t||(t=document),[...t.querySelectorAll(e)]),_initParams(){o._urlParams={};const e=/([^&=]+)=?([^&]*)/g,t=o._searchString();let r=e.exec(t);for(;r;)o._urlParams[decodeURIComponent(r[1])]=decodeURIComponent(r[2]),r=e.exec(t)},param:e=>o.params()[e],params(e){let t=o._urlParams;return void 0===t&&(o._initParams(),t=o._urlParams),e?t[e]:t},_searchString:()=>window.location.search.substring(1),autofill(){o.param("init");const e=o._urlParams;for(const t in e)"undefined"!==e[t]&&e[t].length>0&&document.getElementById(`autofill_${t}`)&&(document.getElementById(`autofill_${t}`).innerHTML=e[t])},throwError(e){o.miCaptureFallback(()=>{MICapture.error(e)},()=>{o.log("Capturama error: "+e)})},cancelRequest(e){o.miCaptureFallback(()=>{MICapture.cancel(e)},()=>{o.log(`Request canceled: ${e}`)})},setImageRedirect(e){const t=document.getElementById("mi-redirect-image")||document.createElement("a");return t.href=e,t.id="mi-redirect-image",t.style.display="none",document.body.appendChild(t),t},setClickthrough(e){const t=document.getElementById("mi_dynamic_link")||document.createElement("a");return t.href=e,t.id="mi_dynamic_link",t.style.display="none",document.body.appendChild(t),t},setExtraData(e){const t=document.getElementById("mi-data")||document.createElement("div");let r;t.id="mi-data",t.style.display="none";try{r=JSON.parse(t.getAttribute("data-mi-data"))||{}}catch(e){r={}}for(const n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return t.setAttribute("data-mi-data",JSON.stringify(r)),document.body.appendChild(t),t},proxyUrl(e){const t=document.createElement("a");t.href=e;let r="";r="0"===t.port||""===t.port?"https:"===t.protocol?":443":"":`:${t.port}`;const{hostname:n,pathname:a,search:s,hash:u}=t;return`${o.CORS_PROXY_SERVER}/${n}${r}${a}${s}${u}`},_readyToCapture:!0,_reset(){o._readyToCapture=!0},pause(e,t="manual suspension"){e&&(t+=`, will end in ${e}ms`,setTimeout(()=>{o.resume(t)},e)),o.miCaptureFallback(()=>{MICapture.pause(t)},()=>{o.log(`paused: ${t}`)})},resume(e){o.miCaptureFallback(()=>{MICapture.resume(e)},()=>{o.log(`resuming paused capture: ${e}`)})},getCORS(e,t={},r){return"function"==typeof t&&(r=t,t={}),t.corsCacheTime=t.corsCacheTime||1e4,/cors.movableink.com/.test(e)||(e=o.proxyUrl(e)),t.headers=t.headers||{},t.headers["x-reverse-proxy-ttl"]=t.corsCacheTime/1e3,t.headers["x-mi-cbe"]=this._hashForRequest(e,t),o.get(e,t,r)},get(e,t={},r){"function"==typeof t&&(r=t,t={});const a=`xhr: ${e}`,s=function(){if(r&&"function"==typeof r)return o.log(n),r(...arguments)};o.pause(t.maxSuspension||0,a);const u=o._optionsForFetch(t);return fetch(e,u).then(e=>{if(!e.ok)throw new Error(e.statusText);return e.text().then(t=>{const r=e.status,n=e.headers.get("Content-Type");return s(t,r,n),{data:t,status:r,contentType:n}})}).then(e=>(o.resume(a),e),t=>{throw o.log(`Error encountered in CD.get for ${e}: ${t}`),o.resume(a),s(null),t})},getImage(e,t={},r){"function"==typeof t&&(r=t,t={});const a=function(){if(r&&"function"==typeof r)return o.log(n),r(...arguments)},s=`getImage: ${e}`;return new Promise(function(r,n){const u=new Image;u.onload=function(){o.resume(s),a(u),r(u)},u.onerror=function(e){o.resume(s),a(null),n(e)},o.pause(t.maxSuspension,s),u.src=e})},getImages(e,t={},r,a){const s="getImages:";o.pause(t.maxSuspension,s),"function"==typeof t&&(a=r,r=t,t={});const u=e.map(e=>this.getImage(e,t.maxSuspension).then(e=>(r&&r(e),e)));return Promise.all(u).then(e=>(a&&(o.log(n),a(e)),o.resume(s),e),e=>{throw o.resume(s),new Error("Not all images loaded successfully")})},waitForAsset(e){o.miCaptureFallback(()=>{MICapture.waitForAsset(e)},()=>{o.log(`Wait for asset: ${e}`)})},log(e){console.log(e)},miCaptureFallback(e,t){const r=!!window.MICapture&&"object"==typeof window.MICapture;return r?e():t()},_hashForRequest(e,t){const r=`${e}${JSON.stringify(t)}`;let n=0;if(0===r.length)return n;for(let o=0;o<r.length;o++)n=(n<<5)-n+r.charCodeAt(o)&4294967295;return n.toString()},_optionsForFetch(e){const t={redirect:"follow",headers:new Headers(e.headers||{}),method:e.method||"GET",body:e.body,mode:"cors"};return e.withoutCredentials||(t.credentials="include"),t}};t.default=o}])}); | ||
//# sourceMappingURL=cropduster.js.map |
@@ -29,6 +29,3 @@ module.exports = function(config) { | ||
use: { | ||
loader: 'babel-loader', | ||
options: { | ||
presets: ['es2015'] | ||
} | ||
loader: 'babel-loader' | ||
} | ||
@@ -35,0 +32,0 @@ } |
{ | ||
"name": "cropduster", | ||
"version": "5.2.0", | ||
"version": "5.3.0", | ||
"description": "Library for building web pages for use with Movable Ink Web Crops", | ||
"main": "src/cropduster.js", | ||
"main": "dist/cropduster.js", | ||
"module": "src/cropduster.js", | ||
"directories": { | ||
@@ -10,6 +11,5 @@ "test": "tests" | ||
"devDependencies": { | ||
"babel-cli": "^6.24.1", | ||
"babel-loader": "^7.0.0", | ||
"babel-polyfill": "^6.23.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-core": "^6.26.0", | ||
"babel-loader": "^7.1.2", | ||
"babel-preset-env": "^1.6.1", | ||
"fetch-mock": "^6.0.0-beta.7", | ||
@@ -25,3 +25,3 @@ "karma": "^1.7.1", | ||
"sinon": "^4.1.1", | ||
"uglify-js": "^3.0.18", | ||
"uglifyjs-webpack-plugin": "^1.1.6", | ||
"webpack": "^3.10.0", | ||
@@ -31,3 +31,3 @@ "webpack-dev-server": "^2.10.0" | ||
"scripts": { | ||
"test": "node_modules/karma/bin/karma start", | ||
"test": "yarn run karma start", | ||
"build": "yarn run webpack", | ||
@@ -34,0 +34,0 @@ "build:dev": "NODE_ENV=development yarn run webpack --watch", |
@@ -239,2 +239,5 @@ # Cropduster | ||
### 5.3.0 | ||
* Bundling change: our package.json `main` points to webpacked version, `module` points to es6 version. Prefer es6 version unless you know you need the webpacked version. | ||
### 5.2.0 | ||
@@ -241,0 +244,0 @@ * CD.get uses the `fetch` API instead of XMLHttpRequest |
const path = require('path'); | ||
const webpack = require('webpack'); | ||
const uglifier = new webpack.optimize.UglifyJsPlugin({ sourceMap: true }); | ||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); | ||
const uglifier = new UglifyJsPlugin({ | ||
sourceMap: true, | ||
uglifyOptions: { | ||
// Necessary because of Safari 10 bug | ||
// https://bugs.webkit.org/show_bug.cgi?id=171041 | ||
mangle: { | ||
safari10: true | ||
} | ||
} | ||
}); | ||
const inDev = process.env.NODE_ENV === 'development'; | ||
const plugins = inDev ? [] : [uglifier]; | ||
const isDevelopment = process.env.NODE_ENV === 'development'; | ||
const plugins = isDevelopment ? [] : [uglifier]; | ||
@@ -8,0 +17,0 @@ const defaultConfig = { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16
347
264195
794