Deduplicate list of GM functions used.

This commit is contained in:
ccd0 2015-11-01 01:23:48 -08:00
parent 9c2ceacfde
commit 4756015a88
3 changed files with 26 additions and 22 deletions

View File

@ -297,21 +297,18 @@ module.exports = (grunt) ->
'-W084': true
'-W083': true
'-W093': true
globals:
Notification: true
MediaError: true
Set: true
GM_getValue: true
GM_setValue: true
GM_deleteValue: true
GM_listValues: true
GM_addValueChangeListener: true
GM_openInTab: true
GM_xmlhttpRequest: true
GM_info: true
cloneInto: true
unsafeWindow: true
chrome: true
globals: do ->
globals =
Notification: true
MediaError: true
Set: true
GM_info: true
cloneInto: true
unsafeWindow: true
chrome: true
pkg = grunt.file.readJSON 'package.json'
globals[v] = true for v in pkg.meta.grants
globals
script: 'tmp-<%= pkg.type %>/*.js'
require('load-grunt-tasks') grunt

View File

@ -30,6 +30,15 @@
"https://www.google.com/recaptcha/api2/frame?*&k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc*",
"*://www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc*"
],
"grants": [
"GM_getValue",
"GM_setValue",
"GM_deleteValue",
"GM_listValues",
"GM_addValueChangeListener",
"GM_openInTab",
"GM_xmlhttpRequest"
],
"suffix": {
"stable": "",
"beta": "-beta",

View File

@ -18,13 +18,11 @@
}
}).join('\n')
%>
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// @grant GM_listValues
// @grant GM_addValueChangeListener
// @grant GM_openInTab
// @grant GM_xmlhttpRequest
<%=
meta.grants.map(function(grant) {
return '// @grant ' + grant;
}).join('\n')
%>
// @run-at document-start
<% if (channel !== 'dev') { %>// @updateURL <%= (channel !== 'noupdate') ? (meta.downloads + name + meta.suffix[channel] + '.meta.js') : 'https://noupdate.invalid/' %>
// @downloadURL <%= (channel !== 'noupdate') ? (meta.downloads + name + meta.suffix[channel] + '.user.js') : 'https://noupdate.invalid/' %>