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

Unified Diff: lib/api.js

Issue 10802049: Functional prefs implementation (Closed)
Patch Set: Cleaned up init.js a bit Created June 5, 2013, 9:44 a.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: lib/api.js
===================================================================
--- a/lib/api.js
+++ b/lib/api.js
@@ -19,16 +19,17 @@ var API = (function()
{
var Filter = require("filterClasses").Filter;
var Subscription = require("subscriptionClasses").Subscription;
var SpecialSubscription = require("subscriptionClasses").SpecialSubscription;
var FilterStorage = require("filterStorage").FilterStorage;
var defaultMatcher = require("matcher").defaultMatcher;
var ElemHide = require("elemHide").ElemHide;
var Synchronizer = require("synchronizer").Synchronizer;
+ var Prefs = require("prefs").Prefs;
return {
getFilterFromText: function(text)
{
text = Filter.normalize(text);
if (!text)
throw "Attempted to create a filter from empty text";
return Filter.fromText(text);
@@ -140,11 +141,21 @@ var API = (function()
var documentHost = extractHostFromURL(documentUrl);
var thirdParty = isThirdParty(requestHost, documentHost);
return defaultMatcher.matchesAny(url, contentType, documentUrl, thirdParty);
},
getElementHidingSelectors: function(domain)
{
return ElemHide.getSelectorsForDomain(domain, false);
+ },
+
+ getPref: function(pref)
+ {
+ return Prefs[pref];
+ },
+
+ setPref: function(pref, value)
+ {
+ Prefs[pref] = value;
}
};
})();

Powered by Google App Engine
This is Rietveld