diff --git a/Gruntfile.js b/Gruntfile.js index d08b2f9..fe932c2 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -31,7 +31,7 @@ module.exports = function(grunt) { src: 'dist/xapidashboard.js', dest: 'dist/xapidashboard.min.js' },{ - src: 'src/xapicollection.js', + src: 'dist/xapicollection.js', dest: 'dist/xapicollection.min.js' }] } diff --git a/dist/xapicollection.min.js b/dist/xapicollection.min.js index 22173a0..c893517 100644 --- a/dist/xapicollection.min.js +++ b/dist/xapicollection.min.js @@ -1,2 +1,2 @@ /*! xAPI-Dashboard v1.1.0 | Built on 08-12-2014 */ -"use strict";try{window.ADL=window.ADL||{}}catch(e){var window={ADL:{}}}try{var workerScript=document.querySelector('script[src*="xapicollection"]').src}catch(e){}Array.isArray||(Array.isArray=function(a){return a.length>=0&&!a.length}),function(a){function b(a,c){if(void 0===c)return null;if(0===a.length)return c;var d;if(Array.isArray(a))d=a;else{d=a.split(".");for(var e=0;e0&&console.log("Warning: Your browser does not support WebWorker transfers. Performance of this site may suffer as a result.")}function f(a){return function(){var b=Array.prototype.slice.call(arguments);return this._worker.postMessage(e.serialize([a].concat(b))),this}}d.prototype.exec=function(a){return a(this.contents),this.parent},d.prototype.save=function(){return new d(this)},d.prototype.append=function(a){return this.contents=this.contents.concat(a),this},d.prototype.toCSV=function(){function a(a){return"object"==typeof a&&(a=JSON.stringify(a)),"string"==typeof a&&(a=a.replace(/"/g,'""')),'"'+a+'"'}if(this.contents.length>0){var b="",c=Object.keys(this.contents[0]);b+=c.map(a).join(",")+"\r\n";for(var d=0;d=|<=|=|>|<)\s*(.*)\s*$/.exec(a);if(!b)return e;var c=h(b[1]),d=i(b[3]);if(!c)return e;if(d instanceof RegExp)return"="===b[2]?{op:"re",xpath:c,value:d}:"!="===b[2]?{op:"nre",xpath:c,value:d}:(console.error("Regex comparison only supports = and !="),e);switch(b[2]){case"=":return{op:"eq",xpath:c,value:d};case"!=":return{op:"neq",xpath:c,value:d};case"<":return{op:"lt",xpath:c,value:d};case"<=":return{op:"leq",xpath:c,value:d};case">":return{op:"gt",xpath:c,value:d};case">=":return{op:"geq",xpath:c,value:d};default:return e}}function h(a){var b=/^\s*([^\.]+(?:\.[^\.]+)*)\s*$/.exec(a);return b?b[1]:e}function i(a){var b=null;a=a.trim();var c=Number.isNaN||isNaN;return/^0[0-7]+$/.test(a)&&!c(b=parseInt(a,8))?b:/^\d+$/.test(a)&&!c(b=parseInt(a,10))?b:/^0x[0-9a-f]+$/i.test(a)&&!c(b=parseInt(a,16))?b:c(b=parseFloat(a))?(b=/^\s*(["'])(.*)\1\s*$/.exec(a))?b[2]:(b=/^\s*\/(.*)\/(i?)\s*$/.exec(a))?new RegExp(b[1],b[2]):"null"===a?null:"true"===a||"false"===a?"true"===a:e:b}var j=b(a);return j!=e?j:null}function d(a,c){if(Array.isArray(a.and)&&0===a.and.length)return!0;if(Array.isArray(a.or)&&0===a.or.length)return!1;if(!a.op||/\.\*\.?/.test(a.xpath)){if(a.op&&/\.\*\.?/.test(a.xpath)){var e=b(a.xpath,c);if(!e)return!1;for(var f=0;f=a.value:"leq"===a.op?e[f]<=a.value:"lt"===a.op?e[f]a.value:"re"===a.op?a.value.test(e[f]):"nre"===a.op?!a.value.test(e[f]):!1)return!0}return!1}return a.and?d(a.and[0],c)?d({and:a.and.slice(1)},c):!1:a.or?d(a.or[0],c)?!0:d({or:a.or.slice(1)},c):!1}switch(a.op){case"eq":return b(a.xpath,c)===a.value;case"neq":return b(a.xpath,c)!==a.value;case"geq":return b(a.xpath,c)>=a.value;case"leq":return b(a.xpath,c)<=a.value;case"lt":return b(a.xpath,c)a.value;case"re":return a.value.test(b(a.xpath,c));case"nre":return!a.value.test(b(a.xpath,c));default:return!1}}var e=0/0;if(!a)return this;var f=c(a);if(!f)return void console.error("Invalid where expression: "+a);for(var g=0;g0)for(var g=this.contents,h=0;h0)for(var f=this.contents,g=0;g0)for(var g=0;gf?-1:1)*c}),this},d.prototype._groupByRange=function(a,c){if(!Array.isArray(c)||3!==c.length||c[2]%1!==0)return this.groupBy(a);var d,e,f=c[0],g=c[1],h=c[2];"string"==typeof f&&"string"==typeof g&&Date.parse(f)&&Date.parse(g)?(d=function(a){return Date.parse(a)},e=function(a,b){var c=new Date(Date.parse(a)+b);return c.toISOString()}):"string"==typeof f&&"string"==typeof g?(d=function(a){return a.charAt(0).toLowerCase().charCodeAt(0)-"a".charCodeAt(0)},e=function(a,b){return String.fromCharCode(a.charAt(0).toLowerCase().charCodeAt(0)+b)}):(d=function(a){return a},e=function(a,b){return a+b});var i=[];if((d(g)-d(f))*h<=0)console.error("Group range is open, cannot generate groups!"),console.log(JSON.stringify(c)),i=[f,g];else{if(d(f)>d(g))return groupByRange(a,[g,f,-h]),void dataStack.push(dataStack.pop().reverse());for(var j=f;d(j)0){for(var c=0;c0){for(var f=0;f0){for(var f=0;f0?h/j.data.length:0,j.sample=j.data[0],g.push(j)}return this.contents=g,this},d.prototype.min=function(a,c){if(!a)return this;var e=this.contents,f=[];if(e[0]&&e[0].group&&e[0].data){if(c&&c>0){for(var g=0;g0){for(var f=0;fl&&y.push("'"+this.terminals_[v]+"'");A=this.lexer.showPosition?"Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+y.join(", ")+", got '"+(this.terminals_[q]||q)+"'":"Parse error on line "+(i+1)+": Unexpected "+(q==m?"end of input":"'"+(this.terminals_[q]||q)+"'"),this.parseError(A,{text:this.lexer.match,token:this.terminals_[q]||q,line:this.lexer.yylineno,loc:o,expected:y})}if(t[0]instanceof Array&&t.length>1)throw new Error("Parse Error: multiple actions possible at state: "+s+", token: "+q);switch(t[0]){case 1:d.push(q),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(t[1]),q=null,r?(q=r,r=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,o=this.lexer.yylloc,k>0&&k--);break;case 2:if(w=this.productions_[t[1]][1],z.$=e[e.length-w],z._$={first_line:f[f.length-(w||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(w||1)].first_column,last_column:f[f.length-1].last_column},p&&(z._$.range=[f[f.length-(w||1)].range[0],f[f.length-1].range[1]]),u=this.performAction.apply(z,[h,j,i,this.yy,t[1],e,f].concat(n)),"undefined"!=typeof u)return u;w&&(d=d.slice(0,-1*w*2),e=e.slice(0,-1*w),f=f.slice(0,-1*w)),d.push(this.productions_[t[1]][0]),e.push(z.$),f.push(z._$),x=g[d[d.length-2]][d[d.length-1]],d.push(x);break;case 3:return!0}}return!0}},c=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a){return this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b-1),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},test_match:function(a,b){var c,d,e;if(this.options.backtrack_lexer&&(e={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(e.yylloc.range=this.yylloc.range.slice(0))),d=a[0].match(/(?:\r\n?|\n).*/g),d&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+a[0].length},this.yytext+=a[0],this.match+=a[0],this.matches=a,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(a[0].length),this.matched+=a[0],c=this.performAction.call(this,this.yy,this,b,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c)return c;if(this._backtrack){for(var f in e)this[f]=e[f];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d;this._more||(this.yytext="",this.match="");for(var e=this._currentRules(),f=0;fb[0].length)){if(b=c,d=f,this.options.backtrack_lexer){if(a=this.test_match(c,e[f]),a!==!1)return a;if(this._backtrack){b=!1;continue}return!1}if(!this.options.flex)break}return b?(a=this.test_match(b,e[d]),a!==!1?a:!1):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){var a=this.conditionStack.length-1;return a>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(a){return a=this.conditionStack.length-1-Math.abs(a||0),a>=0?this.conditionStack[a]:"INITIAL"},pushState:function(a){this.begin(a)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(a,b,c,d){switch(c){case 0:return 13;case 1:return 14;case 2:return 16;case 3:return 17;case 4:return 18;case 5:return 19;case 6:return 8;case 7:return 6;case 8:return 10;case 9:return 11;case 10:return 4;case 11:return 5;case 12:return 21;case 13:}},rules:[/^(?:-?[0-9]+(\.[0-9]+)?)/,/^(?:"[^"]+")/,/^(?:\$\([^\)]+\))/,/^(?:\$\|[^|]+\|)/,/^(?:\$\{[^\}]+\})/,/^(?:\$\[[^|]+\|-?[0-9]+(,-?[0-9]+)?\])/,/^(?:\+)/,/^(?:-)/,/^(?:\*)/,/^(?:\/)/,/^(?:\()/,/^(?:\))/,/^(?:$)/,/^(?:[ \t\n])/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}}};return a}();return b.lexer=c,a.prototype=b,b.Parser=a,new a}();"undefined"!=typeof require&&"undefined"!=typeof exports&&(exports.parser=MathParser,exports.Parser=MathParser.Parser,exports.parse=function(){return MathParser.parse.apply(MathParser,arguments)},exports.main=function(a){a[1]||(console.log("Usage: "+a[0]+" FILE"),process.exit(1));var b=require("fs").readFileSync(require("path").normalize(a[1]),"utf8");return exports.parser.parse(b)},"undefined"!=typeof module&&require.main===module&&exports.main(process.argv.slice(1)));try{window.ADL=window.ADL||{}}catch(e){var window={ADL:{}}}try{var workerScript=document.querySelector('script[src*="xapicollection"]').src}catch(e){}Array.isArray||(Array.isArray=function(a){return a.length>=0&&!a.length}),function(a){function b(a,c){if(void 0===c)return null;if(0===a.length)return c;var d;if(Array.isArray(a))d=a;else{d=a.split(".");for(var e=0;e0&&console.log("Warning: Your browser does not support WebWorker transfers. Performance of this site may suffer as a result.")}function f(a){return function(){var b=Array.prototype.slice.call(arguments);return this._worker.postMessage(e.serialize([a].concat(b))),this}}d.prototype.exec=function(a){return a(this.contents),this.parent},d.prototype.save=function(){return new d(this)},d.prototype.append=function(a){return this.contents=this.contents.concat(a),this},d.prototype.toCSV=function(){function a(a){return"object"==typeof a&&(a=JSON.stringify(a)),"string"==typeof a&&(a=a.replace(/"/g,'""')),'"'+a+'"'}if(this.contents.length>0){var b="",c=Object.keys(this.contents[0]);b+=c.map(a).join(",")+"\r\n";for(var d=0;d=|<=|=|>|<)\s*(.*)\s*$/.exec(a);if(!b)return e;var c=h(b[1]),d=i(b[3]);if(!c)return e;if(d instanceof RegExp)return"="===b[2]?{op:"re",xpath:c,value:d}:"!="===b[2]?{op:"nre",xpath:c,value:d}:(console.error("Regex comparison only supports = and !="),e);switch(b[2]){case"=":return{op:"eq",xpath:c,value:d};case"!=":return{op:"neq",xpath:c,value:d};case"<":return{op:"lt",xpath:c,value:d};case"<=":return{op:"leq",xpath:c,value:d};case">":return{op:"gt",xpath:c,value:d};case">=":return{op:"geq",xpath:c,value:d};default:return e}}function h(a){var b=/^\s*([^\.]+(?:\.[^\.]+)*)\s*$/.exec(a);return b?b[1]:e}function i(a){var b=null;a=a.trim();var c=Number.isNaN||isNaN;return/^0[0-7]+$/.test(a)&&!c(b=parseInt(a,8))?b:/^\d+$/.test(a)&&!c(b=parseInt(a,10))?b:/^0x[0-9a-f]+$/i.test(a)&&!c(b=parseInt(a,16))?b:c(b=parseFloat(a))?(b=/^\s*(["'])(.*)\1\s*$/.exec(a))?b[2]:(b=/^\s*\/(.*)\/(i?)\s*$/.exec(a))?new RegExp(b[1],b[2]):"null"===a?null:"true"===a||"false"===a?"true"===a:e:b}var j=b(a);return j!=e?j:null}function d(a,c){if(Array.isArray(a.and)&&0===a.and.length)return!0;if(Array.isArray(a.or)&&0===a.or.length)return!1;if(!a.op||/\.\*\.?/.test(a.xpath)){if(a.op&&/\.\*\.?/.test(a.xpath)){var e=b(a.xpath,c);if(!e)return!1;for(var f=0;f=a.value:"leq"===a.op?e[f]<=a.value:"lt"===a.op?e[f]a.value:"re"===a.op?a.value.test(e[f]):"nre"===a.op?!a.value.test(e[f]):!1)return!0}return!1}return a.and?d(a.and[0],c)?d({and:a.and.slice(1)},c):!1:a.or?d(a.or[0],c)?!0:d({or:a.or.slice(1)},c):!1}switch(a.op){case"eq":return b(a.xpath,c)===a.value;case"neq":return b(a.xpath,c)!==a.value;case"geq":return b(a.xpath,c)>=a.value;case"leq":return b(a.xpath,c)<=a.value;case"lt":return b(a.xpath,c)a.value;case"re":return a.value.test(b(a.xpath,c));case"nre":return!a.value.test(b(a.xpath,c));default:return!1}}var e=0/0;if(!a)return this;var f=c(a);if(!f)return void console.error("Invalid where expression: "+a);for(var g=0;g0)for(var g=this.contents,h=0;h0)for(var f=this.contents,g=0;g0)for(var g=0;gf?-1:1)*c}),this},d.prototype._groupByRange=function(a,c){if(!Array.isArray(c)||3!==c.length||c[2]%1!==0)return this.groupBy(a);var d,e,f=c[0],g=c[1],h=c[2];"string"==typeof f&&"string"==typeof g&&Date.parse(f)&&Date.parse(g)?(d=function(a){return Date.parse(a)},e=function(a,b){var c=new Date(Date.parse(a)+b);return c.toISOString()}):"string"==typeof f&&"string"==typeof g?(d=function(a){return a.charAt(0).toLowerCase().charCodeAt(0)-"a".charCodeAt(0)},e=function(a,b){return String.fromCharCode(a.charAt(0).toLowerCase().charCodeAt(0)+b)}):(d=function(a){return a},e=function(a,b){return a+b});var i=[];if((d(g)-d(f))*h<=0)console.error("Group range is open, cannot generate groups!"),console.log(JSON.stringify(c)),i=[f,g];else{if(d(f)>d(g))return groupByRange(a,[g,f,-h]),void dataStack.push(dataStack.pop().reverse());for(var j=f;d(j)0){for(var c=0;c0){for(var f=0;f0){for(var f=0;f0?h/j.data.length:0,j.sample=j.data[0],g.push(j)}return this.contents=g,this},d.prototype.min=function(a,c){if(!a)return this;var e=this.contents,f=[];if(e[0]&&e[0].group&&e[0].data){if(c&&c>0){for(var g=0;g0){for(var f=0;f