Daily Lucky Numbers:
6
10
21
29
41
42

HTML5 Save Code V3

Started by Chen Zhen, January 09, 2022, 10:58:00 PM

Previous topic - Next topic

Chen Zhen

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);

origon

#1
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

Hero

But you haven't used this code origon for a long time.