-
Notifications
You must be signed in to change notification settings - Fork 137
/
Copy pathmetadata.js
63 lines (63 loc) · 2.08 KB
/
metadata.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
60
61
62
63
// ==UserScript==
// @name <%= meta.name %><%= (channel === '-beta') ? ' beta' : '' %>
// @version <%= readJSON('/version.json').version %>
// @minGMVer <%= meta.min.greasemonkey %>
// @minFFVer <%= meta.min.firefox %>
// @namespace <%= name %>
// @description <%= description %>
// @license MIT; <%= meta.license %>
<%=
(function() {
function expand(items, regex, substitutions) {
var results = [];
items.forEach(function(item) {
if (regex.test(item)) {
substitutions.forEach(function(s) {
results.push(item.replace(regex, s));
});
} else {
results.push(item);
}
});
return results;
}
function expandMatches(matches) {
return expand(matches, /^\*/, ['http', 'https']);
}
return [].concat(
expandMatches(meta.includes_only.concat(meta.matches, meta.matches_extra)).map(function(match) {
return '// @include ' + match;
}),
expandMatches(meta.exclude_matches).map(function(match) {
return '// @exclude ' + match;
})
).join('\n');
})()
%>
// @connect 4chan.org
// @connect 4channel.org
// @connect 4cdn.org
// @connect 4chenz.github.io
<%=
readJSON('/src/Archive/archives.json').map(function(archive) {
return '// @connect ' + archive.domain;
}).join('\n')
%>
// @connect api.clyp.it
// @connect api.dailymotion.com
// @connect api.github.com
// @connect soundcloud.com
// @connect api.streamable.com
// @connect vimeo.com
// @connect www.youtube.com
// @connect *
<%=
meta.grants.map(function(grant) {
return '// @grant ' + grant;
}).join('\n')
%>
// @run-at document-start
// @updateURL <%= (channel !== '-noupdate') ? `${meta.downloads}${name}${channel}.meta.js` : 'https://noupdate.invalid/' %>
// @downloadURL <%= (channel !== '-noupdate') ? `${meta.downloads}${name}${channel}.user.js` : 'https://noupdate.invalid/' %>
// @icon data:image/png;base64,<%= readBase64('/src/meta/icon48.png') %>
// ==/UserScript==