Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d6

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d6 - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

109

d6-client.js
/**
* ____ __ ____ _ _ _ ___ ___ _____
* | _ \ / /_ / ___| (_) ___ _ __ | |_ __ __/ _ \ / _ \|___ |
* | | | | '_ \ | | | | |/ _ \ '_ \| __| \ \ / / | | | | | | / /
* | |_| | (_) | | |___| | | __/ | | | |_ \ V /| |_| | |_| | / /
* |____/ \___/ \____|_|_|\___|_| |_|\__| \_/ \___(_)___(_)_/
* ____ __ ____ _ _ _ ___ ___ ___
* | _ \ / /_ / ___| (_) ___ _ __ | |_ __ __/ _ \ / _ \ / _ \
* | | | | '_ \ | | | | |/ _ \ '_ \| __| \ \ / / | | | | | | (_) |
* | |_| | (_) | | |___| | | __/ | | | |_ \ V /| |_| | |_| |\__, |
* |____/ \___/ \____|_|_|\___|_| |_|\__| \_/ \___(_)___(_) /_/
*

@@ -71,3 +71,2 @@ *

data._REQUEST = request;
data = data || {_ERROR: '_OFFLINE'};
callback(data);

@@ -245,3 +244,3 @@ }

*/
var pad = function (
var padArray = function (
array, // Array: The array to check for items.

@@ -1509,81 +1508,3 @@ padToLength, // number: The minimum number of items in the array.

};
/**
* Create a not-strictly-JSON string.
*/
var stringify = function (data, stack) {
var reserved = /^(break|case|catch|continue|debugger|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|this|throw|try|typeof|var|void|while|with)$/;
if (data === null) {
data = 'null';
}
else if (isFunction(data)) {
data = ensureString(data).replace(/^function \(/, 'function(');
}
else if (isDate(data)) {
data = 'new Date(' + getTime(data) + ')';
}
else if (isObject(data)) {
stack = stack || [];
var isCircular = false;
forEach(stack, function (item, index) {
if (item == data) {
isCircular = true;
}
});
if (isCircular) {
return null;
}
push(stack, data);
var parts = [];
if (isArray(data)) {
forEach(data, function (value) {
push(parts, stringify(value, stack));
});
}
else {
forIn(data, function (key, value) {
if (reserved.test(key)) {
key = '"' + key + '"';
}
push(parts, key + ':' + stringify(value, stack));
});
}
pop(stack);
data = '{' + parts.join(',') + '}';
}
else if (isString(data) && stack) {
data = '"' + data.replace(/"/g, '\\"') + '"';
}
else {
data = '' + data;
}
return data;
};
/**
* Parse JavaScript.
*/
var parse = function (text) {
if (text[0] == '{') {
try {
var evil = window.eval; // jshint ignore:line
evil('eval.J=' + text);
text = evil.J;
}
catch (e) {
//+env:debug
error('[Jymin] Could not parse JS: "' + text + '"');
//-env:debug
}
}
return text;
};
/**
* Execute JavaScript.
*/
var execute = function (text) {
parse('0;' + text);
};
/**
* This file is used in conjunction with Jymin to form the D6 client.

@@ -1738,3 +1659,3 @@ *

var removeD6Param = function (url) {
return ensureString(url).replace(/[&\?]d6=[1r]/g, '');
return ensureString(url).replace(/[&\?]d6=[r\d]+/g, '');
};

@@ -1752,3 +1673,3 @@

//+env:debug
log('[D6] Executing callbacks for prefetched URL "' + url + '".');
log('[D6] Caching contents for prefetched URL "' + url + '".');
//-env:debug

@@ -1814,3 +1735,3 @@

//-env:debug
renderResponse(resource);
renderResponse(resource, url);
}

@@ -1838,3 +1759,3 @@ };

forEach(queue, function (callback) {
callback(data);
callback(data, url);
});

@@ -1848,10 +1769,10 @@ };

// Render a template with the given context, and display the resulting HTML.
var renderResponse = function (context) {
var renderResponse = function (context, requestUrl) {
D6._CONTEXT = context;
var err = context._ERROR;
var requestUrl = removeD6Param(context._REQUEST._URL);
var responseUrl = context.d6u || requestUrl;
var responseUrl = removeD6Param(context.d6u || requestUrl);
var viewName = context.d6 || 'error0';
var view = D6._VIEW = views[viewName];
var html;
requestUrl = removeD6Param(requestUrl);

@@ -1866,4 +1787,4 @@ // Make sure the URL we render is the last one we tried to load.

// If we got a string, try rendering it as HTML.
if (isString(context) && trim(context)[0] == '<') {
// If we received HTML, try rendering it.
if (trim(context)[0] == '<') {
html = context;

@@ -1870,0 +1791,0 @@ //+env:debug

2

d6-client.min.js

@@ -1,1 +0,1 @@

!function(n){var t=function(){},e=t,r=t,o=function(){var t=n.XMLHttpRequest,e=n.ActiveXObject;return t?new t:e?new e("Microsoft.XMLHTTP"):!1},u=function(n,t,i,c){z(t)&&(c=i,i=t,t=0);var a=o();return a&&(a.onreadystatechange=function(){if(4==a.readyState){--u._WAITING;var n=a.status,t=200==n,o=t?i||e:c||r,f=tt(a.responseText);f._STATUS=n,f._REQUEST=a,f=f||{_ERROR:"_OFFLINE"},o(f)}},a.open(t?"POST":"GET",n,!0),a.setRequestHeader("x-requested-with","XMLHttpRequest"),t&&a.setRequestHeader("content-type","application/x-www-form-urlencoded"),u._WAITING=(u._WAITING||0)+1,a._URL=n,t&&(a._BODY=t),a._TIME=getTime(),a.send(t||null)),!0},i=function(n,t){if(n)for(var e=0,r=f(n);r>e;e++){var o=t(n[e],e,n);if(o===!1)break}},c=function(n,t){if(n)for(var e in n){var r=t(e,n[e],n);if(r===!1)break}},a=function(n,t){return n&&t&&c(t,function(t,e){n[t]=e}),n},f=function(n){return Z(n)||Y(n)?n.length:0},s=function(n){return f(n)>1},l=function(n,t){return nt(n)&&n.push(t),t},p=function(n){for(var t=function(t){n.push(t)},e=1,r=arguments.length;r>e;e++)i(arguments[e],t)},v=function(n,t){return f(arguments)<2&&(t=n,n=document),Y(t)?n.getElementById(t):t},d=function(n,t){return f(arguments)<2&&(t=n,n=document),n.getElementsByTagName(t||"*")},m=function(n,t){f(arguments)<2&&(t=n,n=document),t=t.split(".");var e,r=(t[0]||"*").toUpperCase(),o=t[1],u="*"==r;return o?(e=[],n.getElementsByClassName?i(n.getElementsByClassName(o),function(n){(u||n.tagName==r)&&e.push(n)}):i(d(n,r),function(n){D(n,o)&&e.push(n)})):e=d(n,r),e},g=function(n,t){var e=(v(n)||{}).parentNode;return t&&e&&e.tagName!=t&&(e=g(e,t)),e},_=function(n){if(!Y(n))return n;n=n||"";var t=n.split("?"),e=t[0].split("."),r=e.slice(1).join(" "),o=e[0].split("#"),u=o[0]||"div",c=o[1],a=t[1],f=_[u]||(_[u]=document.createElement(u)),s=f.cloneNode(!0);return c&&(s.id=c),r&&(s.className=r),a&&(a=a.split("&"),i(a,function(n){var t=n.split("="),e=Q(t[0]),r=Q(t[1]);s[e]=r,s.setAttribute(e,r)})),s},E=function(n,t,e){var r=_(t);return n&&T(n,r,e),r},h=function(n){return v(n).childNodes},T=function(n,t,e){n=v(n),t=v(t),n&&t&&($(e)&&(e=h(n)[e]),n.insertBefore(t,e||null))},N=function(n,t){n=v(n),n&&(n.innerHTML=t)},R=function(n){return n=v(n),n?n.className:void 0},D=function(n,t){var e=new RegExp("(^|\\s)"+t+"(\\s|$)");return e.test(R(n))},L=function(n,t){n=v(n),n&&(n.className+=" "+t)},y=function(n,t){if(n=v(n)){var e=R(n).split(/\s/),r=[];i(e,function(n){n!=t&&r.push(n)}),n.className=r.join(" ")}},A=function(n,t){var e=d("head")[0],r=E(e,"script");t&&(r.onload=t,r.onreadystatechange=function(){S(r)&&t()}),r.src=n},C=function(n,t,e){(!t||z(t))&&(e=t,t=n,n=document);var r;if(M(t,",")){r=[];var o=F(t);i(o,function(t){var e=C(n,t);f(e)&&p(r,e)})}else if(M(t," ")){var u=t.indexOf(" "),c=t.substr(0,u),a=t.substr(u+1);r=[],C(n,c,function(n){var t=C(n,a);p(r,t)})}else if("#"==t[0]){var s=v(n,t.substr(1));r=s?[s]:[]}else r=m(n,t);return e&&i(r,e),r},I=function(t,e,r,o,u){if(M(e," ")){var c=W(e);return void i(c,function(n){I(t,n,r,o,u)})}if(t=v(t)){var a=function(i){i=i||n.event;var c=i.target||i.srcElement;3==c.nodeType&&(c=g(c));var a=i.relatedTarget||i.toElement;if("mouseout"==e)for(;a=g(a);)if(a==c)return;return r(t,i,c,u||o)};t.addEventListener?t.addEventListener(e,a,!0):t.attachEvent?t.attachEvent("on"+e,a):t["on"+e]=a;var f=t._HANDLERS=t._HANDLERS||{},s=f[e]=f[e]||[];l(s,r)}},b=function(n){n.preventDefault()},O=function(n,t,e,r,o,u){t=t.split(".");var i=t[0].toUpperCase(),c=t[1],a=function(n,t,e,o){return i&&e.tagName!=i||c&&!D(e,c)?(e=g(e),void(e&&a(n,t,e,o))):r(e,t,n,u||o)};I(n,e,a,o)},S=function(n){var t=n.readyState;return"complete"==t||"script"==n.tagName&&"loaded"==t},U=function(n){if(n=v(n)){var t=n.type[0],e=n.value,r=n.checked,o=n.options;return"c"==t||"r"==t?e=r?e:null:n.multiple?(e=[],i(o,function(n){n.selected&&l(e,n.value)})):o&&(e=o[n.selectedIndex].value),e}},H=function(){var t=n.history||{};return i(["push","replace"],function(n){var e=t[n+"State"];t[n]=function(n){e&&e.apply(t,[null,null,n])}}),t},w=function(n){H().push(n)},x=function(t){I(n,"popstate",t)},G=function(){B("error",arguments)},k=function(){B("log",arguments)},B=function(t,e){var r=n.console;r&&r[t]&&r[t].apply(r,e)},j=function(n){return Y(n)?n:""+n},M=function(n,t){return j(n).indexOf(t)>-1},q=function(n,t){return 0==j(n).indexOf(t)},P=function(n){return j(n).replace(/^\s+|\s+$/g,"")},F=function(n){return j(n).split(",")},W=function(n){return j(n).split(" ")},X=function(n,t,e){var r=n.match(t);r&&e.apply(n,r)},J=function(n){return j(n).toLowerCase()},K=function(n){return encodeURIComponent(n)},Q=function(n){return decodeURIComponent(n)},V=function(n,t){return typeof n==t},$=function(n){return V(n,"number")},Y=function(n){return V(n,"string")},z=function(n){return V(n,"function")},Z=function(n,t){return n instanceof(t||Object)},nt=function(n){return Z(n,Array)},tt=function(t){if("{"==t[0])try{var e=n.eval;e("eval.J="+t),t=e.J}catch(r){G('[Jymin] Could not parse JS: "'+t+'"')}return t},et=function(n){tt("0;"+n)};!function(){var t,e,r=n.D6=function(n){a(o,n),f||p()},o=r._VIEWS={},c=r._CACHE={},f=!1,p=function(){t=document.body,O(t,"a","click",function(n,t){var e=m(n.href),r=t.which,o=!r||1==r;v(e)&&o&&(b(t),h(e))}),O(t,"a","mouseover",function(n){if(!D(n,"_NOPREFETCH")){var t=m(n.href),e=t!=m(location);e&&v(t)&&E(t)}});var n=function(n){var t=n.form;t&&(t._LAST_CHANGED=getTime())};O(t,"input","change",n),O(t,"select","change",n),O(t,"textarea","change",n);var e=function(n){if("submit"==n.type){var t=n.form;t&&t._CLICKED_BUTTON!=n&&(t._CLICKED_BUTTON=n,t._LAST_CHANGED=getTime())}};O(t,"input","click",e),O(t,"button","click",e),O(t,"form","submit",function(n,t){var e=m(n.action),r="get"==J(n.method);if(v(e)){b(t);var o=[];C(n,"input,select,textarea,button",function(t){var e=t.name,r=t.type,u=U(t),c=!e;c=c||"radio"==r&&!u,c=c||"submit"==r&&t!=n._CLICKED_BUTTON,c||(Y(u)?l(o,K(e)+"="+K(u)):i(u,function(n){l(o,K(e)+"="+K(n))}))}),r?(e+=(M(e,"?")?"&":"?")+o.join("&"),o=0):(e=g(e,n._LAST_CHANGED),o=o.join("&")),h(e,o)}});x(function(){h(location)}),f=!0},v=function(n){return q(n,location.protocol+"//"+location.host+"/")},m=function(n){return j(n).replace(/#.*$/,"")},g=function(n,t){return n+(M(n,"?")?"&":"?")+"d6="+(t||1)},_=function(n){return j(n).replace(/[&\?]d6=[1r]/g,"")},E=function(n){c[n]||(k('[D6] Prefetching "'+n+'".'),c[n]=[function(t){k('[D6] Executing callbacks for prefetched URL "'+n+'".'),c[n]=t;var e=t.ttl||1e4;setTimeout(function(){nt(c[n])||(k('[D6] Removing "'+n+'" from prefetch cache.'),delete c[n])},e)}],T(n))},h=r._LOAD_URL=function(n,t){r._LOADING_URL=_(n),r._LOAD_STARTED=getTime(),k('[D6] Loading "'+n+'".'),C("._SPINNER",function(n){L(n,"_LOADING")});var e=c[n];e?nt(e)?(k('[D6] Queueing callback for "'+n+'".'),l(e,R)):(k('[D6] Found precached response for "'+n+'".'),R(e)):(k('[D6] Creating callback queue for "'+n+'".'),c[n]=[R],T(n,t))},T=function(n,t){k('[D6] Fetching response for "'+n+'".');var e=g(n),r=function(t){var e=c[n];c[n]=t,k("[D6] Running "+e.length+' callback(s) for "'+n+'".'),i(e,function(n){n(t)})};u(e,t,r,r,1)},R=function(t){r._CONTEXT=t;var e,u=(t._ERROR,_(t._REQUEST._URL)),i=t.d6u||u,a=t.d6||"error0",f=r._VIEW=o[a];u==r._LOADING_URL&&(C("._SPINNER",function(n){y(n,"_LOADING")}),Y(t)&&"<"==P(t)[0]?(e=t,k("[D6] Rendering HTML string")):f?(e=f.call(o,t),k('[D6] Rendering view "'+a+'".')):(G('[D6] View "'+a+'" not found. Changing location.'),n.location=i)),e&&(I(e),w(i),delete c[u])},I=function(n){X(n,/<title.*?>([\s\S]+)<\/title>/,function(n,t){document.title=t});var e=[];n=n.replace(/<script.*?>([\s\S]*?)<\/script>/g,function(n,t){return t&&(e.push(t),n=""),n}),X(n,/<body.*?>([\s\S]+)<\/body>/,function(n,e){N(t,e),t.scrollTop=0}),e.forEach(et),onReady()},S=d("script");i(S,function(n){var t=j(n.src).split("?");s(t)&&(e=t[1])}),A("/d6.js?"+e)}()}(window);
!function(n){var t=function(){},e=t,r=t,o=function(){var t=n.XMLHttpRequest,e=n.ActiveXObject;return t?new t:e?new e("Microsoft.XMLHTTP"):!1},u=function(n,t,i,c){J(t)&&(c=i,i=t,t=0);var a=o();return a&&(a.onreadystatechange=function(){if(4==a.readyState){--u._WAITING;var n=a.status,t=200==n,o=t?i||e:c||r,f=parse(a.responseText);f._STATUS=n,f._REQUEST=a,o(f)}},a.open(t?"POST":"GET",n,!0),a.setRequestHeader("x-requested-with","XMLHttpRequest"),t&&a.setRequestHeader("content-type","application/x-www-form-urlencoded"),u._WAITING=(u._WAITING||0)+1,a._URL=n,t&&(a._BODY=t),a._TIME=getTime(),a.send(t||null)),!0},i=function(n,t){if(n)for(var e=0,r=f(n);r>e;e++){var o=t(n[e],e,n);if(o===!1)break}},c=function(n,t){if(n)for(var e in n){var r=t(e,n[e],n);if(r===!1)break}},a=function(n,t){return n&&t&&c(t,function(t,e){n[t]=e}),n},f=function(n){return Z(n)||z(n)?n.length:0},s=function(n){return f(n)>1},l=function(n,t){return nt(n)&&n.push(t),t},p=function(n){for(var t=function(t){n.push(t)},e=1,r=arguments.length;r>e;e++)i(arguments[e],t)},d=function(n,t){return f(arguments)<2&&(t=n,n=document),z(t)?n.getElementById(t):t},v=function(n,t){return f(arguments)<2&&(t=n,n=document),n.getElementsByTagName(t||"*")},m=function(n,t){f(arguments)<2&&(t=n,n=document),t=t.split(".");var e,r=(t[0]||"*").toUpperCase(),o=t[1],u="*"==r;return o?(e=[],n.getElementsByClassName?i(n.getElementsByClassName(o),function(n){(u||n.tagName==r)&&e.push(n)}):i(v(n,r),function(n){L(n,o)&&e.push(n)})):e=v(n,r),e},g=function(n,t){var e=(d(n)||{}).parentNode;return t&&e&&e.tagName!=t&&(e=g(e,t)),e},_=function(n){if(!z(n))return n;n=n||"";var t=n.split("?"),e=t[0].split("."),r=e.slice(1).join(" "),o=e[0].split("#"),u=o[0]||"div",c=o[1],a=t[1],f=_[u]||(_[u]=document.createElement(u)),s=f.cloneNode(!0);return c&&(s.id=c),r&&(s.className=r),a&&(a=a.split("&"),i(a,function(n){var t=n.split("="),e=$(t[0]),r=$(t[1]);s[e]=r,s.setAttribute(e,r)})),s},h=function(n,t,e){var r=_(t);return n&&E(n,r,e),r},T=function(n){return d(n).childNodes},E=function(n,t,e){n=d(n),t=d(t),n&&t&&(Y(e)&&(e=T(n)[e]),n.insertBefore(t,e||null))},N=function(n,t){n=d(n),n&&(n.innerHTML=t)},D=function(n){return n=d(n),n?n.className:void 0},L=function(n,t){var e=new RegExp("(^|\\s)"+t+"(\\s|$)");return e.test(D(n))},R=function(n,t){n=d(n),n&&(n.className+=" "+t)},y=function(n,t){if(n=d(n)){var e=D(n).split(/\s/),r=[];i(e,function(n){n!=t&&r.push(n)}),n.className=r.join(" ")}},A=function(n,t){var e=v("head")[0],r=h(e,"script");t&&(r.onload=t,r.onreadystatechange=function(){S(r)&&t()}),r.src=n},C=function(n,t,e){(!t||J(t))&&(e=t,t=n,n=document);var r;if(M(t,",")){r=[];var o=W(t);i(o,function(t){var e=C(n,t);f(e)&&p(r,e)})}else if(M(t," ")){var u=t.indexOf(" "),c=t.substr(0,u),a=t.substr(u+1);r=[],C(n,c,function(n){var t=C(n,a);p(r,t)})}else if("#"==t[0]){var s=d(n,t.substr(1));r=s?[s]:[]}else r=m(n,t);return e&&i(r,e),r},I=function(t,e,r,o,u){if(M(e," ")){var c=X(e);return void i(c,function(n){I(t,n,r,o,u)})}if(t=d(t)){var a=function(i){i=i||n.event;var c=i.target||i.srcElement;3==c.nodeType&&(c=g(c));var a=i.relatedTarget||i.toElement;if("mouseout"==e)for(;a=g(a);)if(a==c)return;return r(t,i,c,u||o)};t.addEventListener?t.addEventListener(e,a,!0):t.attachEvent?t.attachEvent("on"+e,a):t["on"+e]=a;var f=t._HANDLERS=t._HANDLERS||{},s=f[e]=f[e]||[];l(s,r)}},b=function(n){n.preventDefault()},O=function(n,t,e,r,o,u){t=t.split(".");var i=t[0].toUpperCase(),c=t[1],a=function(n,t,e,o){return i&&e.tagName!=i||c&&!L(e,c)?(e=g(e),void(e&&a(n,t,e,o))):r(e,t,n,u||o)};I(n,e,a,o)},S=function(n){var t=n.readyState;return"complete"==t||"script"==n.tagName&&"loaded"==t},H=function(n){if(n=d(n)){var t=n.type[0],e=n.value,r=n.checked,o=n.options;return"c"==t||"r"==t?e=r?e:null:n.multiple?(e=[],i(o,function(n){n.selected&&l(e,n.value)})):o&&(e=o[n.selectedIndex].value),e}},U=function(){var t=n.history||{};return i(["push","replace"],function(n){var e=t[n+"State"];t[n]=function(n){e&&e.apply(t,[null,null,n])}}),t},w=function(n){U().push(n)},x=function(t){I(n,"popstate",t)},G=function(){B("error",arguments)},k=function(){B("log",arguments)},B=function(t,e){var r=n.console;r&&r[t]&&r[t].apply(r,e)},j=function(n){return z(n)?n:""+n},M=function(n,t){return j(n).indexOf(t)>-1},q=function(n,t){return 0==j(n).indexOf(t)},P=function(n){return j(n).replace(/^\s+|\s+$/g,"")},W=function(n){return j(n).split(",")},X=function(n){return j(n).split(" ")},F=function(n,t,e){var r=n.match(t);r&&e.apply(n,r)},K=function(n){return j(n).toLowerCase()},V=function(n){return encodeURIComponent(n)},$=function(n){return decodeURIComponent(n)},Q=function(n,t){return typeof n==t},Y=function(n){return Q(n,"number")},z=function(n){return Q(n,"string")},J=function(n){return Q(n,"function")},Z=function(n,t){return n instanceof(t||Object)},nt=function(n){return Z(n,Array)};!function(){var t,e,r=n.D6=function(n){a(o,n),f||p()},o=r._VIEWS={},c=r._CACHE={},f=!1,p=function(){t=document.body,O(t,"a","click",function(n,t){var e=m(n.href),r=t.which,o=!r||1==r;d(e)&&o&&(b(t),T(e))}),O(t,"a","mouseover",function(n){if(!L(n,"_NOPREFETCH")){var t=m(n.href),e=t!=m(location);e&&d(t)&&h(t)}});var n=function(n){var t=n.form;t&&(t._LAST_CHANGED=getTime())};O(t,"input","change",n),O(t,"select","change",n),O(t,"textarea","change",n);var e=function(n){if("submit"==n.type){var t=n.form;t&&t._CLICKED_BUTTON!=n&&(t._CLICKED_BUTTON=n,t._LAST_CHANGED=getTime())}};O(t,"input","click",e),O(t,"button","click",e),O(t,"form","submit",function(n,t){var e=m(n.action),r="get"==K(n.method);if(d(e)){b(t);var o=[];C(n,"input,select,textarea,button",function(t){var e=t.name,r=t.type,u=H(t),c=!e;c=c||"radio"==r&&!u,c=c||"submit"==r&&t!=n._CLICKED_BUTTON,c||(z(u)?l(o,V(e)+"="+V(u)):i(u,function(n){l(o,V(e)+"="+V(n))}))}),r?(e+=(M(e,"?")?"&":"?")+o.join("&"),o=0):(e=g(e,n._LAST_CHANGED),o=o.join("&")),T(e,o)}});x(function(){T(location)}),f=!0},d=function(n){return q(n,location.protocol+"//"+location.host+"/")},m=function(n){return j(n).replace(/#.*$/,"")},g=function(n,t){return n+(M(n,"?")?"&":"?")+"d6="+(t||1)},_=function(n){return j(n).replace(/[&\?]d6=[r\d]+/g,"")},h=function(n){c[n]||(k('[D6] Prefetching "'+n+'".'),c[n]=[function(t){k('[D6] Caching contents for prefetched URL "'+n+'".'),c[n]=t;var e=t.ttl||1e4;setTimeout(function(){nt(c[n])||(k('[D6] Removing "'+n+'" from prefetch cache.'),delete c[n])},e)}],E(n))},T=r._LOAD_URL=function(n,t){r._LOADING_URL=_(n),r._LOAD_STARTED=getTime(),k('[D6] Loading "'+n+'".'),C("._SPINNER",function(n){R(n,"_LOADING")});var e=c[n];e?nt(e)?(k('[D6] Queueing callback for "'+n+'".'),l(e,D)):(k('[D6] Found precached response for "'+n+'".'),D(e,n)):(k('[D6] Creating callback queue for "'+n+'".'),c[n]=[D],E(n,t))},E=function(n,t){k('[D6] Fetching response for "'+n+'".');var e=g(n),r=function(t){var e=c[n];c[n]=t,k("[D6] Running "+e.length+' callback(s) for "'+n+'".'),i(e,function(e){e(t,n)})};u(e,t,r,r,1)},D=function(t,e){r._CONTEXT=t;var u,i=(t._ERROR,_(t.d6u||e)),a=t.d6||"error0",f=r._VIEW=o[a];e=_(e),e==r._LOADING_URL&&(C("._SPINNER",function(n){y(n,"_LOADING")}),"<"==P(t)[0]?(u=t,k("[D6] Rendering HTML string")):f?(u=f.call(o,t),k('[D6] Rendering view "'+a+'".')):(G('[D6] View "'+a+'" not found. Changing location.'),n.location=i)),u&&(I(u),w(i),delete c[e])},I=function(n){F(n,/<title.*?>([\s\S]+)<\/title>/,function(n,t){document.title=t});var e=[];n=n.replace(/<script.*?>([\s\S]*?)<\/script>/g,function(n,t){return t&&(e.push(t),n=""),n}),F(n,/<body.*?>([\s\S]+)<\/body>/,function(n,e){N(t,e),t.scrollTop=0}),e.forEach(execute),onReady()},S=v("script");i(S,function(n){var t=j(n.src).split("?");s(t)&&(e=t[1])}),A("/d6.js?"+e)}()}(window);

@@ -7,3 +7,3 @@ {

],
"version": "0.0.8",
"version": "0.0.9",
"main": "d6.js",

@@ -31,3 +31,3 @@ "homepage": "http://lighter.io/d6",

"dependencies": {
"jymin": "0.2.4"
"jymin": "0.2.6"
},

@@ -34,0 +34,0 @@ "devDependencies": {

@@ -151,3 +151,3 @@ /**

var removeD6Param = function (url) {
return ensureString(url).replace(/[&\?]d6=[1r]/g, '');
return ensureString(url).replace(/[&\?]d6=[r\d]+/g, '');
};

@@ -165,3 +165,3 @@

//+env:debug
log('[D6] Executing callbacks for prefetched URL "' + url + '".');
log('[D6] Caching contents for prefetched URL "' + url + '".');
//-env:debug

@@ -227,3 +227,3 @@

//-env:debug
renderResponse(resource);
renderResponse(resource, url);
}

@@ -251,3 +251,3 @@ };

forEach(queue, function (callback) {
callback(data);
callback(data, url);
});

@@ -261,10 +261,10 @@ };

// Render a template with the given context, and display the resulting HTML.
var renderResponse = function (context) {
var renderResponse = function (context, requestUrl) {
D6._CONTEXT = context;
var err = context._ERROR;
var requestUrl = removeD6Param(context._REQUEST._URL);
var responseUrl = context.d6u || requestUrl;
var responseUrl = removeD6Param(context.d6u || requestUrl);
var viewName = context.d6 || 'error0';
var view = D6._VIEW = views[viewName];
var html;
requestUrl = removeD6Param(requestUrl);

@@ -279,4 +279,4 @@ // Make sure the URL we render is the last one we tried to load.

// If we got a string, try rendering it as HTML.
if (isString(context) && trim(context)[0] == '<') {
// If we received HTML, try rendering it.
if (trim(context)[0] == '<') {
html = context;

@@ -283,0 +283,0 @@ //+env:debug

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc