77 < title > Sploder</ title >
88</ head >
99< script >
10+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
11+ function getUrl ( ) {
12+ return new URL ( window . location . href ) . searchParams . get ( 'url' ) ;
13+ }
1014 // Check get parameter to get URL
11- const queryString = window . location . search ;
12- const urlParams = new URLSearchParams ( queryString ) ;
13- const url = urlParams . get ( 'url' ) ;
14-
15+ let url = getUrl ( ) ;
16+ document . getElementById ( 'sploder-url' ) . textContent = getUrl ( ) ;
17+ document . getElementById ( "content-frame" ) . setAttribute ( 'src' , url ) ;
1518 // If the URL is not provided, redirect to the update page
16- if ( url == null ) {
17- window . location . href = "https://sploder.xyz/update" ;
18- }
19+ // window.href.location = urlParam + '/update';
1920
2021 var page ;
2122 var prevpage ;
5859// Custom built code to check if user is online.
5960// I have no idea how or why this works.
6061 function online ( ) {
61- if ( document . getElementById ( "content-frame" ) . contentWindow . location . href != "chrome-error://chromewebdata/" ) {
62- page = document . getElementById ( "content-frame" ) . contentWindow . location . href ;
63- } else if ( page == undefined ) {
62+ if ( document . getElementById ( "content-frame" ) . contentWindow . location . href != "chrome-error://chromewebdata/" ) {
63+ page = document . getElementById ( "content-frame" ) . contentWindow . location . href ;
64+ } else if ( page == undefined ) {
6465 page = url ;
6566 }
66- if ( page . includes ( "offline.html" ) ) {
67+
68+ if ( page . includes ( "offline.html" ) ) {
6769 page = "test" ;
6870 } else {
69-
70-
71- const frame = document . getElementById ( 'content-frame' ) ;
72- var url = "https://sploder.xyz/php/ping.php" ;
73- var xhttp = new XMLHttpRequest ( ) ;
74- xhttp . onreadystatechange = function ( ) {
75-
76- if ( this . readyState == 4 && this . status != 200 && frame . getAttribute ( 'src' ) != "offline.html?retry=" + page ) {
71+ const frame = document . getElementById ( 'content-frame' ) ;
72+ const pingUrl = url + '/php/ping.php' ;
73+ var xhttp = new XMLHttpRequest ( ) ;
74+ xhttp . onreadystatechange = function ( ) {
75+ const offlineUrl = "offline.html?retry=" + page + '&url=' + encodeURIComponent ( urlParam ) ;
76+ if ( this . readyState == 4 && this . status != 200 && frame . getAttribute ( 'src' ) != offlineUrl ) {
7777 if ( page != "test" ) {
78- prevpage = page ;
78+ prevpage = page ;
7979 }
8080 pagestat = "offline" ;
8181 page = "offline.html" ;
82- frame . setAttribute ( 'src' , 'offline.html?retry=' + page ) ;
83-
82+ frame . setAttribute ( 'src' , offlineUrl ) ;
8483 } else if ( document . getElementById ( "content-frame" ) . contentWindow . location . href != "chrome-error://chromewebdata/" ) {
8584 page = document . getElementById ( "content-frame" ) . contentWindow . location . href ;
8685 } else {
8988 }
9089 //pagestat = "online";
9190 }
92-
9391 } ;
94- xhttp . open ( "GET" , url , true ) ;
92+ xhttp . open ( "GET" , pingUrl , true ) ;
9593 xhttp . send ( ) ;
96-
9794 }
9895 }
9996 // Prevent scrolling using JavaScript
113110 event . preventDefault ( ) ; // Disable keyboard scrolling
114111 }
115112 } ) ;
116-
117-
118-
119-
113+ } ) ;
120114</ script >
121115< style >
122116 body , html {
163157 }
164158</ style >
165159< body >
166-
167160 < div class ="window " style ="width: 100%; height: calc(100% - 3px) ">
168161 < div class ="title-bar ">
169162 < img class ="title-bar-icon " src ="images/icon.png ">
170- < div class ="title-bar-text "> Sploder</ div >
163+ < div class ="title-bar-text "> Sploder < span id =" sploder-url " > </ span > </ div >
171164 < div class ="titlebar-movable "> </ div >
172165 < div class ="title-bar-controls ">
173166 < button id ="min-btn " onclick ="win.minimize() " aria-label ="Minimize "> </ button >
178171 < div class ="window-body "
179172 style ="width: 100%; height: calc(100% - 50px); margin-left: 3px; margin-top:0px; padding-bottom: -50px; ">
180173 < iframe id ="content-frame " onload ="online(); " src ="">
181- </ iframe >
182- < script >
183- document . getElementById ( "content-frame" ) . setAttribute ( 'src' , url ) ;
184- </ script >
185-
174+ </ iframe >
186175 </ div >
187176 </ div >
188-
189177</ body >
190- </ html >
178+ </ html >
0 commit comments