Comparing version 0.1.3 to 0.1.4
{ | ||
"name": "oc-client", | ||
"description": "", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"dependencies": {}, | ||
@@ -6,0 +6,0 @@ "repository": "", |
@@ -7,2 +7,10 @@ 'use strict'; | ||
// Polifills | ||
if(!Array.isArray){ | ||
Array.isArray = function(arg){ | ||
return Object.prototype.toString.call(arg) === '[object Array]'; | ||
}; | ||
} | ||
// The code | ||
var headScripts = [], | ||
@@ -34,2 +42,3 @@ $ = typeof(jQuery) !== 'undefined' ? jQuery : undefined, | ||
// a minimal vanilla require.js | ||
var _require = function(hrefs, callback){ | ||
@@ -36,0 +45,0 @@ |
@@ -1,1 +0,1 @@ | ||
var Handlebars=function(){var e=function(){"use strict";function e(e){this.string=e}var r;return e.prototype.toString=function(){return""+this.string},r=e}(),r=function(e){"use strict";function r(e){return c[e]||"&"}function n(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}function t(e){return e instanceof a?e.toString():e||0===e?(e=""+e,l.test(e)?e.replace(s,r):e):""}function o(e){return e||0===e?f(e)&&0===e.length?!0:!1:!0}var i={},a=e,c={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},s=/[&<>"'`]/g,l=/[&<>"'`]/;i.extend=n;var u=Object.prototype.toString;i.toString=u;var p=function(e){return"function"==typeof e};p(/x/)&&(p=function(e){return"function"==typeof e&&"[object Function]"===u.call(e)});var p;i.isFunction=p;var f=Array.isArray||function(e){return e&&"object"==typeof e?"[object Array]"===u.call(e):!1};return i.isArray=f,i.escapeExpression=t,i.isEmpty=o,i}(e),n=function(){"use strict";function e(e,r){var t;r&&r.firstLine&&(t=r.firstLine,e+=" - "+t+":"+r.firstColumn);for(var o=Error.prototype.constructor.call(this,e),i=0;i<n.length;i++)this[n[i]]=o[n[i]];t&&(this.lineNumber=t,this.column=r.firstColumn)}var r,n=["description","fileName","lineNumber","message","name","number","stack"];return e.prototype=new Error,r=e}(),t=function(e,r){"use strict";function n(e,r){this.helpers=e||{},this.partials=r||{},t(this)}function t(e){e.registerHelper("helperMissing",function(e){if(2===arguments.length)return void 0;throw new c("Missing helper: '"+e+"'")}),e.registerHelper("blockHelperMissing",function(r,n){var t=n.inverse||function(){},o=n.fn;return f(r)&&(r=r.call(this)),r===!0?o(this):r===!1||null==r?t(this):p(r)?r.length>0?e.helpers.each(r,n):t(this):o(r)}),e.registerHelper("each",function(e,r){var n,t=r.fn,o=r.inverse,i=0,a="";if(f(e)&&(e=e.call(this)),r.data&&(n=v(r.data)),e&&"object"==typeof e)if(p(e))for(var c=e.length;c>i;i++)n&&(n.index=i,n.first=0===i,n.last=i===e.length-1),a+=t(e[i],{data:n});else for(var s in e)e.hasOwnProperty(s)&&(n&&(n.key=s,n.index=i,n.first=0===i),a+=t(e[s],{data:n}),i++);return 0===i&&(a=o(this)),a}),e.registerHelper("if",function(e,r){return f(e)&&(e=e.call(this)),!r.hash.includeZero&&!e||a.isEmpty(e)?r.inverse(this):r.fn(this)}),e.registerHelper("unless",function(r,n){return e.helpers["if"].call(this,r,{fn:n.inverse,inverse:n.fn,hash:n.hash})}),e.registerHelper("with",function(e,r){return f(e)&&(e=e.call(this)),a.isEmpty(e)?void 0:r.fn(e)}),e.registerHelper("log",function(r,n){var t=n.data&&null!=n.data.level?parseInt(n.data.level,10):1;e.log(t,r)})}function o(e,r){m.log(e,r)}var i={},a=e,c=r,s="1.3.0";i.VERSION=s;var l=4;i.COMPILER_REVISION=l;var u={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"};i.REVISION_CHANGES=u;var p=a.isArray,f=a.isFunction,d=a.toString,h="[object Object]";i.HandlebarsEnvironment=n,n.prototype={constructor:n,logger:m,log:o,registerHelper:function(e,r,n){if(d.call(e)===h){if(n||r)throw new c("Arg not supported with multiple helpers");a.extend(this.helpers,e)}else n&&(r.not=n),this.helpers[e]=r},registerPartial:function(e,r){d.call(e)===h?a.extend(this.partials,e):this.partials[e]=r}};var m={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(e,r){if(m.level<=e){var n=m.methodMap[e];"undefined"!=typeof console&&console[n]&&console[n].call(console,r)}}};i.logger=m,i.log=o;var v=function(e){var r={};return a.extend(r,e),r};return i.createFrame=v,i}(r,n),o=function(e,r,n){"use strict";function t(e){var r=e&&e[0]||1,n=f;if(r!==n){if(n>r){var t=d[n],o=d[r];throw new p("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+t+") or downgrade your runtime to an older version ("+o+").")}throw new p("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+e[1]+").")}}function o(e,r){if(!r)throw new p("No environment passed to template");var n=function(e,n,t,o,i,a){var c=r.VM.invokePartial.apply(this,arguments);if(null!=c)return c;if(r.compile){var s={helpers:o,partials:i,data:a};return i[n]=r.compile(e,{data:void 0!==a},r),i[n](t,s)}throw new p("The partial "+n+" could not be compiled when running in runtime-only mode")},t={escapeExpression:u.escapeExpression,invokePartial:n,programs:[],program:function(e,r,n){var t=this.programs[e];return n?t=a(e,r,n):t||(t=this.programs[e]=a(e,r)),t},merge:function(e,r){var n=e||r;return e&&r&&e!==r&&(n={},u.extend(n,r),u.extend(n,e)),n},programWithDepth:r.VM.programWithDepth,noop:r.VM.noop,compilerInfo:null};return function(n,o){o=o||{};var i,a,c=o.partial?o:r;o.partial||(i=o.helpers,a=o.partials);var s=e.call(t,c,n,i,a,o.data);return o.partial||r.VM.checkRevision(t.compilerInfo),s}}function i(e,r,n){var t=Array.prototype.slice.call(arguments,3),o=function(e,o){return o=o||{},r.apply(this,[e,o.data||n].concat(t))};return o.program=e,o.depth=t.length,o}function a(e,r,n){var t=function(e,t){return t=t||{},r(e,t.data||n)};return t.program=e,t.depth=0,t}function c(e,r,n,t,o,i){var a={partial:!0,helpers:t,partials:o,data:i};if(void 0===e)throw new p("The partial "+r+" could not be found");return e instanceof Function?e(n,a):void 0}function s(){return""}var l={},u=e,p=r,f=n.COMPILER_REVISION,d=n.REVISION_CHANGES;return l.checkRevision=t,l.template=o,l.programWithDepth=i,l.program=a,l.invokePartial=c,l.noop=s,l}(r,n,t),i=function(e,r,n,t,o){"use strict";var i,a=e,c=r,s=n,l=t,u=o,p=function(){var e=new a.HandlebarsEnvironment;return l.extend(e,a),e.SafeString=c,e.Exception=s,e.Utils=l,e.VM=u,e.template=function(r){return u.template(r,e)},e},f=p();return f.create=p,i=f}(t,e,n,r,o);return i}(),oc=oc||{};!function(e,r,n){var t=[],o="undefined"!=typeof jQuery?jQuery:void 0,i="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js",a=5e3,c=function(){},s={error:function(e){return console.log(e)},info:function(e){return n?console.log(e):void 0}},l=function(e,r){for(var n=0;n<e.length;n++)if(e[n]===r)return n;return-1},u=function(e,n){Array.isArray(e)||(e=[e]);for(var o=e.length,i=r.getElementsByTagName("head")[0],a=function(){o--,0===o&&"function"==typeof n&&(n(),n=c)},s=function(e){t.push(e);var n=r.createElement("script");n.type="text/javascript",n.src=e,n.onload=a,i.appendChild(n)},u=0;u<e.length;u++)l(t,e[u])<0?s(e[u]):a()},p=function(e,r,n){var t=Math.floor(9999999999*Math.random());e.html(r.html),e.attr("id",t),e.attr("data-hash",r.key),e.attr("data-rendered",!0),e.attr("data-version",r.version),oc.setEventListeners(e),n()};oc.render=function(r,n,t){if(oc.components[r]){var o=e.template(oc.components[r],[]),i=o(n);t(null,i)}else t("Error loading "+r+" component",null)},oc.resolveNestedComponents=function(e,r){if(r)for(var n in r)if(r.hasOwnProperty(n))for(var t="@component('"+n+"')";e.indexOf(t)>=0;)e=e.replace(t,'<oc-component href="'+r[n].href+'"></oc-component>');return e},oc.renderNestedComponent=function(e,r){e.html('<div class="loading">LOADING...</div>'),oc.renderByHref(e.attr("href"),function(n,t){return!n&&t&&t.html?void p(e,t,r):s.error(n)})},oc.renderByHref=function(e,r){return""===e?r("Failed to retrieve the component. Href parameter missing.",null):void o.ajax({url:e,headers:{"render-mode":"pre-rendered"},success:function(e){u(e.template.src,function(){oc.render(e.template.key,e.data,function(n,t){return n?r("Error rendering component: "+e.href+", error: "+n,null):(t=oc.resolveNestedComponents(t,e.components),s.info("Component '"+e.template.src+"' correctly loaded."),void r(null,{html:t,key:e.template.key,version:e.version}))})})},error:function(){s.error("Failed to retrieve the component. Retrying in 5 seconds..."),setTimeout(function(){oc.renderByHref(e,r)},a)}})},oc.renderUnloadedComponents=oc.refresh=function(){var e=o("oc-component[data-rendered!=true]"),r=function(e,n){s.info("Unloaded component found. Trying to retrieve it..."),oc.renderNestedComponent(o(e[n]),function(){n++,n<e.length?r(e,n):oc.renderUnloadedComponents()})};e.length>0&&r(e,0)},oc.setEventListeners=function(e){e.off("reRender"),e.on("reRender",function(e,r){var n=o(e.target);return r&&""!==r&&n.attr("href",r),n.attr("data-hash",""),n.attr("data-rendered",!1),oc.renderUnloadedComponents(),!1}),e.trigger("loaded")},oc.load=function(e,r,n){if(o(e)){o(e).html('<oc-component href="'+r+'" />');var t=o("oc-component",e);oc.renderNestedComponent(t,function(){"function"==typeof n&&n(t)})}},o?oc.renderUnloadedComponents():u(i,function(){o=jQuery,oc.renderUnloadedComponents()})}(Handlebars,document,!0),oc.clientVersion="0.1.3"; | ||
var Handlebars=function(){var e=function(){"use strict";function e(e){this.string=e}var r;return e.prototype.toString=function(){return""+this.string},r=e}(),r=function(e){"use strict";function r(e){return c[e]||"&"}function n(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}function t(e){return e instanceof a?e.toString():e||0===e?(e=""+e,l.test(e)?e.replace(s,r):e):""}function o(e){return e||0===e?f(e)&&0===e.length?!0:!1:!0}var i={},a=e,c={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},s=/[&<>"'`]/g,l=/[&<>"'`]/;i.extend=n;var u=Object.prototype.toString;i.toString=u;var p=function(e){return"function"==typeof e};p(/x/)&&(p=function(e){return"function"==typeof e&&"[object Function]"===u.call(e)});var p;i.isFunction=p;var f=Array.isArray||function(e){return e&&"object"==typeof e?"[object Array]"===u.call(e):!1};return i.isArray=f,i.escapeExpression=t,i.isEmpty=o,i}(e),n=function(){"use strict";function e(e,r){var t;r&&r.firstLine&&(t=r.firstLine,e+=" - "+t+":"+r.firstColumn);for(var o=Error.prototype.constructor.call(this,e),i=0;i<n.length;i++)this[n[i]]=o[n[i]];t&&(this.lineNumber=t,this.column=r.firstColumn)}var r,n=["description","fileName","lineNumber","message","name","number","stack"];return e.prototype=new Error,r=e}(),t=function(e,r){"use strict";function n(e,r){this.helpers=e||{},this.partials=r||{},t(this)}function t(e){e.registerHelper("helperMissing",function(e){if(2===arguments.length)return void 0;throw new c("Missing helper: '"+e+"'")}),e.registerHelper("blockHelperMissing",function(r,n){var t=n.inverse||function(){},o=n.fn;return f(r)&&(r=r.call(this)),r===!0?o(this):r===!1||null==r?t(this):p(r)?r.length>0?e.helpers.each(r,n):t(this):o(r)}),e.registerHelper("each",function(e,r){var n,t=r.fn,o=r.inverse,i=0,a="";if(f(e)&&(e=e.call(this)),r.data&&(n=v(r.data)),e&&"object"==typeof e)if(p(e))for(var c=e.length;c>i;i++)n&&(n.index=i,n.first=0===i,n.last=i===e.length-1),a+=t(e[i],{data:n});else for(var s in e)e.hasOwnProperty(s)&&(n&&(n.key=s,n.index=i,n.first=0===i),a+=t(e[s],{data:n}),i++);return 0===i&&(a=o(this)),a}),e.registerHelper("if",function(e,r){return f(e)&&(e=e.call(this)),!r.hash.includeZero&&!e||a.isEmpty(e)?r.inverse(this):r.fn(this)}),e.registerHelper("unless",function(r,n){return e.helpers["if"].call(this,r,{fn:n.inverse,inverse:n.fn,hash:n.hash})}),e.registerHelper("with",function(e,r){return f(e)&&(e=e.call(this)),a.isEmpty(e)?void 0:r.fn(e)}),e.registerHelper("log",function(r,n){var t=n.data&&null!=n.data.level?parseInt(n.data.level,10):1;e.log(t,r)})}function o(e,r){m.log(e,r)}var i={},a=e,c=r,s="1.3.0";i.VERSION=s;var l=4;i.COMPILER_REVISION=l;var u={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"};i.REVISION_CHANGES=u;var p=a.isArray,f=a.isFunction,d=a.toString,h="[object Object]";i.HandlebarsEnvironment=n,n.prototype={constructor:n,logger:m,log:o,registerHelper:function(e,r,n){if(d.call(e)===h){if(n||r)throw new c("Arg not supported with multiple helpers");a.extend(this.helpers,e)}else n&&(r.not=n),this.helpers[e]=r},registerPartial:function(e,r){d.call(e)===h?a.extend(this.partials,e):this.partials[e]=r}};var m={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(e,r){if(m.level<=e){var n=m.methodMap[e];"undefined"!=typeof console&&console[n]&&console[n].call(console,r)}}};i.logger=m,i.log=o;var v=function(e){var r={};return a.extend(r,e),r};return i.createFrame=v,i}(r,n),o=function(e,r,n){"use strict";function t(e){var r=e&&e[0]||1,n=f;if(r!==n){if(n>r){var t=d[n],o=d[r];throw new p("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+t+") or downgrade your runtime to an older version ("+o+").")}throw new p("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+e[1]+").")}}function o(e,r){if(!r)throw new p("No environment passed to template");var n=function(e,n,t,o,i,a){var c=r.VM.invokePartial.apply(this,arguments);if(null!=c)return c;if(r.compile){var s={helpers:o,partials:i,data:a};return i[n]=r.compile(e,{data:void 0!==a},r),i[n](t,s)}throw new p("The partial "+n+" could not be compiled when running in runtime-only mode")},t={escapeExpression:u.escapeExpression,invokePartial:n,programs:[],program:function(e,r,n){var t=this.programs[e];return n?t=a(e,r,n):t||(t=this.programs[e]=a(e,r)),t},merge:function(e,r){var n=e||r;return e&&r&&e!==r&&(n={},u.extend(n,r),u.extend(n,e)),n},programWithDepth:r.VM.programWithDepth,noop:r.VM.noop,compilerInfo:null};return function(n,o){o=o||{};var i,a,c=o.partial?o:r;o.partial||(i=o.helpers,a=o.partials);var s=e.call(t,c,n,i,a,o.data);return o.partial||r.VM.checkRevision(t.compilerInfo),s}}function i(e,r,n){var t=Array.prototype.slice.call(arguments,3),o=function(e,o){return o=o||{},r.apply(this,[e,o.data||n].concat(t))};return o.program=e,o.depth=t.length,o}function a(e,r,n){var t=function(e,t){return t=t||{},r(e,t.data||n)};return t.program=e,t.depth=0,t}function c(e,r,n,t,o,i){var a={partial:!0,helpers:t,partials:o,data:i};if(void 0===e)throw new p("The partial "+r+" could not be found");return e instanceof Function?e(n,a):void 0}function s(){return""}var l={},u=e,p=r,f=n.COMPILER_REVISION,d=n.REVISION_CHANGES;return l.checkRevision=t,l.template=o,l.programWithDepth=i,l.program=a,l.invokePartial=c,l.noop=s,l}(r,n,t),i=function(e,r,n,t,o){"use strict";var i,a=e,c=r,s=n,l=t,u=o,p=function(){var e=new a.HandlebarsEnvironment;return l.extend(e,a),e.SafeString=c,e.Exception=s,e.Utils=l,e.VM=u,e.template=function(r){return u.template(r,e)},e},f=p();return f.create=p,i=f}(t,e,n,r,o);return i}(),oc=oc||{};!function(e,r,n){Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)});var t=[],o="undefined"!=typeof jQuery?jQuery:void 0,i="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js",a=5e3,c=function(){},s={error:function(e){return console.log(e)},info:function(e){return n?console.log(e):void 0}},l=function(e,r){for(var n=0;n<e.length;n++)if(e[n]===r)return n;return-1},u=function(e,n){Array.isArray(e)||(e=[e]);for(var o=e.length,i=r.getElementsByTagName("head")[0],a=function(){o--,0===o&&"function"==typeof n&&(n(),n=c)},s=function(e){t.push(e);var n=r.createElement("script");n.type="text/javascript",n.src=e,n.onload=a,i.appendChild(n)},u=0;u<e.length;u++)l(t,e[u])<0?s(e[u]):a()},p=function(e,r,n){var t=Math.floor(9999999999*Math.random());e.html(r.html),e.attr("id",t),e.attr("data-hash",r.key),e.attr("data-rendered",!0),e.attr("data-version",r.version),oc.setEventListeners(e),n()};oc.render=function(r,n,t){if(oc.components[r]){var o=e.template(oc.components[r],[]),i=o(n);t(null,i)}else t("Error loading "+r+" component",null)},oc.resolveNestedComponents=function(e,r){if(r)for(var n in r)if(r.hasOwnProperty(n))for(var t="@component('"+n+"')";e.indexOf(t)>=0;)e=e.replace(t,'<oc-component href="'+r[n].href+'"></oc-component>');return e},oc.renderNestedComponent=function(e,r){e.html('<div class="loading">LOADING...</div>'),oc.renderByHref(e.attr("href"),function(n,t){return!n&&t&&t.html?void p(e,t,r):s.error(n)})},oc.renderByHref=function(e,r){return""===e?r("Failed to retrieve the component. Href parameter missing.",null):void o.ajax({url:e,headers:{"render-mode":"pre-rendered"},success:function(e){u(e.template.src,function(){oc.render(e.template.key,e.data,function(n,t){return n?r("Error rendering component: "+e.href+", error: "+n,null):(t=oc.resolveNestedComponents(t,e.components),s.info("Component '"+e.template.src+"' correctly loaded."),void r(null,{html:t,key:e.template.key,version:e.version}))})})},error:function(){s.error("Failed to retrieve the component. Retrying in 5 seconds..."),setTimeout(function(){oc.renderByHref(e,r)},a)}})},oc.renderUnloadedComponents=oc.refresh=function(){var e=o("oc-component[data-rendered!=true]"),r=function(e,n){s.info("Unloaded component found. Trying to retrieve it..."),oc.renderNestedComponent(o(e[n]),function(){n++,n<e.length?r(e,n):oc.renderUnloadedComponents()})};e.length>0&&r(e,0)},oc.setEventListeners=function(e){e.off("reRender"),e.on("reRender",function(e,r){var n=o(e.target);return r&&""!==r&&n.attr("href",r),n.attr("data-hash",""),n.attr("data-rendered",!1),oc.renderUnloadedComponents(),!1}),e.trigger("loaded")},oc.load=function(e,r,n){if(o(e)){o(e).html('<oc-component href="'+r+'" />');var t=o("oc-component",e);oc.renderNestedComponent(t,function(){"function"==typeof n&&n(t)})}},o?oc.renderUnloadedComponents():u(i,function(){o=jQuery,oc.renderUnloadedComponents()})}(Handlebars,document,!0),oc.clientVersion="0.1.4"; |
{ | ||
"name": "oc-client", | ||
"description": "", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"dependencies": {}, | ||
@@ -6,0 +6,0 @@ "repository": "", |
@@ -7,2 +7,10 @@ 'use strict'; | ||
// Polifills | ||
if(!Array.isArray){ | ||
Array.isArray = function(arg){ | ||
return Object.prototype.toString.call(arg) === '[object Array]'; | ||
}; | ||
} | ||
// The code | ||
var headScripts = [], | ||
@@ -34,2 +42,3 @@ $ = typeof(jQuery) !== 'undefined' ? jQuery : undefined, | ||
// a minimal vanilla require.js | ||
var _require = function(hrefs, callback){ | ||
@@ -36,0 +45,0 @@ |
@@ -1,1 +0,1 @@ | ||
var Handlebars=function(){var e=function(){"use strict";function e(e){this.string=e}var r;return e.prototype.toString=function(){return""+this.string},r=e}(),r=function(e){"use strict";function r(e){return c[e]||"&"}function n(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}function t(e){return e instanceof a?e.toString():e||0===e?(e=""+e,l.test(e)?e.replace(s,r):e):""}function o(e){return e||0===e?f(e)&&0===e.length?!0:!1:!0}var i={},a=e,c={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},s=/[&<>"'`]/g,l=/[&<>"'`]/;i.extend=n;var u=Object.prototype.toString;i.toString=u;var p=function(e){return"function"==typeof e};p(/x/)&&(p=function(e){return"function"==typeof e&&"[object Function]"===u.call(e)});var p;i.isFunction=p;var f=Array.isArray||function(e){return e&&"object"==typeof e?"[object Array]"===u.call(e):!1};return i.isArray=f,i.escapeExpression=t,i.isEmpty=o,i}(e),n=function(){"use strict";function e(e,r){var t;r&&r.firstLine&&(t=r.firstLine,e+=" - "+t+":"+r.firstColumn);for(var o=Error.prototype.constructor.call(this,e),i=0;i<n.length;i++)this[n[i]]=o[n[i]];t&&(this.lineNumber=t,this.column=r.firstColumn)}var r,n=["description","fileName","lineNumber","message","name","number","stack"];return e.prototype=new Error,r=e}(),t=function(e,r){"use strict";function n(e,r){this.helpers=e||{},this.partials=r||{},t(this)}function t(e){e.registerHelper("helperMissing",function(e){if(2===arguments.length)return void 0;throw new c("Missing helper: '"+e+"'")}),e.registerHelper("blockHelperMissing",function(r,n){var t=n.inverse||function(){},o=n.fn;return f(r)&&(r=r.call(this)),r===!0?o(this):r===!1||null==r?t(this):p(r)?r.length>0?e.helpers.each(r,n):t(this):o(r)}),e.registerHelper("each",function(e,r){var n,t=r.fn,o=r.inverse,i=0,a="";if(f(e)&&(e=e.call(this)),r.data&&(n=v(r.data)),e&&"object"==typeof e)if(p(e))for(var c=e.length;c>i;i++)n&&(n.index=i,n.first=0===i,n.last=i===e.length-1),a+=t(e[i],{data:n});else for(var s in e)e.hasOwnProperty(s)&&(n&&(n.key=s,n.index=i,n.first=0===i),a+=t(e[s],{data:n}),i++);return 0===i&&(a=o(this)),a}),e.registerHelper("if",function(e,r){return f(e)&&(e=e.call(this)),!r.hash.includeZero&&!e||a.isEmpty(e)?r.inverse(this):r.fn(this)}),e.registerHelper("unless",function(r,n){return e.helpers["if"].call(this,r,{fn:n.inverse,inverse:n.fn,hash:n.hash})}),e.registerHelper("with",function(e,r){return f(e)&&(e=e.call(this)),a.isEmpty(e)?void 0:r.fn(e)}),e.registerHelper("log",function(r,n){var t=n.data&&null!=n.data.level?parseInt(n.data.level,10):1;e.log(t,r)})}function o(e,r){m.log(e,r)}var i={},a=e,c=r,s="1.3.0";i.VERSION=s;var l=4;i.COMPILER_REVISION=l;var u={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"};i.REVISION_CHANGES=u;var p=a.isArray,f=a.isFunction,d=a.toString,h="[object Object]";i.HandlebarsEnvironment=n,n.prototype={constructor:n,logger:m,log:o,registerHelper:function(e,r,n){if(d.call(e)===h){if(n||r)throw new c("Arg not supported with multiple helpers");a.extend(this.helpers,e)}else n&&(r.not=n),this.helpers[e]=r},registerPartial:function(e,r){d.call(e)===h?a.extend(this.partials,e):this.partials[e]=r}};var m={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(e,r){if(m.level<=e){var n=m.methodMap[e];"undefined"!=typeof console&&console[n]&&console[n].call(console,r)}}};i.logger=m,i.log=o;var v=function(e){var r={};return a.extend(r,e),r};return i.createFrame=v,i}(r,n),o=function(e,r,n){"use strict";function t(e){var r=e&&e[0]||1,n=f;if(r!==n){if(n>r){var t=d[n],o=d[r];throw new p("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+t+") or downgrade your runtime to an older version ("+o+").")}throw new p("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+e[1]+").")}}function o(e,r){if(!r)throw new p("No environment passed to template");var n=function(e,n,t,o,i,a){var c=r.VM.invokePartial.apply(this,arguments);if(null!=c)return c;if(r.compile){var s={helpers:o,partials:i,data:a};return i[n]=r.compile(e,{data:void 0!==a},r),i[n](t,s)}throw new p("The partial "+n+" could not be compiled when running in runtime-only mode")},t={escapeExpression:u.escapeExpression,invokePartial:n,programs:[],program:function(e,r,n){var t=this.programs[e];return n?t=a(e,r,n):t||(t=this.programs[e]=a(e,r)),t},merge:function(e,r){var n=e||r;return e&&r&&e!==r&&(n={},u.extend(n,r),u.extend(n,e)),n},programWithDepth:r.VM.programWithDepth,noop:r.VM.noop,compilerInfo:null};return function(n,o){o=o||{};var i,a,c=o.partial?o:r;o.partial||(i=o.helpers,a=o.partials);var s=e.call(t,c,n,i,a,o.data);return o.partial||r.VM.checkRevision(t.compilerInfo),s}}function i(e,r,n){var t=Array.prototype.slice.call(arguments,3),o=function(e,o){return o=o||{},r.apply(this,[e,o.data||n].concat(t))};return o.program=e,o.depth=t.length,o}function a(e,r,n){var t=function(e,t){return t=t||{},r(e,t.data||n)};return t.program=e,t.depth=0,t}function c(e,r,n,t,o,i){var a={partial:!0,helpers:t,partials:o,data:i};if(void 0===e)throw new p("The partial "+r+" could not be found");return e instanceof Function?e(n,a):void 0}function s(){return""}var l={},u=e,p=r,f=n.COMPILER_REVISION,d=n.REVISION_CHANGES;return l.checkRevision=t,l.template=o,l.programWithDepth=i,l.program=a,l.invokePartial=c,l.noop=s,l}(r,n,t),i=function(e,r,n,t,o){"use strict";var i,a=e,c=r,s=n,l=t,u=o,p=function(){var e=new a.HandlebarsEnvironment;return l.extend(e,a),e.SafeString=c,e.Exception=s,e.Utils=l,e.VM=u,e.template=function(r){return u.template(r,e)},e},f=p();return f.create=p,i=f}(t,e,n,r,o);return i}(),oc=oc||{};!function(e,r,n){var t=[],o="undefined"!=typeof jQuery?jQuery:void 0,i="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js",a=5e3,c=function(){},s={error:function(e){return console.log(e)},info:function(e){return n?console.log(e):void 0}},l=function(e,r){for(var n=0;n<e.length;n++)if(e[n]===r)return n;return-1},u=function(e,n){Array.isArray(e)||(e=[e]);for(var o=e.length,i=r.getElementsByTagName("head")[0],a=function(){o--,0===o&&"function"==typeof n&&(n(),n=c)},s=function(e){t.push(e);var n=r.createElement("script");n.type="text/javascript",n.src=e,n.onload=a,i.appendChild(n)},u=0;u<e.length;u++)l(t,e[u])<0?s(e[u]):a()},p=function(e,r,n){var t=Math.floor(9999999999*Math.random());e.html(r.html),e.attr("id",t),e.attr("data-hash",r.key),e.attr("data-rendered",!0),e.attr("data-version",r.version),oc.setEventListeners(e),n()};oc.render=function(r,n,t){if(oc.components[r]){var o=e.template(oc.components[r],[]),i=o(n);t(null,i)}else t("Error loading "+r+" component",null)},oc.resolveNestedComponents=function(e,r){if(r)for(var n in r)if(r.hasOwnProperty(n))for(var t="@component('"+n+"')";e.indexOf(t)>=0;)e=e.replace(t,'<oc-component href="'+r[n].href+'"></oc-component>');return e},oc.renderNestedComponent=function(e,r){e.html('<div class="loading">LOADING...</div>'),oc.renderByHref(e.attr("href"),function(n,t){return!n&&t&&t.html?void p(e,t,r):s.error(n)})},oc.renderByHref=function(e,r){return""===e?r("Failed to retrieve the component. Href parameter missing.",null):void o.ajax({url:e,headers:{"render-mode":"pre-rendered"},success:function(e){u(e.template.src,function(){oc.render(e.template.key,e.data,function(n,t){return n?r("Error rendering component: "+e.href+", error: "+n,null):(t=oc.resolveNestedComponents(t,e.components),s.info("Component '"+e.template.src+"' correctly loaded."),void r(null,{html:t,key:e.template.key,version:e.version}))})})},error:function(){s.error("Failed to retrieve the component. Retrying in 5 seconds..."),setTimeout(function(){oc.renderByHref(e,r)},a)}})},oc.renderUnloadedComponents=oc.refresh=function(){var e=o("oc-component[data-rendered!=true]"),r=function(e,n){s.info("Unloaded component found. Trying to retrieve it..."),oc.renderNestedComponent(o(e[n]),function(){n++,n<e.length?r(e,n):oc.renderUnloadedComponents()})};e.length>0&&r(e,0)},oc.setEventListeners=function(e){e.off("reRender"),e.on("reRender",function(e,r){var n=o(e.target);return r&&""!==r&&n.attr("href",r),n.attr("data-hash",""),n.attr("data-rendered",!1),oc.renderUnloadedComponents(),!1}),e.trigger("loaded")},oc.load=function(e,r,n){if(o(e)){o(e).html('<oc-component href="'+r+'" />');var t=o("oc-component",e);oc.renderNestedComponent(t,function(){"function"==typeof n&&n(t)})}},o?oc.renderUnloadedComponents():u(i,function(){o=jQuery,oc.renderUnloadedComponents()})}(Handlebars,document,!0),oc.clientVersion="0.1.3"; | ||
var Handlebars=function(){var e=function(){"use strict";function e(e){this.string=e}var r;return e.prototype.toString=function(){return""+this.string},r=e}(),r=function(e){"use strict";function r(e){return c[e]||"&"}function n(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}function t(e){return e instanceof a?e.toString():e||0===e?(e=""+e,l.test(e)?e.replace(s,r):e):""}function o(e){return e||0===e?f(e)&&0===e.length?!0:!1:!0}var i={},a=e,c={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},s=/[&<>"'`]/g,l=/[&<>"'`]/;i.extend=n;var u=Object.prototype.toString;i.toString=u;var p=function(e){return"function"==typeof e};p(/x/)&&(p=function(e){return"function"==typeof e&&"[object Function]"===u.call(e)});var p;i.isFunction=p;var f=Array.isArray||function(e){return e&&"object"==typeof e?"[object Array]"===u.call(e):!1};return i.isArray=f,i.escapeExpression=t,i.isEmpty=o,i}(e),n=function(){"use strict";function e(e,r){var t;r&&r.firstLine&&(t=r.firstLine,e+=" - "+t+":"+r.firstColumn);for(var o=Error.prototype.constructor.call(this,e),i=0;i<n.length;i++)this[n[i]]=o[n[i]];t&&(this.lineNumber=t,this.column=r.firstColumn)}var r,n=["description","fileName","lineNumber","message","name","number","stack"];return e.prototype=new Error,r=e}(),t=function(e,r){"use strict";function n(e,r){this.helpers=e||{},this.partials=r||{},t(this)}function t(e){e.registerHelper("helperMissing",function(e){if(2===arguments.length)return void 0;throw new c("Missing helper: '"+e+"'")}),e.registerHelper("blockHelperMissing",function(r,n){var t=n.inverse||function(){},o=n.fn;return f(r)&&(r=r.call(this)),r===!0?o(this):r===!1||null==r?t(this):p(r)?r.length>0?e.helpers.each(r,n):t(this):o(r)}),e.registerHelper("each",function(e,r){var n,t=r.fn,o=r.inverse,i=0,a="";if(f(e)&&(e=e.call(this)),r.data&&(n=v(r.data)),e&&"object"==typeof e)if(p(e))for(var c=e.length;c>i;i++)n&&(n.index=i,n.first=0===i,n.last=i===e.length-1),a+=t(e[i],{data:n});else for(var s in e)e.hasOwnProperty(s)&&(n&&(n.key=s,n.index=i,n.first=0===i),a+=t(e[s],{data:n}),i++);return 0===i&&(a=o(this)),a}),e.registerHelper("if",function(e,r){return f(e)&&(e=e.call(this)),!r.hash.includeZero&&!e||a.isEmpty(e)?r.inverse(this):r.fn(this)}),e.registerHelper("unless",function(r,n){return e.helpers["if"].call(this,r,{fn:n.inverse,inverse:n.fn,hash:n.hash})}),e.registerHelper("with",function(e,r){return f(e)&&(e=e.call(this)),a.isEmpty(e)?void 0:r.fn(e)}),e.registerHelper("log",function(r,n){var t=n.data&&null!=n.data.level?parseInt(n.data.level,10):1;e.log(t,r)})}function o(e,r){m.log(e,r)}var i={},a=e,c=r,s="1.3.0";i.VERSION=s;var l=4;i.COMPILER_REVISION=l;var u={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"};i.REVISION_CHANGES=u;var p=a.isArray,f=a.isFunction,d=a.toString,h="[object Object]";i.HandlebarsEnvironment=n,n.prototype={constructor:n,logger:m,log:o,registerHelper:function(e,r,n){if(d.call(e)===h){if(n||r)throw new c("Arg not supported with multiple helpers");a.extend(this.helpers,e)}else n&&(r.not=n),this.helpers[e]=r},registerPartial:function(e,r){d.call(e)===h?a.extend(this.partials,e):this.partials[e]=r}};var m={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(e,r){if(m.level<=e){var n=m.methodMap[e];"undefined"!=typeof console&&console[n]&&console[n].call(console,r)}}};i.logger=m,i.log=o;var v=function(e){var r={};return a.extend(r,e),r};return i.createFrame=v,i}(r,n),o=function(e,r,n){"use strict";function t(e){var r=e&&e[0]||1,n=f;if(r!==n){if(n>r){var t=d[n],o=d[r];throw new p("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+t+") or downgrade your runtime to an older version ("+o+").")}throw new p("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+e[1]+").")}}function o(e,r){if(!r)throw new p("No environment passed to template");var n=function(e,n,t,o,i,a){var c=r.VM.invokePartial.apply(this,arguments);if(null!=c)return c;if(r.compile){var s={helpers:o,partials:i,data:a};return i[n]=r.compile(e,{data:void 0!==a},r),i[n](t,s)}throw new p("The partial "+n+" could not be compiled when running in runtime-only mode")},t={escapeExpression:u.escapeExpression,invokePartial:n,programs:[],program:function(e,r,n){var t=this.programs[e];return n?t=a(e,r,n):t||(t=this.programs[e]=a(e,r)),t},merge:function(e,r){var n=e||r;return e&&r&&e!==r&&(n={},u.extend(n,r),u.extend(n,e)),n},programWithDepth:r.VM.programWithDepth,noop:r.VM.noop,compilerInfo:null};return function(n,o){o=o||{};var i,a,c=o.partial?o:r;o.partial||(i=o.helpers,a=o.partials);var s=e.call(t,c,n,i,a,o.data);return o.partial||r.VM.checkRevision(t.compilerInfo),s}}function i(e,r,n){var t=Array.prototype.slice.call(arguments,3),o=function(e,o){return o=o||{},r.apply(this,[e,o.data||n].concat(t))};return o.program=e,o.depth=t.length,o}function a(e,r,n){var t=function(e,t){return t=t||{},r(e,t.data||n)};return t.program=e,t.depth=0,t}function c(e,r,n,t,o,i){var a={partial:!0,helpers:t,partials:o,data:i};if(void 0===e)throw new p("The partial "+r+" could not be found");return e instanceof Function?e(n,a):void 0}function s(){return""}var l={},u=e,p=r,f=n.COMPILER_REVISION,d=n.REVISION_CHANGES;return l.checkRevision=t,l.template=o,l.programWithDepth=i,l.program=a,l.invokePartial=c,l.noop=s,l}(r,n,t),i=function(e,r,n,t,o){"use strict";var i,a=e,c=r,s=n,l=t,u=o,p=function(){var e=new a.HandlebarsEnvironment;return l.extend(e,a),e.SafeString=c,e.Exception=s,e.Utils=l,e.VM=u,e.template=function(r){return u.template(r,e)},e},f=p();return f.create=p,i=f}(t,e,n,r,o);return i}(),oc=oc||{};!function(e,r,n){Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)});var t=[],o="undefined"!=typeof jQuery?jQuery:void 0,i="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js",a=5e3,c=function(){},s={error:function(e){return console.log(e)},info:function(e){return n?console.log(e):void 0}},l=function(e,r){for(var n=0;n<e.length;n++)if(e[n]===r)return n;return-1},u=function(e,n){Array.isArray(e)||(e=[e]);for(var o=e.length,i=r.getElementsByTagName("head")[0],a=function(){o--,0===o&&"function"==typeof n&&(n(),n=c)},s=function(e){t.push(e);var n=r.createElement("script");n.type="text/javascript",n.src=e,n.onload=a,i.appendChild(n)},u=0;u<e.length;u++)l(t,e[u])<0?s(e[u]):a()},p=function(e,r,n){var t=Math.floor(9999999999*Math.random());e.html(r.html),e.attr("id",t),e.attr("data-hash",r.key),e.attr("data-rendered",!0),e.attr("data-version",r.version),oc.setEventListeners(e),n()};oc.render=function(r,n,t){if(oc.components[r]){var o=e.template(oc.components[r],[]),i=o(n);t(null,i)}else t("Error loading "+r+" component",null)},oc.resolveNestedComponents=function(e,r){if(r)for(var n in r)if(r.hasOwnProperty(n))for(var t="@component('"+n+"')";e.indexOf(t)>=0;)e=e.replace(t,'<oc-component href="'+r[n].href+'"></oc-component>');return e},oc.renderNestedComponent=function(e,r){e.html('<div class="loading">LOADING...</div>'),oc.renderByHref(e.attr("href"),function(n,t){return!n&&t&&t.html?void p(e,t,r):s.error(n)})},oc.renderByHref=function(e,r){return""===e?r("Failed to retrieve the component. Href parameter missing.",null):void o.ajax({url:e,headers:{"render-mode":"pre-rendered"},success:function(e){u(e.template.src,function(){oc.render(e.template.key,e.data,function(n,t){return n?r("Error rendering component: "+e.href+", error: "+n,null):(t=oc.resolveNestedComponents(t,e.components),s.info("Component '"+e.template.src+"' correctly loaded."),void r(null,{html:t,key:e.template.key,version:e.version}))})})},error:function(){s.error("Failed to retrieve the component. Retrying in 5 seconds..."),setTimeout(function(){oc.renderByHref(e,r)},a)}})},oc.renderUnloadedComponents=oc.refresh=function(){var e=o("oc-component[data-rendered!=true]"),r=function(e,n){s.info("Unloaded component found. Trying to retrieve it..."),oc.renderNestedComponent(o(e[n]),function(){n++,n<e.length?r(e,n):oc.renderUnloadedComponents()})};e.length>0&&r(e,0)},oc.setEventListeners=function(e){e.off("reRender"),e.on("reRender",function(e,r){var n=o(e.target);return r&&""!==r&&n.attr("href",r),n.attr("data-hash",""),n.attr("data-rendered",!1),oc.renderUnloadedComponents(),!1}),e.trigger("loaded")},oc.load=function(e,r,n){if(o(e)){o(e).html('<oc-component href="'+r+'" />');var t=o("oc-component",e);oc.renderNestedComponent(t,function(){"function"==typeof n&&n(t)})}},o?oc.renderUnloadedComponents():u(i,function(){o=jQuery,oc.renderUnloadedComponents()})}(Handlebars,document,!0),oc.clientVersion="0.1.4"; |
{ | ||
"name": "oc", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "An experimental framework to develop and distribute html components", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
218769
4846