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 var COMPILED_FLAG = false; |
| 6 var TEST_FLAG = false; |
| 7 var BASE_URL = ''; |
| 8 |
| 9 /** |
| 10 * Loads the bookmark manager. |
| 11 */ |
| 12 function loadBookmarkManager() { |
| 13 if (document.location.toString().indexOf( |
| 14 'http://www.corp.google.com/~chaitanyag/speech/flash.html') == 0) { |
| 15 return; |
| 16 } |
| 17 |
| 18 // Use a hidden div to send messages from the injected content script |
| 19 // to the extension background page. |
| 20 var port = chrome.extension.connect({name: 'content2Chrome'}); |
| 21 var hiddenDiv = document.createElement('div'); |
| 22 hiddenDiv.id = 'cvoxPage2ExtensionDiv'; |
| 23 hiddenDiv.style.display = 'none'; |
| 24 document.body.appendChild(hiddenDiv); |
| 25 document.addEventListener('cvoxPage2ExtensionEvent', function() { |
| 26 var message = JSON.parse(hiddenDiv.innerHTML); |
| 27 port.postMessage(message); |
| 28 }); |
| 29 |
| 30 // Append this to the end of a remote URL to force it to bypass the cache |
| 31 // and be redownloaded. |
| 32 var forceRedownload = '?' + new Date().getTime(); |
| 33 |
| 34 function loadScript(src) { |
| 35 var theScript = document.createElement('script'); |
| 36 theScript.type = 'text/javascript'; |
| 37 if (src.substr(0, 4) == 'http') |
| 38 theScript.src = src + forceRedownload; |
| 39 else if (BASE_URL) |
| 40 theScript.src = BASE_URL + src + forceRedownload; |
| 41 else |
| 42 theScript.src = chrome.extension.getURL(src) + forceRedownload; |
| 43 document.getElementsByTagName('head')[0].appendChild(theScript); |
| 44 } |
| 45 |
| 46 loadScript('chromevox/injected/extension_bridge.js'); |
| 47 loadScript('browser/chromeVox_ttsBridge.js'); |
| 48 loadScript('tts/chromeVox_earcons.js'); |
| 49 loadScript('chromevox/background/bookmark_manager_ui.js'); |
| 50 } |
| 51 |
| 52 loadBookmarkManager(); |
OLD | NEW |