Configuration API

Here you will be able to find various configurations that can be done for webReader. If you cannot find what you're looking for, feel free to contact us as described on this page

General settings

Path: rsConf.general

Settings that affect the service in general.

  • cookieLifetime

    Description: How long the settings cookie should survive on the user’s computer, expressed in milliseconds. The default setting is just over four days. Set this to null in order to use a session-only cookie that is not stored on the user’s computer after the browser closes. Note! Some browsers have functionality for restoring previous sessions when starting. This might cause session-only cookies to be restored as well. This is something that is handled entirely by the browser and is not something ReadSpeaker can control.

  • cookieName

    Description: The name of the main cookie that will be used to store users’ personalized settings.

  • defaultSpeedValue

    Description: This is the default speed value sent to ReadSpeaker. This value is equal to the medium speed setting. Slow will be 25 units lower, relative to this default value and fast will be 25 units higher.

  • domain

    Description: The domain that is used for the calls to the ReadSpeaker servers.

  • popupCloseTime

    Description: Determines the amount of time the popup will be visible when the user has selected some text. Expressed in milliseconds.

  • shadowDomSelector

    Description: To enable reading content from a shadow DOM, it needs to be defined in the general.shadowDomSelector configuration. The value should be a selector string, that points out all shadow root elements that should be included in the reading. Any shadow DOM that can't be matched by this selector will be ignored.

  • subdomain

    Description: The sub-domain that is used for the calls to the ReadSpeaker servers.

  • syncContainer

    Description: Sets the type of element the sync tags will use. By default <font> is used in Interner Explorer and <rs:span> in other browsers.

Default settings

Path: rsConf.settings
The difference between configuration and settings is that configuration affects everyone that uses the service, whereas settings/properties only affect the current user in the current browser. (The words settings and properties are used interchangeably throughout this document.)
In this section you specify which default settings should be used, if the user has not yet made any active choices.

  • hl

    Description: Which highlighting style to use. Default setting is highlighting both word and sentence.

  • hlicon

    Description: Whether or not to display a popup button when selecting text on a web page. The popup button can be used to start the audio playback.

  • hlscroll

    Description: Whether or not to automatically scroll the page vertically when the reading has reached the bottom of the browser’s viewport.

  • hlsent

    Description: The color that will be used for highlighting sentences, expressed as a valid CSS color value.

  • hlspeed

    Description: The reading speed.

  • hltext

    Description: The color that will be used for the text in the highlighted elements, expressed as a valid CSS color value.

  • hltoggle

    Description: This setting toggles highlighting on or off (hlon or hloff). If set to off, it overrides the rsConf.settings.hl value.

  • hlword

    Description: The color that will be used for highlighting words, expressed as a valid CSS color value.

Phrases

Path: rsConf.phrases
The phrases section defines the translation of labels that are used in the user interface. Each supported language is defined in a separate object, defined by its five-letter countrylanguage code. For languages that have identical phrase sets a function can be used to return the language which serves as the basis for the current language, in order to avoid redundant entries.
Example:

window.rsConf = {
	phrases: {
		en_uk: {
			play: 'Play',
			...
			...
		},
		en_us: function() {
			return this.en_uk;
		}
	}
};

Or, alternatively, if you want to do this programmatically:

window.rsConf.phrases.en_us = function() {
	return window.rsConf.phrases.en_uk;
};

We will not list every single phrase, but we use American English, en_us, as the basis for all other languages. Consequently, en_us lists all phrases that are available for use.

    Callback

    Path: rsConf.cb
    The callback API can be used to trigger custom functions when certain pre-defined events occur. Inside the callback functions the context (the this keyword) is always set to the player element that triggered the event. Optionally, some events provide arguments as well.
    Note: If you're using multiple callbacks, make sure you add them all to the same rsConf object.
    Example:

    window.rsConf = {
    	cb: {
    		ui: {
    			open: function() {
    				doSomething();
    			}
    		}
    	}
    };
    • audio.download

      Description: Fires when a user downloads an mp3 from the Download dialog. The "this" keyword will refer to the container of the currently active player.

    • audio.ended

      Description: Fires when the player has finished the playback of an entire audio file. The "this" keyword will refer to the container of the currently active player.

    • audio.loaded

      Description: Fires after the audio have loaded enough to start the playback, just before the playback begins. The "this" keyword will refer to the container of the currently active player.

    • audio.loaderror

      Description: Fires if the audio for some reason could not be loaded. The "this" keyword will refer to the container of the currently active player.

    • audio.nosound

      Description: Fires when the player for some reason doesn't succeed with playing the audio and instead has to display a link to the audio. The "this" keyword will refer to the container of the currently active player.

    • ui.beforeclose

      Description: Fires immediately after the user clicks on the close button in the player before any native close events have taken place. Note that opening a new player while the previous player is playing does not trigger this event, it only responds to direct user interaction. The "this" keyword will refer to the container element of the closed player.

    • ui.close

      Description: Fires when the user clicks on the close button in the player, and after all native close events have taken place. Note that opening a new player while the previous player is playing does not trigger this event, it only responds to direct user interaction. The "this" keyword will refer to the container element of the closed player.

    • ui.dialog.beforeopen

      Description: Fires before any dialog (Settings, Text Mode, Translation, Dictionary, Download mp3, Error) is populated and displayed on the screen. The "this" keyword will refer to the container of the currently active player, which in most cases is the starting point of opening a dialog.

    • ui.dialog.close

      Description: Fires after a dialog has been closed. The "this" keyword will refer to the container of the currently active player.

    • ui.dialog.open

      Description: Fires after a dialog have been displayed on the screen. The "this" keyword will refer to the container of the currently active player.

    • ui.open

      Description: This event fires when the user opens a player, which happens when the user clicks on a listen button, it always fires before rsConf.cb.ui.play. The "this" keyword will refer to the container element of the currently active player.

    • ui.pause

      Description: Fires when the user clicks on the pause button. The "this" keyword will refer to the container element of the current player.

    • ui.play

      Description: Fires when the user clicks on a listen button, right after rsConf.cb.ui.open if the player was previously closed. Note that this event also fires when playback starts after the player has been paused or stopped. The "this" keyword will refer to the container element of the current player.

    • ui.popup.close

      Description: Fires after the text-selection pop-up menu have been closed, either manually or by timeout. The “this” keyword will refer to the menu container element.

    • ui.popup.open

      Description: Fires immediately after the text-selection pop-up menu has been displayed. The “this” keyword will refer to the menu container element.

    • ui.progresschanged

      Description: Fires when everytime the progressbar is updated, either because the audio is playing or because the user drag’n’dropped the playhead to a new position. The new value (in percent) is provided as the only parameter.

    • ui.settingsopened

      Description: Fires when the user clicks on the settings button. The "this" keyword will refer to the container element of the settings panel.

    • ui.stop

      Description: Fires when the user clicks on the stop button. The "this" keyword will refer to the container element of the current player.

    • ui.timeupdated

      Description: Fires continuously during audio playback. The "this" keyword refers to the player’s container element.

    • ui.volumechanged

      Description: Fires when the user changes the volume.