Skip to content

Commit cd5a00f

Browse files
wikiCheck: convert to addModule()
nobody uses this anymore but whatever
1 parent 51dc7a1 commit cd5a00f

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

utils/wikiCheck.js

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,25 @@ How to use me?
44
Then go on About RES -> wikiCheck and push the button!
55
This will check the wiki and list all undocumented options.
66
*/
7-
modules['wikiCheck'] = {
8-
moduleID: 'wikiCheck',
9-
moduleName: 'Wiki Check',
10-
category: 'About RES',
11-
options: {
7+
addModule('wikiCheck', function(module, moduleID) {
8+
module.moduleName = 'Wiki Check';
9+
module.category = 'About RES';
10+
module.description = 'Check if all options are listed on the wiki.';
11+
module.options = {
1212
check: {
1313
type: 'button',
1414
text: 'Check',
15-
callback: null,
15+
callback: check,
1616
description: 'Launch the test (open the dev console !).'
1717
}
18-
},
19-
description: 'Check if all options are listed on the wiki.',
20-
isEnabled: function() {
21-
return RESUtils.options.getModulePrefs(this.moduleID);
22-
},
23-
isMatchURL: function() {
18+
};
19+
module.isMatchURL = function() {
2420
return false;
25-
},
26-
go: function() {
27-
this.options['check'].callback = this.check;
28-
},
29-
check: function() {
30-
modules['wikiCheck'].fetchPages();
31-
},
32-
fetchPages: function() {
21+
};
22+
function check() {
23+
fetchPages();
24+
}
25+
function fetchPages() {
3326
console.group('Fetching wiki pages');
3427
$.getJSON('http://api.reddit.com/r/Enhancement/wiki/pages/', function(data){
3528
console.log('Wiki page list fetched');
@@ -47,15 +40,15 @@ modules['wikiCheck'] = {
4740
fetchedPages++;
4841
console.log(fetchedPages + '/' + wikiPages.length);
4942
if (fetchedPages === wikiPages.length) {
50-
modules['wikiCheck'].fetchOptions(optionsList);
43+
fetchOptions(optionsList);
5144
console.groupEnd();
5245
}
5346
});
5447
}, i*1000, wikiPage);
5548
});
5649
});
57-
},
58-
fetchOptions: function(optionsList) {
50+
}
51+
function fetchOptions(optionsList) {
5952
var missingOptions = [];
6053
for (var m in modules) {
6154
if (!m.hidden) {
@@ -84,4 +77,4 @@ modules['wikiCheck'] = {
8477
console.groupEnd();
8578
}
8679
}
87-
};
80+
});

0 commit comments

Comments
 (0)