-
Notifications
You must be signed in to change notification settings - Fork 21
/
common.js
61 lines (56 loc) · 1.69 KB
/
common.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (c) 2010 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.
// Whether we can modify the list of readers.
var storageEnabled = window.localStorage != null;
/**
* Returns the default list of feed readers.
*/
function defaultReaderList() {
// This is the default list, unless replaced by what was saved previously.
return [
{ 'url': 'http://www.feedly.com/home#subscription/feed/%s',
'description': 'Feedly'
},
{ 'url': 'http://www.newsblur.com/?url=%s',
'description': 'NewsBlur'
},
{ 'url': 'http://theoldreader.com/feeds/subscribe?url=%s',
'description': 'The Old Reader'
},
{ 'url': 'https://www.rolio.com/subscribe.aspx?feedUrl=%s',
'description': 'Rolio'
},
{ 'url': 'http://wefav.com/news/subs/url/%s',
'description': 'WeFav'
}
];
}
/**
* Check to see if the current item is set as default reader.
*/
function isDefaultReader(url) {
defaultReader = window.localStorage.defaultReader ?
window.localStorage.defaultReader : "";
return url == defaultReader;
}
/**
* Find an element with |id| and replace the text of it with i18n message with
* |msg| key.
*/
function i18nReplaceImpl(id, msg, attribute) {
var element = document.getElementById(id);
if (element) {
if (attribute)
element.setAttribute(attribute, chrome.i18n.getMessage(msg));
else
element.innerText = chrome.i18n.getMessage(msg);
}
}
/**
* Same as i18nReplaceImpl but provided for convenience for elements that have
* the same id as the i18n message id.
*/
function i18nReplace(msg) {
i18nReplaceImpl(msg, msg, '');
}