-
-
Notifications
You must be signed in to change notification settings - Fork 198
/
branddb.js
38 lines (28 loc) · 897 Bytes
/
branddb.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import {findNode, runOnce} from 'utils/common';
import {setFileInputData, initSearch, sendReceipt} from 'utils/engines';
const engine = 'branddb';
async function search({session, search, image, storageIds}) {
await findNode('body[style^="opacity: 1"]', {
observerOptions: {attributes: true, attributeFilter: ['class']}
});
const inputSelector = 'input#fileInput';
const input = await findNode(inputSelector);
await setFileInputData(inputSelector, input, image);
input.dispatchEvent(new Event('change'));
// wait for image to load
await findNode('.b-icon--edit');
await sendReceipt(storageIds);
window.setTimeout(async () => {
(
await findNode(
'button.search.b-button--is-type_primary:not(.b-button--is-disabled)'
)
).click();
}, 100);
}
function init() {
initSearch(search, engine, taskId);
}
if (runOnce('search')) {
init();
}