Skip to content

Commit ed1d867

Browse files
committed
redirect examples, so links in the CPCWiki forum still work
1 parent 36decc5 commit ed1d867

4 files changed

Lines changed: 286 additions & 6 deletions

File tree

cpcbasic.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ cpcBasic = {
3030
showVariable: false,
3131
showConsole: false,
3232
sound: true,
33-
tron: false // trace on
33+
tron: false, // trace on
34+
redirectExamples: {}
3435
},
3536
model: null,
3637
view: null,
@@ -153,6 +154,16 @@ cpcBasic = {
153154
Utils.console = oConsole;
154155
},
155156

157+
fnRedirectExamples: function () {
158+
var redirectExamples = this.model.getProperty("redirectExamples"),
159+
name = this.model.getProperty("database") + "/" + this.model.getProperty("example");
160+
161+
if (redirectExamples[name]) {
162+
this.model.setProperty("database", redirectExamples[name].database);
163+
this.model.setProperty("example", redirectExamples[name].example);
164+
}
165+
},
166+
156167
fnDoStart: function () {
157168
var that = this,
158169
oStartConfig = this.config,
@@ -178,6 +189,8 @@ cpcBasic = {
178189
Utils.console.changeLog(document.getElementById("consoleText"));
179190
}
180191

192+
this.fnRedirectExamples();
193+
181194
that.controller = new Controller(this.model, this.view);
182195
},
183196

cpcconfig.js

Lines changed: 270 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,276 @@
33
"use strict";
44

55
var cpcconfig = { // eslint-disable-line no-unused-vars
6-
databaseDirs: "examples,https://benchmarko.github.io/CPCBasicApps/apps,storage"
7-
//databaseDirs: "examples,../CPCBasicApps/apps,storage" // use this, if CPCBasicApps is available locally
8-
//databaseDirs: "https://benchmarko.github.io/CPCBasic/examples,https://benchmarko.github.io/CPCBasicApps/apps,storage" // all remote
6+
databaseDirs: "examples,https://benchmarko.github.io/CPCBasicApps/apps,storage",
7+
//databaseDirs: "examples,../CPCBasicApps/apps,storage", // use this, if CPCBasicApps is available locally
8+
//databaseDirs: "https://benchmarko.github.io/CPCBasic/examples,https://benchmarko.github.io/CPCBasicApps/apps,storage", // all remote
9+
10+
redirectExamples: {
11+
"examples/art": {
12+
database: "apps",
13+
example: "demo/art"
14+
},
15+
"examples/blkedit": {
16+
database: "apps",
17+
example: "apps/blkedit"
18+
},
19+
"examples/circlewr": {
20+
database: "apps",
21+
example: "test/circlewr"
22+
},
23+
"examples/cpc464ch": {
24+
database: "apps",
25+
example: "test/cpc464ch"
26+
},
27+
"examples/cpclib": {
28+
database: "apps",
29+
example: "test/cpclib"
30+
},
31+
"examples/crypto1": {
32+
database: "apps",
33+
example: "test/crypto1"
34+
},
35+
"examples/geogra": {
36+
database: "apps",
37+
example: "apps/geogra"
38+
},
39+
"examples/labyrinth": {
40+
database: "apps",
41+
example: "test/labyrinth"
42+
},
43+
"examples/morse": {
44+
database: "apps",
45+
example: "apps/morse"
46+
},
47+
"examples/mouse": {
48+
database: "apps",
49+
example: "test/mouse"
50+
},
51+
"examples/piechart": {
52+
database: "apps",
53+
example: "test/piechart"
54+
},
55+
"examples/rastercircle": {
56+
database: "apps",
57+
example: "test/rastercircle"
58+
},
59+
"examples/rotatio": {
60+
database: "apps",
61+
example: "test/rotatio"
62+
},
63+
"examples/scrudu": {
64+
database: "apps",
65+
example: "test/scrudu"
66+
},
67+
"examples/simple": {
68+
database: "apps",
69+
example: "test/simple"
70+
},
71+
"examples/soundtest1": {
72+
database: "apps",
73+
example: "test/soundtest1"
74+
},
75+
"examples/sphere": {
76+
database: "apps",
77+
example: "test/sphere"
78+
},
79+
"examples/vocabula": {
80+
database: "apps",
81+
example: "apps/vocabula"
82+
},
83+
"examples/advent/advedit": {
84+
database: "apps",
85+
example: "apps/advent/advedit"
86+
},
87+
"examples/advent/advint": {
88+
database: "apps",
89+
example: "apps/advent/advint"
90+
},
91+
"examples/animator/anibas": {
92+
database: "apps",
93+
example: "apps/animator/anibas"
94+
},
95+
"examples/animator/animator": {
96+
database: "apps",
97+
example: "apps/animator/animator"
98+
},
99+
"examples/archi/archidr": {
100+
database: "apps",
101+
example: "apps/archi/archidr"
102+
},
103+
"examples/demo/blocky": {
104+
database: "apps",
105+
example: "test/blocky"
106+
},
107+
"examples/demo/colors": {
108+
database: "apps",
109+
example: "test/colors"
110+
},
111+
"examples/demo/graphics": {
112+
database: "apps",
113+
example: "test/graphics"
114+
},
115+
"examples/games/energy0": {
116+
database: "apps",
117+
example: "test/energy0"
118+
},
119+
"examples/games/energy0": {
120+
database: "apps",
121+
example: "test/energy0"
122+
},
123+
"examples/games/energy1": {
124+
database: "apps",
125+
example: "test/energy1"
126+
},
127+
"examples/games/energysa": {
128+
database: "apps",
129+
example: "test/energysa"
130+
},
131+
"examples/games/hopper": {
132+
database: "apps",
133+
example: "games/hopper"
134+
},
135+
"examples/games/hopper2": {
136+
database: "apps",
137+
example: "games/hopper2"
138+
},
139+
"examples/games/joker": {
140+
database: "apps",
141+
example: "games/joker"
142+
},
143+
"examples/games/shot": {
144+
database: "apps",
145+
example: "games/shot"
146+
},
147+
"examples/games/states": {
148+
database: "apps",
149+
example: "games/states"
150+
},
151+
"examples/math/anageo": {
152+
database: "apps",
153+
example: "math/anageo"
154+
},
155+
"examples/math/complex": {
156+
database: "apps",
157+
example: "math/complex"
158+
},
159+
"examples/math/derivat": {
160+
database: "apps",
161+
example: "math/derivat"
162+
},
163+
"examples/math/division": {
164+
database: "apps",
165+
example: "math/division"
166+
},
167+
"examples/math/euler": {
168+
database: "apps",
169+
example: "math/euler"
170+
},
171+
"examples/math/factorials": {
172+
database: "apps",
173+
example: "math/factorials"
174+
},
175+
"examples/math/fractions": {
176+
database: "apps",
177+
example: "math/fractions"
178+
},
179+
"examples/math/funcarea": {
180+
database: "apps",
181+
example: "math/funcarea"
182+
},
183+
"examples/math/funcspec": {
184+
database: "apps",
185+
example: "math/funcspec"
186+
},
187+
"examples/math/ninedig2": {
188+
database: "apps",
189+
example: "math/ninedig2"
190+
},
191+
"examples/math/quadfunc": {
192+
database: "apps",
193+
example: "math/quadfunc"
194+
},
195+
"examples/math/regress": {
196+
database: "apps",
197+
example: "math/regress"
198+
},
199+
"examples/math/funcarea": {
200+
database: "apps",
201+
example: "test/funcarea"
202+
},
203+
"examples/test/basbankm": {
204+
database: "apps",
205+
example: "test/basbankm"
206+
},
207+
"examples/test/bmbench3": {
208+
database: "apps",
209+
example: "test/bmbench3"
210+
},
211+
"examples/test/charset": {
212+
database: "apps",
213+
example: "test/charset"
214+
},
215+
"examples/test/circles": {
216+
database: "apps",
217+
example: "test/circles"
218+
},
219+
"examples/test/cpcmhz": {
220+
database: "apps",
221+
example: "test/cpcmhz"
222+
},
223+
"examples/test/fancy": {
224+
database: "apps",
225+
example: "test/fancy"
226+
},
227+
"examples/test/fill": {
228+
database: "apps",
229+
example: "test/fill"
230+
},
231+
"examples/test/keyboard": {
232+
database: "apps",
233+
example: "test/keyboard"
234+
},
235+
"examples/test/linemask": {
236+
database: "apps",
237+
example: "test/linemask"
238+
},
239+
"examples/test/mousepa": {
240+
database: "apps",
241+
example: "test/mousepa"
242+
},
243+
"examples/test/pixeltst": {
244+
database: "apps",
245+
example: "test/pixeltst"
246+
},
247+
"examples/test/ramtest": {
248+
database: "apps",
249+
example: "test/ramtest"
250+
},
251+
"examples/test/rectangles": {
252+
database: "apps",
253+
example: "test/rectangles"
254+
},
255+
"examples/test/reftime": {
256+
database: "apps",
257+
example: "test/reftime"
258+
},
259+
"examples/test/scrtest": {
260+
database: "apps",
261+
example: "test/scrtest"
262+
},
263+
"examples/test/seconds": {
264+
database: "apps",
265+
example: "test/seconds"
266+
},
267+
"examples/test/stars": {
268+
database: "apps",
269+
example: "test/stars"
270+
},
271+
"examples/vidi/vidi": {
272+
database: "apps",
273+
example: "apps/vidi/vidi"
274+
}
275+
}
9276
};
10277

11278
if (typeof module !== "undefined" && module.exports) {

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<link rel="stylesheet" href="cpcbasic.css" />
7-
<title id="title">CPC Basic v0.10.7</title>
7+
<title id="title">CPC Basic v0.10.8</title>
88
</head>
99

1010
<body id="pageBody">

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cpcbasic",
3-
"version": "0.10.7",
3+
"version": "0.10.8",
44
"description": "# CPCBasic - Run CPC BASIC in a Browser",
55
"main": "cpcbasic.js",
66
"directories": {

0 commit comments

Comments
 (0)