Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / test / data / extensions / subscribe_page_action / common.js
blob86427c19658ad3ba7dd86da4fc4f3ed778914252
1 // Copyright (c) 2010 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.
5 // Whether we can modify the list of readers.
6 var storageEnabled = window.localStorage != null;
8 /**
9 * Returns the default list of feed readers.
11 function defaultReaderList() {
12 // This is the default list, unless replaced by what was saved previously.
13 return [
14 { 'url': 'http://www.bloglines.com/login?r=/sub/%s',
15 'description': 'Bloglines'
17 { 'url': 'http://add.my.yahoo.com/rss?url=%s',
18 'description': 'My Yahoo'
23 /**
24 * Check to see if the current item is set as default reader.
26 function isDefaultReader(url) {
27 defaultReader = window.localStorage.defaultReader ?
28 window.localStorage.defaultReader : "";
29 return url == defaultReader;
32 /**
33 * Find an element with |id| and replace the text of it with i18n message with
34 * |msg| key.
36 function i18nReplaceImpl(id, msg, attribute) {
37 var element = document.getElementById(id);
38 if (element) {
39 if (attribute)
40 element.setAttribute(attribute, chrome.i18n.getMessage(msg));
41 else
42 element.innerText = chrome.i18n.getMessage(msg);
46 /**
47 * Same as i18nReplaceImpl but provided for convenience for elements that have
48 * the same id as the i18n message id.
50 function i18nReplace(msg) {
51 i18nReplaceImpl(msg, msg, '');