adjust share to work with negative values
Этот коммит содержится в:
родитель
b987ff8a8b
Коммит
f74296fa77
@ -1,5 +1,5 @@
|
||||
export const baseUrl = 'https://interference2020.org';
|
||||
// export const baseUrl = 'http://localhost:5000';
|
||||
// export const baseUrl = 'https://interference2020.org';
|
||||
export const baseUrl = 'http://localhost:5000';
|
||||
|
||||
export const urlFromFilters = (disinformantNations,
|
||||
platforms,
|
||||
@ -17,17 +17,17 @@ export const urlFromFilters = (disinformantNations,
|
||||
const params = {
|
||||
ts: encodeURIComponent(textSearch),
|
||||
as: [attributionScores[0], attributionScores[1]].join(';'),
|
||||
pol: [polarization[0], polarization[1]].join(';'),
|
||||
pol: [Math.round(100 * polarization[0]) / 100, Math.round(100 * polarization[1]) / 100].join(';'),
|
||||
f: filtersToHex([disinformantNations, platforms, methods, sources, sourceCategories, tags, contextData]),
|
||||
id: caseId,
|
||||
bool: filtersToBin([highlightPolarization, highlightCib])
|
||||
};
|
||||
|
||||
return `${baseUrl}/#${params.f}-${params.id}-${params.ts}-${params.as}-${params.pol}-${params.bool}`;
|
||||
return `${baseUrl}/#${params.f}&${params.id}&${params.ts}&${params.as}&${params.pol}&${params.bool}`;
|
||||
};
|
||||
|
||||
export const filtersToHex = (arr) => {
|
||||
const hex = arr.map((d) => binaryToHex(d.map((d) => +d.selected).join(''))).join('-');
|
||||
const hex = arr.map((d) => binaryToHex(d.map((d) => +d.selected).join(''))).join('&');
|
||||
return hex;
|
||||
};
|
||||
|
||||
@ -44,7 +44,7 @@ export const binaryToBool = (binary) => binary.split('').map((d) => d === '0' ?
|
||||
|
||||
export const parseUrl = (hash) => {
|
||||
const s = hash.substring(1);
|
||||
const [ disinformantNations, platforms, methods, sources, sourceCategories, tags, contextData, caseId, textSearch, attributionScores, polarization, bools] = s.split('-');
|
||||
const [ disinformantNations, platforms, methods, sources, sourceCategories, tags, contextData, caseId, textSearch, attributionScores, polarization, bools] = s.split('&');
|
||||
|
||||
const boolArray = bools.split('').map((d) => +d === 1 ? true : false);
|
||||
|
||||
|
||||
Загрузка…
x
Ссылка в новой задаче
Block a user