| Index: chrome/browser/resources/access_chromevox/scripts/gmail.js
|
| ===================================================================
|
| --- chrome/browser/resources/access_chromevox/scripts/gmail.js (revision 0)
|
| +++ chrome/browser/resources/access_chromevox/scripts/gmail.js (revision 0)
|
| @@ -0,0 +1,100 @@
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +goog.provide('cvox.ChromeVoxGmail');
|
| +
|
| +goog.require('cvox.ChromeVox');
|
| +goog.require('cvox.GmailApi');
|
| +
|
| +
|
| +/**
|
| + * @fileoverview Script for enhancing Gmail.
|
| + */
|
| +cvox.ChromeVoxGmail = { };
|
| +
|
| +/**
|
| + * Collection of strings to be spoken to the user.
|
| + * @type {Object}
|
| + */
|
| +cvox.ChromeVoxGmail.STRINGS = {
|
| + STARRED: 'Starred.',
|
| + NOT_STARRED: 'Not starred.',
|
| + SELECTED: 'Selected.',
|
| + NOT_SELECTED: 'Not selected.',
|
| + UNREAD: 'Unread.'
|
| +};
|
| +
|
| +/**
|
| + * Listener for responding to GMail events.
|
| + * @type {Object}
|
| + */
|
| +cvox.ChromeVoxGmail.listener = null;
|
| +
|
| +/**
|
| + * Initializes the Gmail script.
|
| + */
|
| +cvox.ChromeVoxGmail.init = function() {
|
| + cvox.ChromeVoxGmail.listener = new GmailListener();
|
| +
|
| + cvox.ChromeVoxGmail.listener.onNavigatedToNewThread = function(threadObj) {
|
| + var threadInfo = '';
|
| + if (threadObj.isSelected()) {
|
| + threadInfo = threadInfo + cvox.ChromeVoxGmail.STRINGS.SELECTED + ' ';
|
| + }
|
| + if (threadObj.isStarred()) {
|
| + threadInfo = threadInfo + cvox.ChromeVoxGmail.STRINGS.STARRED + ' ';
|
| + }
|
| + if (!threadObj.isRead()) {
|
| + threadInfo = threadInfo + cvox.ChromeVoxGmail.STRINGS.UNREAD + ' ';
|
| + }
|
| + var threadSnippet = cvox.DomUtil.getText(threadObj.getNode());
|
| + cvox.ChromeVox.tts.speak(threadInfo + threadSnippet, 0, null);
|
| + var syncTarget = threadObj.getNode().firstChild;
|
| + cvox.ChromeVox.navigationManager.syncToNode(syncTarget);
|
| + };
|
| +
|
| + cvox.ChromeVoxGmail.listener.onNavigatedToNewMessage = function(messageObj) {
|
| + var messageInfo = '';
|
| + if (messageObj.isStarred()) {
|
| + messageInfo = messageInfo + cvox.ChromeVoxGmail.STRINGS.STARRED + ' ';
|
| + }
|
| + var threadSnippet = cvox.DomUtil.getText(messageObj.getNode());
|
| + cvox.ChromeVox.tts.speak(messageInfo + threadSnippet, 0, null);
|
| + var syncTarget = messageObj.getNode().firstChild;
|
| + cvox.ChromeVox.navigationManager.syncToNode(syncTarget);
|
| + };
|
| +
|
| + cvox.ChromeVoxGmail.listener.onNavigatedToNewSearchCompletion =
|
| + function(searchCompletionObj) {
|
| + var searchCompletionText = cvox.DomUtil.getText(
|
| + searchCompletionObj.getNode());
|
| + cvox.ChromeVox.tts.speak(searchCompletionText, 0, null);
|
| + };
|
| +
|
| + cvox.ChromeVoxGmail.listener.onStatusChangeEvent = function(status, message) {
|
| + switch (status) {
|
| + case GmailListener.STATUS.Starred:
|
| + cvox.ChromeVox.tts.speak(cvox.ChromeVoxGmail.STRINGS.STARRED, 0, null);
|
| + break;
|
| + case GmailListener.STATUS.NotStarred:
|
| + cvox.ChromeVox.tts.speak(cvox.ChromeVoxGmail.STRINGS.NOT_STARRED, 0,
|
| + null);
|
| + break;
|
| + case GmailListener.STATUS.Selected:
|
| + cvox.ChromeVox.tts.speak(cvox.ChromeVoxGmail.STRINGS.SELECTED, 0, null);
|
| + break;
|
| + case GmailListener.STATUS.NotSelected:
|
| + cvox.ChromeVox.tts.speak(cvox.ChromeVoxGmail.STRINGS.NOT_SELECTED, 0,
|
| + null);
|
| + break;
|
| + case GmailListener.STATUS.Notification:
|
| + cvox.ChromeVox.tts.speak(message, 0, null);
|
| + break;
|
| + }
|
| + };
|
| +
|
| + GmailApi.setGmailEventListener(cvox.ChromeVoxGmail.listener);
|
| +};
|
| +
|
| +window.setTimeout(cvox.ChromeVoxGmail.init, 500);
|
|
|
| Property changes on: chrome/browser/resources/access_chromevox/scripts/gmail.js
|
| ___________________________________________________________________
|
| Added: svn:executable
|
| + *
|
| Added: svn:eol-style
|
| + LF
|
|
|
|
|