Skip to content

Game won't load on the textadventures site (includes a fix) #143

@KVonGit

Description

@KVonGit

I've had a game running on GitHub Pages for a few days. When I uploaded the same game to textadventures.co.uk just now, it would not load.

It said it couldn't find game//settings.js. I changed index.html to this to get it to work:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8"/>
  <title>Interactive Fiction Using QuestJS</title>
  <meta http-equiv="Content-Security-Policy" content="
    default-src 'self';
    style-src 'unsafe-inline' 'self' https://fonts.googleapis.com https://cdnjs.cloudflare.com;
    font-src 'self' https://fonts.gstatic.com https://cdnjs.cloudflare.com;
    script-src 'unsafe-inline' 'self';
    img-src 'self';"
  >
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" integrity="sha512-+4zCK9k+qNFUR5X+cKL9EIR+ZOhtIloNl9GIKS57V1MyNsYpYcUrUeQc9vNfzsWfV28IaLL3i96P9sdNyeRssA==" crossorigin="anonymous" />
  

  <script>
    let folder = 'game/'
    let loaded = false
    if (window.location.search) folder = 'game-' + window.location.search.substring(1) + ''
    const qeditor = false
    const resourcesFolder = ''
  </script>

  <script src="lib/_util.js"></script>
  <script src="lib/_settings.js"></script>

  <script>
    const myScript = document.createElement("script")
    myScript.setAttribute("src", folder + 'settings.js')
    myScript.onload = function() {
      settings.writeScript(folder, "", "")
    }
    myScript.onerror = function() {
      console.log("Failed to load file \"" + folder + "settings.js\".")
      console.log("Check the file and folder actually exist.")
      console.log("This is probably because the folder \"" + folder + "\" does not exist, perhaps because it is wrongly specified in the address.")
    }
    document.head.appendChild(myScript)
  </script>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>



<body>

<h1 id="loading">Story loading, please wait...</h1>

<div id="main">
<div id="inner">
<div id="output"></div>
<div id="input"></div>
</div>
</div>

<dialog id="dialog">
  <form method="dialog">
    <h4 id="dialog-title"></h4>
    <hr/>
    <div id="dialog-content"></div>
    <div id="dialog-footer" style="text-align:right">
    <hr/>
    <button id="dialog-button" value="default">Confirm</button>
    </div>
  </form>
</dialog>
<div id="quest-map"></div>
<div id="quest-image"></div>
<form style="display:none" id="fileDialogForm">
	<input type="file" id="fileDialog" accept=".q6save"/>
</form>
</body>
</html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions