function saveHTML52score(score, gamename) {
let pathArray = window.location.pathname.split('/');
let newpath = '';
if (pathArray[1] && pathArray[1] != 'arcade' && pathArray[1] != 'games') {
newpath = '/' + pathArray[1];
}
scorepost(window.location.protocol + '//' + window.location.hostname + newpath + '/index.php?act=Arcade&do=newscore', {
gname : gamename,
gscore: score
});
}
function scorepost(href, inputs) {
var gform = document.createElement('form');
gform.method = 'post';
gform.action = href;
gform.target = '_parent';
for (var k in inputs) {
var input = document.createElement('input');
input.setAttribute('name', k);
input.setAttribute('value', inputs[k]);
gform.appendChild(input);
}
document.body.appendChild(gform);
gform.submit();
document.body.removeChild(gform);
}
An example of usage:
var score = parseInt(localStorage.getItem("energizerScore")), gamename = 'energizerCZ';
saveHTML52score(score, gamename);
This code is inserted in index.html
<script type="text/javascript">
function scorepost(href, inputs) {
var gform = document.createElement('form');
gform.method = 'post';
gform.action = href;
gform.target = '_parent';
for (var k in inputs) {
var input = document.createElement('input');
input.setAttribute('name', k);
input.setAttribute('value', inputs[k]);
gform.appendChild(input);
}
document.body.appendChild(gform);
gform.submit();
document.body.removeChild(gform);
}
</script>
and this is the score code
let pathArray = window.location.pathname.split('/');
let newpath = '';
if (pathArray[1] && pathArray[1] != 'arcade') {
newpath = '/' + pathArray[1];
}
scorepost('https://' + window.location.hostname + '/index.php?act=Arcade&do=newscore', {
gname : '1010Hex_Origon',
gscore: score
});
This is the way the code should be used, it's a score code developed at origon-games.dk
But you haven't used this code origon for a long time.