mcWebTTSPlugin

/config

  • app.yml - settings for connection to the TTS server (e.g. username or tts_request_url)

/lib

  • ttsTools.class.php - helper functions for connecting to the TTS server

/modules

Contains the main action and its template for the TTS-reader component, which is inserted into the main template in /apps/frontend/templates/layout.php

<?php include_component('mcWebTTS', 'webTTSReader'); ?>

Important

File _webTTSReader.php contains the main functionality for parsing the HTML and reading.

cleanDOM() - remove unnecessary tags, i.e. empty tags or spans and divs with no attribute
processFormulas() - make formulas pretty, i.e. swap the content and name-attribute
markTexts() - mark what to read
processSolutions() - hide solutions of examples
processPauses() - change images of pauses
buildPlaylist() - build playlist from selected texts
registerControls() - register touch control events using the *Hammer.js* library

/web

Contains CSS definitions and additional Javascript functionality needed for reading and parsing the HTML code.

/web/js

  • hammer.min.* - the Hammer.js library for touch gestures needed for controlling the application on tablets and mobile phones.

  • tts.js - functions for controlling the jPlayer and sending requests for mp3 files to the TTS server via AJAX requests.

    buildJSON(index) - build a JSON string containing data for the current TTS request
    getData(indexFrom) - sends request to the TTS server for mp3s of HTML elements
    getHeadersData(headersCount) - sends request to the TTS server for a specified number of mp3s for reading header elements
    playListMoveTo(group, tabindex) - starts playing a specific mp3 depending on clicked HTML element
  • ttsContentProcessing.js - helper functions for processing parts of the whole HTML document

    processFormulas() - swap the *name* attribute with the content of a formula. Remove redundant *alt* attributes.
    processSolutions() - hide solutions. Prepend buttons for showing the solutions and register *onClick* events.
  • ttsTagProcessing.js - functions for processing different HTML tags.

    ttsProcessDiv(jsonTag) - add an element for reading depending on the DIVs class
    ttsProcessTable(jsonTag) - if table has a *summary* attribute, read it instead of the table content
    ttsProcessImg(jsonTag, tag) - if an image has an *alt* attribute, read it. Don't read images in hidden solutions or in tables with *summary*.
    clearText(inputText) - remove unnecessary strings from text
    ttsProcessSpan(jsonTag, tag) - process the SPAN tags:
    • preserve inline-formulas and chemical-formulas
    • remove unwanted characters using clearText()
    • determine the voice type with which to read the tag. Depends on tag type (ordinary or header) and language (czech, english or german).

Table Of Contents

Previous topic

mcTinyMceDragMathPlugin

This Page