From 9f9e613d4da1363c31fa1ab1089dd60ff54b1a97 Mon Sep 17 00:00:00 2001 From: Pelle Nilsson Date: Tue, 18 Jun 2013 22:59:13 +0200 Subject: [PATCH] HTML output now playable with JavaScript disabled or missing js file. --- gamebookformat.css | 6 ++++-- gamebookformatplay.js | 5 +++++ templates/html/begin.html | 4 +++- templates/html/endscript.html | 4 ++-- templates/html/section_ref.html | 3 ++- templates/html/sections_begin.html | 2 +- todo.org | 4 ++-- 7 files changed, 19 insertions(+), 9 deletions(-) diff --git a/gamebookformat.css b/gamebookformat.css index e7996ab..844dcbe 100644 --- a/gamebookformat.css +++ b/gamebookformat.css @@ -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;} \ No newline at end of file +.counterChange {font-weight: bold;} + +a {text-decoration: none; color: black;} \ No newline at end of file diff --git a/gamebookformatplay.js b/gamebookformatplay.js index c7b38be..bcd8eca 100644 --- a/gamebookformatplay.js +++ b/gamebookformatplay.js @@ -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'); diff --git a/templates/html/begin.html b/templates/html/begin.html index dd0559f..5ed1fad 100644 --- a/templates/html/begin.html +++ b/templates/html/begin.html @@ -8,7 +8,9 @@ #include "head-overrides" diff --git a/templates/html/endscript.html b/templates/html/endscript.html index d05590e..0dfc66b 100644 --- a/templates/html/endscript.html +++ b/templates/html/endscript.html @@ -1,3 +1,3 @@ -if (this.gamebook) { - gamebook.runActionsInIntroSections(); +if (typeof gamebook !== 'undefined') { + gamebook.prepare(); } diff --git a/templates/html/section_ref.html b/templates/html/section_ref.html index 138883c..35e67b5 100644 --- a/templates/html/section_ref.html +++ b/templates/html/section_ref.html @@ -1 +1,2 @@ -%(nr)d \ No newline at end of file +%(nr)d \ No newline at end of file diff --git a/templates/html/sections_begin.html b/templates/html/sections_begin.html index 0f823bc..de4a45d 100644 --- a/templates/html/sections_begin.html +++ b/templates/html/sections_begin.html @@ -4,7 +4,7 @@