12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- 'use strict';
- define(['jquery', '../../lib/@waca/core-client/js/core-client/ui/core/Class'], function ($, Class) {
-
- var ScreenReaderUtil = null;
- ScreenReaderUtil = Class.extend({
- INPUTBOX_ID: 'boardScreenReaderInputBox',
- CLEAR_TIMER_DURATION: 500,
- oCallOutClearTimer: null,
- init: function init() {
- ScreenReaderUtil.inherited('init', this, arguments);
-
- if ($('#' + this.INPUTBOX_ID).length === 0) {
-
-
- var divScreenReaderCallout = document.createElement('div');
- divScreenReaderCallout.style.width = '0px';
- divScreenReaderCallout.style.height = '0px';
- divScreenReaderCallout.style.overflow = 'hidden';
- divScreenReaderCallout.style.position = 'absolute';
- divScreenReaderCallout.style.top = '-1px';
- divScreenReaderCallout.style.left = '-1px';
- var txtScreenReaderCallout = document.createElement('input');
- txtScreenReaderCallout.type = 'text';
- txtScreenReaderCallout.id = this.INPUTBOX_ID;
- txtScreenReaderCallout.setAttribute('aria-selected', 'false');
- txtScreenReaderCallout.setAttribute('aria-live', 'assertive');
- txtScreenReaderCallout.setAttribute('tabIndex', '-1');
- $(divScreenReaderCallout).append(txtScreenReaderCallout);
- $('body').append(divScreenReaderCallout);
- }
- },
- callOut: function callOut(sMessage) {
-
- if (this.oCallOutClearTimer) {
- clearInterval(this.oCallOutClearTimer);
- }
-
- $('#' + this.INPUTBOX_ID).val(sMessage);
- this.oCallOutClearTimer = setTimeout(function () {
- $('#' + this.INPUTBOX_ID).val('');
- }.bind(this), this.CLEAR_TIMER_DURATION);
- },
- destroy: function destroy() {
-
- $('#' + this.INPUTBOX_ID).parent().remove();
-
- ScreenReaderUtil.inherited('destroy', this, arguments);
- }
- });
- return ScreenReaderUtil;
- });
|