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+
0 commit comments