-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp-target.html
69 lines (65 loc) · 2.12 KB
/
app-target.html
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- <meta http-equiv="refresh" content="0; url = https://arnav-kr.github.io/slcodepreview" /> -->
<title>Redirecting to Previewer...</title>
<style>.hide{display: none !important}</style>
</head>
<body style="
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
overflow: hidden;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
background-color: #ffffff;
box-sizing: border-box;
">
<div id="notslcode"
class="hide"
style="
background-color: #2C3E50;
border-radius: .5rem;
box-shadow: 0 19px 38px 0 rgba(0,0,0,0.24);
padding: 2rem;
width: 90vw;
min-width: 200px;
max-width: 500px;
height: 60vh;
max-height: 400px;
color: white;
display: flex;
align-items: center;
justify-content: center;
font-size: 2.1rem;box-sizing: border-box;
">Shared URL Is Not a<br>SoloLearn Code</div>
<script>
window.addEventListener('DOMContentLoaded', () => {
const parsedUrl = new URL(window.location);
var title = parsedUrl.searchParams.get('title');
var text = parsedUrl.searchParams.get('text');
var url = parsedUrl.searchParams.get('url');
var isValid,CodeURL,Id;
try{
CodeURL = new URL(text);
isValid = true;
}
catch(e){
}
if(isValid && (CodeURL.host == "code.sololearn.com" || CodeURL.hostname == "code.sololearn.com")){
var Id = CodeURL.pathname.slice(1);
if(Id.endsWith("/")){
Id = Id.substr(0, Id.length - 1);
}
window.location.replace("https://arnav-kr.github.io/slcodepreview/?q=" + Id + "&nav=1");
}
else{
document.getElementById("notslcode").classList.remove("hide");
}
});
</script>
</body>
</html>