HTML output now playable with JavaScript disabled or missing js file.

This commit is contained in:
Pelle Nilsson 2013-06-18 22:59:13 +02:00
parent 25fb3ec60c
commit 9f9e613d4d
7 changed files with 19 additions and 9 deletions

View File

@ -24,7 +24,7 @@
.sectionnumber,.introsectionheading {font-weight: bolder;
width: 100%;
text-align: center;}
.section {display: none; width: 90%; margin-left: 5%; margin-right: 5%;}
.section {width: 90%; margin-left: 5%; margin-right: 5%;}
.sectiontext {margin-top: 0.5em;}
.gamebook {max-width: 30em; padding: 1em; width: 100%; font-size: 133%;}
.collections {margin-top: 4em;}
@ -47,4 +47,6 @@
.sectionimage {width: 100%; padding: 1em;}
.nodisplay {display: none;}
.resumenr {font-weight: bold;}
.counterChange {font-weight: bold;}
.counterChange {font-weight: bold;}
a {text-decoration: none; color: black;}

View File

@ -160,6 +160,11 @@ var gamebook = {
this.displaySection(nr);
},
prepare : function() {
this.addClassToClass('section', 'nodisplay');
this.runActionsInIntroSections();
},
'start' : function() {
this.hideIntroSections();
this.addClassToClass('startlink', 'nodisplay');

View File

@ -8,7 +8,9 @@
<link rel="stylesheet" href="gamebookformat.css"
type="text/css" />
<script>
gamebook.id = '%(id)s';
if (typeof gamebook !== 'undefined') {
gamebook.id = '%(id)s';
}
</script>
#include "head-overrides"
</head>

View File

@ -1,3 +1,3 @@
if (this.gamebook) {
gamebook.runActionsInIntroSections();
if (typeof gamebook !== 'undefined') {
gamebook.prepare();
}

View File

@ -1 +1,2 @@
<a class="sectionref enabledlink" data-ref="%(nr)d">%(nr)d</a>
<a class="sectionref enabledlink" data-ref="%(nr)d"
href="#section%(nr)d">%(nr)d</a>

View File

@ -4,7 +4,7 @@
<div class="startlink"
onclick="gamebook.turnTo(1)">%(starttext)s</div>
<script>
if (gamebook.hasSavedGame()) {
if (typeof gamebook !== 'undefined' && gamebook.hasSavedGame()) {
var resumeLinks = document.getElementsByClassName('resumelink');
Array.prototype.forEach.call(resumeLinks, function(e) {
e.classList.remove('nodisplay');

View File

@ -1,4 +1,4 @@
* TODO [48/72] [66%]
* TODO [49/72] [68%]
- [X] Debug output
- [X] DOT output
- [X] LaTeX output
@ -59,7 +59,7 @@
display somewhere on page (in HTML output)
- [X] Counters increase/decrease
- [X] Counters check
- [ ] Make sure HTML output works with javascript disabled
- [X] Make sure HTML output works with javascript disabled
and in inferior browsers
- [ ] Trade (optionally drop something from collection to add something new).
- [ ] Buy (optionally decrease a counter to add something to a collection)