Skip to content

Commit 74f8a83

Browse files
authored
Luxotick version
1 parent 69fa69c commit 74f8a83

File tree

6 files changed

+66
-0
lines changed

6 files changed

+66
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
function openRawAnswerImageInNewTab(url) {
2+
const newTab = window.open(url, '_blank');
3+
newTab.focus();
4+
}
5+
6+
function getElementByXpath(path) {
7+
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
8+
}
9+
10+
function sleep(ms) {
11+
return new Promise(resolve => setTimeout(resolve, ms));
12+
}
13+
14+
15+
16+
async function runScript() {
17+
18+
window.onload = function(event) {
19+
const maymun = getElementByXpath('//*[@id="__next"]/div[2]/aside/div/div')
20+
const essek = getElementByXpath('//*[@id="__next"]/div[2]/aside/div/div')
21+
const rawData = document.getElementById('__NEXT_DATA__').innerText;
22+
const jsonData = JSON.parse(rawData);
23+
const rawAnswerImage = jsonData.props.pageProps.question.raw_answer_image;
24+
25+
let buton = document.createElement('button')
26+
27+
essek.innerHTML = '';
28+
29+
buton.id = 'openRawAnswerImageInNewTab';
30+
buton.class = 'css-mqgdn0';
31+
buton.class = 'openRawAnswerImageInNewTab';
32+
buton.innerText = 'Answer Image In New Tab';
33+
buton.style="color: white; background-color: #4E5058; text-align: center; display: block;margin-top: 5%; margin-left: auto; margin-right: auto; width: 100px; border-radius: 5px; border: 0; cursor: pointer; -webkit-mask-image: -webkit-radial-gradient(#000, #fff);";
34+
35+
maymun.appendChild(buton)
36+
console.log('essek', essek);
37+
console.log('maymun', maymun);
38+
39+
buton.onclick = () => openRawAnswerImageInNewTab(rawAnswerImage);
40+
};
41+
}
42+
43+
runScript();
44+
6.4 KB
Loading
519 Bytes
Loading
1.08 KB
Loading
1.74 KB
Loading

Kunduz Answer Viewer/manifest.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"manifest_version": 3,
3+
"name": "Kunduz Answer Viewer",
4+
"description": "Shows the answer when the specified link is clicked.",
5+
"version": "0.1",
6+
"icons": {
7+
"16": "images/icon-16.png",
8+
"32": "images/icon-32.png",
9+
"48": "images/icon-48.png",
10+
"128": "images/icon-128.png"
11+
},
12+
"content_scripts": [
13+
{
14+
"js": [
15+
"content-script.js"
16+
],
17+
"matches": [
18+
"https://kunduz.com/*"
19+
]
20+
}
21+
]
22+
}

0 commit comments

Comments
 (0)