mirror of
https://github.com/osmarks/meme-search-engine.git
synced 2025-05-01 14:54:05 +00:00
fix embedding-from-URL feature
This commit is contained in:
parent
e57931d47f
commit
899fbb7092
@ -300,6 +300,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const decodeFloat16 = uint16 => {
|
||||||
|
const sign = (uint16 & 0x8000) ? -1 : 1
|
||||||
|
const exponent = (uint16 & 0x7C00) >> 10
|
||||||
|
const fraction = uint16 & 0x03FF
|
||||||
|
|
||||||
|
if (exponent === 0) {
|
||||||
|
return sign * Math.pow(2, -14) * (fraction / Math.pow(2, 10))
|
||||||
|
} else if (exponent === 0x1F) {
|
||||||
|
return fraction ? NaN : sign * Infinity
|
||||||
|
} else {
|
||||||
|
return sign * Math.pow(2, exponent - 15) * (1 + fraction / Math.pow(2, 10))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const parseQueryString = queryStringParams => {
|
const parseQueryString = queryStringParams => {
|
||||||
if (queryStringParams.get("q") && queryTerms.length === 0) {
|
if (queryStringParams.get("q") && queryTerms.length === 0) {
|
||||||
newTextQuery(queryStringParams.get("q"))
|
newTextQuery(queryStringParams.get("q"))
|
||||||
@ -346,20 +360,6 @@
|
|||||||
return `${snd}/${fst}`
|
return `${snd}/${fst}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const decodeFloat16 = uint16 => {
|
|
||||||
const sign = (uint16 & 0x8000) ? -1 : 1
|
|
||||||
const exponent = (uint16 & 0x7C00) >> 10
|
|
||||||
const fraction = uint16 & 0x03FF
|
|
||||||
|
|
||||||
if (exponent === 0) {
|
|
||||||
return sign * Math.pow(2, -14) * (fraction / Math.pow(2, 10))
|
|
||||||
} else if (exponent === 0x1F) {
|
|
||||||
return fraction ? NaN : sign * Infinity
|
|
||||||
} else {
|
|
||||||
return sign * Math.pow(2, exponent - 15) * (1 + fraction / Math.pow(2, 10))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const focusEl = el => el.focus()
|
const focusEl = el => el.focus()
|
||||||
const removeTerm = term => {
|
const removeTerm = term => {
|
||||||
queryTerms = queryTerms.filter(x => x !== term)
|
queryTerms = queryTerms.filter(x => x !== term)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user