initial commit

This commit is contained in:
ReznoRMichael 2020-08-22 17:41:39 +02:00
commit 3505984d12
5 changed files with 163 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
plain.json

29
HKCheckCompletion.js Normal file
View file

@ -0,0 +1,29 @@
function HKCheckCompletion(jsonObject) {
console.log("Script Run");
let HKPlayerData = jsonObject.playerData;
let symbolTrue = "✅";
let symbolFalse = "❌";
let divStart = [
"<div>"
].join("\n");
let divEnd = [
"</div>"
].join("\n");
for(i in HKPlayerData) {
let completedCheck = symbolFalse;
if(i === "completionPercentage") {
if(HKPlayerData.completionPercentage >= 112) completedCheck = symbolTrue;
document.getElementById("hk-intro").innerHTML += divStart + completedCheck + " Hollow Knight Completion: " + HKPlayerData.completionPercentage + " %" + divEnd;
}
if(i === "mawlekDefeated") {
if(HKPlayerData.mawlekDefeated === true) completedCheck = symbolTrue;
document.getElementById("hk-bosses").innerHTML += divStart + completedCheck + " Brooding Mawlek: " + HKPlayerData.mawlekDefeated + divEnd;
}
}
}

57
index.html Normal file
View file

@ -0,0 +1,57 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="style.css">
<title>Hollow Knight Completion %</title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta property="og:title" content="Hollow Knight Completion %">
<meta property="og:description" content="">
<meta property="og:image" content="http://reznortech.rf.gd/favicon.png">
<meta property="og:url" content="http://reznortech.rf.gd/epic-games-store-version-history">
<meta name="twitter:card" content="summary_large_image">
<meta property="og:site_name" content="rezno[R].tech">
<meta name="twitter:image:alt" content="">
<meta name="author" content="ReznoR Michael">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="icon" href="../favicon.png">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script src="loadJson.js"></script>
<script src="HKCheckCompletion.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-136831794-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-136831794-2');
</script>
</head>
<body>
<h1>Hollow Knight Completion %</h1>
<p class="smalltext">Check what you have left for completion.</p>
<div style="margin-bottom: 20px;"></div>
<button id="startbutton" onclick="HKCheckCompletion( jsonObj );">Run Script</button>
<div style="margin-bottom: 20px;"></div>
<div id="hk-intro">
</div>
<div id="hk-bosses">
<div>Bosses:</div>
</div>
</body>
</html>

39
loadJson.js Normal file
View file

@ -0,0 +1,39 @@
var jsonObj;
/**
* Reads the .json file and parses it to a JS object (jsonObj).
* @param callback Asynchronous function.
*/
function loadJSON( callback ) {
// new Http request object (asynchronous), both the web page and the XML file it tries to load, must be located on the same server.
var xobj = new XMLHttpRequest();
xobj.overrideMimeType( "application/json" );
// Specifies the request
/* method: the request type GET or POST
url: the file location
async: true (asynchronous) or false (synchronous)
user: optional user name
psw: optional password */
xobj.open( 'GET', 'plain.json', true ); // Path to the file
// Defines a function to be called when the readyState property changes
xobj.onreadystatechange = function GetResponseText() {
if( xobj.readyState == 4 && xobj.status == "200" ) {
// Required use of an anonymous callback as .open will NOT return a value but simply returns undefined in asynchronous mode
// Returns the response data as a string
callback( xobj.responseText );
}
};
// Sends the request to the server - Used for GET requests
xobj.send( null );
}
loadJSON(
function JSONparse( response ) {
// Parse JSON string into object
jsonObj = JSON.parse( response );
console.log( jsonObj );
}
);

37
style.css Normal file
View file

@ -0,0 +1,37 @@
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 15px;
}
p {
margin-top: 10px;
margin-bottom: 10px;
}
.horizontal-line {
padding-bottom: 1px;
background: linear-gradient(90deg, #e9e9e9 0%, #FFFFFF 75%);
}
.smalltext {
font-size: 0.75em;
}
.entryNo {
color: #d1d1d1;
}
.changelog {
margin-top: 0px;
padding-inline-start: 30px;
}
.date {
font-size: 0.75em;
color: #737373;
margin-left: 1em;
}
a,
a:active,
a:visited {
color: black;
font-weight: bold;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}