-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path20171025.fix_LintErrors.js
59 lines (43 loc) · 1.43 KB
/
20171025.fix_LintErrors.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
/*
初版試營運。
@see
[[Special:LintErrors]]
https://www.mediawiki.org/wiki/Help:Extension:Linter
https://www.mediawiki.org/w/api.php?action=help&modules=query%2Blinterrors
*/
'use strict';
// Load CeJS library and modules.
require('./wiki loder.js');
/* eslint no-use-before-define: ["error", { "functions": false }] */
/* global CeL */
/* global Wiki */
// Set default language. 改變預設之語言。 e.g., 'zh'
// 採用這個方法,而非 Wiki(true, 'ja'),才能夠連報告介面的語系都改變。
set_language('zh');
var
/** {Object}wiki operator 操作子. */
wiki = Wiki(true);
/** {String}編輯摘要。總結報告。 */
// ----------------------------------------------------------------------------
// CeL.set_debug(6);
get_linterrors('bogus-image-options', for_lint_error, {});
function get_linterrors(category, for_lint_error, options) {
options = CeL.setup_options(options);
var action = 'query&list=linterrors&lntcategories=' + category;
if ('namespace' in options) {
action += '&lntnamespace=' + (CeL.namespace(options.namespace) || 0);
}
action += '&lntlimit=' + (options.limit || ('max' && 2));
if (options.from >= 0) {
action += '&lntfrom=' + options.from;
}
CeL.wiki.query(action, function for_error_list(data, error) {
data.query.linterrors.forEach(for_lint_error);
}, null, {
// [KEY_SESSION]
session : wiki
});
}
function for_lint_error(error_data) {
console.log(error_data);
}