| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 goog.provide('cvox.ChromeVoxBooksReader'); |
| 6 |
| 7 goog.require('cvox.BooksReaderApi'); |
| 8 goog.require('cvox.ChromeVox'); |
| 9 |
| 10 /** |
| 11 * @fileoverview Script for enhancing the Google Books Reader. |
| 12 */ |
| 13 cvox.ChromeVoxBooksReader = { }; |
| 14 |
| 15 /** |
| 16 * Listener for responding to Books events. |
| 17 * @type {Object} |
| 18 */ |
| 19 cvox.ChromeVoxBooksReader.listener = null; |
| 20 |
| 21 /** |
| 22 * Initializes the Psychic Search script. |
| 23 */ |
| 24 cvox.ChromeVoxBooksReader.init = function() { |
| 25 cvox.ChromeVoxBooksReader.listener = new BooksListener(); |
| 26 |
| 27 cvox.ChromeVoxBooksReader.listener.onPageTurned = function(pageObject) { |
| 28 var pageContentNode = pageObject.getNode(); |
| 29 cvox.ChromeVox.tts.speak(pageContentNode.textContent, 0, null); |
| 30 cvox.ChromeVox.navigationManager.syncToNode( |
| 31 pageContentNode.previousSibling); |
| 32 }; |
| 33 |
| 34 cvox.ChromeVoxBooksReader.listener.onIndexItemSelected = |
| 35 function(indexItemObject) { |
| 36 cvox.ChromeVox.tts.speak(indexItemObject.getText() + ' ' + |
| 37 indexItemObject.getPageNumber(), 0, null); |
| 38 }; |
| 39 |
| 40 BooksReaderApi.setBooksEventListener(cvox.ChromeVoxBooksReader.listener); |
| 41 }; |
| 42 |
| 43 window.setTimeout(cvox.ChromeVoxBooksReader.init, 500); |
| OLD | NEW |