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