Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@GoSubRoutine
Last active June 18, 2020 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GoSubRoutine/f6b689fbb36320ff6d9296a8d273d3c3 to your computer and use it in GitHub Desktop.
Save GoSubRoutine/f6b689fbb36320ff6d9296a8d273d3c3 to your computer and use it in GitHub Desktop.
JSON Proxy Nexon FIFA
height: 300
scrolling: no
border: no
license: cc-by-4.0
<!DOCTYPE html>
<meta charset=utf-8>
<meta name=viewport content=width=device-width,initial-scale=1>
<script async src=https://cdn.JsDelivr.net/npm/p5></script>
<script defer src=sketch.js></script>
/**
* JSON Proxy Nexon FIFA (v1.0.0)
* GoToLoop (2020-Jun-17)
*
* https://Discourse.Processing.org/t/including-api-key-in-the-header/21936/3
* https://Bl.ocks.org/GoSubRoutine/f6b689fbb36320ff6d9296a8d273d3c3
*/
"use strict";
const HTTP = 'https' + '://',
CDN = 'YaCDN.org/',
PROX = 'proxy/', SERV = 'serve/',
SITE = 'static.api.Nexon.co.kr/',
FOLD = 'fifaonline4/latest/',
FILE = 'spid.json',
REMOTE = true, USE_PROXY = true, AS_PROXY = false,
PROXY = USE_PROXY && HTTP + CDN + (AS_PROXY && PROX || SERV) || '',
PATH = REMOTE && PROXY + HTTP + SITE + FOLD + FILE || FILE,
LIST_COLOR = 'Orchid', NAME_COLOR = 'Blue', ID_COLOR = 'Brown',
MAX_ENTRIES = 10;
let jsonArray;
function preload() {
jsonArray = loadJSON(PATH, print);
}
function setup() {
noCanvas(), noLoop();
const ol = createElement('ol'),
entries = Array.from({ length: MAX_ENTRIES }, (v, i) => jsonArray[i]);
ol.style('color', LIST_COLOR).style('font-size: 1.2em');
for (let { id, name } of entries) {
name = name.bold().fontcolor(NAME_COLOR);
id = ` (id: ${ id })`.italics().fontcolor(ID_COLOR);
createElement('li', name + id).parent(ol);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment