Skip to content

Commit

Permalink
move RESSettings into RESUtils.options
Browse files Browse the repository at this point in the history
  • Loading branch information
jewel-andraia committed Feb 6, 2015
1 parent 0827c99 commit 7fce755
Show file tree
Hide file tree
Showing 41 changed files with 47 additions and 48 deletions.
7 changes: 3 additions & 4 deletions lib/core/settings.js
Expand Up @@ -121,7 +121,7 @@ RESUtils.options.listTypes['subreddits'] = {
};
})();

var RESSettings = {
$.extend(RESUtils.options, {
resetModulePrefs: function() {
this.setModulePrefs({});
},
Expand Down Expand Up @@ -227,7 +227,7 @@ var RESSettings = {
}
thisOptions[optionName].value = saveOptionValue;
// save it to the object and to RESStorage
RESSettings.saveModuleOptions(moduleID, thisOptions);
RESUtils.options.saveModuleOptions(moduleID, thisOptions);
return true;
},
saveModuleOptions: function(moduleID, newOptions) {
Expand Down Expand Up @@ -278,5 +278,4 @@ var RESSettings = {
this.getOptionsFirstRun[moduleID] = true;
return modules[moduleID].options;
};
};

});
8 changes: 4 additions & 4 deletions lib/core/utils.js
Expand Up @@ -110,7 +110,7 @@ RESUtils.isMatchURL = function(moduleID) {
};

RESUtils.getOptions = function() {
return RESSettings.getOptions.apply(RESSettings, Array.prototype.slice.call(arguments));
return RESUtils.options.getOptions.apply(RESUtils.options, Array.prototype.slice.call(arguments));
};
RESUtils.getUrlParams = function() {
var result = {}, queryString = location.search.substring(1),
Expand All @@ -122,10 +122,10 @@ RESUtils.getUrlParams = function() {
return result;
};
RESUtils.setOption = function() {
return RESSettings.setOption.apply(RESSettings, Array.prototype.slice.call(arguments);
return RESUtils.options.setOption.apply(RESUtils.options, Array.prototype.slice.call(arguments);
};
RESUtils.saveModuleOptions = function() {
return RESSettings.saveModuleOptions.apply(RESSettings, Array.prototype.slice.call(arguments);
return RESUtils.options.saveModuleOptions.apply(RESUtils.options, Array.prototype.slice.call(arguments);
};

RESUtils.click = function(obj, button) {
Expand Down Expand Up @@ -673,7 +673,7 @@ RESUtils.setCursorPosition = function(form, pos) {
return form;
};
RESUtils.setNewNotification = function() {
$('#RESSettingsButton, #RESMainGearOverlay .gearIcon').addClass('newNotification').click(function() {
$('#RESUtils.optionsButton, #RESMainGearOverlay .gearIcon').addClass('newNotification').click(function() {
location.href = '/r/RESAnnouncements';
});
};
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/RESTips.js
Expand Up @@ -15,7 +15,7 @@ modules['RESTips'] = {
},
description: 'Adds tips/tricks help to RES console',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'all'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/accountSwitcher.js
Expand Up @@ -68,7 +68,7 @@ modules['accountSwitcher'] = {
},
description: 'Store username/password pairs and switch accounts instantly while browsing Reddit!',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'all'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/betteReddit.js
Expand Up @@ -131,7 +131,7 @@ modules['betteReddit'] = {
},
description: 'Adds a number of interface enhancements to Reddit, such as "full comments" links, the ability to unhide accidentally hidden posts, and more',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
isMatchURL: function() {
return RESUtils.isMatchURL(this.moduleID);
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/bitcointip.js
Expand Up @@ -101,7 +101,7 @@ modules['bitcointip'] = {
}
},
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'all'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/commentHidePersistor.js
Expand Up @@ -16,7 +16,7 @@ var m_chp = modules['commentHidePersistor'] = {

options: {},
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'comments'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/commentNavigator.js
Expand Up @@ -17,7 +17,7 @@ modules['commentNavigator'] = {
}
},
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'comments'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/commentPreview.js
Expand Up @@ -53,7 +53,7 @@ modules['commentPreview'] = {
},
description: 'Provides a live preview of comments, as well as a two column editor for writing walls of text.',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'comments',
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/commentTools.js
Expand Up @@ -139,7 +139,7 @@ modules['commentTools'] = {
},
description: 'Provides shortcuts for easier markdown.',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'comments',
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/context.js
Expand Up @@ -16,7 +16,7 @@ modules['context'] = {
},
description: 'Adds a link to the yellow infobar to view deeply linked comments in their full context.',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
isMatchURL: function() {
return RESUtils.isMatchURL(this.moduleID);
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/dashboard.js
Expand Up @@ -45,7 +45,7 @@ modules['dashboard'] = {
},
description: 'The RES Dashboard is home to a number of features including widgets and other useful tools',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'all'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/filteReddit.js
Expand Up @@ -188,7 +188,7 @@ modules['filteReddit'] = {
},
description: 'Filter out NSFW content, or links by keyword, domain (use User Tagger to ignore by user) or subreddit (for /r/all or /domain/*).',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
/^https?:\/\/(?:[\-\w\.]+\.)?reddit\.com\/?(?:\??[\w]+=[\w]+&?)*/i,
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/hideChildComments.js
Expand Up @@ -15,7 +15,7 @@ modules['hideChildComments'] = {
},
description: 'Allows you to hide all comments except for replies to the OP for easier reading.',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'comments'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/keyboardNav.js
Expand Up @@ -582,7 +582,7 @@ modules['keyboardNav'] = {
},
description: 'Keyboard navigation for reddit!',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'all'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/localDate.js
Expand Up @@ -5,7 +5,7 @@ modules['localDate'] = {
options: {},
description: 'Shows date in your local time zone when you hover over a relative date.',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
// include: [
// ],
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/logoLink.js
Expand Up @@ -21,7 +21,7 @@ modules['logoLink'] = {
},
description: 'Allow you to change the link on the reddit logo.',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
// include: [
// ],
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/neverEndingReddit.js
Expand Up @@ -56,7 +56,7 @@ modules['neverEndingReddit'] = {
},
description: 'Inspired by modules like River of Reddit and Auto Pager - gives you a never ending stream of reddit goodness.',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'all'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/newCommentCount.js
Expand Up @@ -20,7 +20,7 @@ modules['newCommentCount'] = {
},
description: 'Shows how many new comments there are since your last visit.',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'all'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/saveComments.js
Expand Up @@ -4,7 +4,7 @@ modules['saveComments'] = {
category: 'Comments',
options: {},
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'all'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/searchHelper.js
Expand Up @@ -44,7 +44,7 @@ modules['searchHelper'] = {
},
description: 'Provide help with the use of search.',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
// include: [
// ],
Expand Down
4 changes: 2 additions & 2 deletions lib/modules/settingsConsole.js
Expand Up @@ -184,7 +184,7 @@ addModule('settingsConsole', function(module, moduleID) {
var evalTest = eval(moduleTest);
}
*/
moduleList = moduleList || RESSettings.getModuleIDsByCategory(category);
moduleList = moduleList || RESUtils.options.getModuleIDsByCategory(category);

this.RESConfigPanelModulesPane = RESUtils.createElementWithID('div', 'RESConfigPanelModulesPane');

Expand Down Expand Up @@ -953,7 +953,7 @@ addModule('settingsConsole', function(module, moduleID) {
var objID = obj.getAttribute('id');
var category = objID.split('-');
category = category[category.length - 1];
var moduleID = RESSettings.getModuleIDsByCategory(category)[0];
var moduleID = RESUtils.options.getModuleIDsByCategory(category)[0];
this.openCategoryPanel(category);
this.showConfigOptions(moduleID);
},
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/settingsNavigation.js
Expand Up @@ -20,7 +20,7 @@ modules['settingsNavigation'] = {
},
alwaysEnabled: true,
isEnabled: function() {
// return RESSettings.getModulePrefs(this.moduleID);
// return RESUtils.options.getModulePrefs(this.moduleID);
return true;
},
include: [
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/showImages.js
Expand Up @@ -155,7 +155,7 @@ modules['showImages'] = {
},
description: 'Opens images inline in your browser with the click of a button. Also has configuration options, check it out!',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'all'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/showKarma.js
Expand Up @@ -17,7 +17,7 @@ modules['showKarma'] = {
},
description: 'Shows your comment karma next to your link karma.',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'all'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/showParent.js
Expand Up @@ -36,7 +36,7 @@ modules['showParent'] = {
},
description: 'Shows the parent comments when hovering over the "parent" link of a comment.',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'comments'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/singleClick.js
Expand Up @@ -29,7 +29,7 @@ modules['singleClick'] = {
},
description: 'Adds an [l+c] link that opens a link and the comments page in new tabs for you in one click.',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
isMatchURL: function() {
return RESUtils.isMatchURL(this.moduleID);
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/snoonet.js
Expand Up @@ -7,7 +7,7 @@ modules['snoonet'] = {
},
description: 'Module to simplify adding snoonet IRC support to your subreddit(s)',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
/^https?:\/\/([a-z]+)\.reddit\.com\/r\/[\w]+\/?(?:\??[\w]+=[\w]+&?)*$/i
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/spamButton.js
Expand Up @@ -6,7 +6,7 @@ modules['spamButton'] = {
options: {},
description: 'Adds a Spam button to posts for easy reporting.',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'all'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/styleTweaks.js
Expand Up @@ -142,7 +142,7 @@ modules['styleTweaks'] = {
}
},
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'all'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/subredditInfo.js
Expand Up @@ -30,7 +30,7 @@ modules['subredditInfo'] = {
},
description: 'Adds a hover tooltip to subreddits',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'all'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/subredditManager.js
Expand Up @@ -106,7 +106,7 @@ modules['subredditManager'] = {
},
description: 'Allows you to customize the top bar with your own subreddit shortcuts, including dropdown menus of multi-reddits and more.',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'all'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/subredditTagger.js
Expand Up @@ -27,7 +27,7 @@ modules['subRedditTagger'] = {
},
description: 'Adds tags to posts based on which subreddit they were posted to.',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'all'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/tableTools.js
Expand Up @@ -11,7 +11,7 @@
}
},
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'all'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/upload.js
Expand Up @@ -13,7 +13,7 @@ modules['uploader'] = {
},
description: 'Lets you upload files from the submit page.',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'submit'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/uppersAndDowners.js
Expand Up @@ -46,7 +46,7 @@ modules['uppersAndDowners'] = {
},
description: 'Displays upvote and downvote counts on comments.<br><br>(reddit "fuzzes" vote counts as an anti-spam measure. RES only displays what reddit serves up.)',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'linklist',
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/userHighlight.js
Expand Up @@ -133,7 +133,7 @@ modules['userHighlight'] = {
}
},
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'all'
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/userTagger.js
Expand Up @@ -115,7 +115,7 @@ modules['userTagger'] = {
},
description: 'Adds a great deal of customization around users - tagging them, ignoring them, and more. You can manage tagged users on <a href="/r/Dashboard/#userTaggerContents">Manage User Tags</a>.',
isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
isMatchURL: function() {
return RESUtils.isMatchURL(this.moduleID);
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/usernameHider.js
Expand Up @@ -49,7 +49,7 @@ modules['usernameHider'] = {
you made it from.',

isEnabled: function() {
return RESSettings.getModulePrefs(this.moduleID);
return RESUtils.options.getModulePrefs(this.moduleID);
},
include: [
'all'
Expand Down

0 comments on commit 7fce755

Please sign in to comment.