Using WTraffic

In order to have WTraffic somewhere (possibly on multiply places) in a HTML page, the WTraffic JavaScript program and the WTraffic style sheet have to be included in the page.

Place the following lines into the <head> section of your page:

<script src='http://pc2.pxtr.de/wtr.js' type='text/javascript'>
<link rel='stylesheet' type='text/css' href='http://pc2.pxtr.de/wtr.css'>
WTraffic runs inside a HTML element - usually a <div> . The user (the page author) have to create this element, determine it's size and style it accordingly. Adding the class name wtrauto or wtrmanual selects the element for running WTraffic inside it. The element have the style position: relative (given in wtr.css), so another position style is not possible. If the user intends to use some of the keyboard commands, then it's the user's responsibility to assure, that the element is focusable adding the HTML attribute tabindex='0' to it.

The two possible class name differ in the way, how the presentation starts.

The parameters for WTraffic should be placed in the data-attributes of the HTML element. The most important attribute is the equivalent of the Timetable File of the Traffic screensaver:

Additionally parameters for starting section command - or for the implicit root section command in case of the immediate timetable lines - can be added, for example ML=, MS=, ST= parameters.

A few examples:

<div id='tr1'
     class='wtrmanual'
     style='width:100%;height:100px;'
     tabindex='0'
     data-tt='
C=DB_4_221;
C=DB_4_221S1OB;D=X;
'>
</div>

<div id='tr2'
     class='wtrauto'
     style='width:100%;height:200px;'
     tabindex='0'
     data-root='MM_GHIST'
     data-ab='5'
     data-bl='10'
     data-st='0.8'
>
</div>

If you intend to run WTraffic on the whole page, there is a ready page, which can be controlled by the query part of the URL. It is the http(s)://pc2.pxtr.de/wtraffic.htm page. If you do not specify the root section name, temporarily the section name WTR is used - it marks a subset of the standard timetable, which already runs in WTraffic since spring 2021. It was for your convenience: not to start accidentally parts not functioning yet. If you want to start the whole standard timetable, please specify ROOT=ROOT;. You can select every section in the timetable as the root section - listed on the Sections page - the whole Traffic standard timetable is available there. As now the whole Traffic standard timetable is running in WTraffic, there is not need for special caution.

Nevertheless, if you want to be on the safe side, the WTraffic Demo chapter in the table of content lists pages, which are functioning (it is possible, that there are a few smaller problems - for example, a large bus runs without a street line). Check back in 1-2 month intervals, and you will find a growing set of functioning WTraffic scenes.

This way - invoking WTraffic on a full page, not creating an own HTML page with the containing <div> elements - does not provide the possibility to use a short, own timetable.