diff --git a/assets/csvkit.js b/assets/csvkit.js deleted file mode 100644 index fd43939..0000000 --- a/assets/csvkit.js +++ /dev/null @@ -1,250 +0,0 @@ -(function() { - this.CSVKit = {}; - - /* Utils */ - - var ctor = function() {}; - var inherits = function(child, parent){ - ctor.prototype = parent.prototype; - child.prototype = new ctor(); - child.prototype.constructor = child; - }; - - /* CSVKit.Reader */ - - CSVKit.Reader = function(options) { - options = options || {}; - - this.separator = options.separator || ','; - this.quote_char = options.quote_char || '"'; - this.escape_char = options.escape_char || '"'; - this.column_names = options.column_names || []; - this.columns_from_header = 'columns_from_header' in options ? options.columns_from_header : true; - this.nested_quotes = 'nested_quotes' in options ? options.nested_quotes : false; - this.rows = []; - - this.state = { - rows: 0, - open_record: [], - open_field: '', - last_char: '', - in_quoted_field: false - }; - }; - - CSVKit.Reader.prototype.parse = function(data) { - if (this.state.open_record.length === 0) { - if (data.charCodeAt(0) === 0xFEFF) { - data = data.slice(1); - } - } - - for (var i = 0; i < data.length; i++) { - var c = data.charAt(i), next_char; - switch (c) { - // escape and separator may be the same char, typically '"' - case this.escape_char: - case this.quote_char: - var is_escape = false; - - if (c === this.escape_char) { - next_char = data.charAt(i + 1); - - if (this._is_escapable(next_char)) { - this._add_character(next_char); - i++; - is_escape = true; - } - } - if (!is_escape && (c === this.quote_char)) { - if (this.state.open_field && !this.state.in_quoted_field) { - this.state.in_quoted_field = true; - break; - } - - if (this.state.in_quoted_field) { - // closing quote should be followed by separator unless the nested quotes option is set - next_char = data.charAt(i + 1); - - if (next_char && next_char !== '\r' && next_char != '\n' && next_char !== this.separator && this.nested_quotes !== true) { - throw new Error("separator expected after a closing quote; found " + next_char); - } else { - this.state.in_quoted_field = false; - } - } else if (this.state.open_field === '') { - this.state.in_quoted_field = true; - } - } - - break; - case this.separator: - if (this.state.in_quoted_field) { - this._add_character(c); - } else { - this._add_field(); - } - break; - case '\n': - // handle CRLF sequence - if (!this.state.in_quoted_field && (this.state.last_char === '\r')) { - break; - } - case '\r': - if (this.state.in_quoted_field) { - this._add_character(c); - } else { - this._add_field(); - this._add_record(); - } - break; - default: - this._add_character(c); - } - - this.state.last_char = c; - } - - if (this.state.in_quoted_field) { - throw new Error("Input stream ended but closing quotes expected"); - } else { - if (this.state.open_field) { - this._add_field(); - } - - if (this.state.open_record.length > 0) { - this._add_record(); - } - } - }; - - CSVKit.Reader.prototype._is_escapable = function(c) { - if ((c === this.escape_char) || (c === this.quote_char)) { - return true; - } - return false; - }; - - CSVKit.Reader.prototype._add_character = function(c) { - this.state.open_field += c; - }; - - CSVKit.Reader.prototype._add_field = function() { - this.state.open_record.push(this.state.open_field); - this.state.open_field = ''; - this.state.in_quoted_field = false; - }; - - CSVKit.Reader.prototype._add_record = function() { - if (this.columns_from_header && this.state.rows === 0) { - this.column_names = this.state.open_record; - } else { - this.rows.push(this._serialize_record(this.state.open_record)); - } - - this.state.rows++; - this.state.open_record = []; - this.state.open_field = ''; - this.state.in_quoted_field = false; - }; - - CSVKit.Reader.prototype._serialize_record = function(record) { - return record; - }; - - /* CSVKit.ObjectReader */ - - CSVKit.ObjectReader = function(options) { - CSVKit.Reader.call(this, options); - }; - inherits(CSVKit.ObjectReader, CSVKit.Reader); - - CSVKit.ObjectReader.prototype._serialize_record = function(record) { - var obj = {}; - - for (var i = 0; i < this.column_names.length; i++) { - obj[this.column_names[i]] = record[i]; - } - - return obj; - }; - - /* CSVKit.Writer */ - - CSVKit.Writer = function(options) { - options = options || {}; - - this.separator = options.separator || ','; - this.quote_char = options.quote_char || '"'; - this.escape_char = options.escape_char || '"'; - this.quote_all = options.quote_all || false; - this.newline = '\n'; - - CSVKit.Writer.prototype.write = function(rows) { - var formatted_rows = []; - - for (var i = 0; i < rows.length; i++) { - formatted_rows.push(this._serialize_row(rows[i])); - } - - return formatted_rows.join(this.newline); - }; - - CSVKit.Writer.prototype._serialize_row = function(row) { - var formatted_cells = []; - - for (var i = 0; i < row.length; i++) { - formatted_cells.push(this._serialize_cell(row[i])); - } - - return formatted_cells.join(this.separator); - }; - - CSVKit.Writer.prototype._serialize_cell = function(cell) { - if (cell.indexOf(this.quote_char) >= 0) { - cell = cell.replace(new RegExp(this.quote_char, 'g'), this.escape_char + this.quote_char); - } - - if (this.quote_all || cell.indexOf(this.separator) >= 0 || cell.indexOf(this.newline) >= 0) { - return this.quote_char + cell + this.quote_char; - } - - return cell; - }; - } - - /* CSVKit.ObjectWriter */ - - CSVKit.ObjectWriter = function(options) { - CSVKit.Writer.call(this, options); - - if (!('column_names' in options)) { - throw "The column_names option is required."; - } - - this.column_names = options.column_names; - }; - inherits(CSVKit.ObjectWriter, CSVKit.Writer); - - CSVKit.ObjectWriter.prototype.write = function(rows) { - var header = {}; - - for (var i = 0; i < this.column_names.length; i++) { - header[this.column_names[i]] = this.column_names[i]; - } - - rows.splice(0, 0, header); - - return CSVKit.Writer.prototype.write.call(this, rows); - } - - CSVKit.ObjectWriter.prototype._serialize_row = function(row) { - var cells = []; - - for (var i = 0; i < this.column_names.length; i++) { - cells.push(row[this.column_names[i]]); - } - - return CSVKit.Writer.prototype._serialize_row.call(this, cells); - }; - -}).call(this); diff --git a/assets/f-ninja.png b/assets/f-ninja.png new file mode 100644 index 0000000..3b0ef05 Binary files /dev/null and b/assets/f-ninja.png differ diff --git a/assets/favicon.png b/assets/favicon.png new file mode 100644 index 0000000..705233d Binary files /dev/null and b/assets/favicon.png differ diff --git a/assets/leaderboard.js b/assets/leaderboard.js index 69ee40b..5830b66 100644 --- a/assets/leaderboard.js +++ b/assets/leaderboard.js @@ -16,6 +16,8 @@ const sidebarClose = () => { }, 300); }; +function formatTable(){ + const tableRow = document.querySelectorAll(".list__row"); tableRow.forEach(tableRow => { tableRow.addEventListener("click", function () { overlay.style.opacity = 0; @@ -34,7 +36,7 @@ tableRow.forEach(tableRow => { const driverTeam = this.querySelector(".list__cell:nth-of-type(3) .list__value").innerHTML; const driverPoints = this.querySelector(".list__cell:nth-of-type(4) .list__value").innerHTML; const driverImage = this.dataset.image; - const driverNationality = this.dataset.nationality; + const ninjaActivity = this.dataset.activity; const driverDOB = this.dataset.dob; const driverCountry = this.dataset.country; @@ -68,11 +70,11 @@ tableRow.forEach(tableRow => { Activity - ${driverNationality} + ${ninjaActivity} Place - ${driverPlace} + ${driverPlace} @@ -84,6 +86,7 @@ tableRow.forEach(tableRow => { }); }); +} closeOverlayBtn.addEventListener("click", function () { sidebarClose(); diff --git a/assets/m-ninja.png b/assets/m-ninja.png new file mode 100644 index 0000000..705233d Binary files /dev/null and b/assets/m-ninja.png differ diff --git a/assets/papaparse.min.js b/assets/papaparse.min.js new file mode 100644 index 0000000..eeaf983 --- /dev/null +++ b/assets/papaparse.min.js @@ -0,0 +1,7 @@ +/* @license +Papa Parse +v5.4.1 +https://github.com/mholt/PapaParse +License: MIT +*/ +!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof module&&"undefined"!=typeof exports?module.exports=t():e.Papa=t()}(this,function s(){"use strict";var f="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==f?f:{};var n=!f.document&&!!f.postMessage,o=f.IS_PAPA_WORKER||!1,a={},u=0,b={parse:function(e,t){var r=(t=t||{}).dynamicTyping||!1;J(r)&&(t.dynamicTypingFunction=r,r={});if(t.dynamicTyping=r,t.transform=!!J(t.transform)&&t.transform,t.worker&&b.WORKERS_SUPPORTED){var i=function(){if(!b.WORKERS_SUPPORTED)return!1;var e=(r=f.URL||f.webkitURL||null,i=s.toString(),b.BLOB_URL||(b.BLOB_URL=r.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",i,")();"],{type:"text/javascript"})))),t=new f.Worker(e);var r,i;return t.onmessage=_,t.id=u++,a[t.id]=t}();return i.userStep=t.step,i.userChunk=t.chunk,i.userComplete=t.complete,i.userError=t.error,t.step=J(t.step),t.chunk=J(t.chunk),t.complete=J(t.complete),t.error=J(t.error),delete t.worker,void i.postMessage({input:e,config:t,workerId:i.id})}var n=null;b.NODE_STREAM_INPUT,"string"==typeof e?(e=function(e){if(65279===e.charCodeAt(0))return e.slice(1);return e}(e),n=t.download?new l(t):new p(t)):!0===e.readable&&J(e.read)&&J(e.on)?n=new g(t):(f.File&&e instanceof File||e instanceof Object)&&(n=new c(t));return n.stream(e)},unparse:function(e,t){var n=!1,_=!0,m=",",y="\r\n",s='"',a=s+s,r=!1,i=null,o=!1;!function(){if("object"!=typeof t)return;"string"!=typeof t.delimiter||b.BAD_DELIMITERS.filter(function(e){return-1!==t.delimiter.indexOf(e)}).length||(m=t.delimiter);("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(n=t.quotes);"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(r=t.skipEmptyLines);"string"==typeof t.newline&&(y=t.newline);"string"==typeof t.quoteChar&&(s=t.quoteChar);"boolean"==typeof t.header&&(_=t.header);if(Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");i=t.columns}void 0!==t.escapeChar&&(a=t.escapeChar+s);("boolean"==typeof t.escapeFormulae||t.escapeFormulae instanceof RegExp)&&(o=t.escapeFormulae instanceof RegExp?t.escapeFormulae:/^[=+\-@\t\r].*$/)}();var u=new RegExp(Q(s),"g");"string"==typeof e&&(e=JSON.parse(e));if(Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return h(null,e,r);if("object"==typeof e[0])return h(i||Object.keys(e[0]),e,r)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||i),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),h(e.fields||[],e.data||[],r);throw new Error("Unable to serialize unrecognized input");function h(e,t,r){var i="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var n=Array.isArray(e)&&0=this._config.preview;if(o)f.postMessage({results:n,workerId:b.WORKER_ID,finished:a});else if(J(this._config.chunk)&&!t){if(this._config.chunk(n,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);n=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(n.data),this._completeResults.errors=this._completeResults.errors.concat(n.errors),this._completeResults.meta=n.meta),this._completed||!a||!J(this._config.complete)||n&&n.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),a||n&&n.meta.paused||this._nextChunk(),n}this._halted=!0},this._sendError=function(e){J(this._config.error)?this._config.error(e):o&&this._config.error&&f.postMessage({workerId:b.WORKER_ID,error:e,finished:!1})}}function l(e){var i;(e=e||{}).chunkSize||(e.chunkSize=b.RemoteChunkSize),h.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(i=new XMLHttpRequest,this._config.withCredentials&&(i.withCredentials=this._config.withCredentials),n||(i.onload=v(this._chunkLoaded,this),i.onerror=v(this._chunkError,this)),i.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var t in e)i.setRequestHeader(t,e[t])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;i.setRequestHeader("Range","bytes="+this._start+"-"+r)}try{i.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===i.status&&this._chunkError()}},this._chunkLoaded=function(){4===i.readyState&&(i.status<200||400<=i.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:i.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(e){var t=e.getResponseHeader("Content-Range");if(null===t)return-1;return parseInt(t.substring(t.lastIndexOf("/")+1))}(i),this.parseChunk(i.responseText)))},this._chunkError=function(e){var t=i.statusText||e;this._sendError(new Error(t))}}function c(e){var i,n;(e=e||{}).chunkSize||(e.chunkSize=b.LocalChunkSize),h.call(this,e);var s="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,s?((i=new FileReader).onload=v(this._chunkLoaded,this),i.onerror=v(this._chunkError,this)):i=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(i.error)}}function p(e){var r;h.call(this,e=e||{}),this.stream=function(e){return r=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e,t=this._config.chunkSize;return t?(e=r.substring(0,t),r=r.substring(t)):(e=r,r=""),this._finished=!r,this.parseChunk(e)}}}function g(e){h.call(this,e=e||{});var t=[],r=!0,i=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){i&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=v(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=v(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=v(function(){this._streamCleanUp(),i=!0,this._streamData("")},this),this._streamCleanUp=v(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function r(m){var a,o,u,i=Math.pow(2,53),n=-i,s=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,h=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,t=this,r=0,f=0,d=!1,e=!1,l=[],c={data:[],errors:[],meta:{}};if(J(m.step)){var p=m.step;m.step=function(e){if(c=e,_())g();else{if(g(),0===c.data.length)return;r+=e.data.length,m.preview&&r>m.preview?o.abort():(c.data=c.data[0],p(c,t))}}}function y(e){return"greedy"===m.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function g(){return c&&u&&(k("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+b.DefaultDelimiter+"'"),u=!1),m.skipEmptyLines&&(c.data=c.data.filter(function(e){return!y(e)})),_()&&function(){if(!c)return;function e(e,t){J(m.transformHeader)&&(e=m.transformHeader(e,t)),l.push(e)}if(Array.isArray(c.data[0])){for(var t=0;_()&&t=l.length?"__parsed_extra":l[r]),m.transform&&(s=m.transform(s,n)),s=v(n,s),"__parsed_extra"===n?(i[n]=i[n]||[],i[n].push(s)):i[n]=s}return m.header&&(r>l.length?k("FieldMismatch","TooManyFields","Too many fields: expected "+l.length+" fields but parsed "+r,f+t):r=i.length/2?"\r\n":"\r"}(e,i)),u=!1,m.delimiter)J(m.delimiter)&&(m.delimiter=m.delimiter(e),c.meta.delimiter=m.delimiter);else{var n=function(e,t,r,i,n){var s,a,o,u;n=n||[",","\t","|",";",b.RECORD_SEP,b.UNIT_SEP];for(var h=0;h=N)return L(!0)}else for(S=W,W++;;){if(-1===(S=i.indexOf(z,S+1)))return r||h.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:u.length,index:W}),T();if(S===n-1)return T(i.substring(W,S).replace(C,z));if(z!==K||i[S+1]!==K){if(z===K||0===S||i[S-1]!==K){-1!==w&&w=N)return L(!0);break}h.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:u.length,index:W}),S++}}else S++}return T();function I(e){u.push(e),d=W}function A(e){var t=0;if(-1!==e){var r=i.substring(S+1,e);r&&""===r.trim()&&(t=r.length)}return t}function T(e){return r||(void 0===e&&(e=i.substring(W)),f.push(e),W=n,I(f),o&&F()),L()}function D(e){W=e,I(f),f=[],R=i.indexOf(P,W)}function L(e){return{data:u,errors:h,meta:{delimiter:M,linebreak:P,aborted:H,truncated:!!e,cursor:d+(t||0)}}}function F(){q(L()),u=[],h=[]}},this.abort=function(){H=!0},this.getCharIndex=function(){return W}}function _(e){var t=e.data,r=a[t.workerId],i=!1;if(t.error)r.userError(t.error,t.file);else if(t.results&&t.results.data){var n={abort:function(){i=!0,m(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(J(r.userStep)){for(var s=0;s + + Document + @@ -15,14 +18,9 @@

IMPACT leaderboard

- - - - - - - - +
1Lewis HamiltonNinjaWhiteBelt8Level
+ +
+
@@ -154,7 +155,47 @@ + + + - + + \ No newline at end of file