chore: install rgbquant

This commit is contained in:
Azgaar 2022-07-03 08:58:58 +03:00
parent 1abcec8129
commit 51df2f90b0
6 changed files with 9 additions and 40 deletions

View file

@ -7721,7 +7721,6 @@
<script type="module" src="/src/modules/ui/submap.js"></script>
<script type="module" src="/src/modules/ui/hotkeys.js"></script>
<script type="module" src="/src/modules/coa-renderer.js"></script>
<script defer src="/src/libs/rgbquant.min.js"></script>
<script defer src="/src/libs/jquery.ui.touch-punch.min.js"></script>
<script type="module" src="/src/modules/io/save.js"></script>
<script type="module" src="/src/modules/io/load.js"></script>

View file

@ -15,6 +15,7 @@
"delaunator": "^5.0.0",
"flatqueue": "^2.0.3",
"lineclip": "^1.1.5",
"polylabel": "^1.1.0"
"polylabel": "^1.1.0",
"rgbquant": "^1.1.2"
}
}

File diff suppressed because one or more lines are too long

View file

@ -1,36 +0,0 @@
(window => {
const noTrack = !location.hostname || window.localStorage.getItem("noTrack");
const {
screen: {width, height},
navigator: {language},
location: {hostname, pathname, search},
document: {referrer}
} = window;
const website = "4f6fd0ae-646a-4946-a9da-7aad63284e48";
const root = "https://fmg-stats.herokuapp.com";
const screen = `${width}x${height}`;
const url = `${pathname}${search}`;
const post = (url, data) => {
const req = new XMLHttpRequest();
req.open("POST", url, true);
req.setRequestHeader("Content-Type", "application/json");
req.send(JSON.stringify(data));
};
const collect = (type, params) => {
if (noTrack) return;
const payload = {website, hostname, screen, language, cache: false};
Object.keys(params).forEach(key => {
payload[key] = params[key];
});
post(`${root}/api/collect`, {type, payload});
};
collect("pageview", {url, referrer});
window.track = (event_type = "reach", event_value = "") => collect("event", {event_type, event_value, url});
})(window);

View file

@ -1,3 +1,5 @@
import RgbQuant from "rgbquant";
import {heightmapTemplates} from "config/heightmap-templates";
import {createTypedArray, last} from "utils/arrayUtils";
import {getColorScheme, getHeightColor} from "utils/colorUtils";

View file

@ -209,6 +209,11 @@ resolve@^1.22.1:
path-parse "^1.0.7"
supports-preserve-symlinks-flag "^1.0.0"
rgbquant@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/rgbquant/-/rgbquant-1.1.2.tgz#d95e889a8fcb1e6c1a4fa2ccc8be3a41a2fcd185"
integrity sha512-AGuKVeUUFW5rhm4Eu/7SXQRSxs3MoXIGKP4i/5Rok89QBrOu9+ytWezuxHhCsHT9Y6z+sGPKL9PKo6X8tZNUaw==
robust-predicates@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/robust-predicates/-/robust-predicates-3.0.1.tgz#ecde075044f7f30118682bd9fb3f123109577f9a"