Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(770)

Side by Side Diff: chrome/browser/resources/access_chromevox/scripts/loader.js

Issue 6254007: Adding ChromeVox as a component extensions (enabled only for ChromeOS, for no... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:executable
+ *
Added: svn:eol-style
+ LF
OLDNEW
(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 /**
6 * @fileoverview The script chooser loads any page specific enhancement
7 * scripts that are applicable to the page the user is currently on.
8 */
9
10 goog.provide('cvox.SiteSpecificEnhancements');
11
12 var ENHANCEMENT_SCRIPTS_BASE_URL =
13 'http://www.gstatic.com/accessibility/javascript/ext/';
14
15 /**
16 * Loads site specific enhancement scripts.
17 */
18 cvox.SiteSpecificEnhancements.load = function() {
19 // Append this to the end of a remote URL to force it to bypass the cache
20 // and be redownloaded.
21 var forceRedownload = '?' + new Date().getTime();
22
23 function loadScript(src) {
24 var theScript = document.createElement('script');
25 theScript.type = 'text/javascript';
26 if (src.substr(0, 4) == 'http') {
27 theScript.src = src + forceRedownload;
28 } else if (ENHANCEMENT_SCRIPTS_BASE_URL) {
29 theScript.src = ENHANCEMENT_SCRIPTS_BASE_URL + src + forceRedownload;
30 } else {
31 theScript.src = chrome.extension.getURL(src) + forceRedownload;
32 }
33 document.getElementsByTagName('head')[0].appendChild(theScript);
34 }
35
36 var currentURL = document.baseURI;
37
38 if ((currentURL.indexOf('http://www.google.com/search?') == 0) ||
39 (currentURL.indexOf('http://www.google.com/webhp') == 0) ||
40 (currentURL.indexOf('http://www.google.com/#') == 0) ||
41 (currentURL == 'http://www.google.com/')) {
42 // Google Instant Search
43 loadScript('instant.js');
44 } else if (currentURL.indexOf('https://mail.google.com/mail/') == 0) {
45 // GMail
46 loadScript('gmail_api.js');
47 loadScript('gmail.js');
48 } else if ((currentURL.indexOf('http://books.google.com/ebooks?id=') == 0) &&
49 (currentURL.indexOf('&printsec=frontcover&output=reader') != -1)) {
50 // Google Books Web Reader
51 loadScript('booksReader_api.js');
52 loadScript('booksReader.js');
53 } else if (currentURL.indexOf('http://news.google.com/') == 0) {
54 // News
55 loadScript('news/axsEnableNews.js');
56 }
57 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698