Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: options.js

Issue 29328672: Issue 2668 - Use new subscription types in options page (Closed)
Patch Set: Created Sept. 25, 2015, 3:27 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: options.js
===================================================================
--- a/options.js
+++ b/options.js
@@ -210,7 +210,7 @@
if (subscriptionUrl in recommendationsMap)
{
var recommendation = recommendationsMap[subscriptionUrl];
- if (recommendation.isAdsType)
+ if (recommendation.type == "ads")
{
if (subscription.disabled == false)
{
@@ -257,9 +257,9 @@
if (subscriptionUrl in recommendationsMap)
{
var recommendation = recommendationsMap[subscriptionUrl];
- if (recommendation.isPopular)
+ if (recommendation.type != "ads")
collection = collections.popular;
- else if (recommendation.isAdsType && subscription.disabled == false)
+ else if (subscription.disabled == false)
collection = collections.langs;
else
collection = collections.allLangs;
@@ -309,19 +309,17 @@
subscription.homepage = null;
subscription.lastSuccess = null;
var recommendation = Object.create(null);
- recommendation.isAdsType = false;
- recommendation.isPopular = false;
+ recommendation.type = element.getAttribute("type");
var prefix = element.getAttribute("prefixes");
if (prefix)
{
- var prefix = element.getAttribute("prefixes").replace(/,/g, "_");
+ prefix = prefix.replace(/\W/g, "_");
subscription.title = ext.i18n.getMessage("options_language_" + prefix);
- recommendation.isAdsType = true;
}
else
{
- subscription.title = element.getAttribute("specialization");
- recommendation.isPopular = true;
+ var type = recommendation.type.replace(/\W/g, "_");
Thomas Greiner 2015/09/25 15:43:22 I needed to replace "-" with "_" for "common_featu
saroyanm 2015/11/10 16:47:25 Nit: What is the reason to assign the result to va
Thomas Greiner 2015/11/10 19:54:09 Just a personal preference to improve readability
saroyanm 2015/11/11 10:47:57 I see, well while nothing related in coding styles
+ subscription.title = ext.i18n.getMessage("common_feature_" + type + "_title");
}
recommendationsMap[subscription.url] = recommendation;
« no previous file with comments | « locale/en-US/common.json ('k') | subscriptions.xml » ('j') | subscriptions.xml » ('J')

Powered by Google App Engine
This is Rietveld