From 3b79ec93781b3d7b9c0b56f598e060301d1f3e73 Mon Sep 17 00:00:00 2001 From: Andrew Dodson Date: Thu, 9 Jan 2020 18:39:03 +1000 Subject: [PATCH] Release v1.18.4 --- dist/hello.all.js | 2 +- dist/hello.all.min.js | 2 +- dist/hello.js | 2 +- dist/hello.min.js | 2 +- package.json | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/hello.all.js b/dist/hello.all.js index 8e1060b3..b77c8263 100644 --- a/dist/hello.all.js +++ b/dist/hello.all.js @@ -1,4 +1,4 @@ -/*! hellojs v1.18.2 | (c) 2012-2020 Andrew Dodson | MIT https://adodson.com/hello.js/LICENSE */ +/*! hellojs v1.18.4 | (c) 2012-2020 Andrew Dodson | MIT https://adodson.com/hello.js/LICENSE */ // ES5 Object.create if (!Object.create) { diff --git a/dist/hello.all.min.js b/dist/hello.all.min.js index e95a090f..85606130 100644 --- a/dist/hello.all.min.js +++ b/dist/hello.all.min.js @@ -1,2 +1,2 @@ -/*! hellojs v1.18.2 | (c) 2012-2020 Andrew Dodson | MIT https://adodson.com/hello.js/LICENSE */ +/*! hellojs v1.18.4 | (c) 2012-2020 Andrew Dodson | MIT https://adodson.com/hello.js/LICENSE */ Object.create||(Object.create=function(){function e(){}return function(t){if(1!=arguments.length)throw new Error("Object.create implementation only accepts one parameter.");return e.prototype=t,new e}}()),Object.keys||(Object.keys=function(e,t,n){for(t in n=[],e)n.hasOwnProperty.call(e,t)&&n.push(t);return n}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e){for(var t=0;t>>0;if("function"!=typeof e)throw new TypeError;for(var o=arguments.length>=2?arguments[1]:void 0,i=0;i(new Date).getTime()/1e3&&0===n.diff((p.scope||"").split(m),(a.qs.state.scope||"").split(m)).length))return i.fulfill({unchanged:!0,network:a.network,authResponse:p}),i;if("page"===s.display&&s.page_uri&&(a.qs.state.page_uri=n.url(s.page_uri).href),"login"in u&&"function"==typeof u.login&&u.login(a),(!/\btoken\b/.test(f)||parseInt(u.oauth.version,10)<2||"none"===s.display&&u.oauth.grant&&p&&p.refresh_token)&&(a.qs.state.oauth=u.oauth,a.qs.state.oauth_proxy=s.oauth_proxy),a.qs.state=encodeURIComponent(JSON.stringify(a.qs.state)),1===parseInt(u.oauth.version,10)?e=n.qs(s.oauth_proxy,a.qs,w):"none"===s.display&&u.oauth.grant&&p&&p.refresh_token?(a.qs.refresh_token=p.refresh_token,e=n.qs(s.oauth_proxy,a.qs,w)):e=n.qs(u.oauth.auth,a.qs,w),l("auth.init",a),"none"===s.display)n.iframe(e,d);else if("popup"===s.display)var v=n.popup(e,d,s.popup),y=setInterval(function(){if((!v||v.closed)&&(clearInterval(y),!i.state)){var e=o("cancelled","Login has been cancelled");v||(e=o("blocked","Popup was blocked")),e.network=a.network,i.reject(e)}},100);else window.location=e;return i.proxy;function w(e){return e}function _(e){return!!e}},logout:function(){var e=this.utils,t=e.error,n=e.Promise(),o=e.args({name:"s",options:"o",callback:"f"},arguments);function i(e,t){hello.emit(e,t)}if(o.options=o.options||{},n.proxy.then(o.callback,o.callback),n.proxy.then(i.bind(this,"auth.logout auth"),i.bind(this,"error")),o.name=o.name||this.settings.default_service,o.authResponse=e.store(o.name),!o.name||o.name in this.services)if(o.name&&o.authResponse){var a=function(t){e.store(o.name,null),n.fulfill(hello.utils.merge({network:o.name},t||{}))},r={};if(o.options.force){var s=this.services[o.name].logout;if(s)if("function"==typeof s&&(s=s(a,o)),"string"==typeof s)e.iframe(s),r.force=null,r.message="Logout success on providers site was indeterminate";else if(void 0===s)return n.proxy}a(r)}else n.reject(t("invalid_session","There was no session to remove"));else n.reject(t("invalid_network","The network was unrecognized"));return n.proxy},getAuthResponse:function(e){return(e=e||this.settings.default_service)&&e in this.services&&this.utils.store(e)||null},events:{}}),hello.utils.extend(hello.utils,{error:function(e,t){return{error:{code:e,message:t}}},qs:function(e,t,n){if(t)for(var o in n=n||encodeURIComponent,t){var i=new RegExp("([\\?\\&])"+o+"=[^\\&]*");e.match(i)&&(e=e.replace(i,"$1"+o+"="+n(t[o])),delete t[o])}return this.isEmpty(t)?e:e+(e.indexOf("?")>-1?"&":"?")+this.param(t,n)},param:function(e,t){var n,o,i={};if("string"==typeof e){if(t=t||decodeURIComponent,o=e.replace(/^[\#\?]/,"").match(/([^=\/\&]+)=([^\&]+)/g))for(var a=0;a-1&&"string"===i||e[a].indexOf("o")>-1&&"object"===i||e[a].indexOf("i")>-1&&"number"===i||e[a].indexOf("a")>-1&&"object"===i||e[a].indexOf("f")>-1&&"function"===i))n[a]=t[o++];else if("string"==typeof e[a]&&e[a].indexOf("!")>-1)return!1;return n},url:function(e){if(e){if(window.URL&&URL instanceof Function&&0!==URL.length)return new URL(e,window.location);var t=document.createElement("a");return t.href=e,t.cloneNode(!1)}return window.location},diff:function(e,t){return t.filter(function(t){return-1===e.indexOf(t)})},diffKey:function(e,t){if(e||!t){var n={};for(var o in e)o in t||(n[o]=e[o]);return n}return e},unique:function(e){return Array.isArray(e)?e.filter(function(t,n){return e.indexOf(t)===n}):[]},isEmpty:function(e){if(!e)return!0;if(Array.isArray(e))return!e.length;if("object"==typeof e)for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},Promise:function(){var e=function(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.6",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};e.prototype={fulfill:function(e){return t(this,1,"fulfillValue",e)},reject:function(e){return t(this,2,"rejectReason",e)},then:function(t,o){var a=new e;return this.onFulfilled.push(i(t,a,"fulfill")),this.onRejected.push(i(o,a,"reject")),n(this),a.proxy}};var t=function(e,t,o,i){return 0===e.state&&(e.state=t,e[o]=i,n(e)),e},n=function(e){1===e.state?o(e,"onFulfilled",e.fulfillValue):2===e.state&&o(e,"onRejected",e.rejectReason)},o=function(e,t,n){if(0!==e[t].length){var o=e[t];e[t]=[];var i=function(){for(var e=0;e-1)for(var a=0;a=400:"object"==typeof e&&"error"in e)?o.reject(e):o.fulfill(e)})}},hello.utils.extend(hello.utils,{request:function(e,t){var n=this,o=n.error;if(n.isEmpty(e.data)||"FileList"in window||!n.hasBinary(e.data)||(e.xhr=!1,e.jsonp=!1),this.request_cors(function(){return void 0===e.xhr||e.xhr&&("function"!=typeof e.xhr||e.xhr(e,e.query))}))r(e,function(o){var i=n.xhr(e.method,o,e.headers,e.data,t);i.onprogress=e.onprogress||null,i.upload&&e.onuploadprogress&&(i.upload.onprogress=e.onuploadprogress)});else{var i,a=e.query;if(e.query=n.clone(e.query),e.callbackID=n.globalEvent(),!1!==e.jsonp){if(e.query.callback=e.callbackID,"function"==typeof e.jsonp&&e.jsonp(e,e.query),"get"===e.method)return void r(e,function(o){n.jsonp(o,t,e.callbackID,e.timeout)});e.query=a}if(!1!==e.form&&(e.query.redirect_uri=e.redirect_uri,e.query.state=JSON.stringify({callback:e.callbackID}),"function"==typeof e.form&&(i=e.form(e,e.query)),"post"===e.method&&!1!==i))return void r(e,function(o){n.post(o,e.data,i,t,e.callbackID,e.timeout)});t(o("invalid_request","There was no mechanism for handling this request"))}function r(e,t){var o;e.authResponse&&e.authResponse.oauth&&1===parseInt(e.authResponse.oauth.version,10)&&(o=e.query.access_token,delete e.query.access_token,e.proxy=!0),!e.data||"get"!==e.method&&"delete"!==e.method||(n.extend(e.query,e.data),e.data=null);var i=n.qs(e.url,e.query);e.proxy&&(i=n.qs(e.oauth_proxy,{path:i,access_token:o||"",then:e.proxy_response_type||("get"===e.method.toLowerCase()?"redirect":"proxy"),method:e.method.toLowerCase(),suppress_response_codes:e.suppress_response_codes||!0})),t(i)}},request_cors:function(e){return"withCredentials"in new XMLHttpRequest&&e()},domInstance:function(e,t){var n="HTML"+(e||"").replace(/^[a-z]/,function(e){return e.toUpperCase()})+"Element";return!!t&&(window[n]?t instanceof window[n]:window.Element?t instanceof window.Element&&(!e||t.tagName&&t.tagName.toLowerCase()===e):!(t instanceof Object||t instanceof Array||t instanceof String||t instanceof Number)&&t.tagName&&t.tagName.toLowerCase()===e)},clone:function(e){if(null===e||"object"!=typeof e||e instanceof Date||"nodeName"in e||this.isBinary(e)||"function"==typeof FormData&&e instanceof FormData)return e;if(Array.isArray(e))return e.map(this.clone.bind(this));var t={};for(var n in e)t[n]=this.clone(e[n]);return t},xhr:function(e,t,n,o,i){var a,r=new XMLHttpRequest,s=this.error,l=!1;if("blob"===e&&(l=e,e="GET"),e=e.toUpperCase(),r.onload=function(t){var n=r.response;try{n=JSON.parse(r.responseText)}catch(e){401===r.status&&(n=s("access_denied",r.statusText))}var o=function(e){var t,n={},o=/([a-z\-]+):\s?(.*);?/gi;for(;t=o.exec(e);)n[t[1]]=t[2];return n}(r.getAllResponseHeaders());o.statusCode=r.status,i(n||("GET"===e?s("empty_response","Could not get resource"):{}),o)},r.onerror=function(e){var t=r.responseText;try{t=JSON.parse(r.responseText)}catch(e){}i(t||s("access_denied","Could not get resource"))},"GET"===e||"DELETE"===e)o=null;else if(o&&"string"!=typeof o&&!(o instanceof FormData)&&!(o instanceof File)&&!(o instanceof Blob)){var u=new FormData;for(a in o)o.hasOwnProperty(a)&&(o[a]instanceof HTMLInputElement?"files"in o[a]&&o[a].files.length>0&&u.append(a,o[a].files[0]):o[a]instanceof Blob?u.append(a,o[a],o.name):u.append(a,o[a]));o=u}if(r.open(e,t,!0),l&&("responseType"in r?r.responseType=l:r.overrideMimeType("text/plain; charset=x-user-defined")),n)for(a in n)r.setRequestHeader(a,n[a]);return r.send(o),r},jsonp:function(e,t,n,o){var i,a=this.error,r=0,s=document.getElementsByTagName("head")[0],l=a("server_error","server_error"),u=function(){r++||window.setTimeout(function(){t(l),s.removeChild(c)},0)};n=this.globalEvent(function(e){return l=e,!0},n),e=e.replace(new RegExp("=\\?(&|$)"),"="+n+"$1");var c=this.append("script",{id:n,name:n,src:e,async:!0,onload:u,onerror:u,onreadystatechange:function(){/loaded|complete/i.test(this.readyState)&&u()}});window.navigator.userAgent.toLowerCase().indexOf("opera")>-1&&(i=this.append("script",{text:"document.getElementById('"+n+"').onerror();"}),c.async=!1),o&&window.setTimeout(function(){l=a("timeout","timeout"),u()},o),s.appendChild(c),i&&s.appendChild(i)},post:function(e,t,n,o,i,a){var r,s,l=this,u=l.error,c=document,d=null,f=[],p=0,m=null,h=0,g=function(e){h++||o(e)};l.globalEvent(g,i);try{s=c.createElement('