mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 14:45:35 +00:00
Remove unused code
This commit is contained in:
@@ -1,50 +0,0 @@
|
|||||||
/**
|
|
||||||
* Generate a BBCode (Forum) compatible table from comparisons
|
|
||||||
* @param {Function} translate Translate language function
|
|
||||||
* @param {object} formats Number Formats
|
|
||||||
* @param {array} facets Ship Facets
|
|
||||||
* @param {object} builds Ship builds
|
|
||||||
* @param {string} link Link to the comparison
|
|
||||||
* @return {string} the BBCode
|
|
||||||
*/
|
|
||||||
export function comparisonBBCode(translate, formats, facets, builds, link) {
|
|
||||||
let colCount = 2, b, i, j, k, f, fl, p, pl, l = [];
|
|
||||||
|
|
||||||
for (i = 0; i < facets.length; i++) {
|
|
||||||
if (facets[i].active) {
|
|
||||||
f = facets[i];
|
|
||||||
p = f.props;
|
|
||||||
|
|
||||||
if (p.length == 1) {
|
|
||||||
l.push('[th][B][COLOR=#FF8C0D]', translate(f.title).toUpperCase(), '[/COLOR][/B][/th]');
|
|
||||||
colCount++;
|
|
||||||
} else {
|
|
||||||
for (j = 0; j < p.length; j++) {
|
|
||||||
l.push('[th][B][COLOR=#FF8C0D]', translate(f.title).toUpperCase(), '\n', translate(f.lbls[j]).toUpperCase(), '[/COLOR][/B][/th]');
|
|
||||||
colCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
l.push('[/tr]\n');
|
|
||||||
|
|
||||||
for (i = 0; i < builds.length; i++) {
|
|
||||||
b = builds[i];
|
|
||||||
|
|
||||||
l.push('[tr][td]', b.name, '[/td][td]', b.buildName, '[/td]');
|
|
||||||
|
|
||||||
for (j = 0, fl = facets.length; j < fl; j++) {
|
|
||||||
if (facets[j].active) {
|
|
||||||
f = facets[j];
|
|
||||||
p = f.props;
|
|
||||||
for (k = 0, pl = p.length; k < pl; k++) {
|
|
||||||
l.push('[td="align: right"]', formats[f.fmt](b[p[k]]), ' [size=-2]', translate(f.unit), '[/size][/td]');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
l.push('[/tr]\n');
|
|
||||||
}
|
|
||||||
l.push('[tr][td="align: center, colspan:', colCount, '"][size=-3]\n[url=', link, ']Interactive Comparison at Coriolis.io[/url][/td][/tr]\n[/size][/table]');
|
|
||||||
l.unshift('[table="width:', colCount * 90, ',align: center"]\n[tr][th][B][COLOR=#FF8C0D]Ship[/COLOR][/B][/th][th][B][COLOR="#FF8C0D"]Build[/COLOR][/B][/th]');
|
|
||||||
return l.join('');
|
|
||||||
}
|
|
||||||
@@ -20,60 +20,6 @@ export default function shorternUrl(url, success, error) {
|
|||||||
orbisShorten(url, success, error);
|
orbisShorten(url, success, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
const SHORTEN_API_GOOGLE = 'https://www.googleapis.com/urlshortener/v1/url?key=';
|
|
||||||
/**
|
|
||||||
* Shorten a URL using Google's URL shortener API
|
|
||||||
* @param {string} url The URL to shorten
|
|
||||||
* @param {function} success Success callback
|
|
||||||
* @param {function} error Failure/Error callback
|
|
||||||
*/
|
|
||||||
function shortenUrlGoogle(url, success, error) {
|
|
||||||
if (window.navigator.onLine) {
|
|
||||||
try {
|
|
||||||
request.post(SHORTEN_API_GOOGLE + window.CORIOLIS_GAPI_KEY)
|
|
||||||
.send({ longUrl: url })
|
|
||||||
.end(function(err, response) {
|
|
||||||
if (err) {
|
|
||||||
error(response.statusText == 'OK' ? 'Bad Request' : response.statusText);
|
|
||||||
} else {
|
|
||||||
success(response.body.id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
error(e.message ? e.message : e);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
error('Not Online');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const SHORTEN_API_EDDP = 'https://eddp.co/u';
|
|
||||||
/**
|
|
||||||
* Shorten a URL using EDDP's URL shortener API
|
|
||||||
* @param {string} url The URL to shorten
|
|
||||||
* @param {function} success Success callback
|
|
||||||
* @param {function} error Failure/Error callback
|
|
||||||
*/
|
|
||||||
function shortenUrlEddp(url, success, error) {
|
|
||||||
if (window.navigator.onLine) {
|
|
||||||
try {
|
|
||||||
request.post(SHORTEN_API_EDDP)
|
|
||||||
.send(url)
|
|
||||||
.end(function(err, response) {
|
|
||||||
if (err) {
|
|
||||||
error('Bad Request');
|
|
||||||
} else {
|
|
||||||
success(response.header['location']);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
error(e.message ? e.message : e);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
error('Not Online');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const SHORTEN_API_ORBIS = 'https://s.orbis.zone/api.php';
|
const SHORTEN_API_ORBIS = 'https://s.orbis.zone/api.php';
|
||||||
/**
|
/**
|
||||||
* Shorten a URL using Orbis's URL shortener API
|
* Shorten a URL using Orbis's URL shortener API
|
||||||
|
|||||||
Reference in New Issue
Block a user