Skip to content
This repository was archived by the owner on Nov 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is loosely inspired by Keep a Changelog.

### Changed

- **Web 0.14.31, web app links point to visucode.de:** the website now lives on one subdomain per world (visustruct.visucode.de, visubot.visucode.de, visuobject.visucode.de, published from the GitLab repo visucode/website). The app's home, imprint and privacy links go to the start page of the current world there (relative on its own subdomain, e.g. `../de/index.html`, otherwise absolute); before, in VisuBot they pointed to `../de/visubot.html`, which no longer exists. On visubot.visucode.de and visuobject.visucode.de the app starts in that world when no world was chosen yet. The about link (web and Swift app) and the Messprotokoll links in lesson 22 use the new addresses (`web/src/ui/site.ts`, test `site.test.ts`).
- **Web 0.14.30, VisuBot concentrates on robotics:** the VisuBot world now shows only the robot lessons and robot tasks (23 lessons in four parts: Losfahren, Sensoren und Entscheidungen, Licht/Ton/Bildschirm, Motoren und Methoden) instead of all 40 VisuStruct lessons with the robot lessons in between; plain Java (console, Scanner, files, windows) stays in VisuStruct (Holger 2026-11-03). The five „Jetzt ohne Roboter“ steps became robot steps: L3 „Ergebnis auf dem Bildschirm“ (`mbot.showText`, data types with robot examples), L9 „Startsignal“ (switch in a for loop), L17 „Messreihe“ (five distance measurements in an array, average), L19 „Laufschrift“ (`charAt` backwards on the screen), L22 „Methode mit Rückgabe“ (`int zentimeter(int umdrehungen)`). New lesson 8 „Und, oder, nicht“ (`&&`, `||`, `!` with distance, line and buttons, truth tables, Java exercise „Sicher fahren“ in four worlds); it is inserted after the line lesson without renaming files, robot lessons are numbered in file order. Links „📘 Mehr dazu ohne Roboter“ (`[…](?visustruct&lektion=…)`) open the matching VisuStruct lesson in a new window (`?lektion=` opens a lesson). The robot lesson file `09-fallauswahl.md` is now `09-fallauswahl-mbot2.md`, because an old progress rename for VisuStruct deleted its progress on every load. Robot Java exercises are now also checked by typing them as Java (de/en).
- **Web 0.14.29, VisuBot commands grouped by colour:** in the palette every mBot2 box gets a 4 px stripe on the left and every group heading a dot in the colour of its group: driving and wheels orange, light (LEDs) yellow-green, sound magenta, screen and emotions indigo, waiting and stopwatch grey, all sensors turquoise. The boxes themselves stay yellow (statement), and the structure chart and the code are unchanged. The former group „Licht, Ton und Bildschirm“ is split into „Licht“, „Ton“ and „Bildschirm“ in the palette and in the VisuBot Nachschlagen (de/en), whose `###` headings show the same dots. New lesson syntax `### Überschrift {.klasse}`. With „Blöcke farbig“ off, stripes and dots disappear. Every sub-group also gets a symbol in the palette (all languages) and in the Nachschlagen headings: 🚗 driving, ⚙️ wheels, 💡 LEDs, 🔊 sound, 🖥️ screen, 😊 emotions, ⏱️ waiting, 📏 distance, ➖ line, 🎨 colours, 🕹️ buttons/joystick, 🔆 light/loudness, 📐 tilt, 🔋 stopwatch/battery.
- **Web 0.14.27, VisuBot: `forward`/`backward` overloaded with a unit:** besides `mbot.forward()` (10 cm) and `mbot.forward(30)` there is now `mbot.forward(2, "Umdrehungen")` and `mbot.forward(30, "cm")` (en `"rotations"`, pt `"rotações"`), same for `backward`. One wheel rotation is π · 6.5 cm ≈ 20.4 cm; the action stores the distance in cm, so simulation, exercise check and the real robot (`mbot2.straight`) work unchanged, and the console shows e.g. „2 Umdrehungen vorwärts (40.84 cm)“. An unknown unit is an error naming the allowed units. The CyberPi program export gets the same overload. VisuBot lesson 22 gets a step „Gleicher Name, andere Parameter: Überladung“ with the three headers, a Ludwig Angeberwissen asking pupils to measure their own robot with a printable test record (PDF, de/en, `website/visubot/messprotokoll-radumdrehung.pdf` / `test-record-wheel-rotation.pdf`: wheel diameter, five test cases expected vs. actual, evaluation, causes, feedback for the teacher, box „So testet man Softwaresysteme“), the exercise „Quadrat mit Umdrehungen“ and a quiz; Nachschlagen, glossary („Überladung“) and code completion list the new variants (de/en).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ struct AboutVisuStructView: View {
// Öffentliches Java-Repo: maßgebliche Quelle & Releases (aktueller als dieses SwiftUI-Repo).
private let projectDisplay = "code4teaching/VisuStruct"
private let projectURL = URL(string: "https://github.com/code4teaching/VisuStruct")
private let webDisplay = "www.visustruct.org"
private let webURL = URL(string: "https://www.visustruct.org")
private let webDisplay = "visustruct.visucode.de"
private let webURL = URL(string: "https://visustruct.visucode.de")
private let developerDisplay = "www.sebastiao.org"
private let developerURL = URL(string: "https://www.sebastiao.org")
// Java-Referenzrepo (aktuell gepflegt): code4teaching/VisuStruct
Expand Down
2 changes: 1 addition & 1 deletion web/lessons/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Der Text darf Markdown und Links enthalten:

```
::: angeberwissen
Ben Shneiderman hatte die Idee 1972. [Mehr dazu](https://visustruct.org/de/angeberwissen.html)
Ben Shneiderman hatte die Idee 1972. [Mehr dazu](https://visustruct.visucode.de/de/angeberwissen.html)
:::
```

Expand Down
2 changes: 1 addition & 1 deletion web/lessons/de/visubot/22-eigene-methoden.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void forward(int wert, String einheit)
Überladung kennst du schon: `System.out.println` gibt es für `int`, für `double`, für `String` und noch mehr. Deshalb kannst du jeden dieser Werte einfach in die Klammern schreiben.

::: angeberwissen
Stimmen die 20,4 cm bei **deinem** mBot2 wirklich? Profis glauben keiner Zahl, die sie nicht nachgemessen haben. Miss den Raddurchmesser und lass `mbot.forward(5, "Umdrehungen")` fahren: Soll sind 102,1 cm. So testet man Softwaresysteme: Jeder **Testfall** hat ein erwartetes Ergebnis (**Soll**) und ein gemessenes (**Ist**). Man testet mehrmals und schreibt alles in ein **Protokoll**. Hier ist dein [Messprotokoll zum Ausdrucken (PDF)](https://visustruct.org/visubot/messprotokoll-radumdrehung.pdf). Gib es deiner Lehrkraft, dann sieht sie, ob alle Roboter gleich weit fahren.
Stimmen die 20,4 cm bei **deinem** mBot2 wirklich? Profis glauben keiner Zahl, die sie nicht nachgemessen haben. Miss den Raddurchmesser und lass `mbot.forward(5, "Umdrehungen")` fahren: Soll sind 102,1 cm. So testet man Softwaresysteme: Jeder **Testfall** hat ein erwartetes Ergebnis (**Soll**) und ein gemessenes (**Ist**). Man testet mehrmals und schreibt alles in ein **Protokoll**. Hier ist dein [Messprotokoll zum Ausdrucken (PDF)](https://visubot.visucode.de/messprotokoll-radumdrehung.pdf). Gib es deiner Lehrkraft, dann sieht sie, ob alle Roboter gleich weit fahren.
:::

::: übung vb-ueberladung-umdrehung
Expand Down
2 changes: 1 addition & 1 deletion web/lessons/en/visubot/22-eigene-methoden.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void forward(int value, String unit)
You already know overloading: `System.out.println` exists for `int`, for `double`, for `String` and more. That is why you can simply put any of these values in the brackets.

::: angeberwissen
Are the 20.4 cm really true for **your** mBot2? Professionals don't trust a number they haven't measured. Measure the wheel diameter and run `mbot.forward(5, "rotations")`: the expected distance is 102.1 cm. This is how software systems are tested: every **test case** has an expected result and an actual (measured) result. You test several times and write everything into a **test record**. Here is your [test record to print (PDF)](https://visustruct.org/visubot/test-record-wheel-rotation.pdf). Give it to your teacher, so they can see whether all robots drive the same distance.
Are the 20.4 cm really true for **your** mBot2? Professionals don't trust a number they haven't measured. Measure the wheel diameter and run `mbot.forward(5, "rotations")`: the expected distance is 102.1 cm. This is how software systems are tested: every **test case** has an expected result and an actual (measured) result. You test several times and write everything into a **test record**. Here is your [test record to print (PDF)](https://visubot.visucode.de/test-record-wheel-rotation.pdf). Give it to your teacher, so they can see whether all robots drive the same distance.
:::

::: übung vb-ueberladung-umdrehung
Expand Down
4 changes: 2 additions & 2 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "visustruct-web",
"private": true,
"version": "0.14.30",
"version": "0.14.31",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
10 changes: 9 additions & 1 deletion web/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import './ui/styles.css'
import { App, applyCanvasStubTexts } from './ui/app'
import { installTooltips } from './ui/tooltip'
import { preferredLanguage, setCodeKeywords, setLanguage, storedCodeKeywords } from './ui/i18n'
import { setVisuFlowWorld, setVisuObjectWorld, visuFlowWorld, visuObjectWorld } from './ui/visubotView'
import { setVisuBotMode, setVisuFlowWorld, setVisuObjectWorld, visuFlowWorld, visuObjectWorld, worldChosen } from './ui/visubotView'
import { hostWorld } from './ui/site'

// Nach einem Update kann eine noch offene oder zwischengespeicherte Seite Dateien der alten Version
// nachladen wollen, die es nicht mehr gibt. Dann einmal neu laden statt leer zu bleiben.
Expand Down Expand Up @@ -53,6 +54,13 @@ Promise.all([setLanguage(language, false), setCodeKeywords(storedCodeKeywords(),
installTooltips()
// Welten VisuObject (…/app/?visuobject) und VisuFlow (?visuflow) haben eine eigene Oberfläche; ?visustruct und ?visubot wählt die App selbst.
const query = new URLSearchParams(location.search)
// Erster Besuch auf visubot.visucode.de oder visuobject.visucode.de ohne Welt in der Adresse: gleich die Welt der Seite
const anyWorld = ['visustruct', 'visubot', 'visuobject', 'visuflow'].some((k) => query.has(k))
if (!anyWorld && !worldChosen()) {
const site = hostWorld()
if (site === 'visubot') setVisuBotMode('on')
else if (site === 'visuobject') setVisuObjectWorld()
}
if (query.has('visuobject')) setVisuObjectWorld()
if (query.has('visuflow')) setVisuFlowWorld()
const root = document.getElementById('app')!
Expand Down
10 changes: 3 additions & 7 deletions web/src/ui/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { canvasTextLines, setCanvasStubTexts } from '../core/diagramText'
import { worldHomeURL } from './site'
import {
appendCaseToFallauswahl,
canDeleteElement,
Expand Down Expand Up @@ -199,12 +200,7 @@ const isMac = /Mac|iPhone|iPad/.test(navigator.platform)
/** Tastenkürzel im Tooltip, z. B. „Strg+S“ bzw. „⌘S“. */
/** Startseite (oder ein Abschnitt ihrer Fußzeile) in der passenden Sprache der Webseite; im VisuBot-Modus die VisuBot-Startseite. */
function siteURL(section?: 'contact' | 'privacy'): string {
const code = currentLanguage()
const lang = code === 'pt-PT' ? 'pt' : code === 'de' ? 'de' : 'en'
// Auf visustruct.org liegt die Web-App unter /app/, sonst (Vorschau, Einzeldatei) zur echten Seite
const base = /\/app\/(index\.html)?$/.test(location.pathname) ? '../' : 'https://visustruct.org/'
const page = visuBotEnabled() ? 'visubot' : 'index'
return `${base}${lang}/${page}.html${section ? `#${section}` : ''}`
return worldHomeURL(visuBotEnabled() ? 'visubot' : 'visustruct', currentLanguage(), section)
}

/** Symbolknopf; der Name (mit Tastenkürzel) erscheint als Tooltip. */
Expand Down Expand Up @@ -1162,7 +1158,7 @@ export class App {
<h3>VisuStruct <small>${e(t('web_brand_suffix'))}</small></h3>
<p class="about-version">${e(t('web_about_version_fmt').replace('%@', __APP_VERSION__))}</p>
<p class="about-author">Holger Sebastiao</p>
${link('about_web_label', 'https://www.visustruct.org', 'www.visustruct.org')}
${link('about_web_label', 'https://visustruct.visucode.de', 'visustruct.visucode.de')}
${link('about_developer_label', 'https://www.sebastiao.org', 'www.sebastiao.org')}
${link('about_project_github_label', 'https://github.com/code4teaching/VisuStruct', 'code4teaching/VisuStruct')}
</div>
Expand Down
6 changes: 2 additions & 4 deletions web/src/ui/flowApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
import { gearIcon } from './app'
import { buildDiagramPDF, canvasRGB, canvasToPNG, exportFilenameSlug, rasterize, svgMarkup, type ExportImage } from './exporter'
import { currentLanguage, t } from './i18n'
import { worldHomeURL } from './site'
import { icons } from './icons'
import { setVisuBotMode, setVisuObjectWorld, worldChooserHTML, type WorldChoice } from './visubotView'

Expand Down Expand Up @@ -65,10 +66,7 @@ function store(key: string, value: string) {
}

function siteURL(): string {
const code = currentLanguage()
const lang = code === 'pt-PT' ? 'pt' : code === 'de' ? 'de' : 'en'
const base = /\/app\/(index\.html)?$/.test(location.pathname) ? '../' : 'https://visustruct.org/'
return `${base}${lang}/index.html`
return worldHomeURL('visustruct', currentLanguage())
}

function download(name: string, data: BlobPart, type: string) {
Expand Down
2 changes: 1 addition & 1 deletion web/src/ui/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export function codeKeywords(): boolean {
/** Wie `AppLanguage.deviceDefault`: erste Browsersprache, die VisuStruct anbietet, sonst Englisch. */
export function preferredLanguage(): LanguageCode {
if (migrateJavaLanguage()) return 'en'
// Link von der Webseite, z. B. visustruct.org/app/?lang=de
// Link von der Webseite, z. B. visustruct.visucode.de/app/?lang=de
const fromURL = new URLSearchParams(location.search).get('lang')
if (fromURL && isOffered(fromURL)) return fromURL
try {
Expand Down
6 changes: 2 additions & 4 deletions web/src/ui/objectApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ import {
} from '../core/umlRelations'
import { gearIcon } from './app'
import { currentLanguage, t } from './i18n'
import { worldHomeURL } from './site'
import { icons } from './icons'
import { codeScopes, JavaEditor, setCodeScopes } from './javaEditor'
import { closeWindows, compileAndRunProject, prepareJava } from './javaRuntime'
Expand Down Expand Up @@ -144,10 +145,7 @@ function store(key: string, value: string) {
}

function siteURL(): string {
const code = currentLanguage()
const lang = code === 'pt-PT' ? 'pt' : code === 'de' ? 'de' : 'en'
const base = /\/app\/(index\.html)?$/.test(location.pathname) ? '../' : 'https://visustruct.org/'
return `${base}${lang}/visuobject.html`
return worldHomeURL('visuobject', currentLanguage())
}

function download(name: string, data: BlobPart, type: string) {
Expand Down
34 changes: 34 additions & 0 deletions web/src/ui/site.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Webseiten der Welten auf visucode.de: visustruct.visucode.de, visubot.visucode.de, visuobject.visucode.de.
* Jede Subdomain hat ihre eigene Startseite (/de/, /en/, /pt/ …) und eine eigene Kopie der Web-App unter /app/.
*/
export type SiteWorld = 'visustruct' | 'visubot' | 'visuobject'

export const SITE_DOMAIN = 'visucode.de'

/** Welt der Subdomain, auf der die App gerade läuft (z. B. `visubot` auf visubot.visucode.de), sonst `undefined`. */
export function hostWorld(host: string = location.hostname): SiteWorld | undefined {
const m = /^(visustruct|visubot|visuobject)\.visucode\.de$/.exec(host.toLowerCase())
return m ? (m[1] as SiteWorld) : undefined
}

/** Sprachordner der Webseite zur App-Sprache (die Seiten gibt es auf Deutsch, Englisch und Portugiesisch). */
export function siteLanguage(code: string): 'de' | 'en' | 'pt' {
return code === 'pt-PT' ? 'pt' : code === 'de' ? 'de' : 'en'
}

/**
* Startseite einer Welt, auf Wunsch mit Abschnitt (#contact, #privacy).
* Läuft die App unter /app/ auf der Subdomain dieser Welt, relativ (`../de/index.html`), sonst absolut.
*/
export function worldHomeURL(
world: SiteWorld,
languageCode: string,
section?: string,
where: { hostname: string; pathname: string } = location,
): string {
const lang = siteLanguage(languageCode)
const hash = section ? `#${section}` : ''
const local = hostWorld(where.hostname) === world && /\/app\/(index\.html)?$/.test(where.pathname)
return local ? `../${lang}/index.html${hash}` : `https://${world}.${SITE_DOMAIN}/${lang}/${hash}`
}
28 changes: 28 additions & 0 deletions web/test/site.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { describe, expect, it } from 'vitest'
import { hostWorld, siteLanguage, worldHomeURL } from '../src/ui/site'

describe('Webseiten auf visucode.de', () => {
it('erkennt die Welt an der Subdomain', () => {
expect(hostWorld('visubot.visucode.de')).toBe('visubot')
expect(hostWorld('VisuStruct.visucode.de')).toBe('visustruct')
expect(hostWorld('visuobject.visucode.de')).toBe('visuobject')
expect(hostWorld('visucode.de')).toBeUndefined()
expect(hostWorld('localhost')).toBeUndefined()
expect(hostWorld('visubot.visucode.de.example.com')).toBeUndefined()
})

it('nimmt de, en oder pt als Sprachordner', () => {
expect(siteLanguage('de')).toBe('de')
expect(siteLanguage('pt-PT')).toBe('pt')
expect(siteLanguage('fr')).toBe('en')
})

it('verlinkt die Startseite relativ nur auf der eigenen Subdomain', () => {
const bot = { hostname: 'visubot.visucode.de', pathname: '/app/index.html' }
expect(worldHomeURL('visubot', 'de', undefined, bot)).toBe('../de/index.html')
expect(worldHomeURL('visubot', 'pt-PT', 'privacy', bot)).toBe('../pt/index.html#privacy')
expect(worldHomeURL('visustruct', 'de', 'contact', bot)).toBe('https://visustruct.visucode.de/de/#contact')
const preview = { hostname: 'localhost', pathname: '/' }
expect(worldHomeURL('visuobject', 'en', undefined, preview)).toBe('https://visuobject.visucode.de/en/')
})
})
Loading
Loading