diff --git a/client/oc-client.min.js b/client/oc-client.min.js index 80b7e5d39..0146f265b 100644 --- a/client/oc-client.min.js +++ b/client/oc-client.min.js @@ -1 +1 @@ -!function(e,n){"use strict";function t(){}function r(e,n){if(e){"object"==typeof e&&(e=[].slice.call(e));for(var t=0,r=e.length;r>t;t++)n.call(e,e[t],t)}}function o(e,t){var r=Object.prototype.toString.call(t).slice(8,-1);return t!==n&&null!==t&&r===e}function a(e){return o("Function",e)}function c(e){return o("Array",e)}function i(e){var n=e.split("/"),t=n[n.length-1],r=t.indexOf("?");return-1!==r?t.substring(0,r):t}function u(e){e=e||t,e._done||(e(),e._done=1)}function d(e,n,r,o){var a="object"==typeof e?e:{test:e,success:n?c(n)?n:[n]:!1,failure:r?c(r)?r:[r]:!1,callback:o||t},i=!!a.test;return i&&a.success?(a.success.push(a.callback),S.load.apply(null,a.success)):!i&&a.failure?(a.failure.push(a.callback),S.load.apply(null,a.failure)):o(),S}function l(e){var n={};if("object"==typeof e)for(var t in e)e[t]&&(n={name:t,url:e[t]});else n={name:i(e),url:e};var r=M[n.name];return r&&r.url===n.url?r:(M[n.name]=n,n)}function f(e){e=e||M;for(var n in e)if(e.hasOwnProperty(n)&&e[n].state!==I)return!1;return!0}function s(e){e.state=k,r(e.onpreload,function(e){e.call()})}function m(e,t){e.state===n&&(e.state=A,e.onpreload=[],g({url:e.url,type:"cache"},function(){s(e)}))}function p(){var e=arguments,n=e[e.length-1],t=[].slice.call(e,1),o=t[0];return a(n)||(n=null),c(e[0])?(e[0].push(n),S.load.apply(null,e[0]),S):(o?(r(t,function(e){!a(e)&&e&&m(l(e))}),y(l(e[0]),a(o)?o:function(){S.load.apply(null,t)})):y(l(e[0])),S)}function v(){var e=arguments,n=e[e.length-1],t={};return a(n)||(n=null),c(e[0])?(e[0].push(n),S.load.apply(null,e[0]),S):(r(e,function(e,r){e!==n&&(e=l(e),t[e.name]=e)}),r(e,function(e,r){e!==n&&(e=l(e),y(e,function(){f(t)&&u(n)}))}),S)}function y(e,n){return n=n||t,e.state===I?void n():e.state===_?void S.ready(e.name,n):e.state===A?void e.onpreload.push(function(){y(e,n)}):(e.state=_,void g(e,function(){e.state=I,n(),r(x[e.name],function(e){u(e)}),L&&f()&&r(x.ALL,function(e){u(e)})}))}function h(e){e=e||"";var n=e.split("?")[0].split(".");return n[n.length-1].toLowerCase()}function g(n,r){function o(n){n=n||e.event,i.onload=i.onreadystatechange=i.onerror=null,r()}function a(t){t=t||e.event,("load"===t.type||/loaded|complete/.test(i.readyState)&&(!q.documentMode||q.documentMode<9))&&(e.clearTimeout(n.errorTimeout),e.clearTimeout(n.cssTimeout),i.onload=i.onreadystatechange=i.onerror=null,r())}function c(){if(n.state!==I&&n.cssRetries<=20){for(var t=0,r=q.styleSheets.length;r>t;t++)if(q.styleSheets[t].href===i.href)return void a({type:"load"});n.cssRetries++,n.cssTimeout=e.setTimeout(c,250)}}r=r||t;var i,u=h(n.url);"css"===u?(i=q.createElement("link"),i.type="text/"+(n.type||"css"),i.rel="stylesheet",i.href=n.url,n.cssRetries=0,n.cssTimeout=e.setTimeout(c,500)):(i=q.createElement("script"),i.type="text/"+(n.type||"javascript"),i.src=n.url),i.onload=i.onreadystatechange=a,i.onerror=o,i.async=!1,i.defer=!1,n.errorTimeout=e.setTimeout(function(){o({type:"timeout"})},7e3);var d=q.head||q.getElementsByTagName("head")[0];d.insertBefore(i,d.lastChild)}function j(){for(var e=q.getElementsByTagName("script"),n=0,t=e.length;t>n;n++){var r=e[n].getAttribute("data-headjs-load");if(r)return void S.load(r)}}function b(e,n){if(e===q)return L?u(n):C.push(n),S;if(a(e)&&(n=e,e="ALL"),c(e)){var t={};return r(e,function(e){t[e]=M[e],S.ready(e,function(){f(t)&&u(n)})}),S}if("string"!=typeof e||!a(n))return S;var o=M[e];if(o&&o.state===I||"ALL"===e&&f()&&L)return u(n),S;var i=x[e];return i?i.push(n):i=x[e]=[n],S}function T(){return q.body?void(L||(L=!0,j(),r(C,function(e){u(e)}))):(e.clearTimeout(S.readyTimeout),void(S.readyTimeout=e.setTimeout(T,50)))}function E(){q.addEventListener?(q.removeEventListener("DOMContentLoaded",E,!1),T()):"complete"===q.readyState&&(q.detachEvent("onreadystatechange",E),T())}var L,q=e.document,C=[],x={},M={},O="async"in q.createElement("script")||"MozAppearance"in q.documentElement.style||e.opera,w=e.head_conf&&e.head_conf.head||"head",S=e[w]=e[w]||function(){S.ready.apply(null,arguments)},A=1,k=2,_=3,I=4;if("complete"===q.readyState)T();else if(q.addEventListener)q.addEventListener("DOMContentLoaded",E,!1),e.addEventListener("load",T,!1);else{q.attachEvent("onreadystatechange",E),e.attachEvent("onload",T);var U=!1;try{U=!e.frameElement&&q.documentElement}catch(B){}U&&U.doScroll&&!function N(){if(!L){try{U.doScroll("left")}catch(n){return e.clearTimeout(S.readyTimeout),void(S.readyTimeout=e.setTimeout(N,50))}T()}}()}S.load=S.js=O?v:p,S.test=d,S.ready=b,S.ready(q,function(){f()&&r(x.ALL,function(e){u(e)}),S.feature&&S.feature("domloaded",!0)})}(window);var oc=oc||{};!function(e,n,t){oc.conf=oc.conf||{},oc.cmd=oc.cmd||[],oc.renderedComponents=oc.renderedComponents||{};var r,o="https://cdnjs.cloudflare.com/ajax/libs/",a=o+"jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js",c=o+"handlebars.js/3.0.1/handlebars.runtime.js",i=o+"jade/1.9.2/runtime.min.js",u=o+"jquery/1.11.2/jquery.min.js",d=oc.conf.retryInterval||5e3,l=oc.conf.retryLimit||30,f=oc.conf.retrySendNumber||!0,s=oc.conf.pollingInterval||500,m=oc.conf.tag||"oc-component",p="baseUrl parameter is required",v="Href parameter missing",y="name parameter is required",h="Failed to load {0} component {1} times. Giving up".replace("{1}",l),g="Error getting compiled view: {0}",j="Error rendering component: {0}, error: {1}",b="Failed to retrieve the component. Retrying in {0} seconds...".replace("{0}",d/1e3),T='Error loading component: view engine "{0}" not supported',E="Loading...",L="Component '{0}' correctly rendered",q="Unrendered component found. Trying to retrieve it...",C=oc.conf.debug||!1,x=function(){},M=t.navigator.userAgent,O=!!M.match(/MSIE 8/),w=!!M.match(/MSIE 9/),S=!1,A=!1,k={},_={error:function(e){return console.log(e)},info:function(e){return C?console.log(e):!1}},I=function(e,n,t){return void 0===k[e]&&(k[e]=l),k[e]<=0?t():(setTimeout(function(){n(l-k[e]+1)},d),void k[e]--)},U=function(e,n){if(e&&n){var t=r.param(n);return e.indexOf("?")>-1?e+"&"+t:e+"?"+t}return e};oc.require=function(n,r,o){"function"==typeof r&&(o=r,r=n,n=void 0),"string"==typeof n&&(n=[n]);var a=function(){var e=t;if("undefined"==typeof n)return!0;for(var r=0;r':"<"+m+' href="'+t+'">"},oc.events={},oc.ready=function(e){if(S)return e();if(A)oc.cmd.push(e);else{A=!0;var n=function(e){!O&&!w||r.IE_POLYFILL_LOADED?e():oc.require(a,e)},t=function(){S=!0,A=!1,oc.events=function(){var e=r({});return{fire:function(n,t){return e.trigger(n,t)},on:function(n,t){return e.on(n,t||x)},reset:function(){return e.off()}}}(),e(),oc.events.fire("oc:ready",oc);for(var n=0;n'+E+""),oc.renderByHref(e.attr("href"),function(t,r){return t||!r?(_.error(t),n()):void B(e,r,n)}))})},oc.renderByHref=function(e,n,t){var o=t,a=n;"function"==typeof n&&(o=n,a=0),oc.ready(function(){if(""===e)return o(j.replace("{1}",v));var n=e;f&&(n=U(n,{__oc_Retry:a})),r.ajax({url:n,headers:{Accept:"application/vnd.oc.unrendered+json"},contentType:"text/plain",crossDomain:!0,async:!0,success:function(e){if("pre-rendered"===e.renderMode||"unrendered"===e.renderMode)oc.render(e.template,e.data,function(n,t){return n?o(j.replace("{0}",e.href).replace("{1}",n)):(_.info(L.replace("{0}",e.template.src)),void o(null,{html:t,key:e.template.key,version:e.version,name:e.name}))});else if("rendered"===e.renderMode){if(_.info(L.replace("{0}",e.href)),0===e.html.indexOf("<"+m)){var n=e.html.slice(e.html.indexOf(">")+1),t=n.slice(0,n.lastIndexOf("<"));e.html=t}o(null,{html:e.html,version:e.version,name:e.name})}},error:function(){_.error(b),I(e,function(n){oc.renderByHref(e,n,o)},function(){o(h.replace("{0}",e))})}})})},oc.renderUnloadedComponents=function(){oc.ready(function(){var e=O?"div[data-oc-component=true]":m,n=r(e+"[data-rendered!=true]"),t=n.length,o=function(e){t--,t||oc.renderUnloadedComponents()};if(t>0)for(var a=0;a');var o=r(m,e);oc.renderNestedComponent(o,function(){t(o)})}})},oc.ready(oc.renderUnloadedComponents)}(head,document,window),oc.clientVersion="0.22.2"; \ No newline at end of file +!function(e,n){"use strict";function t(){}function r(e,n){if(e){"object"==typeof e&&(e=[].slice.call(e));for(var t=0,r=e.length;r>t;t++)n.call(e,e[t],t)}}function o(e,t){var r=Object.prototype.toString.call(t).slice(8,-1);return t!==n&&null!==t&&r===e}function a(e){return o("Function",e)}function c(e){return o("Array",e)}function i(e){var n=e.split("/"),t=n[n.length-1],r=t.indexOf("?");return-1!==r?t.substring(0,r):t}function u(e){e=e||t,e._done||(e(),e._done=1)}function d(e,n,r,o){var a="object"==typeof e?e:{test:e,success:n?c(n)?n:[n]:!1,failure:r?c(r)?r:[r]:!1,callback:o||t},i=!!a.test;return i&&a.success?(a.success.push(a.callback),S.load.apply(null,a.success)):!i&&a.failure?(a.failure.push(a.callback),S.load.apply(null,a.failure)):o(),S}function l(e){var n={};if("object"==typeof e)for(var t in e)e[t]&&(n={name:t,url:e[t]});else n={name:i(e),url:e};var r=M[n.name];return r&&r.url===n.url?r:(M[n.name]=n,n)}function f(e){e=e||M;for(var n in e)if(e.hasOwnProperty(n)&&e[n].state!==I)return!1;return!0}function s(e){e.state=k,r(e.onpreload,function(e){e.call()})}function m(e,t){e.state===n&&(e.state=A,e.onpreload=[],g({url:e.url,type:"cache"},function(){s(e)}))}function p(){var e=arguments,n=e[e.length-1],t=[].slice.call(e,1),o=t[0];return a(n)||(n=null),c(e[0])?(e[0].push(n),S.load.apply(null,e[0]),S):(o?(r(t,function(e){!a(e)&&e&&m(l(e))}),y(l(e[0]),a(o)?o:function(){S.load.apply(null,t)})):y(l(e[0])),S)}function v(){var e=arguments,n=e[e.length-1],t={};return a(n)||(n=null),c(e[0])?(e[0].push(n),S.load.apply(null,e[0]),S):(r(e,function(e,r){e!==n&&(e=l(e),t[e.name]=e)}),r(e,function(e,r){e!==n&&(e=l(e),y(e,function(){f(t)&&u(n)}))}),S)}function y(e,n){return n=n||t,e.state===I?void n():e.state===_?void S.ready(e.name,n):e.state===A?void e.onpreload.push(function(){y(e,n)}):(e.state=_,void g(e,function(){e.state=I,n(),r(x[e.name],function(e){u(e)}),L&&f()&&r(x.ALL,function(e){u(e)})}))}function h(e){e=e||"";var n=e.split("?")[0].split(".");return n[n.length-1].toLowerCase()}function g(n,r){function o(n){n=n||e.event,i.onload=i.onreadystatechange=i.onerror=null,r()}function a(t){t=t||e.event,("load"===t.type||/loaded|complete/.test(i.readyState)&&(!q.documentMode||q.documentMode<9))&&(e.clearTimeout(n.errorTimeout),e.clearTimeout(n.cssTimeout),i.onload=i.onreadystatechange=i.onerror=null,r())}function c(){if(n.state!==I&&n.cssRetries<=20){for(var t=0,r=q.styleSheets.length;r>t;t++)if(q.styleSheets[t].href===i.href)return void a({type:"load"});n.cssRetries++,n.cssTimeout=e.setTimeout(c,250)}}r=r||t;var i,u=h(n.url);"css"===u?(i=q.createElement("link"),i.type="text/"+(n.type||"css"),i.rel="stylesheet",i.href=n.url,n.cssRetries=0,n.cssTimeout=e.setTimeout(c,500)):(i=q.createElement("script"),i.type="text/"+(n.type||"javascript"),i.src=n.url),i.onload=i.onreadystatechange=a,i.onerror=o,i.async=!1,i.defer=!1,n.errorTimeout=e.setTimeout(function(){o({type:"timeout"})},7e3);var d=q.head||q.getElementsByTagName("head")[0];d.insertBefore(i,d.lastChild)}function j(){for(var e=q.getElementsByTagName("script"),n=0,t=e.length;t>n;n++){var r=e[n].getAttribute("data-headjs-load");if(r)return void S.load(r)}}function b(e,n){if(e===q)return L?u(n):C.push(n),S;if(a(e)&&(n=e,e="ALL"),c(e)){var t={};return r(e,function(e){t[e]=M[e],S.ready(e,function(){f(t)&&u(n)})}),S}if("string"!=typeof e||!a(n))return S;var o=M[e];if(o&&o.state===I||"ALL"===e&&f()&&L)return u(n),S;var i=x[e];return i?i.push(n):i=x[e]=[n],S}function T(){return q.body?void(L||(L=!0,j(),r(C,function(e){u(e)}))):(e.clearTimeout(S.readyTimeout),void(S.readyTimeout=e.setTimeout(T,50)))}function E(){q.addEventListener?(q.removeEventListener("DOMContentLoaded",E,!1),T()):"complete"===q.readyState&&(q.detachEvent("onreadystatechange",E),T())}var L,q=e.document,C=[],x={},M={},O="async"in q.createElement("script")||"MozAppearance"in q.documentElement.style||e.opera,w=e.head_conf&&e.head_conf.head||"head",S=e[w]=e[w]||function(){S.ready.apply(null,arguments)},A=1,k=2,_=3,I=4;if("complete"===q.readyState)T();else if(q.addEventListener)q.addEventListener("DOMContentLoaded",E,!1),e.addEventListener("load",T,!1);else{q.attachEvent("onreadystatechange",E),e.attachEvent("onload",T);var U=!1;try{U=!e.frameElement&&q.documentElement}catch(B){}U&&U.doScroll&&!function N(){if(!L){try{U.doScroll("left")}catch(n){return e.clearTimeout(S.readyTimeout),void(S.readyTimeout=e.setTimeout(N,50))}T()}}()}S.load=S.js=O?v:p,S.test=d,S.ready=b,S.ready(q,function(){f()&&r(x.ALL,function(e){u(e)}),S.feature&&S.feature("domloaded",!0)})}(window);var oc=oc||{};!function(e,n,t){oc.conf=oc.conf||{},oc.cmd=oc.cmd||[],oc.renderedComponents=oc.renderedComponents||{};var r,o="https://cdnjs.cloudflare.com/ajax/libs/",a=o+"jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js",c=o+"handlebars.js/3.0.1/handlebars.runtime.js",i=o+"jade/1.9.2/runtime.min.js",u=o+"jquery/1.11.2/jquery.min.js",d=oc.conf.retryInterval||5e3,l=oc.conf.retryLimit||30,f=oc.conf.retrySendNumber||!0,s=oc.conf.pollingInterval||500,m=oc.conf.tag||"oc-component",p="baseUrl parameter is required",v="Href parameter missing",y="name parameter is required",h="Failed to load {0} component {1} times. Giving up".replace("{1}",l),g="Error getting compiled view: {0}",j="Error rendering component: {0}, error: {1}",b="Failed to retrieve the component. Retrying in {0} seconds...".replace("{0}",d/1e3),T='Error loading component: view engine "{0}" not supported',E="Loading...",L="Component '{0}' correctly rendered",q="Unrendered component found. Trying to retrieve it...",C=oc.conf.debug||!1,x=function(){},M=t.navigator.userAgent,O=!!M.match(/MSIE 8/),w=!!M.match(/MSIE 9/),S=!1,A=!1,k={},_={error:function(e){return console.log(e)},info:function(e){return C?console.log(e):!1}},I=function(e,n,t){return void 0===k[e]&&(k[e]=l),k[e]<=0?t():(setTimeout(function(){n(l-k[e]+1)},d),void k[e]--)},U=function(e,n){if(e&&n){var t=r.param(n);return e.indexOf("?")>-1?e+"&"+t:e+"?"+t}return e};oc.require=function(n,r,o){"function"==typeof r&&(o=r,r=n,n=void 0),"string"==typeof n&&(n=[n]);var a=function(){var e=t;if("undefined"==typeof n)return!0;for(var r=0;r':"<"+m+' href="'+t+'">"},oc.events={},oc.ready=function(e){if(S)return e();if(A)oc.cmd.push(e);else{A=!0;var n=function(e){!O&&!w||r.IE_POLYFILL_LOADED?e():oc.require(a,e)},t=function(){S=!0,A=!1,oc.events=function(){var e=r({});return{fire:function(n,t){return e.trigger(n,t)},on:function(n,t){return e.on(n,t||x)},reset:function(){return e.off()}}}(),e(),oc.events.fire("oc:ready",oc);for(var n=0;n'+E+""),oc.renderByHref(e.attr("href"),function(t,r){return t||!r?(_.error(t),n()):void B(e,r,n)}))})},oc.renderByHref=function(e,n,t){var o=t,a=n;"function"==typeof n&&(o=n,a=0),oc.ready(function(){if(""===e)return o(j.replace("{1}",v));var n=e;f&&(n=U(n,{__oc_Retry:a})),r.ajax({url:n,headers:{Accept:"application/vnd.oc.unrendered+json"},contentType:"text/plain",crossDomain:!0,async:!0,success:function(e){if("pre-rendered"===e.renderMode||"unrendered"===e.renderMode)oc.render(e.template,e.data,function(n,t){return n?o(j.replace("{0}",e.href).replace("{1}",n)):(_.info(L.replace("{0}",e.template.src)),void o(null,{html:t,key:e.template.key,version:e.version,name:e.name}))});else if("rendered"===e.renderMode){if(_.info(L.replace("{0}",e.href)),0===e.html.indexOf("<"+m)){var n=e.html.slice(e.html.indexOf(">")+1),t=n.slice(0,n.lastIndexOf("<"));e.html=t}o(null,{html:e.html,version:e.version,name:e.name})}},error:function(){_.error(b),I(e,function(n){oc.renderByHref(e,n,o)},function(){o(h.replace("{0}",e))})}})})},oc.renderUnloadedComponents=function(){oc.ready(function(){var e=O?"div[data-oc-component=true]":m,n=r(e+"[data-rendered!=true]"),t=n.length,o=function(e){t--,t||oc.renderUnloadedComponents()};if(t>0)for(var a=0;a');var o=r(m,e);oc.renderNestedComponent(o,function(){t(o)})}})},oc.ready(oc.renderUnloadedComponents)}(head,document,window),oc.clientVersion="0.22.3"; \ No newline at end of file diff --git a/components/oc-client/_package/package.json b/components/oc-client/_package/package.json index e62a3ccc3..0170729cc 100644 --- a/components/oc-client/_package/package.json +++ b/components/oc-client/_package/package.json @@ -1 +1 @@ -{"name":"oc-client","description":"The OpenComponents client-side javascript client","version":"0.22.2","repository":"https://github.com/opentable/oc/tree/master/components/oc-client","oc":{"parameters":{},"files":{"template":{"type":"handlebars","hashKey":"bb774de6a2b7280c2b66103bd36d7e708a1b7541","src":"template.js"},"static":["src"],"dataProvider":{"type":"node.js","hashKey":"ffb0e43eaf72f55fa13dc1e7262019c14c3dfc81","src":"server.js"}},"version":"0.22.2","packaged":true,"date":1452534285343}} +{"name":"oc-client","description":"The OpenComponents client-side javascript client","version":"0.22.3","repository":"https://github.com/opentable/oc/tree/master/components/oc-client","oc":{"parameters":{},"files":{"template":{"type":"handlebars","hashKey":"bb774de6a2b7280c2b66103bd36d7e708a1b7541","src":"template.js"},"static":["src"],"dataProvider":{"type":"node.js","hashKey":"ffb0e43eaf72f55fa13dc1e7262019c14c3dfc81","src":"server.js"}},"version":"0.22.3","packaged":true,"date":1452773356936}} diff --git a/components/oc-client/_package/src/oc-client.min.js b/components/oc-client/_package/src/oc-client.min.js index 80b7e5d39..0146f265b 100644 --- a/components/oc-client/_package/src/oc-client.min.js +++ b/components/oc-client/_package/src/oc-client.min.js @@ -1 +1 @@ -!function(e,n){"use strict";function t(){}function r(e,n){if(e){"object"==typeof e&&(e=[].slice.call(e));for(var t=0,r=e.length;r>t;t++)n.call(e,e[t],t)}}function o(e,t){var r=Object.prototype.toString.call(t).slice(8,-1);return t!==n&&null!==t&&r===e}function a(e){return o("Function",e)}function c(e){return o("Array",e)}function i(e){var n=e.split("/"),t=n[n.length-1],r=t.indexOf("?");return-1!==r?t.substring(0,r):t}function u(e){e=e||t,e._done||(e(),e._done=1)}function d(e,n,r,o){var a="object"==typeof e?e:{test:e,success:n?c(n)?n:[n]:!1,failure:r?c(r)?r:[r]:!1,callback:o||t},i=!!a.test;return i&&a.success?(a.success.push(a.callback),S.load.apply(null,a.success)):!i&&a.failure?(a.failure.push(a.callback),S.load.apply(null,a.failure)):o(),S}function l(e){var n={};if("object"==typeof e)for(var t in e)e[t]&&(n={name:t,url:e[t]});else n={name:i(e),url:e};var r=M[n.name];return r&&r.url===n.url?r:(M[n.name]=n,n)}function f(e){e=e||M;for(var n in e)if(e.hasOwnProperty(n)&&e[n].state!==I)return!1;return!0}function s(e){e.state=k,r(e.onpreload,function(e){e.call()})}function m(e,t){e.state===n&&(e.state=A,e.onpreload=[],g({url:e.url,type:"cache"},function(){s(e)}))}function p(){var e=arguments,n=e[e.length-1],t=[].slice.call(e,1),o=t[0];return a(n)||(n=null),c(e[0])?(e[0].push(n),S.load.apply(null,e[0]),S):(o?(r(t,function(e){!a(e)&&e&&m(l(e))}),y(l(e[0]),a(o)?o:function(){S.load.apply(null,t)})):y(l(e[0])),S)}function v(){var e=arguments,n=e[e.length-1],t={};return a(n)||(n=null),c(e[0])?(e[0].push(n),S.load.apply(null,e[0]),S):(r(e,function(e,r){e!==n&&(e=l(e),t[e.name]=e)}),r(e,function(e,r){e!==n&&(e=l(e),y(e,function(){f(t)&&u(n)}))}),S)}function y(e,n){return n=n||t,e.state===I?void n():e.state===_?void S.ready(e.name,n):e.state===A?void e.onpreload.push(function(){y(e,n)}):(e.state=_,void g(e,function(){e.state=I,n(),r(x[e.name],function(e){u(e)}),L&&f()&&r(x.ALL,function(e){u(e)})}))}function h(e){e=e||"";var n=e.split("?")[0].split(".");return n[n.length-1].toLowerCase()}function g(n,r){function o(n){n=n||e.event,i.onload=i.onreadystatechange=i.onerror=null,r()}function a(t){t=t||e.event,("load"===t.type||/loaded|complete/.test(i.readyState)&&(!q.documentMode||q.documentMode<9))&&(e.clearTimeout(n.errorTimeout),e.clearTimeout(n.cssTimeout),i.onload=i.onreadystatechange=i.onerror=null,r())}function c(){if(n.state!==I&&n.cssRetries<=20){for(var t=0,r=q.styleSheets.length;r>t;t++)if(q.styleSheets[t].href===i.href)return void a({type:"load"});n.cssRetries++,n.cssTimeout=e.setTimeout(c,250)}}r=r||t;var i,u=h(n.url);"css"===u?(i=q.createElement("link"),i.type="text/"+(n.type||"css"),i.rel="stylesheet",i.href=n.url,n.cssRetries=0,n.cssTimeout=e.setTimeout(c,500)):(i=q.createElement("script"),i.type="text/"+(n.type||"javascript"),i.src=n.url),i.onload=i.onreadystatechange=a,i.onerror=o,i.async=!1,i.defer=!1,n.errorTimeout=e.setTimeout(function(){o({type:"timeout"})},7e3);var d=q.head||q.getElementsByTagName("head")[0];d.insertBefore(i,d.lastChild)}function j(){for(var e=q.getElementsByTagName("script"),n=0,t=e.length;t>n;n++){var r=e[n].getAttribute("data-headjs-load");if(r)return void S.load(r)}}function b(e,n){if(e===q)return L?u(n):C.push(n),S;if(a(e)&&(n=e,e="ALL"),c(e)){var t={};return r(e,function(e){t[e]=M[e],S.ready(e,function(){f(t)&&u(n)})}),S}if("string"!=typeof e||!a(n))return S;var o=M[e];if(o&&o.state===I||"ALL"===e&&f()&&L)return u(n),S;var i=x[e];return i?i.push(n):i=x[e]=[n],S}function T(){return q.body?void(L||(L=!0,j(),r(C,function(e){u(e)}))):(e.clearTimeout(S.readyTimeout),void(S.readyTimeout=e.setTimeout(T,50)))}function E(){q.addEventListener?(q.removeEventListener("DOMContentLoaded",E,!1),T()):"complete"===q.readyState&&(q.detachEvent("onreadystatechange",E),T())}var L,q=e.document,C=[],x={},M={},O="async"in q.createElement("script")||"MozAppearance"in q.documentElement.style||e.opera,w=e.head_conf&&e.head_conf.head||"head",S=e[w]=e[w]||function(){S.ready.apply(null,arguments)},A=1,k=2,_=3,I=4;if("complete"===q.readyState)T();else if(q.addEventListener)q.addEventListener("DOMContentLoaded",E,!1),e.addEventListener("load",T,!1);else{q.attachEvent("onreadystatechange",E),e.attachEvent("onload",T);var U=!1;try{U=!e.frameElement&&q.documentElement}catch(B){}U&&U.doScroll&&!function N(){if(!L){try{U.doScroll("left")}catch(n){return e.clearTimeout(S.readyTimeout),void(S.readyTimeout=e.setTimeout(N,50))}T()}}()}S.load=S.js=O?v:p,S.test=d,S.ready=b,S.ready(q,function(){f()&&r(x.ALL,function(e){u(e)}),S.feature&&S.feature("domloaded",!0)})}(window);var oc=oc||{};!function(e,n,t){oc.conf=oc.conf||{},oc.cmd=oc.cmd||[],oc.renderedComponents=oc.renderedComponents||{};var r,o="https://cdnjs.cloudflare.com/ajax/libs/",a=o+"jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js",c=o+"handlebars.js/3.0.1/handlebars.runtime.js",i=o+"jade/1.9.2/runtime.min.js",u=o+"jquery/1.11.2/jquery.min.js",d=oc.conf.retryInterval||5e3,l=oc.conf.retryLimit||30,f=oc.conf.retrySendNumber||!0,s=oc.conf.pollingInterval||500,m=oc.conf.tag||"oc-component",p="baseUrl parameter is required",v="Href parameter missing",y="name parameter is required",h="Failed to load {0} component {1} times. Giving up".replace("{1}",l),g="Error getting compiled view: {0}",j="Error rendering component: {0}, error: {1}",b="Failed to retrieve the component. Retrying in {0} seconds...".replace("{0}",d/1e3),T='Error loading component: view engine "{0}" not supported',E="Loading...",L="Component '{0}' correctly rendered",q="Unrendered component found. Trying to retrieve it...",C=oc.conf.debug||!1,x=function(){},M=t.navigator.userAgent,O=!!M.match(/MSIE 8/),w=!!M.match(/MSIE 9/),S=!1,A=!1,k={},_={error:function(e){return console.log(e)},info:function(e){return C?console.log(e):!1}},I=function(e,n,t){return void 0===k[e]&&(k[e]=l),k[e]<=0?t():(setTimeout(function(){n(l-k[e]+1)},d),void k[e]--)},U=function(e,n){if(e&&n){var t=r.param(n);return e.indexOf("?")>-1?e+"&"+t:e+"?"+t}return e};oc.require=function(n,r,o){"function"==typeof r&&(o=r,r=n,n=void 0),"string"==typeof n&&(n=[n]);var a=function(){var e=t;if("undefined"==typeof n)return!0;for(var r=0;r':"<"+m+' href="'+t+'">"},oc.events={},oc.ready=function(e){if(S)return e();if(A)oc.cmd.push(e);else{A=!0;var n=function(e){!O&&!w||r.IE_POLYFILL_LOADED?e():oc.require(a,e)},t=function(){S=!0,A=!1,oc.events=function(){var e=r({});return{fire:function(n,t){return e.trigger(n,t)},on:function(n,t){return e.on(n,t||x)},reset:function(){return e.off()}}}(),e(),oc.events.fire("oc:ready",oc);for(var n=0;n'+E+""),oc.renderByHref(e.attr("href"),function(t,r){return t||!r?(_.error(t),n()):void B(e,r,n)}))})},oc.renderByHref=function(e,n,t){var o=t,a=n;"function"==typeof n&&(o=n,a=0),oc.ready(function(){if(""===e)return o(j.replace("{1}",v));var n=e;f&&(n=U(n,{__oc_Retry:a})),r.ajax({url:n,headers:{Accept:"application/vnd.oc.unrendered+json"},contentType:"text/plain",crossDomain:!0,async:!0,success:function(e){if("pre-rendered"===e.renderMode||"unrendered"===e.renderMode)oc.render(e.template,e.data,function(n,t){return n?o(j.replace("{0}",e.href).replace("{1}",n)):(_.info(L.replace("{0}",e.template.src)),void o(null,{html:t,key:e.template.key,version:e.version,name:e.name}))});else if("rendered"===e.renderMode){if(_.info(L.replace("{0}",e.href)),0===e.html.indexOf("<"+m)){var n=e.html.slice(e.html.indexOf(">")+1),t=n.slice(0,n.lastIndexOf("<"));e.html=t}o(null,{html:e.html,version:e.version,name:e.name})}},error:function(){_.error(b),I(e,function(n){oc.renderByHref(e,n,o)},function(){o(h.replace("{0}",e))})}})})},oc.renderUnloadedComponents=function(){oc.ready(function(){var e=O?"div[data-oc-component=true]":m,n=r(e+"[data-rendered!=true]"),t=n.length,o=function(e){t--,t||oc.renderUnloadedComponents()};if(t>0)for(var a=0;a');var o=r(m,e);oc.renderNestedComponent(o,function(){t(o)})}})},oc.ready(oc.renderUnloadedComponents)}(head,document,window),oc.clientVersion="0.22.2"; \ No newline at end of file +!function(e,n){"use strict";function t(){}function r(e,n){if(e){"object"==typeof e&&(e=[].slice.call(e));for(var t=0,r=e.length;r>t;t++)n.call(e,e[t],t)}}function o(e,t){var r=Object.prototype.toString.call(t).slice(8,-1);return t!==n&&null!==t&&r===e}function a(e){return o("Function",e)}function c(e){return o("Array",e)}function i(e){var n=e.split("/"),t=n[n.length-1],r=t.indexOf("?");return-1!==r?t.substring(0,r):t}function u(e){e=e||t,e._done||(e(),e._done=1)}function d(e,n,r,o){var a="object"==typeof e?e:{test:e,success:n?c(n)?n:[n]:!1,failure:r?c(r)?r:[r]:!1,callback:o||t},i=!!a.test;return i&&a.success?(a.success.push(a.callback),S.load.apply(null,a.success)):!i&&a.failure?(a.failure.push(a.callback),S.load.apply(null,a.failure)):o(),S}function l(e){var n={};if("object"==typeof e)for(var t in e)e[t]&&(n={name:t,url:e[t]});else n={name:i(e),url:e};var r=M[n.name];return r&&r.url===n.url?r:(M[n.name]=n,n)}function f(e){e=e||M;for(var n in e)if(e.hasOwnProperty(n)&&e[n].state!==I)return!1;return!0}function s(e){e.state=k,r(e.onpreload,function(e){e.call()})}function m(e,t){e.state===n&&(e.state=A,e.onpreload=[],g({url:e.url,type:"cache"},function(){s(e)}))}function p(){var e=arguments,n=e[e.length-1],t=[].slice.call(e,1),o=t[0];return a(n)||(n=null),c(e[0])?(e[0].push(n),S.load.apply(null,e[0]),S):(o?(r(t,function(e){!a(e)&&e&&m(l(e))}),y(l(e[0]),a(o)?o:function(){S.load.apply(null,t)})):y(l(e[0])),S)}function v(){var e=arguments,n=e[e.length-1],t={};return a(n)||(n=null),c(e[0])?(e[0].push(n),S.load.apply(null,e[0]),S):(r(e,function(e,r){e!==n&&(e=l(e),t[e.name]=e)}),r(e,function(e,r){e!==n&&(e=l(e),y(e,function(){f(t)&&u(n)}))}),S)}function y(e,n){return n=n||t,e.state===I?void n():e.state===_?void S.ready(e.name,n):e.state===A?void e.onpreload.push(function(){y(e,n)}):(e.state=_,void g(e,function(){e.state=I,n(),r(x[e.name],function(e){u(e)}),L&&f()&&r(x.ALL,function(e){u(e)})}))}function h(e){e=e||"";var n=e.split("?")[0].split(".");return n[n.length-1].toLowerCase()}function g(n,r){function o(n){n=n||e.event,i.onload=i.onreadystatechange=i.onerror=null,r()}function a(t){t=t||e.event,("load"===t.type||/loaded|complete/.test(i.readyState)&&(!q.documentMode||q.documentMode<9))&&(e.clearTimeout(n.errorTimeout),e.clearTimeout(n.cssTimeout),i.onload=i.onreadystatechange=i.onerror=null,r())}function c(){if(n.state!==I&&n.cssRetries<=20){for(var t=0,r=q.styleSheets.length;r>t;t++)if(q.styleSheets[t].href===i.href)return void a({type:"load"});n.cssRetries++,n.cssTimeout=e.setTimeout(c,250)}}r=r||t;var i,u=h(n.url);"css"===u?(i=q.createElement("link"),i.type="text/"+(n.type||"css"),i.rel="stylesheet",i.href=n.url,n.cssRetries=0,n.cssTimeout=e.setTimeout(c,500)):(i=q.createElement("script"),i.type="text/"+(n.type||"javascript"),i.src=n.url),i.onload=i.onreadystatechange=a,i.onerror=o,i.async=!1,i.defer=!1,n.errorTimeout=e.setTimeout(function(){o({type:"timeout"})},7e3);var d=q.head||q.getElementsByTagName("head")[0];d.insertBefore(i,d.lastChild)}function j(){for(var e=q.getElementsByTagName("script"),n=0,t=e.length;t>n;n++){var r=e[n].getAttribute("data-headjs-load");if(r)return void S.load(r)}}function b(e,n){if(e===q)return L?u(n):C.push(n),S;if(a(e)&&(n=e,e="ALL"),c(e)){var t={};return r(e,function(e){t[e]=M[e],S.ready(e,function(){f(t)&&u(n)})}),S}if("string"!=typeof e||!a(n))return S;var o=M[e];if(o&&o.state===I||"ALL"===e&&f()&&L)return u(n),S;var i=x[e];return i?i.push(n):i=x[e]=[n],S}function T(){return q.body?void(L||(L=!0,j(),r(C,function(e){u(e)}))):(e.clearTimeout(S.readyTimeout),void(S.readyTimeout=e.setTimeout(T,50)))}function E(){q.addEventListener?(q.removeEventListener("DOMContentLoaded",E,!1),T()):"complete"===q.readyState&&(q.detachEvent("onreadystatechange",E),T())}var L,q=e.document,C=[],x={},M={},O="async"in q.createElement("script")||"MozAppearance"in q.documentElement.style||e.opera,w=e.head_conf&&e.head_conf.head||"head",S=e[w]=e[w]||function(){S.ready.apply(null,arguments)},A=1,k=2,_=3,I=4;if("complete"===q.readyState)T();else if(q.addEventListener)q.addEventListener("DOMContentLoaded",E,!1),e.addEventListener("load",T,!1);else{q.attachEvent("onreadystatechange",E),e.attachEvent("onload",T);var U=!1;try{U=!e.frameElement&&q.documentElement}catch(B){}U&&U.doScroll&&!function N(){if(!L){try{U.doScroll("left")}catch(n){return e.clearTimeout(S.readyTimeout),void(S.readyTimeout=e.setTimeout(N,50))}T()}}()}S.load=S.js=O?v:p,S.test=d,S.ready=b,S.ready(q,function(){f()&&r(x.ALL,function(e){u(e)}),S.feature&&S.feature("domloaded",!0)})}(window);var oc=oc||{};!function(e,n,t){oc.conf=oc.conf||{},oc.cmd=oc.cmd||[],oc.renderedComponents=oc.renderedComponents||{};var r,o="https://cdnjs.cloudflare.com/ajax/libs/",a=o+"jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js",c=o+"handlebars.js/3.0.1/handlebars.runtime.js",i=o+"jade/1.9.2/runtime.min.js",u=o+"jquery/1.11.2/jquery.min.js",d=oc.conf.retryInterval||5e3,l=oc.conf.retryLimit||30,f=oc.conf.retrySendNumber||!0,s=oc.conf.pollingInterval||500,m=oc.conf.tag||"oc-component",p="baseUrl parameter is required",v="Href parameter missing",y="name parameter is required",h="Failed to load {0} component {1} times. Giving up".replace("{1}",l),g="Error getting compiled view: {0}",j="Error rendering component: {0}, error: {1}",b="Failed to retrieve the component. Retrying in {0} seconds...".replace("{0}",d/1e3),T='Error loading component: view engine "{0}" not supported',E="Loading...",L="Component '{0}' correctly rendered",q="Unrendered component found. Trying to retrieve it...",C=oc.conf.debug||!1,x=function(){},M=t.navigator.userAgent,O=!!M.match(/MSIE 8/),w=!!M.match(/MSIE 9/),S=!1,A=!1,k={},_={error:function(e){return console.log(e)},info:function(e){return C?console.log(e):!1}},I=function(e,n,t){return void 0===k[e]&&(k[e]=l),k[e]<=0?t():(setTimeout(function(){n(l-k[e]+1)},d),void k[e]--)},U=function(e,n){if(e&&n){var t=r.param(n);return e.indexOf("?")>-1?e+"&"+t:e+"?"+t}return e};oc.require=function(n,r,o){"function"==typeof r&&(o=r,r=n,n=void 0),"string"==typeof n&&(n=[n]);var a=function(){var e=t;if("undefined"==typeof n)return!0;for(var r=0;r':"<"+m+' href="'+t+'">"},oc.events={},oc.ready=function(e){if(S)return e();if(A)oc.cmd.push(e);else{A=!0;var n=function(e){!O&&!w||r.IE_POLYFILL_LOADED?e():oc.require(a,e)},t=function(){S=!0,A=!1,oc.events=function(){var e=r({});return{fire:function(n,t){return e.trigger(n,t)},on:function(n,t){return e.on(n,t||x)},reset:function(){return e.off()}}}(),e(),oc.events.fire("oc:ready",oc);for(var n=0;n'+E+""),oc.renderByHref(e.attr("href"),function(t,r){return t||!r?(_.error(t),n()):void B(e,r,n)}))})},oc.renderByHref=function(e,n,t){var o=t,a=n;"function"==typeof n&&(o=n,a=0),oc.ready(function(){if(""===e)return o(j.replace("{1}",v));var n=e;f&&(n=U(n,{__oc_Retry:a})),r.ajax({url:n,headers:{Accept:"application/vnd.oc.unrendered+json"},contentType:"text/plain",crossDomain:!0,async:!0,success:function(e){if("pre-rendered"===e.renderMode||"unrendered"===e.renderMode)oc.render(e.template,e.data,function(n,t){return n?o(j.replace("{0}",e.href).replace("{1}",n)):(_.info(L.replace("{0}",e.template.src)),void o(null,{html:t,key:e.template.key,version:e.version,name:e.name}))});else if("rendered"===e.renderMode){if(_.info(L.replace("{0}",e.href)),0===e.html.indexOf("<"+m)){var n=e.html.slice(e.html.indexOf(">")+1),t=n.slice(0,n.lastIndexOf("<"));e.html=t}o(null,{html:e.html,version:e.version,name:e.name})}},error:function(){_.error(b),I(e,function(n){oc.renderByHref(e,n,o)},function(){o(h.replace("{0}",e))})}})})},oc.renderUnloadedComponents=function(){oc.ready(function(){var e=O?"div[data-oc-component=true]":m,n=r(e+"[data-rendered!=true]"),t=n.length,o=function(e){t--,t||oc.renderUnloadedComponents()};if(t>0)for(var a=0;a');var o=r(m,e);oc.renderNestedComponent(o,function(){t(o)})}})},oc.ready(oc.renderUnloadedComponents)}(head,document,window),oc.clientVersion="0.22.3"; \ No newline at end of file diff --git a/components/oc-client/package.json b/components/oc-client/package.json index 1af8fe837..95f844aed 100644 --- a/components/oc-client/package.json +++ b/components/oc-client/package.json @@ -1,7 +1,7 @@ { "name": "oc-client", "description": "The OpenComponents client-side javascript client", - "version": "0.22.2", + "version": "0.22.3", "repository": "https://github.com/opentable/oc/tree/master/components/oc-client", "oc": { "parameters": {}, diff --git a/components/oc-client/src/oc-client.min.js b/components/oc-client/src/oc-client.min.js index 80b7e5d39..0146f265b 100644 --- a/components/oc-client/src/oc-client.min.js +++ b/components/oc-client/src/oc-client.min.js @@ -1 +1 @@ -!function(e,n){"use strict";function t(){}function r(e,n){if(e){"object"==typeof e&&(e=[].slice.call(e));for(var t=0,r=e.length;r>t;t++)n.call(e,e[t],t)}}function o(e,t){var r=Object.prototype.toString.call(t).slice(8,-1);return t!==n&&null!==t&&r===e}function a(e){return o("Function",e)}function c(e){return o("Array",e)}function i(e){var n=e.split("/"),t=n[n.length-1],r=t.indexOf("?");return-1!==r?t.substring(0,r):t}function u(e){e=e||t,e._done||(e(),e._done=1)}function d(e,n,r,o){var a="object"==typeof e?e:{test:e,success:n?c(n)?n:[n]:!1,failure:r?c(r)?r:[r]:!1,callback:o||t},i=!!a.test;return i&&a.success?(a.success.push(a.callback),S.load.apply(null,a.success)):!i&&a.failure?(a.failure.push(a.callback),S.load.apply(null,a.failure)):o(),S}function l(e){var n={};if("object"==typeof e)for(var t in e)e[t]&&(n={name:t,url:e[t]});else n={name:i(e),url:e};var r=M[n.name];return r&&r.url===n.url?r:(M[n.name]=n,n)}function f(e){e=e||M;for(var n in e)if(e.hasOwnProperty(n)&&e[n].state!==I)return!1;return!0}function s(e){e.state=k,r(e.onpreload,function(e){e.call()})}function m(e,t){e.state===n&&(e.state=A,e.onpreload=[],g({url:e.url,type:"cache"},function(){s(e)}))}function p(){var e=arguments,n=e[e.length-1],t=[].slice.call(e,1),o=t[0];return a(n)||(n=null),c(e[0])?(e[0].push(n),S.load.apply(null,e[0]),S):(o?(r(t,function(e){!a(e)&&e&&m(l(e))}),y(l(e[0]),a(o)?o:function(){S.load.apply(null,t)})):y(l(e[0])),S)}function v(){var e=arguments,n=e[e.length-1],t={};return a(n)||(n=null),c(e[0])?(e[0].push(n),S.load.apply(null,e[0]),S):(r(e,function(e,r){e!==n&&(e=l(e),t[e.name]=e)}),r(e,function(e,r){e!==n&&(e=l(e),y(e,function(){f(t)&&u(n)}))}),S)}function y(e,n){return n=n||t,e.state===I?void n():e.state===_?void S.ready(e.name,n):e.state===A?void e.onpreload.push(function(){y(e,n)}):(e.state=_,void g(e,function(){e.state=I,n(),r(x[e.name],function(e){u(e)}),L&&f()&&r(x.ALL,function(e){u(e)})}))}function h(e){e=e||"";var n=e.split("?")[0].split(".");return n[n.length-1].toLowerCase()}function g(n,r){function o(n){n=n||e.event,i.onload=i.onreadystatechange=i.onerror=null,r()}function a(t){t=t||e.event,("load"===t.type||/loaded|complete/.test(i.readyState)&&(!q.documentMode||q.documentMode<9))&&(e.clearTimeout(n.errorTimeout),e.clearTimeout(n.cssTimeout),i.onload=i.onreadystatechange=i.onerror=null,r())}function c(){if(n.state!==I&&n.cssRetries<=20){for(var t=0,r=q.styleSheets.length;r>t;t++)if(q.styleSheets[t].href===i.href)return void a({type:"load"});n.cssRetries++,n.cssTimeout=e.setTimeout(c,250)}}r=r||t;var i,u=h(n.url);"css"===u?(i=q.createElement("link"),i.type="text/"+(n.type||"css"),i.rel="stylesheet",i.href=n.url,n.cssRetries=0,n.cssTimeout=e.setTimeout(c,500)):(i=q.createElement("script"),i.type="text/"+(n.type||"javascript"),i.src=n.url),i.onload=i.onreadystatechange=a,i.onerror=o,i.async=!1,i.defer=!1,n.errorTimeout=e.setTimeout(function(){o({type:"timeout"})},7e3);var d=q.head||q.getElementsByTagName("head")[0];d.insertBefore(i,d.lastChild)}function j(){for(var e=q.getElementsByTagName("script"),n=0,t=e.length;t>n;n++){var r=e[n].getAttribute("data-headjs-load");if(r)return void S.load(r)}}function b(e,n){if(e===q)return L?u(n):C.push(n),S;if(a(e)&&(n=e,e="ALL"),c(e)){var t={};return r(e,function(e){t[e]=M[e],S.ready(e,function(){f(t)&&u(n)})}),S}if("string"!=typeof e||!a(n))return S;var o=M[e];if(o&&o.state===I||"ALL"===e&&f()&&L)return u(n),S;var i=x[e];return i?i.push(n):i=x[e]=[n],S}function T(){return q.body?void(L||(L=!0,j(),r(C,function(e){u(e)}))):(e.clearTimeout(S.readyTimeout),void(S.readyTimeout=e.setTimeout(T,50)))}function E(){q.addEventListener?(q.removeEventListener("DOMContentLoaded",E,!1),T()):"complete"===q.readyState&&(q.detachEvent("onreadystatechange",E),T())}var L,q=e.document,C=[],x={},M={},O="async"in q.createElement("script")||"MozAppearance"in q.documentElement.style||e.opera,w=e.head_conf&&e.head_conf.head||"head",S=e[w]=e[w]||function(){S.ready.apply(null,arguments)},A=1,k=2,_=3,I=4;if("complete"===q.readyState)T();else if(q.addEventListener)q.addEventListener("DOMContentLoaded",E,!1),e.addEventListener("load",T,!1);else{q.attachEvent("onreadystatechange",E),e.attachEvent("onload",T);var U=!1;try{U=!e.frameElement&&q.documentElement}catch(B){}U&&U.doScroll&&!function N(){if(!L){try{U.doScroll("left")}catch(n){return e.clearTimeout(S.readyTimeout),void(S.readyTimeout=e.setTimeout(N,50))}T()}}()}S.load=S.js=O?v:p,S.test=d,S.ready=b,S.ready(q,function(){f()&&r(x.ALL,function(e){u(e)}),S.feature&&S.feature("domloaded",!0)})}(window);var oc=oc||{};!function(e,n,t){oc.conf=oc.conf||{},oc.cmd=oc.cmd||[],oc.renderedComponents=oc.renderedComponents||{};var r,o="https://cdnjs.cloudflare.com/ajax/libs/",a=o+"jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js",c=o+"handlebars.js/3.0.1/handlebars.runtime.js",i=o+"jade/1.9.2/runtime.min.js",u=o+"jquery/1.11.2/jquery.min.js",d=oc.conf.retryInterval||5e3,l=oc.conf.retryLimit||30,f=oc.conf.retrySendNumber||!0,s=oc.conf.pollingInterval||500,m=oc.conf.tag||"oc-component",p="baseUrl parameter is required",v="Href parameter missing",y="name parameter is required",h="Failed to load {0} component {1} times. Giving up".replace("{1}",l),g="Error getting compiled view: {0}",j="Error rendering component: {0}, error: {1}",b="Failed to retrieve the component. Retrying in {0} seconds...".replace("{0}",d/1e3),T='Error loading component: view engine "{0}" not supported',E="Loading...",L="Component '{0}' correctly rendered",q="Unrendered component found. Trying to retrieve it...",C=oc.conf.debug||!1,x=function(){},M=t.navigator.userAgent,O=!!M.match(/MSIE 8/),w=!!M.match(/MSIE 9/),S=!1,A=!1,k={},_={error:function(e){return console.log(e)},info:function(e){return C?console.log(e):!1}},I=function(e,n,t){return void 0===k[e]&&(k[e]=l),k[e]<=0?t():(setTimeout(function(){n(l-k[e]+1)},d),void k[e]--)},U=function(e,n){if(e&&n){var t=r.param(n);return e.indexOf("?")>-1?e+"&"+t:e+"?"+t}return e};oc.require=function(n,r,o){"function"==typeof r&&(o=r,r=n,n=void 0),"string"==typeof n&&(n=[n]);var a=function(){var e=t;if("undefined"==typeof n)return!0;for(var r=0;r':"<"+m+' href="'+t+'">"},oc.events={},oc.ready=function(e){if(S)return e();if(A)oc.cmd.push(e);else{A=!0;var n=function(e){!O&&!w||r.IE_POLYFILL_LOADED?e():oc.require(a,e)},t=function(){S=!0,A=!1,oc.events=function(){var e=r({});return{fire:function(n,t){return e.trigger(n,t)},on:function(n,t){return e.on(n,t||x)},reset:function(){return e.off()}}}(),e(),oc.events.fire("oc:ready",oc);for(var n=0;n'+E+""),oc.renderByHref(e.attr("href"),function(t,r){return t||!r?(_.error(t),n()):void B(e,r,n)}))})},oc.renderByHref=function(e,n,t){var o=t,a=n;"function"==typeof n&&(o=n,a=0),oc.ready(function(){if(""===e)return o(j.replace("{1}",v));var n=e;f&&(n=U(n,{__oc_Retry:a})),r.ajax({url:n,headers:{Accept:"application/vnd.oc.unrendered+json"},contentType:"text/plain",crossDomain:!0,async:!0,success:function(e){if("pre-rendered"===e.renderMode||"unrendered"===e.renderMode)oc.render(e.template,e.data,function(n,t){return n?o(j.replace("{0}",e.href).replace("{1}",n)):(_.info(L.replace("{0}",e.template.src)),void o(null,{html:t,key:e.template.key,version:e.version,name:e.name}))});else if("rendered"===e.renderMode){if(_.info(L.replace("{0}",e.href)),0===e.html.indexOf("<"+m)){var n=e.html.slice(e.html.indexOf(">")+1),t=n.slice(0,n.lastIndexOf("<"));e.html=t}o(null,{html:e.html,version:e.version,name:e.name})}},error:function(){_.error(b),I(e,function(n){oc.renderByHref(e,n,o)},function(){o(h.replace("{0}",e))})}})})},oc.renderUnloadedComponents=function(){oc.ready(function(){var e=O?"div[data-oc-component=true]":m,n=r(e+"[data-rendered!=true]"),t=n.length,o=function(e){t--,t||oc.renderUnloadedComponents()};if(t>0)for(var a=0;a');var o=r(m,e);oc.renderNestedComponent(o,function(){t(o)})}})},oc.ready(oc.renderUnloadedComponents)}(head,document,window),oc.clientVersion="0.22.2"; \ No newline at end of file +!function(e,n){"use strict";function t(){}function r(e,n){if(e){"object"==typeof e&&(e=[].slice.call(e));for(var t=0,r=e.length;r>t;t++)n.call(e,e[t],t)}}function o(e,t){var r=Object.prototype.toString.call(t).slice(8,-1);return t!==n&&null!==t&&r===e}function a(e){return o("Function",e)}function c(e){return o("Array",e)}function i(e){var n=e.split("/"),t=n[n.length-1],r=t.indexOf("?");return-1!==r?t.substring(0,r):t}function u(e){e=e||t,e._done||(e(),e._done=1)}function d(e,n,r,o){var a="object"==typeof e?e:{test:e,success:n?c(n)?n:[n]:!1,failure:r?c(r)?r:[r]:!1,callback:o||t},i=!!a.test;return i&&a.success?(a.success.push(a.callback),S.load.apply(null,a.success)):!i&&a.failure?(a.failure.push(a.callback),S.load.apply(null,a.failure)):o(),S}function l(e){var n={};if("object"==typeof e)for(var t in e)e[t]&&(n={name:t,url:e[t]});else n={name:i(e),url:e};var r=M[n.name];return r&&r.url===n.url?r:(M[n.name]=n,n)}function f(e){e=e||M;for(var n in e)if(e.hasOwnProperty(n)&&e[n].state!==I)return!1;return!0}function s(e){e.state=k,r(e.onpreload,function(e){e.call()})}function m(e,t){e.state===n&&(e.state=A,e.onpreload=[],g({url:e.url,type:"cache"},function(){s(e)}))}function p(){var e=arguments,n=e[e.length-1],t=[].slice.call(e,1),o=t[0];return a(n)||(n=null),c(e[0])?(e[0].push(n),S.load.apply(null,e[0]),S):(o?(r(t,function(e){!a(e)&&e&&m(l(e))}),y(l(e[0]),a(o)?o:function(){S.load.apply(null,t)})):y(l(e[0])),S)}function v(){var e=arguments,n=e[e.length-1],t={};return a(n)||(n=null),c(e[0])?(e[0].push(n),S.load.apply(null,e[0]),S):(r(e,function(e,r){e!==n&&(e=l(e),t[e.name]=e)}),r(e,function(e,r){e!==n&&(e=l(e),y(e,function(){f(t)&&u(n)}))}),S)}function y(e,n){return n=n||t,e.state===I?void n():e.state===_?void S.ready(e.name,n):e.state===A?void e.onpreload.push(function(){y(e,n)}):(e.state=_,void g(e,function(){e.state=I,n(),r(x[e.name],function(e){u(e)}),L&&f()&&r(x.ALL,function(e){u(e)})}))}function h(e){e=e||"";var n=e.split("?")[0].split(".");return n[n.length-1].toLowerCase()}function g(n,r){function o(n){n=n||e.event,i.onload=i.onreadystatechange=i.onerror=null,r()}function a(t){t=t||e.event,("load"===t.type||/loaded|complete/.test(i.readyState)&&(!q.documentMode||q.documentMode<9))&&(e.clearTimeout(n.errorTimeout),e.clearTimeout(n.cssTimeout),i.onload=i.onreadystatechange=i.onerror=null,r())}function c(){if(n.state!==I&&n.cssRetries<=20){for(var t=0,r=q.styleSheets.length;r>t;t++)if(q.styleSheets[t].href===i.href)return void a({type:"load"});n.cssRetries++,n.cssTimeout=e.setTimeout(c,250)}}r=r||t;var i,u=h(n.url);"css"===u?(i=q.createElement("link"),i.type="text/"+(n.type||"css"),i.rel="stylesheet",i.href=n.url,n.cssRetries=0,n.cssTimeout=e.setTimeout(c,500)):(i=q.createElement("script"),i.type="text/"+(n.type||"javascript"),i.src=n.url),i.onload=i.onreadystatechange=a,i.onerror=o,i.async=!1,i.defer=!1,n.errorTimeout=e.setTimeout(function(){o({type:"timeout"})},7e3);var d=q.head||q.getElementsByTagName("head")[0];d.insertBefore(i,d.lastChild)}function j(){for(var e=q.getElementsByTagName("script"),n=0,t=e.length;t>n;n++){var r=e[n].getAttribute("data-headjs-load");if(r)return void S.load(r)}}function b(e,n){if(e===q)return L?u(n):C.push(n),S;if(a(e)&&(n=e,e="ALL"),c(e)){var t={};return r(e,function(e){t[e]=M[e],S.ready(e,function(){f(t)&&u(n)})}),S}if("string"!=typeof e||!a(n))return S;var o=M[e];if(o&&o.state===I||"ALL"===e&&f()&&L)return u(n),S;var i=x[e];return i?i.push(n):i=x[e]=[n],S}function T(){return q.body?void(L||(L=!0,j(),r(C,function(e){u(e)}))):(e.clearTimeout(S.readyTimeout),void(S.readyTimeout=e.setTimeout(T,50)))}function E(){q.addEventListener?(q.removeEventListener("DOMContentLoaded",E,!1),T()):"complete"===q.readyState&&(q.detachEvent("onreadystatechange",E),T())}var L,q=e.document,C=[],x={},M={},O="async"in q.createElement("script")||"MozAppearance"in q.documentElement.style||e.opera,w=e.head_conf&&e.head_conf.head||"head",S=e[w]=e[w]||function(){S.ready.apply(null,arguments)},A=1,k=2,_=3,I=4;if("complete"===q.readyState)T();else if(q.addEventListener)q.addEventListener("DOMContentLoaded",E,!1),e.addEventListener("load",T,!1);else{q.attachEvent("onreadystatechange",E),e.attachEvent("onload",T);var U=!1;try{U=!e.frameElement&&q.documentElement}catch(B){}U&&U.doScroll&&!function N(){if(!L){try{U.doScroll("left")}catch(n){return e.clearTimeout(S.readyTimeout),void(S.readyTimeout=e.setTimeout(N,50))}T()}}()}S.load=S.js=O?v:p,S.test=d,S.ready=b,S.ready(q,function(){f()&&r(x.ALL,function(e){u(e)}),S.feature&&S.feature("domloaded",!0)})}(window);var oc=oc||{};!function(e,n,t){oc.conf=oc.conf||{},oc.cmd=oc.cmd||[],oc.renderedComponents=oc.renderedComponents||{};var r,o="https://cdnjs.cloudflare.com/ajax/libs/",a=o+"jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js",c=o+"handlebars.js/3.0.1/handlebars.runtime.js",i=o+"jade/1.9.2/runtime.min.js",u=o+"jquery/1.11.2/jquery.min.js",d=oc.conf.retryInterval||5e3,l=oc.conf.retryLimit||30,f=oc.conf.retrySendNumber||!0,s=oc.conf.pollingInterval||500,m=oc.conf.tag||"oc-component",p="baseUrl parameter is required",v="Href parameter missing",y="name parameter is required",h="Failed to load {0} component {1} times. Giving up".replace("{1}",l),g="Error getting compiled view: {0}",j="Error rendering component: {0}, error: {1}",b="Failed to retrieve the component. Retrying in {0} seconds...".replace("{0}",d/1e3),T='Error loading component: view engine "{0}" not supported',E="Loading...",L="Component '{0}' correctly rendered",q="Unrendered component found. Trying to retrieve it...",C=oc.conf.debug||!1,x=function(){},M=t.navigator.userAgent,O=!!M.match(/MSIE 8/),w=!!M.match(/MSIE 9/),S=!1,A=!1,k={},_={error:function(e){return console.log(e)},info:function(e){return C?console.log(e):!1}},I=function(e,n,t){return void 0===k[e]&&(k[e]=l),k[e]<=0?t():(setTimeout(function(){n(l-k[e]+1)},d),void k[e]--)},U=function(e,n){if(e&&n){var t=r.param(n);return e.indexOf("?")>-1?e+"&"+t:e+"?"+t}return e};oc.require=function(n,r,o){"function"==typeof r&&(o=r,r=n,n=void 0),"string"==typeof n&&(n=[n]);var a=function(){var e=t;if("undefined"==typeof n)return!0;for(var r=0;r':"<"+m+' href="'+t+'">"},oc.events={},oc.ready=function(e){if(S)return e();if(A)oc.cmd.push(e);else{A=!0;var n=function(e){!O&&!w||r.IE_POLYFILL_LOADED?e():oc.require(a,e)},t=function(){S=!0,A=!1,oc.events=function(){var e=r({});return{fire:function(n,t){return e.trigger(n,t)},on:function(n,t){return e.on(n,t||x)},reset:function(){return e.off()}}}(),e(),oc.events.fire("oc:ready",oc);for(var n=0;n'+E+""),oc.renderByHref(e.attr("href"),function(t,r){return t||!r?(_.error(t),n()):void B(e,r,n)}))})},oc.renderByHref=function(e,n,t){var o=t,a=n;"function"==typeof n&&(o=n,a=0),oc.ready(function(){if(""===e)return o(j.replace("{1}",v));var n=e;f&&(n=U(n,{__oc_Retry:a})),r.ajax({url:n,headers:{Accept:"application/vnd.oc.unrendered+json"},contentType:"text/plain",crossDomain:!0,async:!0,success:function(e){if("pre-rendered"===e.renderMode||"unrendered"===e.renderMode)oc.render(e.template,e.data,function(n,t){return n?o(j.replace("{0}",e.href).replace("{1}",n)):(_.info(L.replace("{0}",e.template.src)),void o(null,{html:t,key:e.template.key,version:e.version,name:e.name}))});else if("rendered"===e.renderMode){if(_.info(L.replace("{0}",e.href)),0===e.html.indexOf("<"+m)){var n=e.html.slice(e.html.indexOf(">")+1),t=n.slice(0,n.lastIndexOf("<"));e.html=t}o(null,{html:e.html,version:e.version,name:e.name})}},error:function(){_.error(b),I(e,function(n){oc.renderByHref(e,n,o)},function(){o(h.replace("{0}",e))})}})})},oc.renderUnloadedComponents=function(){oc.ready(function(){var e=O?"div[data-oc-component=true]":m,n=r(e+"[data-rendered!=true]"),t=n.length,o=function(e){t--,t||oc.renderUnloadedComponents()};if(t>0)for(var a=0;a');var o=r(m,e);oc.renderNestedComponent(o,function(){t(o)})}})},oc.ready(oc.renderUnloadedComponents)}(head,document,window),oc.clientVersion="0.22.3"; \ No newline at end of file diff --git a/package.json b/package.json index 34f658a36..8e7ebd8b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oc", - "version": "0.22.2", + "version": "0.22.3", "description": "A framework for developing and distributing html components", "main": "index.js", "bin": {